From: Enrico Tassi Date: Thu, 14 Mar 2013 18:22:55 +0000 (+0100) Subject: Imported Upstream version 0.2 X-Git-Tag: upstream/0.2^0 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fupstream;p=pkg-cerco%2Facc.git Imported Upstream version 0.2 --- 65ee53e13a21736157155f5b27ec292c8c73cca0 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ca9f018 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +include Makefile.variables +include Makefile.local +include Makefile.generic +include Makefile.config + +.PHONY: web + +ifeq ($(HAVE_OCLOSURE), yes) +web: webconfig + @ echo 'module Int = IntByInt64' > src/common/intValueConfig.ml + @ $(OCAMLBUILD) src/accweb.byte + @ js_of_ocaml accweb.byte + @ oclosure_req accweb.js + @ mv *.js web +endif diff --git a/Makefile.config b/Makefile.config new file mode 100644 index 0000000..435e0c0 --- /dev/null +++ b/Makefile.config @@ -0,0 +1,30 @@ +# -*- Makefile -*- + +-include Makefile.local + +.PHONY: announce cparserlib webconfig configure + +announce: + @ echo "Source configuration ..." + @ echo 'module Int = IntByBig_int' > src/common/intValueConfig.ml + +cparserlib: + @ echo "CIL parser compilation ..." + @ $(MAKE) --silent -C cparser all install + +ifeq ($(HAVE_OCLOSURE), yes) +webconfig: + @ echo "Configuring O'Closure support." + @ cat _tags.common > _tags + @ cat _tags.js_of_ocaml >> _tags +else +webconfig: + @ echo "Skipping O'Closure support." +endif + +configure: announce cparserlib + @ cat _tags.common > _tags + @ cat _tags.compiler >> _tags + + + diff --git a/Makefile.generic b/Makefile.generic new file mode 100644 index 0000000..5da718d --- /dev/null +++ b/Makefile.generic @@ -0,0 +1,118 @@ +# -*- Makefile -*- +BTARGET = $(TARGET).byte +JTARGET = $(TARGET).js +OTARGET = $(TARGET).native +BLTARGET = $(TARGET).cma +BNTARGET = $(TARGET).cmxa +STARGET = $(shell if `which ocamlopt`; then \ + echo $(OTARGET); \ + else echo $(BTARGET); fi) + +PREFIX ?= /usr/local + +TESTDIR = tests + +######################### +## Tools configuration ## +######################### + +# Menhir can be told to produce a parser that explains what +# it is doing. +ifeq ($(DEBUGPARSING), yes) + MENHIROPT=-yaccflag --explain -yaccflag --trace +else + MENHIROPT=-yaccflag --explain +endif + +# In Emacs, use classic display to enable error jumping. +TERM = $(shell echo $$TERM) +ifeq ($(TERM), dumb) + OCAMLBUILD = $(OCAMLBUILDCMD) -use-ocamlfind -cflag "-dtypes" -tag debug -classic-display -no-hygiene $(MENHIROPT) +else + OCAMLBUILD = $(OCAMLBUILDCMD) -use-ocamlfind -no-hygiene $(MENHIROPT) -lflags -I,`pwd`/lib +endif + +ifeq ($(PROFILE), 1) + OCAMLBUILD += -tag profile +endif + + +OCAMLDOC = ocamldoc +HEADACHE = headache + +######### +# Rules # +######### + +.PHONY: configure all-generic byte opt doc clean dist install uninstall headers clear + +all-generic: configure clear $(STARGET) $(TARGET) + +$(TARGET): + ln -s $(STARGET) $(TARGET) + +clear: + @ rm -f $(STARGET) + +opt: $(OTARGET) + +byte: $(BTARGET) + +%: + @ $(OCAMLBUILD) src/$@ + +$(JTARGET): + @ $(OCAMLBUILD) -use-ocamlfind -tag "use-nums" -tag "package(js_of_ocaml)" src/$(BTARGET) + js_of_ocaml $(BTARGET) + +byte-debug: + $(OCAMLBUILD) -tag debug src/$(BTARGET) + +ifeq ($(strip $(PREFIX)),) +install uninstall: + @echo "Cannot (un)install $(EXECUTABLE): the PREFIX variable is undefined." && false +else +install: $(EXECUTABLE) + mkdir -p $(PREFIX)/bin/ + install $(STARGET) $(PREFIX)/bin/$(TARGET) +uninstall: + /bin/rm -f $(PREFIX)/bin/$(TARGET) +endif + +####################### +# Administrative part # +####################### + +headers: + for i in src/*.ml src/*.mli src/*.mly; do \ + $(HEADACHE) -h admin/header -c admin/headache.cfg $$i; \ + done + +clean: + @ $(OCAMLBUILD) -clean + make -C cparser clean + make -C $(TESTDIR) clean + find -name '*~' -exec rm '{}' \; + rm -fr config.log config.status *~ $(TARGET) $(PACKAGE) $(PACKAGE).tar.gz + +doc: byte + $(OCAMLBUILD) $(TARGET).docdir/index.html + mkdir -p doc/html + rm -f $(TARGET).docdir/style.css 2> /dev/null + mv $(TARGET).docdir/* doc/html + rm $(TARGET).docdir + +dist: + rm -fr $(PACKAGE) + mkdir $(PACKAGE) + for i in `cat distributed_files` doc/html/*.html; do \ + if test -f $$i; then \ + cp -fr --parents $$i $(PACKAGE); \ + else \ + mkdir -p $$i; \ + fi; \ + done + tar cvfz $(PACKAGE).tar.gz $(PACKAGE) + +check: all + $(MAKE) -C $(TESTDIR) check diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..a1f3265 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,15 @@ +include Makefile.variables +include Makefile.local +include Makefile.generic +include Makefile.config + +.PHONY: web + +ifeq ($(HAVE_OCLOSURE), yes) +web: webconfig + @ echo 'module Int = IntByInt64' > src/common/intValueConfig.ml + @ $(OCAMLBUILD) src/accweb.byte + @ js_of_ocaml accweb.byte + @ oclosure_req accweb.js + @ mv *.js web +endif \ No newline at end of file diff --git a/Makefile.local b/Makefile.local new file mode 100644 index 0000000..9085b18 --- /dev/null +++ b/Makefile.local @@ -0,0 +1,12 @@ +########################### +## Package configuration ## +########################### +.PHONY: all + +all: all-generic + +VERSION = 0.2 +TARGET = acc +TARGETEXT = acc +PACKAGE = acc-$(VERSION) + diff --git a/Makefile.variables.in b/Makefile.variables.in new file mode 100644 index 0000000..5955aa0 --- /dev/null +++ b/Makefile.variables.in @@ -0,0 +1,9 @@ +# -*- Makefile -*- +# +# Local configuration file. +# + +JS_OF_OCAML = @JS_OF_OCAML@ +OCAMLBUILDCMD = @OCAMLBUILD@ +HAVE_OCLOSURE = @HAVE_OCLOSURE@ +PREFIX = @prefix@ \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..8432d5d --- /dev/null +++ b/README @@ -0,0 +1,106 @@ + Description +------------- + + This is an experimental annotating C compiler that was built upon + the CIL parser[1], Xavier Leroy's translation from C to Clight, and + an existing back-end compiler for a register transfer language to a + subset of the MIPS assembly language[2]. + + We wrote 3 compiler passes: one from Clight to Cminor, another from + Cminor to an abstract register transfer language (RTLabs), and a + last one from RTLabs to an RTL that uses MIPS instructions. We + extended interpreters for the intermediate languages to output a + list of labels which denote key control points of the program that + have been crossed during the interpretation. These labels are the + places where the code can be instrumented to obtain a precise cost + annotation. Thus, in that experiment, the annotation function is the + composition of a labelling function followed by an instrumentation + function. + + The architecture of the compiler is described in full details in the + documentation of this development, which can be found in this source + tree at doc/html/index.html. + +[1] http://cil-parser.sourceforge.net/ +[2] http://www.enseignement.polytechnique.fr/informatique/INF564/petit.tar.gz + + Licence +--------- + + This piece of code must not be distributed. It is addressed to the + CerCo partners only. + + Requirements +-------------- + + - ocaml (>= 3.12) + - menhir (>= 20090505) + - CIL (included in the distribution) + - GNU Make (>= 3.8) + - gcc + + Compilation +------------- + + You can compile this compiler using the following command: + + % make + + (assuming that you are located at the root of the source tree) + + Installation +-------------- + + To install the compiler in your favorite system hierarchy, use: + + % PREFIX=your-directory make install + + The executable "acc" will be installed in the subdirectory "bin/" of + "your-directory". If PREFIX is not provided, the default directory used will + be "/usr/local/bin/". + + Usage +------- + +Usage: acc.native [options] file... + -s Choose the source language between: + Clight, Cminor + [default is C] + -l Choose the target language between: + Clight, Cminor, RTLabs, RTL, ERTL, LTL, LIN, ASM + [default is ASM] + -a Add cost annotations on the source code. + -i Interpret the compiled code. + -d Debugging mode. + -dev Playground for developers. + -help Display this list of options + --help Display this list of options + + Test-suite +------------ + + You can optionnally check that compilation went well by confronting + the freshly built compiler to our test-suite. At the root of the + source tree, use: + + % make check + + mcu8051ide +------------ + + The object code can be simulated using the mcu8051ide[3] emulator. The code + makes use of an external memory and that the usage of such memory is not the + default option in mcu8051ide. In order to enable this option, click on the + 'Project' menu, and then on 'Edit project'. There is a box to enable 'External + RAM (XDATA)' and a scrolling bar to specify its size (we suggest to use the + maximum possible). Also, since the produced code might be too big for standard + memory, it is recommended to enable 'External ROM/FLASH (XCODE)' to its + maximum size. + +[3] http://mcu8051ide.sourceforge.net/ + + Known bugs +------------ + + - shift operations between [int] and [unsigned int] + - accessing an array initialized by a string diff --git a/_tags.common b/_tags.common new file mode 100644 index 0000000..871dca0 --- /dev/null +++ b/_tags.common @@ -0,0 +1,17 @@ +: pkg_menhirLib, use_str, use_cparser +: use_unix, pkg_menhirLib, use_str, use_cparser + +: include +: include +: include +: include +: include +: include +: include +: include +: include +: include +: include +: include + +<*>: use_unix, use_menhir, use_cparser diff --git a/_tags.compiler b/_tags.compiler new file mode 100644 index 0000000..85f5c77 --- /dev/null +++ b/_tags.compiler @@ -0,0 +1,2 @@ +: use_nums + diff --git a/_tags.js_of_ocaml b/_tags.js_of_ocaml new file mode 100644 index 0000000..17b59c7 --- /dev/null +++ b/_tags.js_of_ocaml @@ -0,0 +1,4 @@ + + : package(js_of_ocaml.syntax), package(js_of_ocaml), syntax(camlp4o), package(oclosure) + : package(js_of_ocaml.syntax), package(js_of_ocaml), syntax(camlp4o), package(oclosure) +<*>: package(js_of_ocaml.syntax), package(js_of_ocaml), syntax(camlp4o), package(oclosure) diff --git a/acc.odocl b/acc.odocl new file mode 100644 index 0000000..5f661a0 --- /dev/null +++ b/acc.odocl @@ -0,0 +1,84 @@ +Acc +Options +AnnotationOptions +Languages +Checker +OptionsParsing +Position +ASMCompute_costs +ASMInterpret +ASM +ASMPrinter +MIPSInterpret +MIPS +MIPSOps +PrintOps +ClightAnnotator +ClightInterpret +ClightLabelling +Clight +ClightParser +ClightPrinter +ClightToCminor +CminorAnnotator +CminorInterpret +CminorLabelling +Cminor +CminorPrinter +CminorToRTLabs +AST +Atom +AtomSig +CostLabel +Label +Memory +Primitive +PrintPrimitive +Register +Value +Build +ERTLInterpret +ERTL +ERTLPrinter +ERTLToLTLI +ERTLToLTL +Liveness +Uses +Zero +LINInterpret +LIN +LINPrinter +LINToASM +Branch +LTLInterpret +LTL +LTLPrinter +LTLToLINI +LTLToLIN +RTLabsInterpret +RTLabs +RTLabsPrinter +RTLabsToRTL +RTLInterpret +RTL +RTLPrinter +RTLToERTLI +RTLToERTL +Coloring +Error +Fix +Integer +Interference +Misc +MiscPottier +MyMap +PrintCFG +Print +PrintPottier +PrioritySet +SetMap +Spill +StringSig +StringTools +SyntacticAnalysis +UnionFind diff --git a/admin/myocamldoc b/admin/myocamldoc new file mode 100755 index 0000000..08858f4 --- /dev/null +++ b/admin/myocamldoc @@ -0,0 +1,50 @@ +#!/usr/bin/env ocaml + +(* This script is a wrapper for ocamldoc. + + This is a simple workaround for the defaults ocamldoc rules of + ocamlbuild. *) + +(* We assume that the command line arguments are given in the + following order: + + ocamldoc [options] FILE.(ml|mli) + + where FILE is either an implementation or an interface. + + This script rewrites this command line into something of + the shape: + + ocamldoc [options] -intf FILE.mli -impl FILE.ml + + provided that FILE.mli and FILE.ml exist (otherwise, one of these + two options is dropped out). + +*) + +open List + +let nb = Array.length Sys.argv +let args = List.tl (Array.to_list Sys.argv) +let file = Filename.chop_extension (Sys.argv.(nb - 1)) +let file_is = Filename.check_suffix Sys.argv.(nb - 1) +let impl = file ^ ".ml" +let opt what f = if Sys.file_exists f then what ^ " " ^ f else "" + +let cmd = + match args with + | [] -> "ocamlfind ocamldoc" + | _ -> + if file_is ".ml" || file_is ".mli" then + let options = rev (tl (rev args)) in + Printf.sprintf "ocamlfind ocamldoc %s %s %s" + (opt "-impl" (file ^ ".ml")) + (opt "-intf" (file ^ ".mli")) + (String.concat " " options) + else + Printf.sprintf "ocamlfind ocamldoc %s" + (String.concat " " args) + +let _ = + exit (Sys.command cmd) + diff --git a/configure b/configure new file mode 100755 index 0000000..2dda61a --- /dev/null +++ b/configure @@ -0,0 +1,4098 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="configure.ac" +ac_subst_vars='LTLIBOBJS +LIBOBJS +HAVE_OCLOSURE +JS_OF_OCAML +OCAMLBUILD +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_webapp +' + ac_precious_vars='build_alias +host_alias +target_alias' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-webapp support the generation of a WEB application using + js_of_ocaml + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +for ac_prog in ocamlbuild +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OCAMLBUILD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OCAMLBUILD"; then + ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLBUILD="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLBUILD=$ac_cv_prog_OCAMLBUILD +if test -n "$OCAMLBUILD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5 +$as_echo "$OCAMLBUILD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$OCAMLBUILD" && break +done + + + + +# Check whether --with-webapp was given. +if test "${with_webapp+set}" = set; then : + withval=$with_webapp; +else + with_webapp=check +fi + + +echo "let parser_lib = \"`pwd`/lib\"" > myocamlbuild_config.ml + +if test "x$with_webapp" != xno; then : + for ac_prog in js_of_ocaml +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_JS_OF_OCAML+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$JS_OF_OCAML"; then + ac_cv_prog_JS_OF_OCAML="$JS_OF_OCAML" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_JS_OF_OCAML="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +JS_OF_OCAML=$ac_cv_prog_JS_OF_OCAML +if test -n "$JS_OF_OCAML"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JS_OF_OCAML" >&5 +$as_echo "$JS_OF_OCAML" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$JS_OF_OCAML" && break +done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for oclosure" >&5 +$as_echo_n "checking for oclosure... " >&6; } + if sh configure-oclosure.sh; then + HAVE_OCLOSURE=yes + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi +fi + +ac_config_files="$ac_config_files Makefile.variables" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile.variables") CONFIG_FILES="$CONFIG_FILES Makefile.variables" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile.variables") CONFIG_FILES="$CONFIG_FILES Makefile.variables" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + diff --git a/configure-oclosure.sh b/configure-oclosure.sh new file mode 100755 index 0000000..88ff844 --- /dev/null +++ b/configure-oclosure.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +rm -f _tags +cat _tags.compiler > _tags +cat _tags.js_of_ocaml >> _tags +ocamlbuild -use-ocamlfind -no-hygiene src/utilities/checkOClosure.byte -quiet || true +ocamlbuild -clean -quiet +rm -f _tags \ No newline at end of file diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..032b373 --- /dev/null +++ b/configure.ac @@ -0,0 +1,28 @@ +# +# Autoconf +# +AC_INIT(configure.ac) + +AC_CHECK_PROGS([OCAMLBUILD],[ocamlbuild]) +AC_SUBST(OCAMLBUILD) + +AC_ARG_WITH([webapp], + [AS_HELP_STRING([--with-webapp], + [support the generation of a WEB application using js_of_ocaml])], + [], + [with_webapp=check]) + +echo "let parser_lib = \"`pwd`/lib\"" > myocamlbuild_config.ml + +AS_IF([test "x$with_webapp" != xno], + [AC_CHECK_PROGS([JS_OF_OCAML],[js_of_ocaml]) + AC_SUBST(JS_OF_OCAML) + AC_MSG_CHECKING([for oclosure]) + if sh configure-oclosure.sh; then + AC_SUBST(HAVE_OCLOSURE, yes) + AC_MSG_RESULT(yes) + fi]) + +AC_OUTPUT(Makefile.variables) +AC_OUTPUT(Makefile) + diff --git a/cparser/.depend b/cparser/.depend new file mode 100644 index 0000000..9f12718 --- /dev/null +++ b/cparser/.depend @@ -0,0 +1,81 @@ +AddCasts.cmi: C.cmi +Bitfields.cmi: C.cmi +Builtins.cmi: Env.cmi C.cmi +Ceval.cmi: Env.cmi C.cmi +Cleanup.cmi: C.cmi +C.cmi: +Cprint.cmi: C.cmi +Cutil.cmi: Env.cmi C.cmi +Elab.cmi: C.cmi +Env.cmi: C.cmi +Errors.cmi: +GCC.cmi: Builtins.cmi +Lexer.cmi: Parser.cmi +Machine.cmi: +Parse_aux.cmi: +Parse.cmi: C.cmi +Parser.cmi: Cabs.cmo +Rename.cmi: C.cmi +SimplExpr.cmi: C.cmi +StructAssign.cmi: C.cmi +StructByValue.cmi: C.cmi +Transform.cmi: Env.cmi C.cmi +Unblock.cmi: C.cmi +AddCasts.cmo: Transform.cmi Cutil.cmi C.cmi AddCasts.cmi +AddCasts.cmx: Transform.cmx Cutil.cmx C.cmi AddCasts.cmi +Bitfields.cmo: Transform.cmi Machine.cmi Cutil.cmi C.cmi Bitfields.cmi +Bitfields.cmx: Transform.cmx Machine.cmx Cutil.cmx C.cmi Bitfields.cmi +Builtins.cmo: Env.cmi Cutil.cmi C.cmi Builtins.cmi +Builtins.cmx: Env.cmx Cutil.cmx C.cmi Builtins.cmi +Cabshelper.cmo: Cabs.cmo +Cabshelper.cmx: Cabs.cmx +Cabs.cmo: +Cabs.cmx: +Ceval.cmo: Machine.cmi Cutil.cmi C.cmi Ceval.cmi +Ceval.cmx: Machine.cmx Cutil.cmx C.cmi Ceval.cmi +Cleanup.cmo: Cutil.cmi C.cmi Cleanup.cmi +Cleanup.cmx: Cutil.cmx C.cmi Cleanup.cmi +Cprint.cmo: C.cmi Cprint.cmi +Cprint.cmx: C.cmi Cprint.cmi +Cutil.cmo: Machine.cmi Errors.cmi Env.cmi Cprint.cmi C.cmi Cutil.cmi +Cutil.cmx: Machine.cmx Errors.cmx Env.cmx Cprint.cmx C.cmi Cutil.cmi +Elab.cmo: Parser.cmi Machine.cmi Lexer.cmi Errors.cmi Env.cmi Cutil.cmi \ + Cprint.cmi Cleanup.cmi Ceval.cmi Cabshelper.cmo Cabs.cmo C.cmi \ + Builtins.cmi Elab.cmi +Elab.cmx: Parser.cmx Machine.cmx Lexer.cmx Errors.cmx Env.cmx Cutil.cmx \ + Cprint.cmx Cleanup.cmx Ceval.cmx Cabshelper.cmx Cabs.cmx C.cmi \ + Builtins.cmx Elab.cmi +Env.cmo: C.cmi Env.cmi +Env.cmx: C.cmi Env.cmi +Errors.cmo: Errors.cmi +Errors.cmx: Errors.cmi +GCC.cmo: Cutil.cmi C.cmi Builtins.cmi GCC.cmi +GCC.cmx: Cutil.cmx C.cmi Builtins.cmx GCC.cmi +Lexer.cmo: Parser.cmi Parse_aux.cmi Cabshelper.cmo Lexer.cmi +Lexer.cmx: Parser.cmx Parse_aux.cmx Cabshelper.cmx Lexer.cmi +Machine.cmo: Machine.cmi +Machine.cmx: Machine.cmi +Main.cmo: Parse.cmi GCC.cmi Cprint.cmi Builtins.cmi +Main.cmx: Parse.cmx GCC.cmx Cprint.cmx Builtins.cmx +Parse_aux.cmo: Errors.cmi Cabshelper.cmo Parse_aux.cmi +Parse_aux.cmx: Errors.cmx Cabshelper.cmx Parse_aux.cmi +Parse.cmo: Unblock.cmi StructByValue.cmi StructAssign.cmi SimplExpr.cmi \ + Rename.cmi Errors.cmi Elab.cmi Bitfields.cmi AddCasts.cmi Parse.cmi +Parse.cmx: Unblock.cmx StructByValue.cmx StructAssign.cmx SimplExpr.cmx \ + Rename.cmx Errors.cmx Elab.cmx Bitfields.cmx AddCasts.cmx Parse.cmi +Parser.cmo: Parse_aux.cmi Cabshelper.cmo Cabs.cmo Parser.cmi +Parser.cmx: Parse_aux.cmx Cabshelper.cmx Cabs.cmx Parser.cmi +Rename.cmo: Errors.cmi Cutil.cmi C.cmi Builtins.cmi Rename.cmi +Rename.cmx: Errors.cmx Cutil.cmx C.cmi Builtins.cmx Rename.cmi +SimplExpr.cmo: Transform.cmi Errors.cmi Cutil.cmi C.cmi SimplExpr.cmi +SimplExpr.cmx: Transform.cmx Errors.cmx Cutil.cmx C.cmi SimplExpr.cmi +StructAssign.cmo: Transform.cmi Errors.cmi Env.cmi Cutil.cmi C.cmi \ + StructAssign.cmi +StructAssign.cmx: Transform.cmx Errors.cmx Env.cmx Cutil.cmx C.cmi \ + StructAssign.cmi +StructByValue.cmo: Transform.cmi Env.cmi Cutil.cmi C.cmi StructByValue.cmi +StructByValue.cmx: Transform.cmx Env.cmx Cutil.cmx C.cmi StructByValue.cmi +Transform.cmo: Env.cmi Cutil.cmi C.cmi Builtins.cmi Transform.cmi +Transform.cmx: Env.cmx Cutil.cmx C.cmi Builtins.cmx Transform.cmi +Unblock.cmo: Transform.cmi Errors.cmi Cutil.cmi C.cmi Unblock.cmi +Unblock.cmx: Transform.cmx Errors.cmx Cutil.cmx C.cmi Unblock.cmi diff --git a/cparser/AddCasts.ml b/cparser/AddCasts.ml new file mode 100644 index 0000000..9ec128d --- /dev/null +++ b/cparser/AddCasts.ml @@ -0,0 +1,242 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Materialize implicit casts *) + +(* Assumes: simplified code + Produces: simplified code + Preserves: unblocked code *) + +open C +open Cutil +open Transform + +(* We have the option of materializing all casts or leave "widening" + casts implicit. Widening casts are: +- from a small integer type to a larger integer type, +- from a small float type to a larger float type, +- from a pointer type to void *. +*) + +let omit_widening_casts = ref false + +let widening_cast env tfrom tto = + begin match unroll env tfrom, unroll env tto with + | TInt(k1, _), TInt(k2, _) -> + let r1 = integer_rank k1 and r2 = integer_rank k2 in + r1 < r2 || (r1 = r2 && is_signed_ikind k1 = is_signed_ikind k2) + | TFloat(k1, _), TFloat(k2, _) -> + float_rank k1 <= float_rank k2 + | TPtr(ty1, _), TPtr(ty2, _) -> is_void_type env ty2 + | _, _ -> false + end + +let cast_not_needed env tfrom tto = + let tfrom = pointer_decay env tfrom + and tto = pointer_decay env tto in + compatible_types env tfrom tto + || (!omit_widening_casts && widening_cast env tfrom tto) + +let cast env e tto = + if cast_not_needed env e.etyp tto + then e + else {edesc = ECast(tto, e); etyp = tto} + +(* Note: this pass applies only to simplified expressions + because casts cannot be materialized in op= expressions... *) + +let rec add_expr env e = + match e.edesc with + | EConst _ -> e + | EVar _ -> e + | ESizeof _ -> e + | EUnop(op, e1) -> + let e1' = add_expr env e1 in + let desc = + match op with + | Ominus | Oplus | Onot -> + EUnop(op, cast env e1' e.etyp) + | Olognot | Oderef | Oaddrof + | Odot _ | Oarrow _ -> + EUnop(op, e1') + | Opreincr | Opredecr | Opostincr | Opostdecr -> + assert false (* not simplified *) + in { edesc = desc; etyp = e.etyp } + | EBinop(op, e1, e2, ty) -> + let e1' = add_expr env e1 in + let e2' = add_expr env e2 in + let desc = + match op with + | Oadd -> + if is_pointer_type env ty + then EBinop(Oadd, e1', e2', ty) + else EBinop(Oadd, cast env e1' ty, cast env e2' ty, ty) + | Osub -> + if is_pointer_type env ty + then EBinop(Osub, e1', e2', ty) + else EBinop(Osub, cast env e1' ty, cast env e2' ty, ty) + | Omul|Odiv|Omod|Oand|Oor|Oxor|Oeq|One|Olt|Ogt|Ole|Oge -> + EBinop(op, cast env e1' ty, cast env e2' ty, ty) + | Oshl|Oshr -> + EBinop(op, cast env e1' ty, e2', ty) + | Oindex | Ologand | Ologor | Ocomma -> + EBinop(op, e1', e2', ty) + | Oassign + | Oadd_assign|Osub_assign|Omul_assign|Odiv_assign|Omod_assign + | Oand_assign|Oor_assign|Oxor_assign|Oshl_assign|Oshr_assign -> + assert false (* not simplified *) + in { edesc = desc; etyp = e.etyp } + | EConditional(e1, e2, e3) -> + { edesc = + EConditional(add_expr env e1, add_expr env e2, add_expr env e3); + etyp = e.etyp } + | ECast(ty, e1) -> + { edesc = ECast(ty, add_expr env e1); etyp = e.etyp } + | ECall(e1, el) -> + assert false (* not simplified *) + +(* Arguments to a prototyped function *) + +let rec add_proto env args params = + match args, params with + | [], _ -> [] + | _::_, [] -> add_noproto env args + | arg1 :: argl, (_, ty_p) :: paraml -> + cast env (add_expr env arg1) ty_p :: + add_proto env argl paraml + +(* Arguments to a non-prototyped function *) + +and add_noproto env args = + match args with + | [] -> [] + | arg1 :: argl -> + cast env (add_expr env arg1) (default_argument_conversion env arg1.etyp) :: + add_noproto env argl + +(* Arguments to function calls in general *) + +let add_arguments env ty_fun args = + let ty_args = + match unroll env ty_fun with + | TFun(res, args, vararg, a) -> args + | TPtr(ty, a) -> + begin match unroll env ty with + | TFun(res, args, vararg, a) -> args + | _ -> assert false + end + | _ -> assert false in + match ty_args with + | None -> add_noproto env args + | Some targs -> add_proto env args targs + +(* Toplevel expressions (appearing in Sdo statements) *) + +let add_topexpr env loc e = + match e.edesc with + | EBinop(Oassign, lhs, {edesc = ECall(e1, el); etyp = ty}, _) -> + let ecall = + {edesc = ECall(add_expr env e1, add_arguments env e1.etyp el); + etyp = ty} in + if cast_not_needed env ty lhs.etyp then + sassign loc (add_expr env lhs) ecall + else begin + let tmp = new_temp (erase_attributes_type env ty) in + sseq loc (sassign loc tmp ecall) + (sassign loc (add_expr env lhs) (cast env tmp lhs.etyp)) + end + | EBinop(Oassign, lhs, rhs, _) -> + sassign loc (add_expr env lhs) (cast env (add_expr env rhs) lhs.etyp) + | ECall(e1, el) -> + let ecall = + {edesc = ECall(add_expr env e1, add_arguments env e1.etyp el); + etyp = e.etyp} in + {sdesc = Sdo ecall; sloc = loc} + | _ -> + assert false + +(* Initializers *) + +let rec add_init env tto = function + | Init_single e -> + Init_single (cast env (add_expr env e) tto) + | Init_array il -> + let ty_elt = + match unroll env tto with + | TArray(ty, _, _) -> ty | _ -> assert false in + Init_array (List.map (add_init env ty_elt) il) + | Init_struct(id, fil) -> + Init_struct (id, List.map + (fun (fld, i) -> (fld, add_init env fld.fld_typ i)) + fil) + | Init_union(id, fld, i) -> + Init_union(id, fld, add_init env fld.fld_typ i) + +(* Declarations *) + +let add_decl env (sto, id, ty, optinit) = + (sto, id, ty, + begin match optinit with + | None -> None + | Some init -> Some(add_init env ty init) + end) + +(* Statements *) + +let rec add_stmt env f s = + match s.sdesc with + | Sskip -> s + | Sdo e -> add_topexpr env s.sloc e + | Sseq(s1, s2) -> + {sdesc = Sseq(add_stmt env f s1, add_stmt env f s2); sloc = s.sloc } + | Sif(e, s1, s2) -> + {sdesc = Sif(add_expr env e, add_stmt env f s1, add_stmt env f s2); + sloc = s.sloc} + | Swhile(e, s1) -> + {sdesc = Swhile(add_expr env e, add_stmt env f s1); + sloc = s.sloc} + | Sdowhile(s1, e) -> + {sdesc = Sdowhile(add_stmt env f s1, add_expr env e); + sloc = s.sloc} + | Sfor(s1, e, s2, s3) -> + {sdesc = Sfor(add_stmt env f s1, add_expr env e, add_stmt env f s2, + add_stmt env f s3); + sloc = s.sloc} + | Sbreak -> s + | Scontinue -> s + | Sswitch(e, s1) -> + {sdesc = Sswitch(add_expr env e, add_stmt env f s1); sloc = s.sloc} + | Slabeled(lbl, s) -> + {sdesc = Slabeled(lbl, add_stmt env f s); sloc = s.sloc} + | Sgoto lbl -> s + | Sreturn None -> s + | Sreturn (Some e) -> + {sdesc = Sreturn(Some(cast env (add_expr env e) f.fd_ret)); sloc = s.sloc} + | Sblock sl -> + {sdesc = Sblock(List.map (add_stmt env f) sl); sloc = s.sloc} + | Sdecl d -> + {sdesc = Sdecl(add_decl env d); sloc = s.sloc} + +let add_fundef env f = + reset_temps(); + let body' = add_stmt env f f.fd_body in + let temps = get_temps () in + (* fd_locals have no initializers, so no need to transform them *) + { f with fd_locals = f.fd_locals @ temps; fd_body = body' } + + +let program ?(all = false) p = + omit_widening_casts := not all; + Transform.program ~decl:add_decl ~fundef:add_fundef p diff --git a/cparser/AddCasts.mli b/cparser/AddCasts.mli new file mode 100644 index 0000000..318ecc6 --- /dev/null +++ b/cparser/AddCasts.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val program: ?all: bool -> C.program -> C.program diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml new file mode 100644 index 0000000..dea1862 --- /dev/null +++ b/cparser/Bitfields.ml @@ -0,0 +1,396 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Elimination of bit fields in structs *) + +(* Assumes: unblocked, simplified code. + Preserves: unblocked, simplified code. *) + +open Printf +open Machine +open C +open Cutil +open Transform + +(* Info associated to each bitfield *) + +type bitfield_info = + { bf_carrier: string; (* name of underlying regular field *) + bf_carrier_typ: typ; (* type of underlying regular field *) + bf_pos: int; (* start bit *) + bf_size: int; (* size in bit *) + bf_signed: bool } (* signed or unsigned *) + +(* invariants: + 0 <= pos < bitsizeof(int) + 0 < sz <= bitsizeof(int) + 0 < pos + sz <= bitsizeof(int) +*) + +(* Mapping (struct identifier, bitfield name) -> bitfield info *) + +let bitfield_table = + (Hashtbl.create 57: (ident * string, bitfield_info) Hashtbl.t) + +(* Packing algorithm -- keep consistent with [Cutil.pack_bitfield]! *) + +let unsigned_ikind_for_carrier nbits = + if nbits <= 8 then IUChar else + if nbits <= 8 * !config.sizeof_short then IUShort else + if nbits <= 8 * !config.sizeof_int then IUInt else + if nbits <= 8 * !config.sizeof_long then IULong else + if nbits <= 8 * !config.sizeof_longlong then IULongLong else + assert false + +let pack_bitfields env id ml = + let rec pack accu pos = function + | [] -> + (pos, accu, []) + | m :: ms as ml -> + match m.fld_bitfield with + | None -> (pos, accu, ml) + | Some n -> + if n = 0 then + (pos, accu, ms) (* bit width 0 means end of pack *) + else if pos + n > 8 * !config.sizeof_int then + (pos, accu, ml) (* doesn't fit in current word *) + else begin + let signed = + match unroll env m.fld_typ with + | TInt(ik, _) -> is_signed_ikind ik + | _ -> assert false (* should never happen, checked in Elab *) in + pack ((m.fld_name, pos, n, signed) :: accu) (pos + n) ms + end + in pack [] 0 ml + +let rec transf_members env id count = function + | [] -> [] + | m :: ms as ml -> + if m.fld_bitfield = None then + m :: transf_members env id count ms + else begin + let (nbits, bitfields, ml') = pack_bitfields env id ml in + let carrier = sprintf "__bf%d" count in + let carrier_typ = TInt(unsigned_ikind_for_carrier nbits, []) in + List.iter + (fun (name, pos, sz, signed) -> + Hashtbl.add bitfield_table + (id, name) + {bf_carrier = carrier; bf_carrier_typ = carrier_typ; + bf_pos = pos; bf_size = sz; bf_signed = signed}) + bitfields; + { fld_name = carrier; fld_typ = carrier_typ; fld_bitfield = None} + :: transf_members env id (count + 1) ml' + end + +let transf_composite env su id ml = + match su with + | Struct -> transf_members env id 1 ml + | Union -> ml + +(* Bitfield manipulation expressions *) + +let left_shift_count bf = + intconst + (Int64.of_int (8 * !config.sizeof_int - (bf.bf_pos + bf.bf_size))) + IInt + +let right_shift_count bf = + intconst + (Int64.of_int (8 * !config.sizeof_int - bf.bf_size)) + IInt + +let insertion_mask bf = + let m = + Int64.shift_left + (Int64.pred (Int64.shift_left 1L bf.bf_size)) + bf.bf_pos in + (* Give the mask an hexadecimal string representation, nicer to read *) + {edesc = EConst(CInt(m, IUInt, sprintf "0x%LXU" m)); etyp = TInt(IUInt, [])} + +(* Extract the value of a bitfield *) + +(* Reference C code: + +unsigned int bitfield_unsigned_extract(unsigned int x, int ofs, int sz) +{ + return (x << (BITSIZE_UINT - (ofs + sz))) >> (BITSIZE_UINT - sz); +} + +signed int bitfield_signed_extract(unsigned int x, int ofs, int sz) +{ + return ((signed int) (x << (BITSIZE_UINT - (ofs + sz)))) + >> (BITSIZE_UINT - sz); +} + +*) + +let bitfield_extract bf carrier = + let e1 = + {edesc = EBinop(Oshl, carrier, left_shift_count bf, TInt(IUInt, [])); + etyp = carrier.etyp} in + let ty = TInt((if bf.bf_signed then IInt else IUInt), []) in + let e2 = + {edesc = ECast(ty, e1); etyp = ty} in + {edesc = EBinop(Oshr, e2, right_shift_count bf, e2.etyp); + etyp = e2.etyp} + +(* Assign a bitfield within a carrier *) + +(* Reference C code: + +unsigned int bitfield_insert(unsigned int x, int ofs, int sz, unsigned int y) +{ + unsigned int mask = ((1U << sz) - 1) << ofs; + return (x & ~mask) | ((y << ofs) & mask); +} + +*) + +let bitfield_assign bf carrier newval = + let msk = insertion_mask bf in + let notmsk = {edesc = EUnop(Onot, msk); etyp = msk.etyp} in + let newval_shifted = + {edesc = EBinop(Oshl, newval, intconst (Int64.of_int bf.bf_pos) IUInt, + TInt(IUInt,[])); + etyp = TInt(IUInt,[])} in + let newval_masked = + {edesc = EBinop(Oand, newval_shifted, msk, TInt(IUInt,[])); + etyp = TInt(IUInt,[])} + and oldval_masked = + {edesc = EBinop(Oand, carrier, notmsk, TInt(IUInt,[])); + etyp = TInt(IUInt,[])} in + {edesc = EBinop(Oor, oldval_masked, newval_masked, TInt(IUInt,[])); + etyp = TInt(IUInt,[])} + +(* Expressions *) + +let transf_expr env e = + + let is_bitfield_access ty fieldname = + match unroll env ty with + | TStruct(id, _) -> + (try Some(Hashtbl.find bitfield_table (id, fieldname)) + with Not_found -> None) + | _ -> None in + + let is_bitfield_access_ptr ty fieldname = + match unroll env ty with + | TPtr(ty', _) -> is_bitfield_access ty' fieldname + | _ -> None in + + let rec texp e = + match e.edesc with + | EConst _ -> e + | ESizeof _ -> e + | EVar _ -> e + + | EUnop(Odot fieldname, e1) -> + let e1' = texp e1 in + begin match is_bitfield_access e1.etyp fieldname with + | None -> + {edesc = EUnop(Odot fieldname, e1'); etyp = e.etyp} + | Some bf -> + bitfield_extract bf + {edesc = EUnop(Odot bf.bf_carrier, e1'); + etyp = bf.bf_carrier_typ} + end + + | EUnop(Oarrow fieldname, e1) -> + let e1' = texp e1 in + begin match is_bitfield_access_ptr e1.etyp fieldname with + | None -> + {edesc = EUnop(Oarrow fieldname, e1'); etyp = e.etyp} + | Some bf -> + bitfield_extract bf + {edesc = EUnop(Oarrow bf.bf_carrier, e1'); + etyp = bf.bf_carrier_typ} + end + + | EUnop(op, e1) -> + (* Note: simplified expr, so no ++/-- *) + {edesc = EUnop(op, texp e1); etyp = e.etyp} + + | EBinop(Oassign, e1, e2, ty) -> + begin match e1.edesc with + | EUnop(Odot fieldname, e11) -> + let lhs = texp e11 in let rhs = texp e2 in + begin match is_bitfield_access e11.etyp fieldname with + | None -> + {edesc = EBinop(Oassign, + {edesc = EUnop(Odot fieldname, lhs); + etyp = e1.etyp}, + rhs, ty); + etyp = e.etyp} + | Some bf -> + let carrier = + {edesc = EUnop(Odot bf.bf_carrier, lhs); + etyp = bf.bf_carrier_typ} in + {edesc = EBinop(Oassign, carrier, + bitfield_assign bf carrier rhs, + carrier.etyp); + etyp = carrier.etyp} + end + | EUnop(Oarrow fieldname, e11) -> + let lhs = texp e11 in let rhs = texp e2 in + begin match is_bitfield_access_ptr e11.etyp fieldname with + | None -> + {edesc = EBinop(Oassign, + {edesc = EUnop(Oarrow fieldname, lhs); + etyp = e1.etyp}, + rhs, ty); + etyp = e.etyp} + | Some bf -> + let carrier = + {edesc = EUnop(Oarrow bf.bf_carrier, lhs); + etyp = bf.bf_carrier_typ} in + {edesc = EBinop(Oassign, carrier, + bitfield_assign bf carrier rhs, + carrier.etyp); + etyp = carrier.etyp} + end + | _ -> + {edesc = EBinop(Oassign, texp e1, texp e2, e1.etyp); etyp = e1.etyp} + end + + | EBinop(op, e1, e2, ty) -> + (* Note: simplified expr assumed, so no assign-op *) + {edesc = EBinop(op, texp e1, texp e2, ty); etyp = e.etyp} + | EConditional(e1, e2, e3) -> + {edesc = EConditional(texp e1, texp e2, texp e3); etyp = e.etyp} + | ECast(ty, e1) -> + {edesc = ECast(ty, texp e1); etyp = e.etyp} + | ECall(e1, el) -> + {edesc = ECall(texp e1, List.map texp el); etyp = e.etyp} + + in texp e + +(* Statements *) + +let rec transf_stmt env s = + match s.sdesc with + | Sskip -> s + | Sdo e -> + {sdesc = Sdo(transf_expr env e); sloc = s.sloc} + | Sseq(s1, s2) -> + {sdesc = Sseq(transf_stmt env s1, transf_stmt env s2); sloc = s.sloc } + | Sif(e, s1, s2) -> + {sdesc = Sif(transf_expr env e, transf_stmt env s1, transf_stmt env s2); + sloc = s.sloc} + | Swhile(e, s1) -> + {sdesc = Swhile(transf_expr env e, transf_stmt env s1); + sloc = s.sloc} + | Sdowhile(s1, e) -> + {sdesc = Sdowhile(transf_stmt env s1, transf_expr env e); + sloc = s.sloc} + | Sfor(s1, e, s2, s3) -> + {sdesc = Sfor(transf_stmt env s1, transf_expr env e, transf_stmt env s2, + transf_stmt env s3); + sloc = s.sloc} + | Sbreak -> s + | Scontinue -> s + | Sswitch(e, s1) -> + {sdesc = Sswitch(transf_expr env e, transf_stmt env s1); sloc = s.sloc} + | Slabeled(lbl, s) -> + {sdesc = Slabeled(lbl, transf_stmt env s); sloc = s.sloc} + | Sgoto lbl -> s + | Sreturn None -> s + | Sreturn (Some e) -> + {sdesc = Sreturn(Some(transf_expr env e)); sloc = s.sloc} + | Sblock _ | Sdecl _ -> + assert false (* should not occur in unblocked code *) + +(* Functions *) + +let transf_fundef env f = + { f with fd_body = transf_stmt env f.fd_body } + +(* Initializers *) + +let bitfield_initializer bf i = + match i with + | Init_single e -> + let m = Int64.pred (Int64.shift_left 1L bf.bf_size) in + let e_mask = + {edesc = EConst(CInt(m, IUInt, sprintf "0x%LXU" m)); + etyp = TInt(IUInt, [])} in + let e_and = + {edesc = EBinop(Oand, e, e_mask, TInt(IUInt,[])); + etyp = TInt(IUInt,[])} in + {edesc = EBinop(Oshl, e_and, intconst (Int64.of_int bf.bf_pos) IInt, + TInt(IUInt, [])); + etyp = TInt(IUInt, [])} + | _ -> assert false + +let rec pack_bitfield_init id carrier fld_init_list = + match fld_init_list with + | [] -> ([], []) + | (fld, i) :: rem -> + try + let bf = Hashtbl.find bitfield_table (id, fld.fld_name) in + if bf.bf_carrier <> carrier then + ([], fld_init_list) + else begin + let (el, rem') = pack_bitfield_init id carrier rem in + (bitfield_initializer bf i :: el, rem') + end + with Not_found -> + ([], fld_init_list) + +let rec or_expr_list = function + | [] -> assert false + | [e] -> e + | e1 :: el -> + {edesc = EBinop(Oor, e1, or_expr_list el, TInt(IUInt,[])); + etyp = TInt(IUInt,[])} + +let rec transf_struct_init id fld_init_list = + match fld_init_list with + | [] -> [] + | (fld, i) :: rem -> + try + let bf = Hashtbl.find bitfield_table (id, fld.fld_name) in + let (el, rem') = + pack_bitfield_init id bf.bf_carrier fld_init_list in + ({fld_name = bf.bf_carrier; fld_typ = bf.bf_carrier_typ; + fld_bitfield = None}, + Init_single {edesc = ECast(bf.bf_carrier_typ, or_expr_list el); + etyp = bf.bf_carrier_typ}) + :: transf_struct_init id rem' + with Not_found -> + (fld, i) :: transf_struct_init id rem + +let rec transf_init env i = + match i with + | Init_single e -> Init_single (transf_expr env e) + | Init_array il -> Init_array (List.map (transf_init env) il) + | Init_struct(id, fld_init_list) -> + let fld_init_list' = + List.map (fun (f, i) -> (f, transf_init env i)) fld_init_list in + Init_struct(id, transf_struct_init id fld_init_list') + | Init_union(id, fld, i) -> Init_union(id, fld, transf_init env i) + +let transf_decl env (sto, id, ty, init_opt) = + (sto, id, ty, + match init_opt with None -> None | Some i -> Some(transf_init env i)) + +(* Programs *) + +let program p = + Transform.program + ~composite:transf_composite + ~decl: transf_decl + ~fundef:transf_fundef + p diff --git a/cparser/Bitfields.mli b/cparser/Bitfields.mli new file mode 100644 index 0000000..45899a4 --- /dev/null +++ b/cparser/Bitfields.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val program: C.program -> C.program diff --git a/cparser/Builtins.ml b/cparser/Builtins.ml new file mode 100644 index 0000000..8eb1abf --- /dev/null +++ b/cparser/Builtins.ml @@ -0,0 +1,54 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Compiler built-ins *) + +open C +open Cutil + +let env = ref Env.empty +let idents = ref [] +let decls = ref [] + +let environment () = !env +let identifiers () = !idents +let declarations () = List.rev !decls + +let add_typedef (s, ty) = + let (id, env') = Env.enter_typedef !env s ty in + env := env'; + idents := id :: !idents; + decls := {gdesc = Gtypedef(id, ty); gloc = no_loc} :: !decls + +let add_function (s, (res, args, va)) = + let ty = + TFun(res, + Some (List.map (fun ty -> (Env.fresh_ident "", ty)) args), + va, []) in + let (id, env') = Env.enter_ident !env s Storage_extern ty in + env := env'; + idents := id :: !idents; + decls := {gdesc = Gdecl(Storage_extern, id, ty, None); gloc = no_loc} :: !decls + +type t = { + typedefs: (string * C.typ) list; + functions: (string * (C.typ * C.typ list * bool)) list +} + +let set blt = + env := Env.empty; + idents := []; + List.iter add_typedef blt.typedefs; + List.iter add_function blt.functions diff --git a/cparser/Builtins.mli b/cparser/Builtins.mli new file mode 100644 index 0000000..7f9d78a --- /dev/null +++ b/cparser/Builtins.mli @@ -0,0 +1,25 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val environment: unit -> Env.t +val identifiers: unit -> C.ident list +val declarations: unit -> C.globdecl list + +type t = { + typedefs: (string * C.typ) list; + functions: (string * (C.typ * C.typ list * bool)) list +} + +val set: t -> unit diff --git a/cparser/C.mli b/cparser/C.mli new file mode 100644 index 0000000..d477acd --- /dev/null +++ b/cparser/C.mli @@ -0,0 +1,232 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* C abstract syntax after elaboration *) + +(* Locations *) + +type location = string * int (* filename, line number *) + +(* Identifiers *) + +type ident = + { name: string; (* name as in the source *) + stamp: int } (* unique ID *) + +(* kinds of integers *) + +type ikind = + | IBool (** [_Bool] *) + | IChar (** [char] *) + | ISChar (** [signed char] *) + | IUChar (** [unsigned char] *) + | IInt (** [int] *) + | IUInt (** [unsigned int] *) + | IShort (** [short] *) + | IUShort (** [unsigned short] *) + | ILong (** [long] *) + | IULong (** [unsigned long] *) + | ILongLong (** [long long] (or [_int64] on Microsoft Visual C) *) + | IULongLong (** [unsigned long long] (or [unsigned _int64] on Microsoft + Visual C) *) + +(** Kinds of floating-point numbers*) + +type fkind = + FFloat (** [float] *) + | FDouble (** [double] *) + | FLongDouble (** [long double] *) + + +(** Constants *) + +type constant = + | CInt of int64 * ikind * string (* as it appeared in the source *) + | CFloat of float * fkind * string (* as it appeared in the source *) + | CStr of string + | CWStr of int64 list + | CEnum of ident * int64 (* enum tag, integer value *) + +(** Attributes *) + +type attribute = AConst | AVolatile | ARestrict + +type attributes = attribute list + +(** Storage classes *) + +type storage = + | Storage_default + | Storage_extern + | Storage_static + | Storage_register + +(** Unary operators *) + +type unary_operator = + | Ominus (* unary "-" *) + | Oplus (* unary "+" *) + | Olognot (* "!" *) + | Onot (* "~" *) + | Oderef (* unary "*" *) + | Oaddrof (* "&" *) + | Opreincr (* "++" prefix *) + | Opredecr (* "--" prefix *) + | Opostincr (* "++" postfix *) + | Opostdecr (* "--" postfix *) + | Odot of string (* ".field" *) + | Oarrow of string (* "->field" *) + +type binary_operator = + | Oadd (* binary "+" *) + | Osub (* binary "-" *) + | Omul (* binary "*" *) + | Odiv (* "/" *) + | Omod (* "%" *) + | Oand (* "&" *) + | Oor (* "|" *) + | Oxor (* "^" *) + | Oshl (* "<<" *) + | Oshr (* ">>" *) + | Oeq (* "==" *) + | One (* "!=" *) + | Olt (* "<" *) + | Ogt (* ">" *) + | Ole (* "<=" *) + | Oge (* ">=" *) + | Oindex (* "a[i]" *) + | Oassign (* "=" *) + | Oadd_assign (* "+=" *) + | Osub_assign (* "-=" *) + | Omul_assign (* "*=" *) + | Odiv_assign (* "/=" *) + | Omod_assign (* "%=" *) + | Oand_assign (* "&=" *) + | Oor_assign (* "|=" *) + | Oxor_assign (* "^=" *) + | Oshl_assign (* "<<=" *) + | Oshr_assign (* ">>=" *) + | Ocomma (* "," *) + | Ologand (* "&&" *) + | Ologor (* "||" *) + +(** Types *) + +type typ = + | TVoid of attributes + | TInt of ikind * attributes + | TFloat of fkind * attributes + | TPtr of typ * attributes + | TArray of typ * int64 option * attributes + | TFun of typ * (ident * typ) list option * bool * attributes + | TNamed of ident * attributes + | TStruct of ident * attributes + | TUnion of ident * attributes + +(** Expressions *) + +type exp = { edesc: exp_desc; etyp: typ } + +and exp_desc = + | EConst of constant + | ESizeof of typ + | EVar of ident + | EUnop of unary_operator * exp + | EBinop of binary_operator * exp * exp * typ + (* the type at which the operation is performed *) + | EConditional of exp * exp * exp + | ECast of typ * exp + | ECall of exp * exp list + +(** Statements *) + +type stmt = { sdesc: stmt_desc; sloc: location } + +and stmt_desc = + | Sskip + | Sdo of exp + | Sseq of stmt * stmt + | Sif of exp * stmt * stmt + | Swhile of exp * stmt + | Sdowhile of stmt * exp + | Sfor of stmt * exp * stmt * stmt + | Sbreak + | Scontinue + | Sswitch of exp * stmt + | Slabeled of slabel * stmt + | Sgoto of string + | Sreturn of exp option + | Sblock of stmt list + | Sdecl of decl + +and slabel = + | Slabel of string + | Scase of exp + | Sdefault + +(** Declarations *) + +and decl = + storage * ident * typ * init option + +(** Initializers *) + +and init = + | Init_single of exp + | Init_array of init list + | Init_struct of ident * (field * init) list + | Init_union of ident * field * init + +(** Struct or union field *) + +and field = { + fld_name: string; + fld_typ: typ; + fld_bitfield: int option +} + +type struct_or_union = + | Struct + | Union + +(** Function definitions *) + +type fundef = { + fd_storage: storage; + fd_inline: bool; + fd_name: ident; + fd_ret: typ; (* return type *) + fd_params: (ident * typ) list; (* formal parameters *) + fd_vararg: bool; (* variable arguments? *) + fd_locals: decl list; (* local variables *) + fd_body: stmt +} + +(** Global declarations *) + +type globdecl = + { gdesc: globdecl_desc; gloc: location } + +and globdecl_desc = + | Gdecl of decl (* variable declaration, function prototype *) + | Gfundef of fundef (* function definition *) + | Gcompositedecl of struct_or_union * ident (* struct/union declaration *) + | Gcompositedef of struct_or_union * ident * field list + (* struct/union definition *) + | Gtypedef of ident * typ (* typedef *) + | Genumdef of ident * (ident * exp option) list (* enum definition *) + | Gpragma of string (* #pragma directive *) + +type program = globdecl list diff --git a/cparser/CBuiltins.ml b/cparser/CBuiltins.ml new file mode 100644 index 0000000..da90d12 --- /dev/null +++ b/cparser/CBuiltins.ml @@ -0,0 +1 @@ +include GCC diff --git a/cparser/Cabs.ml b/cparser/Cabs.ml new file mode 100644 index 0000000..a2bb512 --- /dev/null +++ b/cparser/Cabs.ml @@ -0,0 +1,299 @@ +(* + * + * Copyright (c) 2001-2002, + * George C. Necula + * Scott McPeak + * Wes Weimer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The names of the contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +(** This file was originally part of Hugues Casee's frontc 2.0, and has been + * extensively changed since. +** +** 1.0 3.22.99 Hugues Cassé First version. +** 2.0 George Necula 12/12/00: Many extensions + **) + +(* +** Types +*) + +type cabsloc = { + lineno : int; + filename: string; + byteno: int; + ident : int; +} + +type typeSpecifier = (* Merge all specifiers into one type *) + Tvoid (* Type specifier ISO 6.7.2 *) + | Tchar + | Tshort + | Tint + | Tlong + | Tint64 + | T_Bool + | Tfloat + | Tdouble + | Tsigned + | Tunsigned + | Tnamed of string + (* each of the following three kinds of specifiers contains a field + * or item list iff it corresponds to a definition (as opposed to + * a forward declaration or simple reference to the type); they + * also have a list of __attribute__s that appeared between the + * keyword and the type name (definitions only) *) + | Tstruct of string * field_group list option * attribute list + | Tunion of string * field_group list option * attribute list + | Tenum of string * enum_item list option * attribute list + | TtypeofE of expression (* GCC __typeof__ *) + | TtypeofT of specifier * decl_type (* GCC __typeof__ *) + +and storage = + NO_STORAGE | AUTO | STATIC | EXTERN | REGISTER + +and funspec = + INLINE | VIRTUAL | EXPLICIT + +and cvspec = + CV_CONST | CV_VOLATILE | CV_RESTRICT + +(* Type specifier elements. These appear at the start of a declaration *) +(* Everywhere they appear in this file, they appear as a 'spec_elem list', *) +(* which is not interpreted by cabs -- rather, this "word soup" is passed *) +(* on to the compiler. Thus, we can represent e.g. 'int long float x' even *) +(* though the compiler will of course choke. *) +and spec_elem = + SpecTypedef + | SpecCV of cvspec (* const/volatile *) + | SpecAttr of attribute (* __attribute__ *) + | SpecStorage of storage + | SpecInline + | SpecType of typeSpecifier + +(* decided to go ahead and replace 'spec_elem list' with specifier *) +and specifier = spec_elem list + + +(* Declarator type. They modify the base type given in the specifier. Keep + * them in the order as they are printed (this means that the top level + * constructor for ARRAY and PTR is the inner-level in the meaning of the + * declared type) *) +and decl_type = + | JUSTBASE (* Prints the declared name *) + | PARENTYPE of attribute list * decl_type * attribute list + (* Prints "(attrs1 decl attrs2)". + * attrs2 are attributes of the + * declared identifier and it is as + * if they appeared at the very end + * of the declarator. attrs1 can + * contain attributes for the + * identifier or attributes for the + * enclosing type. *) + | ARRAY of decl_type * attribute list * expression + (* Prints "decl [ attrs exp ]". + * decl is never a PTR. *) + | PTR of attribute list * decl_type (* Prints "* attrs decl" *) + | PROTO of decl_type * single_name list * bool + (* Prints "decl (args[, ...])". + * decl is never a PTR.*) + +(* The base type and the storage are common to all names. Each name might + * contain type or storage modifiers *) +(* e.g.: int x, y; *) +and name_group = specifier * name list + +(* The optional expression is the bitfield *) +and field_group = specifier * (name * expression option) list + +(* like name_group, except the declared variables are allowed to have initializers *) +(* e.g.: int x=1, y=2; *) +and init_name_group = specifier * init_name list + +(* The decl_type is in the order in which they are printed. Only the name of + * the declared identifier is pulled out. The attributes are those that are + * printed after the declarator *) +(* e.g: in "int *x", "*x" is the declarator; "x" will be pulled out as *) +(* the string, and decl_type will be PTR([], JUSTBASE) *) +and name = string * decl_type * attribute list * cabsloc + +(* A variable declarator ("name") with an initializer *) +and init_name = name * init_expression + +(* Single names are for declarations that cannot come in groups, like + * function parameters and functions *) +and single_name = specifier * name + + +and enum_item = string * expression * cabsloc + +(* +** Declaration definition (at toplevel) +*) +and definition = + FUNDEF of single_name * block * cabsloc * cabsloc + | DECDEF of init_name_group * cabsloc (* global variable(s), or function prototype *) + | TYPEDEF of name_group * cabsloc + | ONLYTYPEDEF of specifier * cabsloc + | GLOBASM of string * cabsloc + | PRAGMA of string * cabsloc + | LINKAGE of string * cabsloc * definition list (* extern "C" { ... } *) + +(* the string is a file name, and then the list of toplevel forms *) +and file = string * definition list + + +(* +** statements +*) + +(* A block contains a list of local label declarations ( GCC's ({ __label__ + * l1, l2; ... }) ) , a list of definitions and a list of statements *) +and block = + { blabels: string list; + battrs: attribute list; + bstmts: statement list + } + +(* GCC asm directives have lots of extra information to guide the optimizer *) +and asm_details = + { aoutputs: (string option * string * expression) list; (* optional name, constraints and expressions for outputs *) + ainputs: (string option * string * expression) list; (* optional name, constraints and expressions for inputs *) + aclobbers: string list (* clobbered registers *) + } + +and statement = + NOP of cabsloc + | COMPUTATION of expression * cabsloc + | BLOCK of block * cabsloc +(* | SEQUENCE of statement * statement * cabsloc *) + | IF of expression * statement * statement * cabsloc + | WHILE of expression * statement * cabsloc + | DOWHILE of expression * statement * cabsloc + | FOR of for_clause * expression * expression * statement * cabsloc + | BREAK of cabsloc + | CONTINUE of cabsloc + | RETURN of expression * cabsloc + | SWITCH of expression * statement * cabsloc + | CASE of expression * statement * cabsloc + | CASERANGE of expression * expression * statement * cabsloc + | DEFAULT of statement * cabsloc + | LABEL of string * statement * cabsloc + | GOTO of string * cabsloc + | COMPGOTO of expression * cabsloc (* GCC's "goto *exp" *) + | DEFINITION of definition (*definition or declaration of a variable or type*) + + | ASM of attribute list * (* typically only volatile and const *) + string list * (* template *) + asm_details option * (* extra details to guide GCC's optimizer *) + cabsloc + + (** MS SEH *) + | TRY_EXCEPT of block * expression * block * cabsloc + | TRY_FINALLY of block * block * cabsloc + +and for_clause = + FC_EXP of expression + | FC_DECL of definition + +(* +** Expressions +*) +and binary_operator = + ADD | SUB | MUL | DIV | MOD + | AND | OR + | BAND | BOR | XOR | SHL | SHR + | EQ | NE | LT | GT | LE | GE + | ASSIGN + | ADD_ASSIGN | SUB_ASSIGN | MUL_ASSIGN | DIV_ASSIGN | MOD_ASSIGN + | BAND_ASSIGN | BOR_ASSIGN | XOR_ASSIGN | SHL_ASSIGN | SHR_ASSIGN + +and unary_operator = + MINUS | PLUS | NOT | BNOT | MEMOF | ADDROF + | PREINCR | PREDECR | POSINCR | POSDECR + +and expression = + NOTHING + | UNARY of unary_operator * expression + | LABELADDR of string (* GCC's && Label *) + | BINARY of binary_operator * expression * expression + | QUESTION of expression * expression * expression + + (* A CAST can actually be a constructor expression *) + | CAST of (specifier * decl_type) * init_expression + + (* There is a special form of CALL in which the function called is + __builtin_va_arg and the second argument is sizeof(T). This + should be printed as just T *) + | CALL of expression * expression list + | COMMA of expression list + | CONSTANT of constant + | PAREN of expression + | VARIABLE of string + | EXPR_SIZEOF of expression + | TYPE_SIZEOF of specifier * decl_type + | EXPR_ALIGNOF of expression + | TYPE_ALIGNOF of specifier * decl_type + | INDEX of expression * expression + | MEMBEROF of expression * string + | MEMBEROFPTR of expression * string + | GNU_BODY of block + +and constant = + | CONST_INT of string (* the textual representation *) + | CONST_FLOAT of string (* the textual representaton *) + | CONST_CHAR of int64 list + | CONST_WCHAR of int64 list + | CONST_STRING of string + | CONST_WSTRING of int64 list + (* ww: wstrings are stored as an int64 list at this point because + * we might need to feed the wide characters piece-wise into an + * array initializer (e.g., wchar_t foo[] = L"E\xabcd";). If that + * doesn't happen we will convert it to an (escaped) string before + * passing it to Cil. *) + +and init_expression = + | NO_INIT + | SINGLE_INIT of expression + | COMPOUND_INIT of (initwhat * init_expression) list + +and initwhat = + NEXT_INIT + | INFIELD_INIT of string * initwhat + | ATINDEX_INIT of expression * initwhat + | ATINDEXRANGE_INIT of expression * expression + + + (* Each attribute has a name and some + * optional arguments *) +and attribute = string * expression list + + diff --git a/cparser/Cabshelper.ml b/cparser/Cabshelper.ml new file mode 100644 index 0000000..2dc1a91 --- /dev/null +++ b/cparser/Cabshelper.ml @@ -0,0 +1,126 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + + +open Cabs + +let nextident = ref 0 +let getident () = + nextident := !nextident + 1; + !nextident + +let currentLoc_lexbuf lb = + let p = Lexing.lexeme_start_p lb in + { lineno = p.Lexing.pos_lnum; + filename = p.Lexing.pos_fname; + byteno = p.Lexing.pos_cnum; + ident = getident ();} + +let currentLoc () = + let p = Parsing.symbol_start_pos() in + { lineno = p.Lexing.pos_lnum; + filename = p.Lexing.pos_fname; + byteno = p.Lexing.pos_cnum; + ident = getident ();} + +let cabslu = {lineno = -10; + filename = "cabs loc unknown"; + byteno = -10; + ident = 0} + +(*********** HELPER FUNCTIONS **********) + +let missingFieldDecl = ("___missing_field_name", JUSTBASE, [], cabslu) + +let rec isStatic = function + [] -> false + | (SpecStorage STATIC) :: _ -> true + | _ :: rest -> isStatic rest + +let rec isExtern = function + [] -> false + | (SpecStorage EXTERN) :: _ -> true + | _ :: rest -> isExtern rest + +let rec isInline = function + [] -> false + | SpecInline :: _ -> true + | _ :: rest -> isInline rest + +let rec isTypedef = function + [] -> false + | SpecTypedef :: _ -> true + | _ :: rest -> isTypedef rest + + +let get_definitionloc (d : definition) : cabsloc = + match d with + | FUNDEF(_, _, l, _) -> l + | DECDEF(_, l) -> l + | TYPEDEF(_, l) -> l + | ONLYTYPEDEF(_, l) -> l + | GLOBASM(_, l) -> l + | PRAGMA(_, l) -> l + | LINKAGE (_, l, _) -> l + +let get_statementloc (s : statement) : cabsloc = +begin + match s with + | NOP(loc) -> loc + | COMPUTATION(_,loc) -> loc + | BLOCK(_,loc) -> loc +(* | SEQUENCE(_,_,loc) -> loc *) + | IF(_,_,_,loc) -> loc + | WHILE(_,_,loc) -> loc + | DOWHILE(_,_,loc) -> loc + | FOR(_,_,_,_,loc) -> loc + | BREAK(loc) -> loc + | CONTINUE(loc) -> loc + | RETURN(_,loc) -> loc + | SWITCH(_,_,loc) -> loc + | CASE(_,_,loc) -> loc + | CASERANGE(_,_,_,loc) -> loc + | DEFAULT(_,loc) -> loc + | LABEL(_,_,loc) -> loc + | GOTO(_,loc) -> loc + | COMPGOTO (_, loc) -> loc + | DEFINITION d -> get_definitionloc d + | ASM(_,_,_,loc) -> loc + | TRY_EXCEPT(_, _, _, loc) -> loc + | TRY_FINALLY(_, _, loc) -> loc +end + + +let explodeStringToInts (s: string) : int64 list = + let rec allChars i acc = + if i < 0 then acc + else allChars (i - 1) (Int64.of_int (Char.code (String.get s i)) :: acc) + in + allChars (-1 + String.length s) [] + +let valueOfDigit chr = + let int_value = + match chr with + '0'..'9' -> (Char.code chr) - (Char.code '0') + | 'a'..'z' -> (Char.code chr) - (Char.code 'a') + 10 + | 'A'..'Z' -> (Char.code chr) - (Char.code 'A') + 10 + | _ -> assert false in + Int64.of_int int_value + +let string_of_cabsloc l = + Printf.sprintf "%s:%d" l.filename l.lineno + +let format_cabsloc pp l = + Format.fprintf pp "%s:%d" l.filename l.lineno diff --git a/cparser/Ceval.ml b/cparser/Ceval.ml new file mode 100644 index 0000000..0e22852 --- /dev/null +++ b/cparser/Ceval.ml @@ -0,0 +1,277 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Evaluation of compile-time constants *) + +open C +open Cutil +open Machine + +(* Extra arith on int64 *) + +external int64_unsigned_to_float: int64 -> float + = "cparser_int64_unsigned_to_float" +external int64_unsigned_div: int64 -> int64 -> int64 + = "cparser_int64_unsigned_div" +external int64_unsigned_mod: int64 -> int64 -> int64 + = "cparser_int64_unsigned_mod" +external int64_unsigned_compare: int64 -> int64 -> int + = "cparser_int64_unsigned_compare" + +exception Notconst + +(* Reduce n to the range of representable integers of the given kind *) + +let normalize_int n ik = + if ik = IBool then + if n = 0L then 0L else 1L + else begin + let bitsize = sizeof_ikind ik * 8 + and signed = is_signed_ikind ik in + if bitsize >= 64 then n else begin + let a = 64 - bitsize in + let p = Int64.shift_left n a in + if signed + then Int64.shift_right p a + else Int64.shift_right_logical p a + end + end + +(* Reduce n to the range of representable floats of the given kind *) + +let normalize_float f fk = + match fk with + | FFloat -> Int32.float_of_bits (Int32.bits_of_float f) + | FDouble -> f + | FLongDouble -> raise Notconst (* cannot accurately compute on this type *) + +type value = + | I of int64 + | F of float + | S of string + | WS of int64 list + +let boolean_value v = + match v with + | I n -> n <> 0L + | F n -> n <> 0.0 + | S _ | WS _ -> true + +let constant = function + | CInt(v, ik, _) -> I (normalize_int v ik) + | CFloat(v, fk, _) -> F (normalize_float v fk) + | CStr s -> S s + | CWStr s -> WS s + | CEnum(id, v) -> I v + +let is_signed env ty = + match unroll env ty with + | TInt(ik, _) -> is_signed_ikind ik + | _ -> false + +let cast env ty_to ty_from v = + match unroll env ty_to, v with + | TInt(IBool, _), _ -> + if boolean_value v then I 1L else I 0L + | TInt(ik, _), I n -> + I(normalize_int n ik) + | TInt(ik, _), F n -> + I(normalize_int (Int64.of_float n) ik) + | TInt(ik, _), (S _ | WS _) -> + if sizeof_ikind ik >= !config.sizeof_ptr + then v + else raise Notconst + | TFloat(fk, _), F n -> + F(normalize_float n fk) + | TFloat(fk, _), I n -> + if is_signed env ty_from + then F(normalize_float (Int64.to_float n) fk) + else F(normalize_float (int64_unsigned_to_float n) fk) + | TPtr(ty, _), I n -> + I (normalize_int n ptr_t_ikind) + | TPtr(ty, _), F n -> + if n = 0.0 then I 0L else raise Notconst + | TPtr(ty, _), (S _ | WS _) -> + v + | _, _ -> + raise Notconst + +let unop env op tyres ty v = + let res = + match op, tyres, v with + | Ominus, TInt _, I n -> I (Int64.neg n) + | Ominus, TFloat _, F n -> F (-. n) + | Oplus, TInt _, I n -> I n + | Oplus, TFloat _, F n -> F n + | Olognot, _, _ -> if boolean_value v then I 0L else I 1L + | _ -> raise Notconst + in cast env ty tyres res + +let comparison env direction ptraction tyop ty1 v1 ty2 v2 = + (* tyop = type at which the comparison is done *) + let b = + match cast env tyop ty1 v1, cast env tyop ty2 v2 with + | I n1, I n2 -> + if is_signed env tyop + then direction (compare n1 n2) 0 + else direction (int64_unsigned_compare n1 n2) 0 (* including pointers *) + | F n1, F n2 -> + direction (compare n1 n2) 0 + | (S _ | WS _), I 0L -> + begin match ptraction with None -> raise Notconst | Some b -> b end + | I 0L, (S _ | WS _) -> + begin match ptraction with None -> raise Notconst | Some b -> b end + | _, _ -> + raise Notconst + in if b then I 1L else I 0L + +let binop env op tyop tyres ty1 v1 ty2 v2 = + (* tyop = type at which the computation is done + tyres = expected result type *) + let res = + match op with + | Oadd -> + if is_arith_type env ty1 && is_arith_type env ty2 then begin + match cast env tyop ty1 v1, cast env tyop ty2 v2 with + | I n1, I n2 -> I (Int64.add n1 n2) + | F n1, F n2 -> F (n1 +. n2) + | _, _ -> raise Notconst + end else + raise Notconst + | Osub -> + if is_arith_type env ty1 && is_arith_type env ty2 then begin + match cast env tyop ty1 v1, cast env tyop ty2 v2 with + | I n1, I n2 -> I (Int64.sub n1 n2) + | F n1, F n2 -> F (n1 -. n2) + | _, _ -> raise Notconst + end else + raise Notconst + | Omul -> + begin match cast env tyop ty1 v1, cast env tyop ty2 v2 with + | I n1, I n2 -> I (Int64.mul n1 n2) + | F n1, F n2 -> F (n1 *. n2) + | _, _ -> raise Notconst + end + | Odiv -> + begin match cast env tyop ty1 v1, cast env tyop ty2 v2 with + | I n1, I n2 -> + if n2 = 0L then raise Notconst else + if is_signed env tyop then I (Int64.div n1 n2) + else I (int64_unsigned_div n1 n2) + | F n1, F n2 -> F (n1 /. n2) + | _, _ -> raise Notconst + end + | Omod -> + begin match v1, v2 with + | I n1, I n2 -> + if n2 = 0L then raise Notconst else + if is_signed env tyop then I (Int64.rem n1 n2) + else I (int64_unsigned_mod n1 n2) + | _, _ -> raise Notconst + end + | Oand -> + begin match v1, v2 with + | I n1, I n2 -> I (Int64.logand n1 n2) + | _, _ -> raise Notconst + end + | Oor -> + begin match v1, v2 with + | I n1, I n2 -> I (Int64.logor n1 n2) + | _, _ -> raise Notconst + end + | Oxor -> + begin match v1, v2 with + | I n1, I n2 -> I (Int64.logxor n1 n2) + | _, _ -> raise Notconst + end + | Oshl -> + begin match v1, v2 with + | I n1, I n2 when n2 >= 0L && n2 < 64L -> + I (Int64.shift_left n1 (Int64.to_int n2)) + | _, _ -> raise Notconst + end + | Oshr -> + begin match v1, v2 with + | I n1, I n2 when n2 >= 0L && n2 < 64L -> + if is_signed env tyop + then I (Int64.shift_right n1 (Int64.to_int n2)) + else I (Int64.shift_right_logical n1 (Int64.to_int n2)) + | _, _ -> raise Notconst + end + | Oeq -> + comparison env (=) (Some false) tyop ty1 v1 ty2 v2 + | One -> + comparison env (<>) (Some true) tyop ty1 v1 ty2 v2 + | Olt -> + comparison env (<) None tyop ty1 v1 ty2 v2 + | Ogt -> + comparison env (>) None tyop ty1 v1 ty2 v2 + | Ole -> + comparison env (<=) None tyop ty1 v1 ty2 v2 + | Oge -> + comparison env (>=) None tyop ty1 v1 ty2 v2 + | Ocomma -> + v2 + | Ologand -> + if boolean_value v1 + then if boolean_value v2 then I 1L else I 0L + else I 0L + | Ologor -> + if boolean_value v1 + then I 1L + else if boolean_value v2 then I 1L else I 0L + | _ -> raise Notconst + (* force normalization of result, e.g. of double to float *) + in cast env tyres tyres res + +let rec expr env e = + match e.edesc with + | EConst c -> + constant c + | ESizeof ty -> + begin match sizeof env ty with + | None -> raise Notconst + | Some n -> I(Int64.of_int n) + end + | EVar _ -> + raise Notconst + | EUnop(op, e1) -> + unop env op e.etyp e1.etyp (expr env e1) + | EBinop(op, e1, e2, ty) -> + binop env op ty e.etyp e1.etyp (expr env e1) e2.etyp (expr env e2) + | EConditional(e1, e2, e3) -> + if boolean_value (expr env e1) then expr env e2 else expr env e3 + | ECast(ty, e1) -> + cast env e1.etyp ty (expr env e1) + | ECall _ -> + raise Notconst + +let integer_expr env e = + try + match cast env e.etyp (TInt(ILongLong, [])) (expr env e) with + | I n -> Some n + | _ -> None + with Notconst -> None + +let constant_expr env ty e = + try + match unroll env ty, cast env e.etyp ty (expr env e) with + | TInt(ik, _), I n -> Some(CInt(n, ik, "")) + | TFloat(fk, _), F n -> Some(CFloat(n, fk, "")) + | TPtr(_, _), I 0L -> Some(CInt(0L, IInt, "")) + | TPtr(_, _), S s -> Some(CStr s) + | TPtr(_, _), WS s -> Some(CWStr s) + | _ -> None + with Notconst -> None diff --git a/cparser/Ceval.mli b/cparser/Ceval.mli new file mode 100644 index 0000000..c7f7aa8 --- /dev/null +++ b/cparser/Ceval.mli @@ -0,0 +1,17 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val integer_expr : Env.t -> C.exp -> int64 option +val constant_expr : Env.t -> C.typ -> C.exp -> C.constant option diff --git a/cparser/Cleanup.ml b/cparser/Cleanup.ml new file mode 100644 index 0000000..be28989 --- /dev/null +++ b/cparser/Cleanup.ml @@ -0,0 +1,196 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Removing unused declarations *) + +open C +open Cutil + +(* The set of all identifiers referenced so far *) +let referenced = ref IdentSet.empty + +(* Record that a new identifier was added to this set *) +let ref_changed = ref false + +(* Record a reference to an identifier. If seen for the first time, + add it to worklist. *) + +let addref id = + if not (IdentSet.mem id !referenced) then begin +(* Printf.printf "Referenced: %s$%d\n" id.name id.stamp; *) + referenced := IdentSet.add id !referenced; + ref_changed := true + end + +let needed id = + IdentSet.mem id !referenced + +(* Iterate [addref] on all syntactic categories. *) + +let rec add_typ = function + | TPtr(ty, _) -> add_typ ty + | TArray(ty, _, _) -> add_typ ty + | TFun(res, None, _, _) -> add_typ res + | TFun(res, Some params, _, _) -> add_typ res; add_vars params + | TNamed(id, _) -> addref id + | TStruct(id, _) -> addref id + | TUnion(id, _) -> addref id + | _ -> () + +and add_vars vl = + List.iter (fun (id, ty) -> add_typ ty) vl + +let rec add_exp e = + add_typ e.etyp; (* perhaps not necessary but play it safe *) + match e.edesc with + | EConst (CEnum(id, v)) -> addref id + | EConst _ -> () + | ESizeof ty -> add_typ ty + | EVar id -> addref id + | EUnop(op, e1) -> add_exp e1 + | EBinop(op, e1, e2, ty) -> add_exp e1; add_exp e2 + | EConditional(e1, e2, e3) -> add_exp e1; add_exp e2; add_exp e3 + | ECast(ty, e1) -> add_typ ty; add_exp e1 + | ECall(e1, el) -> add_exp e1; List.iter add_exp el + +let rec add_init = function + | Init_single e -> add_exp e + | Init_array il -> List.iter add_init il + | Init_struct(id, il) -> addref id; List.iter (fun (_, i) -> add_init i) il + | Init_union(id, _, i) -> addref id; add_init i + +let add_decl (sto, id, ty, init) = + add_typ ty; + match init with None -> () | Some i -> add_init i + +let rec add_stmt s = + match s.sdesc with + | Sskip -> () + | Sdo e -> add_exp e + | Sseq(s1, s2) -> add_stmt s1; add_stmt s2 + | Sif(e, s1, s2) -> add_exp e; add_stmt s1; add_stmt s2 + | Swhile(e, s1) -> add_exp e; add_stmt s1 + | Sdowhile(s1, e) -> add_stmt s1; add_exp e + | Sfor(e1, e2, e3, s1) -> add_stmt e1; add_exp e2; add_stmt e3; add_stmt s1 + | Sbreak -> () + | Scontinue -> () + | Sswitch(e, s1) -> add_exp e; add_stmt s1 + | Slabeled(lbl, s) -> + begin match lbl with Scase e -> add_exp e | _ -> () end; + add_stmt s + | Sgoto lbl -> () + | Sreturn None -> () + | Sreturn(Some e) -> add_exp e + | Sblock sl -> List.iter add_stmt sl + | Sdecl d -> add_decl d + +let add_fundef f = + add_typ f.fd_ret; + add_vars f.fd_params; + List.iter add_decl f.fd_locals; + add_stmt f.fd_body + +let add_field f = add_typ f.fld_typ + +let add_enum e = + List.iter + (fun (id, opt_e) -> match opt_e with Some e -> add_exp e | None -> ()) + e + +(* Saturate the set of referenced identifiers, starting with externally + visible global declarations *) + +let visible_decl (sto, id, ty, init) = + sto = Storage_default && + match ty with TFun _ -> false | _ -> true + +let rec add_init_globdecls accu = function + | [] -> accu + | g :: rem -> + match g.gdesc with + | Gdecl decl when visible_decl decl -> + add_decl decl; add_init_globdecls accu rem + | Gfundef({fd_storage = Storage_default} as f) -> + add_fundef f; add_init_globdecls accu rem + | Gdecl _ | Gfundef _ | Gcompositedef _ | Gtypedef _ | Genumdef _ -> + (* Keep for later iterations *) + add_init_globdecls (g :: accu) rem + | Gcompositedecl _ | Gpragma _ -> + (* Discard, since these cannot introduce more references later *) + add_init_globdecls accu rem + +let rec add_needed_globdecls accu = function + | [] -> accu + | g :: rem -> + match g.gdesc with + | Gdecl((sto, id, ty, init) as decl) -> + if needed id + then (add_decl decl; add_needed_globdecls accu rem) + else add_needed_globdecls (g :: accu) rem + | Gfundef f -> + if needed f.fd_name + then (add_fundef f; add_needed_globdecls accu rem) + else add_needed_globdecls (g :: accu) rem + | Gcompositedef(_, id, flds) -> + if needed id + then (List.iter add_field flds; add_needed_globdecls accu rem) + else add_needed_globdecls (g :: accu) rem + | Gtypedef(id, ty) -> + if needed id + then (add_typ ty; add_needed_globdecls accu rem) + else add_needed_globdecls (g :: accu) rem + | Genumdef(id, enu) -> + if List.exists (fun (id, _) -> needed id) enu + then (add_enum enu; add_needed_globdecls accu rem) + else add_needed_globdecls (g :: accu) rem + | _ -> + assert false + +let saturate p = + let rec loop p = + if !ref_changed then begin + ref_changed := false; + loop (add_needed_globdecls [] p) + end in + ref_changed := false; + loop (add_init_globdecls [] p) + +(* Remove unreferenced definitions *) + +let rec simpl_globdecls accu = function + | [] -> accu + | g :: rem -> + let need = + match g.gdesc with + | Gdecl((sto, id, ty, init) as decl) -> visible_decl decl || needed id + | Gfundef f -> f.fd_storage = Storage_default || needed f.fd_name + | Gcompositedecl(_, id) -> needed id + | Gcompositedef(_, id, flds) -> needed id + | Gtypedef(id, ty) -> needed id + | Genumdef(id, enu) -> List.exists (fun (id, _) -> needed id) enu + | Gpragma s -> true in + if need + then simpl_globdecls (g :: accu) rem + else simpl_globdecls accu rem + +let program p = + referenced := IdentSet.empty; + saturate p; + let p' = simpl_globdecls [] p in + referenced := IdentSet.empty; + p' + + + diff --git a/cparser/Cleanup.mli b/cparser/Cleanup.mli new file mode 100644 index 0000000..818a51b --- /dev/null +++ b/cparser/Cleanup.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val program : C.program -> C.program diff --git a/cparser/Cprint.ml b/cparser/Cprint.ml new file mode 100644 index 0000000..7d8f2b3 --- /dev/null +++ b/cparser/Cprint.ml @@ -0,0 +1,492 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Pretty-printer for C abstract syntax *) + +open Format +open C + +let print_idents_in_full = ref false + +let print_line_numbers = ref false + +let location pp (file, lineno) = + if !print_line_numbers && lineno >= 0 then + fprintf pp "# %d \"%s\"@ " lineno file + +let ident pp i = + if !print_idents_in_full + then fprintf pp "%s$%d" i.name i.stamp + else fprintf pp "%s" i.name + +let attribute pp = function + | AConst -> fprintf pp "const" + | AVolatile -> fprintf pp "volatile" + | ARestrict -> fprintf pp "restrict" + +let attributes pp = function + | [] -> () + | al -> List.iter (fun a -> fprintf pp " %a" attribute a) al + +let name_of_ikind = function + | IBool -> "_Bool" + | IChar -> "char" + | ISChar -> "signed char" + | IUChar -> "unsigned char" + | IInt -> "int" + | IUInt -> "unsigned int" + | IShort -> "short" + | IUShort -> "unsigned short" + | ILong -> "long" + | IULong -> "unsigned long" + | ILongLong -> "long long" + | IULongLong -> "unsigned long long" + +let name_of_fkind = function + | FFloat -> "float" + | FDouble -> "double" + | FLongDouble -> "long double" + +let rec dcl pp ty n = + match ty with + | TVoid a -> + fprintf pp "void%a%t" attributes a n + | TInt(k, a) -> + fprintf pp "%s%a%t" (name_of_ikind k) attributes a n + | TFloat(k, a) -> + fprintf pp "%s%a%t" (name_of_fkind k) attributes a n + | TPtr(t, a) -> + let n' pp = + match t with + | TFun _ | TArray _ -> fprintf pp " (*%a%t)" attributes a n + | _ -> fprintf pp " *%a%t" attributes a n in + dcl pp t n' + | TArray(t, sz, a) -> + let n' pp = + begin match a with + | [] -> n pp + | _ -> fprintf pp " (%a%t)" attributes a n + end; + begin match sz with + | None -> fprintf pp "[]" + | Some i -> fprintf pp "[%Ld]" i + end in + dcl pp t n' + | TFun(tres, args, vararg, a) -> + let param (id, ty) = + dcl pp ty + (fun pp -> fprintf pp " %a" ident id) in + let n' pp = + begin match a with + | [] -> n pp + | _ -> fprintf pp " (%a%t)" attributes a n + end; + fprintf pp "(@["; + begin match args with + | None -> () + | Some [] -> if vararg then fprintf pp "..." else fprintf pp "void" + | Some (a1 :: al) -> + param a1; + List.iter (fun a -> fprintf pp ",@ "; param a) al; + if vararg then fprintf pp ",@ ..." + end; + fprintf pp "@])" in + dcl pp tres n' + | TNamed(id, a) -> + fprintf pp "%a%a%t" ident id attributes a n + | TStruct(id, a) -> + fprintf pp "struct %a%a%t" ident id attributes a n + | TUnion(id, a) -> + fprintf pp "union %a%a%t" ident id attributes a n + +let typ pp ty = + dcl pp ty (fun _ -> ()) + +let const pp = function + | CInt(v, ik, s) -> + if s <> "" then + fprintf pp "%s" s + else begin + fprintf pp "%Ld" v; + match ik with + | IULongLong -> fprintf pp "ULL" + | ILongLong -> fprintf pp "LL" + | IULong -> fprintf pp "UL" + | ILong -> fprintf pp "L" + | IUInt -> fprintf pp "U" + | _ -> () + end + | CFloat(v, fk, s) -> + if s <> "" then + fprintf pp "%s" s + else begin + fprintf pp "%.18g" v; + match fk with + | FFloat -> fprintf pp "F" + | FLongDouble -> fprintf pp "L" + | _ -> () + end + | CStr s -> + fprintf pp "\""; + for i = 0 to String.length s - 1 do + match s.[i] with + | '\009' -> fprintf pp "\\t" + | '\010' -> fprintf pp "\\n" + | '\013' -> fprintf pp "\\r" + | '\"' -> fprintf pp "\\\"" + | '\\' -> fprintf pp "\\\\" + | c -> + if c >= ' ' && c <= '~' + then fprintf pp "%c" c + else fprintf pp "\\%03o" (Char.code c) + done; + fprintf pp "\"" + | CWStr l -> + fprintf pp "L\""; + List.iter + (fun c -> + if c >= 32L && c <= 126L && c <> 34L && c <>92L + then fprintf pp "%c" (Char.chr (Int64.to_int c)) + else fprintf pp "\" \"\\x%02Lx\" \"" c) + l; + fprintf pp "\"" + | CEnum(id, v) -> + ident pp id + +type associativity = LtoR | RtoL | NA + +let precedence = function (* H&S section 7.2 *) + | EConst _ -> (16, NA) + | ESizeof _ -> (15, RtoL) + | EVar _ -> (16, NA) + | EBinop(Oindex, _, _, _) -> (16, LtoR) + | ECall _ -> (16, LtoR) + | EUnop((Odot _|Oarrow _), _) -> (16, LtoR) + | EUnop((Opostincr|Opostdecr), _) -> (16, LtoR) + | EUnop((Opreincr|Opredecr|Onot|Olognot|Ominus|Oplus|Oaddrof|Oderef), _) -> (15, RtoL) + | ECast _ -> (14, RtoL) + | EBinop((Omul|Odiv|Omod), _, _, _) -> (13, LtoR) + | EBinop((Oadd|Osub), _, _, _) -> (12, LtoR) + | EBinop((Oshl|Oshr), _, _, _) -> (11, LtoR) + | EBinop((Olt|Ogt|Ole|Oge), _, _, _) -> (10, LtoR) + | EBinop((Oeq|One), _, _, _) -> (9, LtoR) + | EBinop(Oand, _, _, _) -> (8, LtoR) + | EBinop(Oxor, _, _, _) -> (7, LtoR) + | EBinop(Oor, _, _, _) -> (6, LtoR) + | EBinop(Ologand, _, _, _) -> (5, LtoR) + | EBinop(Ologor, _, _, _) -> (4, LtoR) + | EConditional _ -> (3, RtoL) + | EBinop((Oassign|Oadd_assign|Osub_assign|Omul_assign|Odiv_assign|Omod_assign|Oand_assign|Oor_assign|Oxor_assign|Oshl_assign|Oshr_assign), _, _, _) -> (2, RtoL) + | EBinop(Ocomma, _, _, _) -> (1, LtoR) + +let rec exp pp (prec, a) = + let (prec', assoc) = precedence a.edesc in + let (prec1, prec2) = + if assoc = LtoR + then (prec', prec' + 1) + else (prec' + 1, prec') in + if prec' < prec + then fprintf pp "@[(" + else fprintf pp "@["; + begin match a.edesc with + | EConst cst -> const pp cst + | EVar id -> ident pp id + | ESizeof ty -> fprintf pp "sizeof(%a)" typ ty + | EUnop(Ominus, a1) -> + fprintf pp "-%a" exp (prec', a1) + | EUnop(Oplus, a1) -> + fprintf pp "+%a" exp (prec', a1) + | EUnop(Olognot, a1) -> + fprintf pp "!%a" exp (prec', a1) + | EUnop(Onot, a1) -> + fprintf pp "~%a" exp (prec', a1) + | EUnop(Oderef, a1) -> + fprintf pp "*%a" exp (prec', a1) + | EUnop(Oaddrof, a1) -> + fprintf pp "&%a" exp (prec', a1) + | EUnop(Opreincr, a1) -> + fprintf pp "++%a" exp (prec', a1) + | EUnop(Opredecr, a1) -> + fprintf pp "--%a" exp (prec', a1) + | EUnop(Opostincr, a1) -> + fprintf pp "%a++" exp (prec', a1) + | EUnop(Opostdecr, a1) -> + fprintf pp "%a--" exp (prec', a1) + | EUnop(Odot s, a1) -> + fprintf pp "%a.%s" exp (prec', a1)s + | EUnop(Oarrow s, a1) -> + fprintf pp "%a->%s" exp (prec', a1)s + | EBinop(Oadd, a1, a2, _) -> + fprintf pp "%a@ + %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Osub, a1, a2, _) -> + fprintf pp "%a@ - %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Omul, a1, a2, _) -> + fprintf pp "%a@ * %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Odiv, a1, a2, _) -> + fprintf pp "%a@ / %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Omod, a1, a2, _) -> + fprintf pp "%a@ %% %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oand, a1, a2, _) -> + fprintf pp "%a@ & %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oor, a1, a2, _) -> + fprintf pp "%a@ | %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oxor, a1, a2, _) -> + fprintf pp "%a@ ^ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oshl, a1, a2, _) -> + fprintf pp "%a@ << %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oshr, a1, a2, _) -> + fprintf pp "%a@ >> %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oeq, a1, a2, _) -> + fprintf pp "%a@ == %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(One, a1, a2, _) -> + fprintf pp "%a@ != %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Olt, a1, a2, _) -> + fprintf pp "%a@ < %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Ogt, a1, a2, _) -> + fprintf pp "%a@ > %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Ole, a1, a2, _) -> + fprintf pp "%a@ <= %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oge, a1, a2, _) -> + fprintf pp "%a@ >= %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oindex, a1, a2, _) -> + fprintf pp "%a[%a]" exp (prec1, a1) exp (0, a2) + | EBinop(Oassign, a1, a2, _) -> + fprintf pp "%a =@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oadd_assign, a1, a2, _) -> + fprintf pp "%a +=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Osub_assign, a1, a2, _) -> + fprintf pp "%a -=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Omul_assign, a1, a2, _) -> + fprintf pp "%a *=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Odiv_assign, a1, a2, _) -> + fprintf pp "%a /=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Omod_assign, a1, a2, _) -> + fprintf pp "%a %%=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oand_assign, a1, a2, _) -> + fprintf pp "%a &=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oor_assign, a1, a2, _) -> + fprintf pp "%a |=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oxor_assign, a1, a2, _) -> + fprintf pp "%a ^=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oshl_assign, a1, a2, _) -> + fprintf pp "%a <<=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Oshr_assign, a1, a2, _) -> + fprintf pp "%a >>=@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Ocomma, a1, a2, _) -> + fprintf pp "%a,@ %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Ologand, a1, a2, _) -> + fprintf pp "%a@ && %a" exp (prec1, a1) exp (prec2, a2) + | EBinop(Ologor, a1, a2, _) -> + fprintf pp "%a@ || %a" exp (prec1, a1) exp (prec2, a2) + | EConditional(a1, a2, a3) -> + fprintf pp "%a@ ? %a@ : %a" exp (4, a1) exp (4, a2) exp (4, a3) + | ECast(ty, a1) -> + fprintf pp "(%a) %a" typ ty exp (prec', a1) + | ECall({edesc = EVar {name = "__builtin_va_start"}}, + [a1; {edesc = EUnop(Oaddrof, a2)}]) -> + fprintf pp "__builtin_va_start@[(%a,@ %a)@]" + exp (2, a1) exp (2, a2) + | ECall({edesc = EVar {name = "__builtin_va_arg"}}, + [a1; {edesc = ESizeof ty}]) -> + fprintf pp "__builtin_va_arg@[(%a,@ %a)@]" + exp (2, a1) typ ty + | ECall(a1, al) -> + fprintf pp "%a@[(" exp (prec', a1); + begin match al with + | [] -> () + | a1 :: al -> + fprintf pp "%a" exp (2, a1); + List.iter (fun a -> fprintf pp ",@ %a" exp (2, a)) al + end; + fprintf pp ")@]" + end; + if prec' < prec then fprintf pp ")@]" else fprintf pp "@]" + +let rec init pp = function + | Init_single e -> + exp pp (2, e) + | Init_array il -> + fprintf pp "@[{"; + List.iter (fun i -> fprintf pp "%a,@ " init i) il; + fprintf pp "}@]" + | Init_struct(id, il) -> + fprintf pp "@[{"; + List.iter (fun (fld, i) -> fprintf pp "%a,@ " init i) il; + fprintf pp "}@]" + | Init_union(id, fld, i) -> + fprintf pp "@[{%a}@]" init i + +let simple_decl pp (id, ty) = + dcl pp ty (fun pp -> fprintf pp " %a" ident id) + +let storage pp = function + | Storage_default -> () + | Storage_extern -> fprintf pp "extern " + | Storage_static -> fprintf pp "static " + | Storage_register -> fprintf pp "register " + +let full_decl pp (sto, id, ty, int) = + fprintf pp "@[%a" storage sto; + dcl pp ty (fun pp -> fprintf pp " %a" ident id); + begin match int with + | None -> () + | Some i -> fprintf pp " =@ %a" init i + end; + fprintf pp ";@]" + +exception Not_expr + +let rec exp_of_stmt s = + match s.sdesc with + | Sdo e -> e + | Sseq(s1, s2) -> + {edesc = EBinop(Ocomma, exp_of_stmt s1, exp_of_stmt s2, TVoid []); + etyp = TVoid []} + | Sif(e, s1, s2) -> + {edesc = EConditional(e, exp_of_stmt s1, exp_of_stmt s2); + etyp = TVoid []} + | _ -> + raise Not_expr + +let rec stmt pp s = + location pp s.sloc; + match s.sdesc with + | Sskip -> + fprintf pp "/*skip*/;" + | Sdo e -> + fprintf pp "%a;" exp (0, e) + | Sseq(s1, s2) -> + fprintf pp "%a@ %a" stmt s1 stmt s2 + | Sif(e, s1, {sdesc = Sskip}) -> + fprintf pp "@[if (%a) {@ %a@;<0 -2>}@]" + exp (0, e) stmt_block s1 + | Sif(e, {sdesc = Sskip}, s2) -> + let not_e = {edesc = EUnop(Olognot, e); etyp = TInt(IInt, [])} in + fprintf pp "@[if (%a) {@ %a@;<0 -2>}@]" + exp (0, not_e) stmt_block s2 + | Sif(e, s1, s2) -> + fprintf pp "@[if (%a) {@ %a@;<0 -2>} else {@ %a@;<0 -2>}@]" + exp (0, e) stmt_block s1 stmt_block s2 + | Swhile(e, s1) -> + fprintf pp "@[while (%a) {@ %a@;<0 -2>}@]" + exp (0, e) stmt_block s1 + | Sdowhile(s1, e) -> + fprintf pp "@[do {@ %a@;<0 -2>} while(%a);@]" + stmt_block s1 exp (0, e) + | Sfor(e1, e2, e3, s1) -> + fprintf pp "@[for (@[%a;@ %a;@ %a) {@]@ %a@;<0 -2>}@]" + opt_exp e1 + exp (0, e2) + opt_exp e3 + stmt_block s1 + | Sbreak -> + fprintf pp "break;" + | Scontinue -> + fprintf pp "continue;" + | Sswitch(e, s1) -> + fprintf pp "@[switch (%a) {@ %a@;<0 -2>}@]" + exp (0, e) + stmt_block s1 + | Slabeled(lbl, s1) -> + fprintf pp "%a:@ %a" slabel lbl stmt s1 + | Sgoto lbl -> + fprintf pp "goto %s;" lbl + | Sreturn None -> + fprintf pp "return;" + | Sreturn (Some e) -> + fprintf pp "return %a;" exp (0, e) + | Sblock sl -> + fprintf pp "@[{@ %a@;<0 -2>}@]" stmt_block s + | Sdecl d -> + full_decl pp d + +and slabel pp = function + | Slabel s -> + fprintf pp "%s" s + | Scase e -> + fprintf pp "case %a" exp (0, e) + | Sdefault -> + fprintf pp "default" + +and stmt_block pp s = + match s.sdesc with + | Sblock [] -> () + | Sblock (s1 :: sl) -> + stmt pp s1; + List.iter (fun s -> fprintf pp "@ %a" stmt s) sl + | _ -> + stmt pp s + +and opt_exp pp s = + if s.sdesc = Sskip then fprintf pp "/*nothing*/" else + try + exp pp (0, exp_of_stmt s) + with Not_expr -> + fprintf pp "@[({ %a })@]" stmt s + +let fundef pp f = + fprintf pp "@[%s%a" + (if f.fd_inline then "inline " else "") + storage f.fd_storage; + simple_decl pp (f.fd_name, TFun(f.fd_ret, Some f.fd_params, f.fd_vararg, [])); + fprintf pp "@]@ @[{@ "; + List.iter (fun d -> fprintf pp "%a@ " full_decl d) f.fd_locals; + stmt_block pp f.fd_body; + fprintf pp "@;<0 -2>}@]@ @ " + +let field pp f = + simple_decl pp ({name = f.fld_name; stamp = 0}, f.fld_typ); + match f.fld_bitfield with + | None -> () + | Some n -> fprintf pp " : %d" n + +let globdecl pp g = + location pp g.gloc; + match g.gdesc with + | Gdecl d -> + fprintf pp "%a@ @ " full_decl d + | Gfundef f -> + fundef pp f + | Gcompositedecl(kind, id) -> + fprintf pp "%s %a;@ @ " + (match kind with Struct -> "struct" | Union -> "union") + ident id + | Gcompositedef(kind, id, flds) -> + fprintf pp "@[%s %a {" + (match kind with Struct -> "struct" | Union -> "union") + ident id; + List.iter (fun fld -> fprintf pp "@ %a;" field fld) flds; + fprintf pp "@;<0 -2>};@]@ @ " + | Gtypedef(id, ty) -> + fprintf pp "@[typedef %a;@]@ @ " simple_decl (id, ty) + | Genumdef(id, fields) -> + fprintf pp "@[enum %a {" ident id; + List.iter + (fun (name, opt_e) -> + fprintf pp "@ %a" ident name; + begin match opt_e with + | None -> () + | Some e -> fprintf pp " = %a" exp (0, e) + end; + fprintf pp ",") + fields; + fprintf pp "@;<0 -2>};@]@ @ " + | Gpragma s -> + fprintf pp "#pragma %s@ @ " s + +let program pp prog = + fprintf pp "@["; + List.iter (globdecl pp) prog; + fprintf pp "@]@." diff --git a/cparser/Cprint.mli b/cparser/Cprint.mli new file mode 100644 index 0000000..ce5fb18 --- /dev/null +++ b/cparser/Cprint.mli @@ -0,0 +1,32 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val print_idents_in_full : bool ref +val print_line_numbers : bool ref + +val location : Format.formatter -> C.location -> unit +val typ : Format.formatter -> C.typ -> unit +val simple_decl : Format.formatter -> C.ident * C.typ -> unit +val full_decl: Format.formatter -> C.decl -> unit +val const : Format.formatter -> C.constant -> unit +val exp : Format.formatter -> int * C.exp -> unit +val opt_exp : Format.formatter -> C.stmt -> unit +val stmt : Format.formatter -> C.stmt -> unit +val fundef : Format.formatter -> C.fundef -> unit +val init : Format.formatter -> C.init -> unit +val storage : Format.formatter -> C.storage -> unit +val field : Format.formatter -> C.field -> unit +val globdecl : Format.formatter -> C.globdecl -> unit +val program : Format.formatter -> C.program -> unit diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml new file mode 100644 index 0000000..49b25a2 --- /dev/null +++ b/cparser/Cutil.ml @@ -0,0 +1,691 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Operations on C types and abstract syntax *) + +open Printf +open Errors +open C +open Env +open Machine + +(* Set and Map structures over identifiers *) + +module Ident = struct + type t = ident + let compare id1 id2 = Pervasives.compare id1.stamp id2.stamp +end + +module IdentSet = Set.Make(Ident) +module IdentMap = Map.Make(Ident) + +(* Operations on attributes *) + +(* Lists of attributes are kept sorted in increasing order *) + +let rec add_attributes (al1: attributes) (al2: attributes) = + match al1, al2 with + | [], _ -> al2 + | _, [] -> al1 + | a1 :: al1', a2 :: al2' -> + if a1 < a2 then a1 :: add_attributes al1' al2 + else if a1 > a2 then a2 :: add_attributes al1 al2' + else a1 :: add_attributes al1' al2' + +let rec remove_attributes (al1: attributes) (al2: attributes) = + (* viewed as sets: al1 \ al2 *) + match al1, al2 with + | [], _ -> [] + | _, [] -> al1 + | a1 :: al1', a2 :: al2' -> + if a1 < a2 then a1 :: remove_attributes al1' al2 + else if a1 > a2 then remove_attributes al1 al2' + else remove_attributes al1' al2' + +let rec incl_attributes (al1: attributes) (al2: attributes) = + match al1, al2 with + | [], _ -> true + | _ :: _, [] -> false + | a1 :: al1', a2 :: al2' -> + if a1 < a2 then false + else if a1 > a2 then incl_attributes al1 al2' + else incl_attributes al1' al2' + +(* Adding top-level attributes to a type. Doesn't need to unroll defns. *) +(* Array types cannot carry attributes, so add them to the element type. *) + +let rec add_attributes_type attr t = + match t with + | TVoid a -> TVoid (add_attributes attr a) + | TInt(ik, a) -> TInt(ik, add_attributes attr a) + | TFloat(fk, a) -> TFloat(fk, add_attributes attr a) + | TPtr(ty, a) -> TPtr(ty, add_attributes attr a) + | TArray(ty, sz, a) -> TArray(add_attributes_type attr ty, sz, a) + | TFun(ty, params, vararg, a) -> TFun(ty, params, vararg, add_attributes attr +a) + | TNamed(s, a) -> TNamed(s, add_attributes attr a) + | TStruct(s, a) -> TStruct(s, add_attributes attr a) + | TUnion(s, a) -> TUnion(s, add_attributes attr a) + +(* Unrolling of typedef *) + +let rec unroll env t = + match t with + | TNamed(name, attr) -> + let ty = Env.find_typedef env name in + unroll env (add_attributes_type attr ty) + | _ -> t + +(* Extracting the attributes of a type *) + +let rec attributes_of_type env t = + match t with + | TVoid a -> a + | TInt(ik, a) -> a + | TFloat(fk, a) -> a + | TPtr(ty, a) -> a + | TArray(ty, sz, a) -> a (* correct? *) + | TFun(ty, params, vararg, a) -> a + | TNamed(s, a) -> attributes_of_type env (unroll env t) + | TStruct(s, a) -> a + | TUnion(s, a) -> a + +(* Changing the attributes of a type (at top-level) *) +(* Same hack as above for array types. *) + +let rec change_attributes_type env (f: attributes -> attributes) t = + match t with + | TVoid a -> TVoid (f a) + | TInt(ik, a) -> TInt(ik, f a) + | TFloat(fk, a) -> TFloat(fk, f a) + | TPtr(ty, a) -> TPtr(ty, f a) + | TArray(ty, sz, a) -> + TArray(change_attributes_type env f ty, sz, a) + | TFun(ty, params, vararg, a) -> TFun(ty, params, vararg, f a) + | TNamed(s, a) -> + let t1 = unroll env t in + let t2 = change_attributes_type env f t1 in + if t2 = t1 then t else t2 (* avoid useless expansion *) + | TStruct(s, a) -> TStruct(s, f a) + | TUnion(s, a) -> TUnion(s, f a) + +let remove_attributes_type env attr t = + change_attributes_type env (fun a -> remove_attributes a attr) t + +let erase_attributes_type env t = + change_attributes_type env (fun a -> []) t + +(* Type compatibility *) + +exception Incompat + +let combine_types ?(noattrs = false) env t1 t2 = + + let comp_attr a1 a2 = + if a1 = a2 then a2 + else if noattrs then add_attributes a1 a2 + else raise Incompat + and comp_base x1 x2 = + if x1 = x2 then x2 else raise Incompat + and comp_array_size sz1 sz2 = + match sz1, sz2 with + | None, _ -> sz2 + | _, None -> sz1 + | Some n1, Some n2 -> if n1 = n2 then Some n2 else raise Incompat + and comp_conv (id, ty) = + match unroll env ty with + | TInt(kind, attr) -> + begin match kind with + | IBool | IChar | ISChar | IUChar | IShort | IUShort -> raise Incompat + | _ -> () + end + | TFloat(kind, attr) -> + begin match kind with + | FFloat -> raise Incompat + | _ -> () + end + | _ -> () in + + let rec comp t1 t2 = + match t1, t2 with + | TVoid a1, TVoid a2 -> + TVoid(comp_attr a1 a2) + | TInt(ik1, a1), TInt(ik2, a2) -> + TInt(comp_base ik1 ik2, comp_attr a1 a2) + | TFloat(fk1, a1), TFloat(fk2, a2) -> + TFloat(comp_base fk1 fk2, comp_attr a1 a2) + | TPtr(ty1, a1), TPtr(ty2, a2) -> + TPtr(comp ty1 ty2, comp_attr a1 a2) + | TArray(ty1, sz1, a1), TArray(ty2, sz2, a2) -> + TArray(comp ty1 ty2, comp_array_size sz1 sz2, comp_attr a1 a2) + | TFun(ty1, params1, vararg1, a1), TFun(ty2, params2, vararg2, a2) -> + let (params, vararg) = + match params1, params2 with + | None, None -> None, false + | None, Some l2 -> List.iter comp_conv l2; (params2, vararg2) + | Some l1, None -> List.iter comp_conv l1; (params1, vararg1) + | Some l1, Some l2 -> + if List.length l1 <> List.length l2 then raise Incompat; + (Some(List.map2 (fun (id1, ty1) (id2, ty2) -> (id2, comp ty1 ty2)) + l1 l2), + comp_base vararg1 vararg2) + in + TFun(comp ty1 ty2, params, vararg, comp_attr a1 a2) + | TNamed _, _ -> comp (unroll env t1) t2 + | _, TNamed _ -> comp t1 (unroll env t2) + | TStruct(s1, a1), TStruct(s2, a2) -> + TStruct(comp_base s1 s2, comp_attr a1 a2) + | TUnion(s1, a1), TUnion(s2, a2) -> + TUnion(comp_base s1 s2, comp_attr a1 a2) + | _, _ -> + raise Incompat + + in try Some(comp t1 t2) with Incompat -> None + +let compatible_types ?noattrs env t1 t2 = + match combine_types ?noattrs env t1 t2 with Some _ -> true | None -> false + +(* Naive placement algorithm for bit fields, might not match that + of the compiler. *) + +let pack_bitfields ml = + let rec pack nbits = function + | [] -> + (nbits, []) + | m :: ms as ml -> + match m.fld_bitfield with + | None -> (nbits, ml) + | Some n -> + if n = 0 then + (nbits, ms) (* bit width 0 means end of pack *) + else if nbits + n > 8 * !config.sizeof_int then + (nbits, ml) (* doesn't fit in current word *) + else + pack (nbits + n) ms (* add to current word *) + in + let (nbits, ml') = pack 0 ml in + let sz = + if nbits <= 8 then 1 else + if nbits <= 16 then 2 else + if nbits <= 32 then 4 else + if nbits <= 64 then 8 else assert false in + (sz, ml') + +(* Natural alignment, in bytes *) + +let alignof_ikind = function + | IBool | IChar | ISChar | IUChar -> 1 + | IInt | IUInt -> !config.alignof_int + | IShort | IUShort -> !config.alignof_short + | ILong | IULong -> !config.alignof_long + | ILongLong | IULongLong -> !config.alignof_longlong + +let alignof_fkind = function + | FFloat -> !config.alignof_float + | FDouble -> !config.alignof_double + | FLongDouble -> !config.alignof_longdouble + +(* Return natural alignment of given type, or None if the type is incomplete *) + +let rec alignof env t = + match t with + | TVoid _ -> !config.alignof_void + | TInt(ik, _) -> Some(alignof_ikind ik) + | TFloat(fk, _) -> Some(alignof_fkind fk) + | TPtr(_, _) -> Some(!config.alignof_ptr) + | TArray(ty, _, _) -> alignof env ty + | TFun(_, _, _, _) -> !config.alignof_fun + | TNamed(_, _) -> alignof env (unroll env t) + | TStruct(name, _) -> + let ci = Env.find_struct env name in ci.ci_alignof + | TUnion(name, _) -> + let ci = Env.find_union env name in ci.ci_alignof + +(* Compute the natural alignment of a struct or union. *) + +let alignof_struct_union env members = + let rec align_rec al = function + | [] -> Some al + | m :: rem as ml -> + if m.fld_bitfield = None then begin + match alignof env m.fld_typ with + | None -> None + | Some a -> align_rec (max a al) rem + end else begin + let (sz, ml') = pack_bitfields ml in + align_rec (max sz al) ml' + end + in align_rec 1 members + +let align x boundary = + (* boundary must be a power of 2 *) + (x + boundary - 1) land (lnot (boundary - 1)) + +(* Size of, in bytes *) + +let sizeof_ikind = function + | IBool | IChar | ISChar | IUChar -> 1 + | IInt | IUInt -> !config.sizeof_int + | IShort | IUShort -> !config.sizeof_short + | ILong | IULong -> !config.sizeof_long + | ILongLong | IULongLong -> !config.sizeof_longlong + +let sizeof_fkind = function + | FFloat -> !config.sizeof_float + | FDouble -> !config.sizeof_double + | FLongDouble -> !config.sizeof_longdouble + +(* Overflow-avoiding multiplication of an int64 and an int, with + result in type int. *) + +let cautious_mul (a: int64) (b: int) = + if b = 0 || a <= Int64.of_int (max_int / b) + then Some(Int64.to_int a * b) + else None + +(* Return size of type, in bytes, or [None] if the type is incomplete *) + +let rec sizeof env t = + match t with + | TVoid _ -> !config.sizeof_void + | TInt(ik, _) -> Some(sizeof_ikind ik) + | TFloat(fk, _) -> Some(sizeof_fkind fk) + | TPtr(_, _) -> Some(!config.sizeof_ptr) + | TArray(ty, None, _) -> None + | TArray(ty, Some n, _) as t' -> + begin match sizeof env ty with + | None -> None + | Some s -> + match cautious_mul n s with + | Some sz -> Some sz + | None -> error "sizeof(%a) overflows" Cprint.typ t'; Some 1 + end + | TFun(_, _, _, _) -> !config.sizeof_fun + | TNamed(_, _) -> sizeof env (unroll env t) + | TStruct(name, _) -> + let ci = Env.find_struct env name in ci.ci_sizeof + | TUnion(name, _) -> + let ci = Env.find_union env name in ci.ci_sizeof + +(* Compute the size of a union. + It is the size is the max of the sizes of fields, rounded up to the + natural alignment. *) + +let sizeof_union env members = + let rec sizeof_rec sz = function + | [] -> + begin match alignof_struct_union env members with + | None -> None (* should not happen? *) + | Some al -> Some (align sz al) + end + | m :: rem -> + begin match sizeof env m.fld_typ with + | None -> None + | Some s -> sizeof_rec (max sz s) rem + end + in sizeof_rec 0 members + +(* Compute the size of a struct. + We lay out fields consecutively, inserting padding to preserve + their natural alignment. *) + +let sizeof_struct env members = + let rec sizeof_rec ofs = function + | [] | [ { fld_typ = TArray(_, None, _) } ] -> + (* C99: ty[] allowed as last field *) + begin match alignof_struct_union env members with + | None -> None (* should not happen? *) + | Some al -> Some (align ofs al) + end + | m :: rem as ml -> + if m.fld_bitfield = None then begin + match alignof env m.fld_typ, sizeof env m.fld_typ with + | Some a, Some s -> sizeof_rec (align ofs a + s) rem + | _, _ -> None + end else begin + let (sz, ml') = pack_bitfields ml in + sizeof_rec (align ofs sz + sz) ml' + end + in sizeof_rec 0 members + +(* Determine whether a type is incomplete *) + +let incomplete_type env t = + match sizeof env t with None -> true | Some _ -> false + +(* Computing composite_info records *) + +let composite_info_decl env su = + { ci_kind = su; ci_members = []; ci_alignof = None; ci_sizeof = None } + +let composite_info_def env su m = + { ci_kind = su; ci_members = m; + ci_alignof = alignof_struct_union env m; + ci_sizeof = + match su with + | Struct -> sizeof_struct env m + | Union -> sizeof_union env m } + +(* Type of a function definition *) + +let fundef_typ fd = + TFun(fd.fd_ret, Some fd.fd_params, fd.fd_vararg, []) + +(* Signedness of integer kinds *) + +let is_signed_ikind = function + | IBool -> false + | IChar -> !config.char_signed + | ISChar -> true + | IUChar -> false + | IInt -> true + | IUInt -> false + | IShort -> true + | IUShort -> false + | ILong -> true + | IULong -> false + | ILongLong -> true + | IULongLong -> false + +(* Conversion to unsigned ikind *) + +let unsigned_ikind_of = function + | IBool -> IBool + | IChar | ISChar | IUChar -> IUChar + | IInt | IUInt -> IUInt + | IShort | IUShort -> IUShort + | ILong | IULong -> IULong + | ILongLong | IULongLong -> IULongLong + +(* Some classification functions over types *) + +let is_void_type env t = + match unroll env t with + | TVoid _ -> true + | _ -> false + +let is_integer_type env t = + match unroll env t with + | TInt(_, _) -> true + | _ -> false + +let is_arith_type env t = + match unroll env t with + | TInt(_, _) -> true + | TFloat(_, _) -> true + | _ -> false + +let is_pointer_type env t = + match unroll env t with + | TPtr _ -> true + | _ -> false + +let is_scalar_type env t = + match unroll env t with + | TInt(_, _) -> true + | TFloat(_, _) -> true + | TPtr _ -> true + | TArray _ -> true (* assume implicit decay *) + | TFun _ -> true (* assume implicit decay *) + | _ -> false + +let is_composite_type env t = + match unroll env t with + | TStruct _ | TUnion _ -> true + | _ -> false + +let is_function_type env t = + match unroll env t with + | TFun _ -> true + | _ -> false + +(* Ranking of integer kinds *) + +let integer_rank = function + | IBool -> 1 + | IChar | ISChar | IUChar -> 2 + | IShort | IUShort -> 3 + | IInt | IUInt -> 4 + | ILong | IULong -> 5 + | ILongLong | IULongLong -> 6 + +(* Ranking of float kinds *) + +let float_rank = function + | FFloat -> 1 + | FDouble -> 2 + | FLongDouble -> 3 + +(* Array and function types "decay" to pointer types in many cases *) + +let pointer_decay env t = + match unroll env t with + | TArray(ty, _, _) -> TPtr(ty, []) + | TFun _ as ty -> TPtr(ty, []) + | t -> t + +(* The usual unary conversions (H&S 6.3.3) *) + +let unary_conversion env t = + match unroll env t with + (* Promotion of small integer types *) + | TInt(kind, attr) -> + begin match kind with + | IBool | IChar | ISChar | IUChar | IShort | IUShort -> + TInt(IInt, attr) + | IInt | IUInt | ILong | IULong | ILongLong | IULongLong -> + TInt(kind, attr) + end + (* Arrays and functions decay automatically to pointers *) + | TArray(ty, _, _) -> TPtr(ty, []) + | TFun _ as ty -> TPtr(ty, []) + (* Other types are not changed *) + | t -> t + +(* The usual binary conversions (H&S 6.3.4). + Applies only to arithmetic types. + Return the type to which both sides are to be converted. *) + +let binary_conversion env t1 t2 = + let t1 = unary_conversion env t1 in + let t2 = unary_conversion env t2 in + match unroll env t1, unroll env t2 with + | TFloat(FLongDouble, _), (TInt _ | TFloat _) -> t1 + | (TInt _ | TFloat _), TFloat(FLongDouble, _) -> t2 + | TFloat(FDouble, _), (TInt _ | TFloat _) -> t1 + | (TInt _ | TFloat _), TFloat(FDouble, _) -> t2 + | TFloat(FFloat, _), (TInt _ | TFloat _) -> t1 + | (TInt _), TFloat(FFloat, _) -> t2 + | TInt(k1, _), TInt(k2, _) -> + if k1 = k2 then t1 else begin + match is_signed_ikind k1, is_signed_ikind k2 with + | true, true | false, false -> + (* take the bigger of the two types *) + if integer_rank k1 >= integer_rank k2 then t1 else t2 + | false, true -> + (* if rank (unsigned type) >= rank (signed type), + take the unsigned type *) + if integer_rank k1 >= integer_rank k2 then t1 + (* if rank (unsigned type) < rank (signed type) + and all values of the unsigned type can be represented + in the signed type, take the signed type *) + else if sizeof_ikind k2 > sizeof_ikind k1 then t2 + (* if rank (unsigned type) < rank (signed type) + and some values of the unsigned type cannot be represented + in the signed type, + take the unsigned type corresponding to the signed type *) + else TInt(unsigned_ikind_of k2, []) + | true, false -> + if integer_rank k2 >= integer_rank k1 then t2 + else if sizeof_ikind k1 > sizeof_ikind k2 then t1 + else TInt(unsigned_ikind_of k1, []) + end + | _, _ -> assert false + +(* Conversion on function arguments (with protoypes) *) + +let argument_conversion env t = + (* Arrays and functions degrade automatically to pointers *) + (* Other types are not changed *) + match unroll env t with + | TArray(ty, _, _) -> TPtr(ty, []) + | TFun _ as ty -> TPtr(ty, []) + | _ -> t (* preserve typedefs *) + +(* Conversion on function arguments (old-style unprototyped, or vararg *) +(* H&S 6.3.5 *) + +let default_argument_conversion env t = + match unary_conversion env t with + | TFloat(FFloat, attr) -> TFloat(FDouble, attr) + | t' -> t' + +(** Is the type Tptr(ty, a) appropriate for pointer arithmetic? *) + +let pointer_arithmetic_ok env ty = + match unroll env ty with + | TVoid _ | TFun _ -> false + | _ -> not (incomplete_type env ty) + +(** Special types *) + +let find_matching_unsigned_ikind sz = + if sz = !config.sizeof_int then IUInt + else if sz = !config.sizeof_long then IULong + else if sz = !config.sizeof_longlong then IULongLong + else assert false + +let find_matching_signed_ikind sz = + if sz = !config.sizeof_int then IInt + else if sz = !config.sizeof_long then ILong + else if sz = !config.sizeof_longlong then ILongLong + else assert false + +let wchar_ikind = find_matching_unsigned_ikind !config.sizeof_wchar +let size_t_ikind = find_matching_unsigned_ikind !config.sizeof_size_t +let ptr_t_ikind = find_matching_unsigned_ikind !config.sizeof_ptr +let ptrdiff_t_ikind = find_matching_signed_ikind !config.sizeof_ptrdiff_t +let enum_ikind = IInt + +(** The type of a constant *) + +let type_of_constant = function + | CInt(_, ik, _) -> TInt(ik, []) + | CFloat(_, fk, _) -> TFloat(fk, []) + | CStr _ -> TPtr(TInt(IChar, []), []) (* XXX or array? const? *) + | CWStr _ -> TPtr(TInt(wchar_ikind, []), []) (* XXX or array? const? *) + | CEnum(_, _) -> TInt(IInt, []) + +(* Check that a C expression is a lvalue *) + +let rec is_lvalue env e = + (* Type must not be array or function *) + match unroll env e.etyp with + | TFun _ | TArray _ -> false + | _ -> + match e.edesc with + | EVar id -> true + | EUnop((Oderef | Oarrow _), _) -> true + | EUnop(Odot _, e') -> is_lvalue env e' + | EBinop(Oindex, _, _, _) -> true + | _ -> false + +(* Check that a C expression is the literal "0", which can be used + as a pointer. *) + +let is_literal_0 e = + match e.edesc with + | EConst(CInt(0L, _, _)) -> true + | _ -> false + +(* Check that an assignment is allowed *) + +let valid_assignment env from tto = + match pointer_decay env from.etyp, pointer_decay env tto with + | (TInt _ | TFloat _), (TInt _ | TFloat _) -> true + | TInt _, TPtr _ -> is_literal_0 from + | TPtr(ty, _), TPtr(ty', _) -> + incl_attributes (attributes_of_type env ty) (attributes_of_type env ty') + && (is_void_type env ty || is_void_type env ty' + || compatible_types env + (erase_attributes_type env ty) + (erase_attributes_type env ty')) + | TStruct(s, _), TStruct(s', _) -> s = s' + | TUnion(s, _), TUnion(s', _) -> s = s' + | _, _ -> false + +(* Check that a cast is allowed *) + +let valid_cast env tfrom tto = + compatible_types ~noattrs:true env tfrom tto || + begin match unroll env tfrom, unroll env tto with + | _, TVoid _ -> true + (* from any int-or-pointer (with array and functions decaying to pointers) + to any int-or-pointer *) + | (TInt _ | TPtr _ | TArray _ | TFun _), (TInt _ | TPtr _) -> true + (* between int and float types *) + | (TInt _ | TFloat _), (TInt _ | TFloat _) -> true + | _, _ -> false + end + +(* Construct an integer constant *) + +let intconst v ik = + { edesc = EConst(CInt(v, ik, "")); etyp = TInt(ik, []) } + +(* Construct a float constant *) + +let floatconst v fk = + { edesc = EConst(CFloat(v, fk, "")); etyp = TFloat(fk, []) } + +(* Construct the literal "0" with void * type *) + +let nullconst = + { edesc = EConst(CInt(0L, ptr_t_ikind, "0")); etyp = TPtr(TVoid [], []) } + +(* Construct a sequence *) + +let sseq loc s1 s2 = + match s1.sdesc, s2.sdesc with + | Sskip, _ -> s2 + | _, Sskip -> s1 + | _, Sblock sl -> { sdesc = Sblock(s1 :: sl); sloc = loc } + | _, _ -> { sdesc = Sseq(s1, s2); sloc = loc } + +(* Construct an assignment statement *) + +let sassign loc lv rv = + { sdesc = Sdo {edesc = EBinop(Oassign, lv, rv, lv.etyp); etyp = lv.etyp}; + sloc = loc } + +(* Empty location *) + +let no_loc = ("", -1) + +(* Dummy skip statement *) + +let sskip = { sdesc = Sskip; sloc = no_loc } + +(* Print a location *) + +let printloc oc (filename, lineno) = + if filename <> "" then Printf.fprintf oc "%s:%d: " filename lineno + +(* Format a location *) + +let formatloc pp (filename, lineno) = + if filename <> "" then Format.fprintf pp "%s:%d: " filename lineno + + diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli new file mode 100644 index 0000000..9587c57 --- /dev/null +++ b/cparser/Cutil.mli @@ -0,0 +1,174 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Useful functions to manipulate C abstract syntax *) + +open C + +(* Sets and maps over identifiers *) +module IdentSet : Set.S with type elt = ident +module IdentMap : Map.S with type key = ident + +(* Typedef handling *) +val unroll : Env.t -> typ -> typ + (* Expand typedefs at head of type. Returned type is not [TNamed]. *) + +(* Attributes *) + +val add_attributes : attributes -> attributes -> attributes + (* Union of two sets of attributes *) +val remove_attributes : attributes -> attributes -> attributes + (* Difference [attr1 \ attr2] between two sets of attributes *) +val incl_attributes : attributes -> attributes -> bool + (* Check that first set of attributes is a subset of second set. *) +val attributes_of_type : Env.t -> typ -> attributes + (* Return the attributes of the given type, expanding typedefs if needed. *) +val add_attributes_type : attributes -> typ -> typ + (* Add the given set of attributes to those of the given type. *) +val remove_attributes_type : Env.t -> attributes -> typ -> typ + (* Remove the given set of attributes to those of the given type. *) +val erase_attributes_type : Env.t -> typ -> typ + (* Erase the attributes of the given type. *) + +(* Type compatibility *) +val compatible_types : ?noattrs: bool -> Env.t -> typ -> typ -> bool + (* Check that the two given types are compatible. + If [noattrs], ignore attributes (recursively). *) +val combine_types : ?noattrs: bool -> Env.t -> typ -> typ -> typ option + (* Like [compatible_types], but if the two types are compatible, + return the most precise type compatible with both. *) + +(* Size and alignment *) + +val sizeof : Env.t -> typ -> int option + (* Return the size alignment of the given type, in bytes. + Machine-dependent. [None] is returned if the type is incomplete. *) +val alignof : Env.t -> typ -> int option + (* Return the natural alignment of the given type, in bytes. + Machine-dependent. [None] is returned if the type is incomplete. *) +val sizeof_ikind: ikind -> int + (* Return the size of the given integer kind. *) +val incomplete_type : Env.t -> typ -> bool + (* Return true if the given type is incomplete, e.g. + declared but not defined struct or union, or array type without a size. *) + +(* Computing composite_info records *) + +val composite_info_decl: Env.t -> struct_or_union -> Env.composite_info +val composite_info_def: Env.t -> struct_or_union -> field list -> Env.composite_info + +(* Type classification functions *) + +val is_void_type : Env.t -> typ -> bool + (* Is type [void]? *) +val is_integer_type : Env.t -> typ -> bool + (* Is type integer? *) +val is_arith_type : Env.t -> typ -> bool + (* Is type integer or float? *) +val is_pointer_type : Env.t -> typ -> bool + (* Is type a pointer type? *) +val is_scalar_type : Env.t -> typ -> bool + (* Is type integer, float or pointer? *) +val is_composite_type : Env.t -> typ -> bool + (* Is type a struct or union? *) +val is_function_type : Env.t -> typ -> bool + (* Is type a function type? (not pointer to function) *) +val pointer_arithmetic_ok : Env.t -> typ -> bool + (* Is the type [*ty] appropriate for pointer arithmetic? + [ty] must not be void, nor a function type, nor an incomplete type. *) +val is_signed_ikind : ikind -> bool + (* Return true if the given integer kind is a signed type. *) +val unsigned_ikind_of : ikind -> ikind + (* Return the unsigned integer kind corresponding to the given + integer kind. *) +val integer_rank : ikind -> int + (* Order integer kinds from smaller to bigger *) +val float_rank : fkind -> int + (* Order float kinds from smaller to bigger *) + +(* Usual conversions over types *) + +val pointer_decay : Env.t -> typ -> typ + (* Transform (decay) array and function types to pointer types. *) +val unary_conversion : Env.t -> typ -> typ + (* The usual unary conversions: + small integer types are promoted to [int] + array and function types decay *) +val binary_conversion : Env.t -> typ -> typ -> typ + (* The usual binary conversions. Applies only to arithmetic types. + Return the arithmetic type to which both operands of the binop + are converted. *) +val argument_conversion : Env.t -> typ -> typ + (* Conversion applied to the argument of a prototyped function. + Equivalent to [pointer_decay]. *) +val default_argument_conversion : Env.t -> typ -> typ + (* Conversion applied to the argument of a nonprototyped or variadic + function. Like unary conversion, plus [float] becomes [double]. *) + +(* Special types *) +val enum_ikind : ikind + (* Integer kind for enum values. Always [IInt]. *) +val wchar_ikind : ikind + (* Integer kind for wchar_t type. Unsigned. *) +val size_t_ikind : ikind + (* Integer kind for size_t type. Unsigned. *) +val ptr_t_ikind : ikind + (* Integer kind for ptr_t type. Smallest unsigned kind large enough + to contain a pointer without information loss. *) +val ptrdiff_t_ikind : ikind + (* Integer kind for ptrdiff_t type. Smallest signed kind large enough + to contain the difference between two pointers. *) + +(* Helpers for type-checking *) + +val type_of_constant : constant -> typ + (* Return the type of the given constant. *) +val is_literal_0 : exp -> bool + (* Is the given expression the integer literal "0"? *) +val is_lvalue : Env.t -> exp -> bool + (* Is the given expression a l-value? *) +val valid_assignment : Env.t -> exp -> typ -> bool + (* Check that an assignment of the given expression to a l-value of + the given type is allowed. *) +val valid_cast : Env.t -> typ -> typ -> bool + (* Check that a cast from the first type to the second is allowed. *) +val fundef_typ: fundef -> typ + (* Return the function type for the given function definition. *) + +(* Constructors *) + +val intconst : int64 -> ikind -> exp + (* Build expression for given integer constant. *) +val floatconst : float -> fkind -> exp + (* Build expression for given float constant. *) +val nullconst : exp + (* Expression for [(void * ) 0] *) +val sskip: stmt + (* The [skip] statement. No location. *) +val sseq : location -> stmt -> stmt -> stmt + (* Return the statement [s1; s2], optimizing the cases + where [s1] or [s2] is [skip], or [s2] is a block. *) +val sassign : location -> exp -> exp -> stmt + (* Return the statement [exp1 = exp2;] *) + +(* Locations *) + +val no_loc: location + (* Denotes an unknown location. *) +val printloc: out_channel -> location -> unit + (* Printer for locations (for Printf) *) +val formatloc: Format.formatter -> location -> unit + (* Printer for locations (for Format) *) + diff --git a/cparser/Elab.ml b/cparser/Elab.ml new file mode 100644 index 0000000..a685aef --- /dev/null +++ b/cparser/Elab.ml @@ -0,0 +1,1760 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Elaboration from Cabs parse tree to C simplified, typed syntax tree *) + +open Format +open Errors +open Machine +open Cabs +open Cabshelper +open C +open Cutil +open Env + +(** * Utility functions *) + +(* Error reporting *) + +let fatal_error loc fmt = + Errors.fatal_error ("%a: Error:@ " ^^ fmt) format_cabsloc loc + +let error loc fmt = + Errors.error ("%a: Error:@ " ^^ fmt) format_cabsloc loc + +let warning loc fmt = + Errors.warning ("%a: Warning:@ " ^^ fmt) format_cabsloc loc + +(* Error reporting for Env functions *) + +let wrap fn loc env arg = + try fn env arg + with Env.Error msg -> fatal_error loc "%s" (Env.error_message msg) + +(* Translation of locations *) + +let elab_loc l = (l.filename, l.lineno) + +(* Buffering of the result (a list of topdecl *) + +let top_declarations = ref ([] : globdecl list) + +let emit_elab loc td = + top_declarations := { gdesc = td; gloc = loc } :: !top_declarations + +let reset() = top_declarations := [] + +let elaborated_program () = + let p = !top_declarations in + top_declarations := []; + (* Reverse it and eliminate unreferenced declarations *) + Cleanup.program p + +(* Location stuff *) + +let loc_of_name (_, _, _, loc) = loc + +let loc_of_namelist = function [] -> cabslu | name :: _ -> loc_of_name name + +let loc_of_init_name_list = + function [] -> cabslu | (name, init) :: _ -> loc_of_name name + +(* Monadic map for functions env -> 'a -> 'b * env *) + +let rec mmap f env = function + | [] -> ([], env) + | hd :: tl -> + let (hd', env1) = f env hd in + let (tl', env2) = mmap f env1 tl in + (hd' :: tl', env2) + +(* To detect redefinitions within the same scope *) + +let redef fn env arg = + try + let (id, info) = fn env arg in + if Env.in_current_scope env id then Some(id, info) else None + with Env.Error _ -> + None + +(* Forward declarations *) + +let elab_expr_f : (cabsloc -> Env.t -> Cabs.expression -> C.exp) ref + = ref (fun _ _ _ -> assert false) + +let elab_block_f : (cabsloc -> C.typ -> Env.t -> Cabs.block -> C.stmt) ref + = ref (fun _ _ _ _ -> assert false) + + +(** * Elaboration of constants *) + +let has_suffix s suff = + let ls = String.length s and lsuff = String.length suff in + ls >= lsuff && String.sub s (ls - lsuff) lsuff = suff + +let chop_last s n = + assert (String.length s >= n); + String.sub s 0 (String.length s - n) + +let has_prefix s pref = + let ls = String.length s and lpref = String.length pref in + ls >= lpref && String.sub s 0 lpref = pref + +let chop_first s n = + assert (String.length s >= n); + String.sub s n (String.length s - n) + +exception Overflow +exception Bad_digit + +let parse_int base s = + let max_val = (* (2^64-1) / base, unsigned *) + match base with + | 8 -> 2305843009213693951L + | 10 -> 1844674407370955161L + | 16 -> 1152921504606846975L + | _ -> assert false in + let v = ref 0L in + for i = 0 to String.length s - 1 do + if !v > max_val then raise Overflow; + v := Int64.mul !v (Int64.of_int base); + let c = s.[i] in + let digit = + if c >= '0' && c <= '9' then Char.code c - 48 + else if c >= 'A' && c <= 'F' then Char.code c - 55 + else raise Bad_digit in + if digit >= base then raise Bad_digit; + v := Int64.add !v (Int64.of_int digit) + done; + !v + +let integer_representable v ik = + let bitsize = sizeof_ikind ik * 8 + and signed = is_signed_ikind ik in + if bitsize >= 64 then + (not signed) || (v >= 0L && v <= 0x7FFF_FFFF_FFFF_FFFFL) + else if not signed then + v >= 0L && v < Int64.shift_left 1L bitsize + else + v >= 0L && v < Int64.shift_left 1L (bitsize - 1) + +let elab_int_constant loc s0 = + let s = String.uppercase s0 in + (* Determine possible types and chop type suffix *) + let (s, dec_kinds, hex_kinds) = + if has_suffix s "ULL" || has_suffix s "LLU" then + (chop_last s 3, [IULongLong], [IULongLong]) + else if has_suffix s "LL" then + (chop_last s 2, [ILongLong], [ILongLong; IULongLong]) + else if has_suffix s "UL" || has_suffix s "LU" then + (chop_last s 2, [IULong; IULongLong], [IULong; IULongLong]) + else if has_suffix s "L" then + (chop_last s 1, [ILong; ILongLong], + [ILong; IULong; ILongLong; IULongLong]) + else if has_suffix s "U" then + (chop_last s 1, [IUInt; IULong; IULongLong], + [IUInt; IULong; IULongLong]) + else + (s, [IInt; ILong; IULong; ILongLong], + [IInt; IUInt; ILong; IULong; ILongLong; IULongLong]) + in + (* Determine base *) + let (s, base) = + if has_prefix s "0X" then + (chop_first s 2, 16) + else if has_prefix s "0" then + (chop_first s 1, 8) + else + (s, 10) + in + (* Parse digits *) + let v = + try parse_int base s + with + | Overflow -> + error loc "integer literal '%s' is too large" s0; + 0L + | Bad_digit -> + error loc "bad digit in integer literal '%s'" s0; + 0L + in + (* Find smallest allowable type that fits *) + let ty = + try List.find (fun ty -> integer_representable v ty) + (if base = 10 then dec_kinds else hex_kinds) + with Not_found -> + error loc "integer literal '%s' cannot be represented" s0; + IInt + in + (v, ty) + +let elab_float_constant loc s0 = + let s = String.uppercase s0 in + (* Determine type and chop suffix *) + let (s, ty) = + if has_suffix s "L" then + (chop_last s 1, FLongDouble) + else if has_suffix s "F" then + (chop_last s 1, FFloat) + else + (s, FDouble) in + (* Convert to Caml float - XXX loss of precision for long double *) + let v = + try float_of_string s + with Failure _ -> error loc "bad float literal '%s'" s0; 0.0 in + (v, ty) + +let elab_char_constant loc sz cl = + let nbits = 8 * sz in + (* Treat multi-char constants as a number in base 2^nbits *) + let max_val = Int64.shift_left 1L (64 - nbits) in + let v = + List.fold_left + (fun acc d -> + if acc >= max_val then begin + error loc "character literal overflows"; + end; + Int64.add (Int64.shift_left acc nbits) d) + 0L cl in + let ty = + if v < 256L then IInt + else if v < Int64.shift_left 1L (8 * sizeof_ikind IULong) then IULong + else IULongLong in + (v, ty) + +let elab_constant loc = function + | CONST_INT s -> + let (v, ik) = elab_int_constant loc s in + CInt(v, ik, s) + | CONST_FLOAT s -> + let (v, fk) = elab_float_constant loc s in + CFloat(v, fk, s) + | CONST_CHAR cl -> + let (v, ik) = elab_char_constant loc 1 cl in + CInt(v, ik, "") + | CONST_WCHAR cl -> + let (v, ik) = elab_char_constant loc !config.sizeof_wchar cl in + CInt(v, ik, "") + | CONST_STRING s -> CStr s + | CONST_WSTRING s -> CWStr s + + +(** * Elaboration of type expressions, type specifiers, name declarations *) + +(* Elaboration of attributes *) + +let elab_attribute loc = function + | ("const", []) -> Some AConst + | ("restrict", []) -> Some ARestrict + | ("volatile", []) -> Some AVolatile + | (name, args) -> + (* warning loc "ignoring '%s' attribute" name; *) + None + +let rec elab_attributes loc = function + | [] -> [] + | a1 :: al -> + match elab_attribute loc a1 with + | None -> elab_attributes loc al + | Some a -> add_attributes [a] (elab_attributes loc al) + +(* Auxiliary for typespec elaboration *) + +let typespec_rank = function (* Don't change this *) + | Cabs.Tvoid -> 0 + | Cabs.Tsigned -> 1 + | Cabs.Tunsigned -> 2 + | Cabs.Tchar -> 3 + | Cabs.Tshort -> 4 + | Cabs.Tlong -> 5 + | Cabs.Tint -> 6 + | Cabs.Tint64 -> 7 + | Cabs.Tfloat -> 8 + | Cabs.Tdouble -> 9 + | Cabs.T_Bool -> 10 + | _ -> 11 (* There should be at most one of the others *) + +let typespec_order t1 t2 = compare (typespec_rank t1) (typespec_rank t2) + +(* Elaboration of a type specifier. Returns 4-tuple: + (storage class, "inline" flag, elaborated type, new env) + Optional argument "only" is true if this is a standalone + struct or union declaration, without variable names. +*) + +let rec elab_specifier ?(only = false) loc env specifier = + (* We first divide the parts of the specifier as follows: + - a storage class + - a set of attributes (const, volatile, restrict) + - a list of type specifiers *) + let sto = ref Storage_default + and inline = ref false + and attr = ref [] + and tyspecs = ref [] in + + let do_specifier = function + | SpecTypedef -> () + | SpecCV cv -> + let a = + match cv with + | CV_CONST -> AConst + | CV_VOLATILE -> AVolatile + | CV_RESTRICT -> ARestrict in + attr := add_attributes [a] !attr + | SpecAttr a -> + attr := add_attributes (elab_attributes loc [a]) !attr + | SpecStorage st -> + if !sto <> Storage_default then + error loc "multiple storage specifiers"; + begin match st with + | NO_STORAGE -> () + | AUTO -> () + | STATIC -> sto := Storage_static + | EXTERN -> sto := Storage_extern + | REGISTER -> sto := Storage_register + end + | SpecInline -> inline := true + | SpecType tys -> tyspecs := tys :: !tyspecs in + + List.iter do_specifier specifier; + + let simple ty = (!sto, !inline, add_attributes_type !attr ty, env) in + + (* Now interpret the list of type specifiers. Much of this code + is stolen from CIL. *) + match List.stable_sort typespec_order (List.rev !tyspecs) with + | [Cabs.Tvoid] -> simple (TVoid []) + + | [Cabs.T_Bool] -> simple (TInt(IBool, [])) + | [Cabs.Tchar] -> simple (TInt(IChar, [])) + | [Cabs.Tsigned; Cabs.Tchar] -> simple (TInt(ISChar, [])) + | [Cabs.Tunsigned; Cabs.Tchar] -> simple (TInt(IUChar, [])) + + | [Cabs.Tshort] -> simple (TInt(IShort, [])) + | [Cabs.Tsigned; Cabs.Tshort] -> simple (TInt(IShort, [])) + | [Cabs.Tshort; Cabs.Tint] -> simple (TInt(IShort, [])) + | [Cabs.Tsigned; Cabs.Tshort; Cabs.Tint] -> simple (TInt(IShort, [])) + + | [Cabs.Tunsigned; Cabs.Tshort] -> simple (TInt(IUShort, [])) + | [Cabs.Tunsigned; Cabs.Tshort; Cabs.Tint] -> simple (TInt(IUShort, [])) + + | [] -> simple (TInt(IInt, [])) + | [Cabs.Tint] -> simple (TInt(IInt, [])) + | [Cabs.Tsigned] -> simple (TInt(IInt, [])) + | [Cabs.Tsigned; Cabs.Tint] -> simple (TInt(IInt, [])) + + | [Cabs.Tunsigned] -> simple (TInt(IUInt, [])) + | [Cabs.Tunsigned; Cabs.Tint] -> simple (TInt(IUInt, [])) + + | [Cabs.Tlong] -> simple (TInt(ILong, [])) + | [Cabs.Tsigned; Cabs.Tlong] -> simple (TInt(ILong, [])) + | [Cabs.Tlong; Cabs.Tint] -> simple (TInt(ILong, [])) + | [Cabs.Tsigned; Cabs.Tlong; Cabs.Tint] -> simple (TInt(ILong, [])) + + | [Cabs.Tunsigned; Cabs.Tlong] -> simple (TInt(IULong, [])) + | [Cabs.Tunsigned; Cabs.Tlong; Cabs.Tint] -> simple (TInt(IULong, [])) + + | [Cabs.Tlong; Cabs.Tlong] -> simple (TInt(ILongLong, [])) + | [Cabs.Tsigned; Cabs.Tlong; Cabs.Tlong] -> simple (TInt(ILongLong, [])) + | [Cabs.Tlong; Cabs.Tlong; Cabs.Tint] -> simple (TInt(ILongLong, [])) + | [Cabs.Tsigned; Cabs.Tlong; Cabs.Tlong; Cabs.Tint] -> simple (TInt(ILongLong, [])) + + | [Cabs.Tunsigned; Cabs.Tlong; Cabs.Tlong] -> simple (TInt(IULongLong, [])) + | [Cabs.Tunsigned; Cabs.Tlong; Cabs.Tlong; Cabs.Tint] -> simple (TInt(IULongLong, [])) + + (* int64 is a MSVC extension *) + | [Cabs.Tint64] -> simple (TInt(ILongLong, [])) + | [Cabs.Tsigned; Cabs.Tint64] -> simple (TInt(ILongLong, [])) + | [Cabs.Tunsigned; Cabs.Tint64] -> simple (TInt(IULongLong, [])) + + | [Cabs.Tfloat] -> simple (TFloat(FFloat, [])) + | [Cabs.Tdouble] -> simple (TFloat(FDouble, [])) + + | [Cabs.Tlong; Cabs.Tdouble] -> simple (TFloat(FLongDouble, [])) + + (* Now the other type specifiers *) + + | [Cabs.Tnamed id] -> + let (id', info) = wrap Env.lookup_typedef loc env id in + simple (TNamed(id', [])) + + | [Cabs.Tstruct(id, optmembers, a)] -> + let (id', env') = + elab_struct_or_union only Struct loc id optmembers env in + let attr' = add_attributes !attr (elab_attributes loc a) in + (!sto, !inline, TStruct(id', attr'), env') + + | [Cabs.Tunion(id, optmembers, a)] -> + let (id', env') = + elab_struct_or_union only Union loc id optmembers env in + let attr' = add_attributes !attr (elab_attributes loc a) in + (!sto, !inline, TUnion(id', attr'), env') + + | [Cabs.Tenum(id, optmembers, a)] -> + let env' = + elab_enum loc id optmembers env in + let attr' = add_attributes !attr (elab_attributes loc a) in + (!sto, !inline, TInt(enum_ikind, attr'), env') + + | [Cabs.TtypeofE _] -> + fatal_error loc "GCC __typeof__ not supported" + | [Cabs.TtypeofT _] -> + fatal_error loc "GCC __typeof__ not supported" + + (* Specifier doesn't make sense *) + | _ -> + fatal_error loc "illegal combination of type specifiers" + +(* Elaboration of a type declarator. *) + +and elab_type_declarator loc env ty = function + | Cabs.JUSTBASE -> + (ty, env) + | Cabs.PARENTYPE(attr1, d, attr2) -> + (* XXX ignoring the distinction between attrs after and before *) + let a = elab_attributes loc (attr1 @ attr2) in + elab_type_declarator loc env (add_attributes_type a ty) d + | Cabs.ARRAY(d, attr, sz) -> + let a = elab_attributes loc attr in + let sz' = + match sz with + | Cabs.NOTHING -> + None + | _ -> + match Ceval.integer_expr env (!elab_expr_f loc env sz) with + | Some n -> + if n < 0L then error loc "array size is negative"; + Some n + | None -> + error loc "array size is not a compile-time constant"; + Some 1L in (* produces better error messages later *) + elab_type_declarator loc env (TArray(ty, sz', a)) d + | Cabs.PTR(attr, d) -> + let a = elab_attributes loc attr in + elab_type_declarator loc env (TPtr(ty, a)) d + | Cabs.PROTO(d, params, vararg) -> + begin match unroll env ty with + | TArray _ | TFun _ -> + error loc "illegal function return type@ %a" Cprint.typ ty + | _ -> () + end; + let params' = elab_parameters env params in + elab_type_declarator loc env (TFun(ty, params', vararg, [])) d + +(* Elaboration of parameters in a prototype *) + +and elab_parameters env params = + match params with + | [] -> (* old-style K&R prototype *) + None + | _ -> + (* Prototype introduces a new scope *) + let (vars, _) = mmap elab_parameter (Env.new_scope env) params in + (* Catch special case f(void) *) + match vars with + | [ ( {name=""}, TVoid _) ] -> Some [] + | _ -> Some vars + +(* Elaboration of a function parameter *) + +and elab_parameter env (spec, name) = + let (id, sto, inl, ty, env1) = elab_name env spec name in + if sto <> Storage_default && sto <> Storage_register then + error (loc_of_name name) + "'extern' or 'static' storage not supported for function parameter"; + (* replace array and function types by pointer types *) + let ty1 = argument_conversion env1 ty in + let (id', env2) = Env.enter_ident env1 id sto ty1 in + ( (id', ty1) , env2 ) + +(* Elaboration of a (specifier, Cabs "name") pair *) + +and elab_name env spec (id, decl, attr, loc) = + let (sto, inl, bty, env') = elab_specifier loc env spec in + let (ty, env'') = elab_type_declarator loc env' bty decl in + let a = elab_attributes loc attr in + (id, sto, inl, add_attributes_type a ty, env'') + +(* Elaboration of a name group *) + +and elab_name_group env (spec, namelist) = + let (sto, inl, bty, env') = + elab_specifier (loc_of_namelist namelist) env spec in + let elab_one_name env (id, decl, attr, loc) = + let (ty, env1) = + elab_type_declarator loc env bty decl in + let a = elab_attributes loc attr in + ((id, sto, add_attributes_type a ty), env1) in + mmap elab_one_name env' namelist + +(* Elaboration of an init-name group *) + +and elab_init_name_group env (spec, namelist) = + let (sto, inl, bty, env') = + elab_specifier (loc_of_init_name_list namelist) env spec in + let elab_one_name env ((id, decl, attr, loc), init) = + let (ty, env1) = + elab_type_declarator loc env bty decl in + let a = elab_attributes loc attr in + ((id, sto, add_attributes_type a ty, init), env1) in + mmap elab_one_name env' namelist + +(* Elaboration of a field group *) + +and elab_field_group env (spec, fieldlist) = + let (names, env') = + elab_name_group env (spec, List.map fst fieldlist) in + + let elab_bitfield ((_, _, _, loc), optbitsize) (id, sto, ty) = + if sto <> Storage_default then + error loc "member '%s' has non-default storage" id; + let optbitsize' = + match optbitsize with + | None -> None + | Some sz -> + let ik = + match unroll env' ty with + | TInt(ik, _) -> ik + | _ -> ILongLong (* trigger next error message *) in + if integer_rank ik > integer_rank IInt then + error loc + "the type of a bit field must be an integer type \ + no bigger than 'int'"; + match Ceval.integer_expr env' (!elab_expr_f loc env sz) with + | Some n -> + if n < 0L then begin + error loc "bit size of member (%Ld) is negative" n; + None + end else + if n > Int64.of_int(sizeof_ikind ik * 8) then begin + error loc "bit size of member (%Ld) is too large" n; + None + end else + Some(Int64.to_int n) + | None -> + error loc "bit size of member is not a compile-time constant"; + None in + { fld_name = id; fld_typ = ty; fld_bitfield = optbitsize' } + in + (List.map2 elab_bitfield fieldlist names, env') + +(* Elaboration of a struct or union *) + +and elab_struct_or_union_info kind loc env members = + let (m, env') = mmap elab_field_group env members in + let m = List.flatten m in + (* Check for incomplete types *) + let rec check_incomplete = function + | [] -> () + | [ { fld_typ = TArray(ty_elt, None, _) } ] when kind = Struct -> () + (* C99: ty[] allowed as last field of a struct *) + | fld :: rem -> + if incomplete_type env' fld.fld_typ then + error loc "member '%s' has incomplete type" fld.fld_name; + check_incomplete rem in + check_incomplete m; + (composite_info_def env' kind m, env') + +(* Elaboration of a struct or union *) + +and elab_struct_or_union only kind loc tag optmembers env = + let optbinding = + if tag = "" then None else Env.lookup_composite env tag in + match optbinding, optmembers with + | Some(tag', ci), None + when (not only) || Env.in_current_scope env tag' -> + (* Reference to an already declared struct or union. + Special case: if this is an "only" declaration (without variable names) + and the composite was bound in another scope, + create a new incomplete composite instead via the case + "_, None" below. *) + (tag', env) + | Some(tag', ({ci_sizeof = None} as ci)), Some members + when Env.in_current_scope env tag' -> + if ci.ci_kind <> kind then + error loc "struct/union mismatch on tag '%s'" tag; + (* finishing the definition of an incomplete struct or union *) + let (ci', env') = elab_struct_or_union_info kind loc env members in + (* Emit a global definition for it *) + emit_elab (elab_loc loc) + (Gcompositedef(kind, tag', ci'.ci_members)); + (* Replace infos but keep same ident *) + (tag', Env.add_composite env' tag' ci') + | Some(tag', {ci_sizeof = Some _}), Some _ + when Env.in_current_scope env tag' -> + error loc "redefinition of struct or union '%s'" tag; + (tag', env) + | _, None -> + (* declaration of an incomplete struct or union *) + if tag = "" then + error loc "anonymous, incomplete struct or union"; + let ci = composite_info_decl env kind in + (* enter it with a new name *) + let (tag', env') = Env.enter_composite env tag ci in + (* emit it *) + emit_elab (elab_loc loc) + (Gcompositedecl(kind, tag')); + (tag', env') + | _, Some members -> + (* definition of a complete struct or union *) + let ci1 = composite_info_decl env kind in + (* enter it, incomplete, with a new name *) + let (tag', env') = Env.enter_composite env tag ci1 in + (* emit a declaration so that inner structs and unions can refer to it *) + emit_elab (elab_loc loc) + (Gcompositedecl(kind, tag')); + (* elaborate the members *) + let (ci2, env'') = elab_struct_or_union_info kind loc env' members in + (* emit a definition *) + emit_elab (elab_loc loc) + (Gcompositedef(kind, tag', ci2.ci_members)); + (* Replace infos but keep same ident *) + (tag', Env.add_composite env'' tag' ci2) + +(* Elaboration of an enum item *) + +and elab_enum_item env (s, exp, loc) nextval = + let (v, exp') = + match exp with + | NOTHING -> + (nextval, None) + | _ -> + let exp' = !elab_expr_f loc env exp in + match Ceval.integer_expr env exp' with + | Some n -> (n, Some exp') + | None -> + error loc + "value of enumerator '%s' is not a compile-time constant" s; + (nextval, Some exp') in + if redef Env.lookup_ident env s <> None then + error loc "redefinition of enumerator '%s'" s; + let (id, env') = Env.enter_enum_item env s v in + ((id, exp'), Int64.succ v, env') + +(* Elaboration of an enumeration declaration *) + +and elab_enum loc tag optmembers env = + match optmembers with + | None -> env + | Some members -> + let rec elab_members env nextval = function + | [] -> ([], env) + | hd :: tl -> + let (dcl1, nextval1, env1) = elab_enum_item env hd nextval in + let (dcl2, env2) = elab_members env1 nextval1 tl in + (dcl1 :: dcl2, env2) in + let (dcls, env') = elab_members env 0L members in + let tag' = Env.fresh_ident tag in + emit_elab (elab_loc loc) (Genumdef(tag', dcls)); + env' + +(* Elaboration of a naked type, e.g. in a cast *) + +let elab_type loc env spec decl = + let (sto, inl, bty, env') = elab_specifier loc env spec in + let (ty, env'') = elab_type_declarator loc env' bty decl in + if sto <> Storage_default || inl then + error loc "'extern', 'static', 'register' and 'inline' are meaningless in cast"; + ty + + +(* Elaboration of expressions *) + +let elab_expr loc env a = + + let err fmt = error loc fmt in (* non-fatal error *) + let error fmt = fatal_error loc fmt in + let warning fmt = warning loc fmt in + + let rec elab = function + + | NOTHING -> + error "empty expression" + +(* 7.3 Primary expressions *) + + | VARIABLE s -> + begin match wrap Env.lookup_ident loc env s with + | (id, II_ident(sto, ty)) -> + { edesc = EVar id; etyp = ty } + | (id, II_enum v) -> + { edesc = EConst(CEnum(id, v)); etyp = TInt(enum_ikind, []) } + end + + | CONSTANT cst -> + let cst' = elab_constant loc cst in + { edesc = EConst cst'; etyp = type_of_constant cst' } + + | PAREN e -> + elab e + +(* 7.4 Postfix expressions *) + + | INDEX(a1, a2) -> (* e1[e2] *) + let b1 = elab a1 in let b2 = elab a2 in + let tres = + match (unroll env b1.etyp, unroll env b2.etyp) with + | (TPtr(t, _) | TArray(t, _, _)), TInt _ -> t + | TInt _, (TPtr(t, _) | TArray(t, _, _)) -> t + | t1, t2 -> error "incorrect types for array subscripting" in + { edesc = EBinop(Oindex, b1, b2, TPtr(tres, [])); etyp = tres } + + | MEMBEROF(a1, fieldname) -> + let b1 = elab a1 in + let (fld, attrs) = + match unroll env b1.etyp with + | TStruct(id, attrs) -> + (wrap Env.find_struct_member loc env (id, fieldname), attrs) + | TUnion(id, attrs) -> + (wrap Env.find_union_member loc env (id, fieldname), attrs) + | _ -> + error "left-hand side of '.' is not a struct or union" in + (* A field of a const/volatile struct or union is itself const/volatile *) + { edesc = EUnop(Odot fieldname, b1); + etyp = add_attributes_type attrs fld.fld_typ } + + | MEMBEROFPTR(a1, fieldname) -> + let b1 = elab a1 in + let (fld, attrs) = + match unroll env b1.etyp with + | TPtr(t, _) -> + begin match unroll env t with + | TStruct(id, attrs) -> + (wrap Env.find_struct_member loc env (id, fieldname), attrs) + | TUnion(id, attrs) -> + (wrap Env.find_union_member loc env (id, fieldname), attrs) + | _ -> + error "left-hand side of '->' is not a pointer to a struct or union" + end + | _ -> + error "left-hand side of '->' is not a pointer " in + { edesc = EUnop(Oarrow fieldname, b1); + etyp = add_attributes_type attrs fld.fld_typ } + +(* Hack to treat vararg.h functions the GCC way. Helps with testing. + va_start(ap,n) + (preprocessing) --> __builtin_va_start(ap, arg) + (elaboration) --> __builtin_va_start(ap, &arg) + va_arg(ap, ty) + (preprocessing) --> __builtin_va_arg(ap, ty) + (parsing) --> __builtin_va_arg(ap, sizeof(ty)) +*) + | CALL((VARIABLE "__builtin_va_start" as a1), [a2; a3]) -> + let b1 = elab a1 and b2 = elab a2 and b3 = elab a3 in + { edesc = ECall(b1, [b2; {edesc = EUnop(Oaddrof, b3); + etyp = TPtr(b3.etyp, [])}]); + etyp = TVoid [] } + | CALL((VARIABLE "__builtin_va_arg" as a1), + [a2; (TYPE_SIZEOF _) as a3]) -> + let b1 = elab a1 and b2 = elab a2 and b3 = elab a3 in + let ty = match b3.edesc with ESizeof ty -> ty | _ -> assert false in + { edesc = ECall(b1, [b2; b3]); etyp = ty } + + | CALL(a1, al) -> + let b1 = + (* Catch the old-style usage of calling a function without + having declared it *) + match a1 with + | VARIABLE n when not (Env.ident_is_bound env n) -> + let ty = TFun(TInt(IInt, []), None, false, []) in + (* Emit an extern declaration for it *) + let id = Env.fresh_ident n in + emit_elab (elab_loc loc) (Gdecl(Storage_extern, id, ty, None)); + { edesc = EVar id; etyp = ty } + | _ -> elab a1 in + let bl = List.map elab al in + (* Extract type information *) + let (res, args, vararg) = + match unroll env b1.etyp with + | TFun(res, args, vararg, a) -> (res, args, vararg) + | TPtr(ty, a) -> + begin match unroll env ty with + | TFun(res, args, vararg, a) -> (res, args, vararg) + | _ -> error "the function part of a call does not have a function type" + end + | _ -> error "the function part of a call does not have a function type" + in + (* Type-check the arguments against the prototype *) + let bl' = + match args with + | None -> bl + | Some proto -> elab_arguments 1 bl proto vararg in + { edesc = ECall(b1, bl'); etyp = res } + + | UNARY(POSINCR, a1) -> + elab_pre_post_incr_decr Opostincr "postfix '++'" a1 + | UNARY(POSDECR, a1) -> + elab_pre_post_incr_decr Opostdecr "postfix '--'" a1 + +(* 7.5 Unary expressions *) + + | CAST ((spec, dcl), SINGLE_INIT a1) -> + let ty = elab_type loc env spec dcl in + let b1 = elab a1 in + if not (valid_cast env b1.etyp ty) then + err "illegal cast from %a@ to %a" Cprint.typ b1.etyp Cprint.typ ty; + { edesc = ECast(ty, b1); etyp = ty } + + | CAST ((spec, dcl), _) -> + error "cast of initializer expression is not supported" + + | EXPR_SIZEOF(CONSTANT(CONST_STRING s)) -> + let cst = CInt(Int64.of_int (String.length s), size_t_ikind, "") in + { edesc = EConst cst; etyp = type_of_constant cst } + + | EXPR_SIZEOF a1 -> + let b1 = elab a1 in + if sizeof env b1.etyp = None then + err "incomplete type %a" Cprint.typ b1.etyp; + { edesc = ESizeof b1.etyp; etyp = TInt(size_t_ikind, []) } + + | TYPE_SIZEOF (spec, dcl) -> + let ty = elab_type loc env spec dcl in + if sizeof env ty = None then + err "incomplete type %a" Cprint.typ ty; + { edesc = ESizeof ty; etyp = TInt(size_t_ikind, []) } + + | UNARY(PLUS, a1) -> + let b1 = elab a1 in + if not (is_arith_type env b1.etyp) then + error "argument of unary '+' is not an arithmetic type"; + { edesc = EUnop(Oplus, b1); etyp = unary_conversion env b1.etyp } + + | UNARY(MINUS, a1) -> + let b1 = elab a1 in + if not (is_arith_type env b1.etyp) then + error "argument of unary '-' is not an arithmetic type"; + { edesc = EUnop(Ominus, b1); etyp = unary_conversion env b1.etyp } + + | UNARY(BNOT, a1) -> + let b1 = elab a1 in + if not (is_integer_type env b1.etyp) then + error "argument of '~' is not an integer type"; + { edesc = EUnop(Onot, b1); etyp = unary_conversion env b1.etyp } + + | UNARY(NOT, a1) -> + let b1 = elab a1 in + if not (is_scalar_type env b1.etyp) then + error "argument of '!' is not a scalar type"; + { edesc = EUnop(Olognot, b1); etyp = TInt(IInt, []) } + + | UNARY(ADDROF, a1) -> + let b1 = elab a1 in + begin match unroll env b1.etyp with + | TArray _ | TFun _ -> () + | _ -> + if not (is_lvalue env b1) then err "argument of '&' is not a l-value" + end; + { edesc = EUnop(Oaddrof, b1); etyp = TPtr(b1.etyp, []) } + + | UNARY(MEMOF, a1) -> + let b1 = elab a1 in + begin match unroll env b1.etyp with + (* '*' applied to a function type has no effect *) + | TFun _ -> b1 + | TPtr(ty, _) | TArray(ty, _, _) -> + { edesc = EUnop(Oderef, b1); etyp = ty } + | _ -> + error "argument of unary '*' is not a pointer" + end + + | UNARY(PREINCR, a1) -> + elab_pre_post_incr_decr Opreincr "prefix '++'" a1 + | UNARY(PREDECR, a1) -> + elab_pre_post_incr_decr Opredecr "prefix '--'" a1 + +(* 7.6 Binary operator expressions *) + + | BINARY(MUL, a1, a2) -> + elab_binary_arithmetic "*" Omul a1 a2 + + | BINARY(DIV, a1, a2) -> + elab_binary_arithmetic "/" Odiv a1 a2 + + | BINARY(MOD, a1, a2) -> + elab_binary_integer "/" Omod a1 a2 + + | BINARY(ADD, a1, a2) -> + let b1 = elab a1 in + let b2 = elab a2 in + let tyres = + if is_arith_type env b1.etyp && is_arith_type env b2.etyp then + binary_conversion env b1.etyp b2.etyp + else begin + let (ty, attr) = + match unroll env b1.etyp, unroll env b2.etyp with + | (TPtr(ty, a) | TArray(ty, _, a)), TInt _ -> (ty, a) + | TInt _, (TPtr(ty, a) | TArray(ty, _, a)) -> (ty, a) + | _, _ -> error "type error in binary '+'" in + if not (pointer_arithmetic_ok env ty) then + err "illegal pointer arithmetic in binary '+'"; + TPtr(ty, attr) + end in + { edesc = EBinop(Oadd, b1, b2, tyres); etyp = tyres } + + | BINARY(SUB, a1, a2) -> + let b1 = elab a1 in + let b2 = elab a2 in + let (tyop, tyres) = + if is_arith_type env b1.etyp && is_arith_type env b2.etyp then begin + let tyres = binary_conversion env b1.etyp b2.etyp in + (tyres, tyres) + end else begin + match unroll env b1.etyp, unroll env b2.etyp with + | (TPtr(ty, a) | TArray(ty, _, a)), TInt _ -> + if not (pointer_arithmetic_ok env ty) then + err "illegal pointer arithmetic in binary '-'"; + (TPtr(ty, a), TPtr(ty, a)) + | TInt _, (TPtr(ty, a) | TArray(ty, _, a)) -> + if not (pointer_arithmetic_ok env ty) then + err "illegal pointer arithmetic in binary '-'"; + (TPtr(ty, a), TPtr(ty, a)) + | (TPtr(ty1, a1) | TArray(ty1, _, a1)), + (TPtr(ty2, a2) | TArray(ty2, _, a2)) -> + if not (compatible_types ~noattrs:true env ty1 ty2) then + err "mismatch between pointer types in binary '-'"; + if not (pointer_arithmetic_ok env ty1) then + err "illegal pointer arithmetic in binary '-'"; + (TPtr(ty1, []), TInt(ptrdiff_t_ikind, [])) + | _, _ -> error "type error in binary '-'" + end in + { edesc = EBinop(Osub, b1, b2, tyop); etyp = tyres } + + | BINARY(SHL, a1, a2) -> + elab_shift "<<" Oshl a1 a2 + + | BINARY(SHR, a1, a2) -> + elab_shift ">>" Oshr a1 a2 + + | BINARY(EQ, a1, a2) -> + elab_comparison Oeq a1 a2 + | BINARY(NE, a1, a2) -> + elab_comparison One a1 a2 + | BINARY(LT, a1, a2) -> + elab_comparison Olt a1 a2 + | BINARY(GT, a1, a2) -> + elab_comparison Ogt a1 a2 + | BINARY(LE, a1, a2) -> + elab_comparison Ole a1 a2 + | BINARY(GE, a1, a2) -> + elab_comparison Oge a1 a2 + + | BINARY(BAND, a1, a2) -> + elab_binary_integer "&" Oand a1 a2 + | BINARY(BOR, a1, a2) -> + elab_binary_integer "|" Oor a1 a2 + | BINARY(XOR, a1, a2) -> + elab_binary_integer "^" Oxor a1 a2 + +(* 7.7 Logical operator expressions *) + + | BINARY(AND, a1, a2) -> + elab_logical_operator "&&" Ologand a1 a2 + | BINARY(OR, a1, a2) -> + elab_logical_operator "||" Ologor a1 a2 + +(* 7.8 Conditional expressions *) + | QUESTION(a1, a2, a3) -> + let b1 = elab a1 in + let b2 = elab a2 in + let b3 = elab a3 in + if not (is_scalar_type env b1.etyp) then + err ("the first argument of '? :' is not a scalar type"); + begin match pointer_decay env b2.etyp, pointer_decay env b3.etyp with + | (TInt _ | TFloat _), (TInt _ | TFloat _) -> + { edesc = EConditional(b1, b2, b3); + etyp = binary_conversion env b2.etyp b3.etyp } + | TPtr(ty1, a1), TPtr(ty2, a2) -> + let tyres = + if is_void_type env ty1 || is_void_type env ty2 then + TPtr(TVoid [], add_attributes a1 a2) + else + match combine_types ~noattrs:true env + (TPtr(ty1, a1)) (TPtr(ty2, a2)) with + | None -> + error "the second and third arguments of '? :' \ + have incompatible pointer types" + | Some ty -> ty + in + { edesc = EConditional(b1, b2, b3); etyp = tyres } + | TPtr(ty1, a1), TInt _ when is_literal_0 b3 -> + { edesc = EConditional(b1, b2, nullconst); etyp = TPtr(ty1, a1) } + | TInt _, TPtr(ty2, a2) when is_literal_0 b2 -> + { edesc = EConditional(b1, nullconst, b3); etyp = TPtr(ty2, a2) } + | ty1, ty2 -> + match combine_types env ty1 ty2 with + | None -> + error ("the second and third arguments of '? :' have incompatible types") + | Some tyres -> + { edesc = EConditional(b1, b2, b3); etyp = tyres } + end + +(* 7.9 Assignment expressions *) + + | BINARY(ASSIGN, a1, a2) -> + let b1 = elab a1 in + let b2 = elab a2 in + if not (is_lvalue env b1) then + err "left-hand side of assignment is not a l-value"; + if List.mem AConst (attributes_of_type env b1.etyp) then + err "left-hand side of assignment has 'const' type"; + if not (valid_assignment env b2 b1.etyp) then begin + if valid_cast env b2.etyp b1.etyp then + warning "assigning a value of type@ %a@ to a lvalue of type@ %a" + Cprint.typ b2.etyp Cprint.typ b1.etyp + else + err "assigning a value of type@ %a@ to a lvalue of type@ %a" + Cprint.typ b2.etyp Cprint.typ b1.etyp; + end; + { edesc = EBinop(Oassign, b1, b2, b1.etyp); etyp = b1.etyp } + + | BINARY((ADD_ASSIGN | SUB_ASSIGN | MUL_ASSIGN | DIV_ASSIGN | MOD_ASSIGN + | BAND_ASSIGN | BOR_ASSIGN | XOR_ASSIGN | SHL_ASSIGN | SHR_ASSIGN + as op), a1, a2) -> + let (sop, top) = + match op with + | ADD_ASSIGN -> (ADD, Oadd_assign) + | SUB_ASSIGN -> (SUB, Osub_assign) + | MUL_ASSIGN -> (MUL, Omul_assign) + | DIV_ASSIGN -> (DIV, Odiv_assign) + | MOD_ASSIGN -> (MOD, Omod_assign) + | BAND_ASSIGN -> (BAND, Oand_assign) + | BOR_ASSIGN -> (BOR, Oor_assign) + | XOR_ASSIGN -> (XOR, Oxor_assign) + | SHL_ASSIGN -> (SHL, Oshl_assign) + | SHR_ASSIGN -> (SHR, Oshr_assign) + | _ -> assert false in + begin match elab (BINARY(sop, a1, a2)) with + | { edesc = EBinop(_, b1, b2, _); etyp = ty } as b -> + if not (is_lvalue env b1) then + err ("left-hand side of assignment is not a l-value"); + if List.mem AConst (attributes_of_type env b1.etyp) then + err "left-hand side of assignment has 'const' type"; + if not (valid_assignment env b b1.etyp) then begin + if valid_cast env ty b1.etyp then + warning "assigning a value of type@ %a@ to a lvalue of type@ %a" + Cprint.typ ty Cprint.typ b1.etyp + else + err "assigning a value of type@ %a@ to a lvalue of type@ %a" + Cprint.typ ty Cprint.typ b1.etyp; + end; + { edesc = EBinop(top, b1, b2, ty); etyp = b1.etyp } + | _ -> assert false + end + +(* 7.10 Sequential expressions *) + + | COMMA [] -> + error "empty sequential expression" + | COMMA (a1 :: al) -> (* watch for left associativity *) + let rec elab_comma accu = function + | [] -> accu + | a :: l -> + let b = elab a in + elab_comma { edesc = EBinop(Ocomma, accu, b, b.etyp); etyp = b.etyp } l + in elab_comma (elab a1) al + +(* Extensions that we do not handle *) + + | LABELADDR _ -> + error "GCC's &&label construct is not supported" + | GNU_BODY _ -> + error "GCC's statements within expressions are not supported" + | EXPR_ALIGNOF _ | TYPE_ALIGNOF _ -> + error "GCC's __alignof__ construct is not supported" + +(* + | EXPR_ALIGNOF a1 -> + warning "nonstandard `alignof' expression, turned into a constant"; + let b1 = elab a1 in + begin match alignof env b1.etyp with + | None -> error "incomplete type %a" Cprint.typ b1.etyp + | Some al -> intconst (Int64.of_int al) size_t_ikind + end + | TYPE_ALIGNOF (spec, dcl) -> + warning "nonstandard `alignof' expression, turned into a constant"; + let ty = elab_type loc env spec dcl in + begin match alignof env ty with + | None -> error "incomplete type %a" Cprint.typ ty + | Some al -> intconst (Int64.of_int al) size_t_ikind + end +*) + +(* Elaboration of pre- or post- increment/decrement *) + and elab_pre_post_incr_decr op msg a1 = + let b1 = elab a1 in + if not (is_lvalue env b1) then + err "the argument of %s is not a l-value" msg; + if not (is_scalar_type env b1.etyp) then + err "the argument of %s must be an arithmetic or pointer type" msg; + { edesc = EUnop(op, b1); etyp = b1.etyp } + +(* Elaboration of binary operators over integers *) + and elab_binary_integer msg op a1 a2 = + let b1 = elab a1 in + if not (is_integer_type env b1.etyp) then + error "the first argument of '%s' is not an integer type" msg; + let b2 = elab a2 in + if not (is_integer_type env b2.etyp) then + error "the second argument of '%s' is not an integer type" msg; + let tyres = binary_conversion env b1.etyp b2.etyp in + { edesc = EBinop(op, b1, b2, tyres); etyp = tyres } + +(* Elaboration of binary operators over arithmetic types *) + and elab_binary_arithmetic msg op a1 a2 = + let b1 = elab a1 in + if not (is_arith_type env b1.etyp) then + error "the first argument of '%s' is not an arithmetic type" msg; + let b2 = elab a2 in + if not (is_arith_type env b2.etyp) then + error "the second argument of '%s' is not an arithmetic type" msg; + let tyres = binary_conversion env b1.etyp b2.etyp in + { edesc = EBinop(op, b1, b2, tyres); etyp = tyres } + +(* Elaboration of shift operators *) + and elab_shift msg op a1 a2 = + let b1 = elab a1 in + if not (is_integer_type env b1.etyp) then + error "the first argument of '%s' is not an integer type" msg; + let b2 = elab a2 in + if not (is_integer_type env b2.etyp) then + error "the second argument of '%s' is not an integer type" msg; + let tyres = unary_conversion env b1.etyp in + { edesc = EBinop(op, b1, b2, tyres); etyp = tyres } + +(* Elaboration of comparisons *) + and elab_comparison op a1 a2 = + let b1 = elab a1 in + let b2 = elab a2 in + let resdesc = + match pointer_decay env b1.etyp, pointer_decay env b2.etyp with + | (TInt _ | TFloat _), (TInt _ | TFloat _) -> + EBinop(op, b1, b2, binary_conversion env b1.etyp b2.etyp) + | TInt _, TPtr(ty, _) when is_literal_0 b1 -> + EBinop(op, nullconst, b2, TPtr(ty, [])) + | TPtr(ty, _), TInt _ when is_literal_0 b2 -> + EBinop(op, b1, nullconst, TPtr(ty, [])) + | TPtr(ty1, _), TPtr(ty2, _) + when is_void_type env ty1 -> + EBinop(op, b1, b2, TPtr(ty2, [])) + | TPtr(ty1, _), TPtr(ty2, _) + when is_void_type env ty2 -> + EBinop(op, b1, b2, TPtr(ty1, [])) + | TPtr(ty1, _), TPtr(ty2, _) -> + if not (compatible_types ~noattrs:true env ty1 ty2) then + warning "comparison between incompatible pointer types"; + EBinop(op, b1, b2, TPtr(ty1, [])) + | TPtr _, TInt _ + | TInt _, TPtr _ -> + warning "comparison between integer and pointer"; + EBinop(op, b1, b2, TPtr(TVoid [], [])) + | ty1, ty2 -> + error "illegal comparison between types@ %a@ and %a" + Cprint.typ b1.etyp Cprint.typ b2.etyp in + { edesc = resdesc; etyp = TInt(IInt, []) } + +(* Elaboration of && and || *) + and elab_logical_operator msg op a1 a2 = + let b1 = elab a1 in + if not (is_scalar_type env b1.etyp) then + err "the first argument of '%s' is not a scalar type" msg; + let b2 = elab a2 in + if not (is_scalar_type env b2.etyp) then + err "the second argument of '%s' is not a scalar type" msg; + { edesc = EBinop(op, b1, b2, TInt(IInt, [])); etyp = TInt(IInt, []) } + +(* Type-checking of function arguments *) + and elab_arguments argno args params vararg = + match args, params with + | [], [] -> [] + | [], _::_ -> err "not enough arguments in function call"; [] + | _::_, [] -> + if vararg + then args + else (err "too many arguments in function call"; args) + | arg1 :: argl, (_, ty_p) :: paraml -> + let ty_a = argument_conversion env arg1.etyp in + if not (valid_assignment env {arg1 with etyp = ty_a} ty_p) then begin + if valid_cast env ty_a ty_p then + warning + "argument #%d of function call has type@ %a@ \ + instead of the expected type@ %a" + argno Cprint.typ ty_a Cprint.typ ty_p + else + err + "argument #%d of function call has type@ %a@ \ + instead of the expected type@ %a" + argno Cprint.typ ty_a Cprint.typ ty_p + end; + arg1 :: elab_arguments (argno + 1) argl paraml vararg + + in elab a + +(* Filling in forward declaration *) +let _ = elab_expr_f := elab_expr + +let elab_opt_expr loc env = function + | NOTHING -> None + | a -> Some (elab_expr loc env a) + +let elab_for_expr loc env = function + | NOTHING -> { sdesc = Sskip; sloc = elab_loc loc } + | a -> { sdesc = Sdo (elab_expr loc env a); sloc = elab_loc loc } + + +(* Elaboration of initializers *) + +(* Initializers are first elaborated to the following type: *) + +let project_init loc il = + List.map + (fun (what, i) -> + if what <> NEXT_INIT then + error loc "C99 initializers are not supported"; + i) + il + +let below_optsize n opt_sz = + match opt_sz with None -> true | Some sz -> n < sz + +let init_char_array_string opt_size s = + let init = ref [] + and len = ref 0L in + let enter x = + if below_optsize !len opt_size then begin + init := Init_single (intconst x IChar) :: !init; + len := Int64.succ !len + end in + for i = 0 to String.length s - 1 do + enter (Int64.of_int (Char.code s.[i])) + done; + enter 0L; + Init_array (List.rev !init) + +let init_int_array_wstring opt_size s = + let init = ref [] + and len = ref 0L in + let enter x = + if below_optsize !len opt_size then begin + init := Init_single (intconst x IInt) :: !init; + len := Int64.succ !len + end in + List.iter enter s; + enter 0L; + Init_array (List.rev !init) + +let check_init_type loc env a ty = + if valid_assignment env a ty then () + else if valid_cast env a.etyp ty then + warning loc + "initializer has type@ %a@ instead of the expected type @ %a" + Cprint.typ a.etyp Cprint.typ ty + else + error loc + "initializer has type@ %a@ instead of the expected type @ %a" + Cprint.typ a.etyp Cprint.typ ty + +(* Build an initializer for type [ty], consuming initialization items + from the list [ile]. Return a pair (initializer, items not consumed). *) + +let rec elab_init loc env ty ile = + match unroll env ty with + | TArray(ty_elt, opt_sz, _) -> + let rec elab_init_array n accu rem = + match opt_sz, rem with + | Some sz, _ when n >= sz -> + (Init_array(List.rev accu), rem) + | None, [] -> + (Init_array(List.rev accu), rem) + | _, _ -> + let (i, rem') = elab_init loc env ty_elt rem in + elab_init_array (Int64.succ n) (i :: accu) rem' in + begin match ile with + (* char array = "string literal" *) + | (SINGLE_INIT (CONSTANT (CONST_STRING s)) + | COMPOUND_INIT [_, SINGLE_INIT(CONSTANT (CONST_STRING s))]) :: ile1 + when (match unroll env ty_elt with + | TInt((IChar|IUChar|ISChar), _) -> true + | _ -> false) -> + (init_char_array_string opt_sz s, ile1) + (* wchar array = L"wide string literal" *) + | (SINGLE_INIT (CONSTANT (CONST_WSTRING s)) + | COMPOUND_INIT [_, SINGLE_INIT(CONSTANT (CONST_WSTRING s))]) :: ile1 + when (match unroll env ty_elt with + | TInt _ -> true + | _ -> false) -> + (init_int_array_wstring opt_sz s, ile1) + (* array = { elt, ..., elt } *) + | COMPOUND_INIT ile1 :: ile2 -> + let (ie, rem) = elab_init_array 0L [] (project_init loc ile1) in + if rem <> [] then + warning loc "excess elements at end of array initializer"; + (ie, ile2) + (* array = elt, ..., elt (within a bigger compound initializer) *) + | _ -> + elab_init_array 0L [] ile + end + | TStruct(id, _) -> + let ci = wrap Env.find_struct loc env id in + let rec elab_init_fields fld accu rem = + match fld with + | [] -> + (Init_struct(id, List.rev accu), rem) + | fld1 :: fld' -> + let (i, rem') = elab_init loc env fld1.fld_typ rem in + elab_init_fields fld' ((fld1, i) :: accu) rem' in + begin match ile with + (* struct = { elt, ..., elt } *) + | COMPOUND_INIT ile1 :: ile2 -> + let (ie, rem) = + elab_init_fields ci.ci_members [] (project_init loc ile1) in + if rem <> [] then + warning loc "excess elements at end of struct initializer"; + (ie, ile2) + (* struct = elt, ..., elt (within a bigger compound initializer) *) + | _ -> + elab_init_fields ci.ci_members [] ile + end + | TUnion(id, _) -> + let ci = wrap Env.find_union loc env id in + let fld1 = + match ci.ci_members with [] -> assert false | hd :: tl -> hd in + begin match ile with + (* union = { elt } *) + | COMPOUND_INIT ile1 :: ile2 -> + let (i, rem) = + elab_init loc env fld1.fld_typ (project_init loc ile1) in + if rem <> [] then + warning loc "excess elements at end of union initializer"; + (Init_union(id, fld1, i), ile2) + (* union = elt (within a bigger compound initializer) *) + | _ -> + let (i, rem) = elab_init loc env fld1.fld_typ ile in + (Init_union(id, fld1, i), rem) + end + | TInt _ | TFloat _ | TPtr _ -> + begin match ile with + (* scalar = elt *) + | SINGLE_INIT a :: ile1 -> + let a' = elab_expr loc env a in + check_init_type loc env a' ty; + (Init_single a', ile1) + (* scalar = nothing (within a bigger compound initializer) *) + | (NO_INIT :: ile1) | ([] as ile1) -> + begin match unroll env ty with + | TInt _ -> (Init_single (intconst 0L IInt), ile1) + | TFloat _ -> (Init_single (floatconst 0.0 FDouble), ile1) + | TPtr _ -> (Init_single nullconst, ile1) + | _ -> assert false + end + | COMPOUND_INIT _ :: ile1 -> + fatal_error loc "compound initializer for type@ %a" Cprint.typ ty + end + | _ -> + fatal_error loc "impossible to initialize at type@ %a" Cprint.typ ty + +let elab_initial loc env ty ie = + match unroll env ty, ie with + | _, NO_INIT -> None + (* scalar or composite = expr *) + | (TInt _ | TFloat _ | TPtr _ | TStruct _ | TUnion _), SINGLE_INIT a -> + let a' = elab_expr loc env a in + check_init_type loc env a' ty; + Some (Init_single a') + (* array = expr or + array or struct or union = { elt, ..., elt } *) + | (TArray _, SINGLE_INIT _) + | ((TArray _ | TStruct _ | TUnion _), COMPOUND_INIT _) -> + let (i, rem) = elab_init loc env ty [ie] in + if rem <> [] then + warning loc "excess elements at end of compound initializer"; + Some i + | _, _ -> + error loc "ill-formed initializer for type@ %a" Cprint.typ ty; + None + +(* Complete an array type with the size obtained from the initializer: + "int x[] = { 1, 2, 3 }" becomes "int x[3] = ..." *) + +let fixup_typ env ty init = + match unroll env ty, init with + | TArray(ty_elt, None, attr), Init_array il -> + TArray(ty_elt, Some(Int64.of_int(List.length il)), attr) + | _ -> ty + +(* Entry point *) + +let elab_initializer loc env ty ie = + match elab_initial loc env ty ie with + | None -> + (ty, None) + | Some init -> + (fixup_typ env ty init, Some init) + + +(* Elaboration of top-level and local definitions *) + +let enter_typedef loc env (s, sto, ty) = + if sto <> Storage_default then + error loc "Non-default storage on 'typedef' definition"; + if redef Env.lookup_typedef env s <> None then + error loc "Redefinition of typedef '%s'" s; + let (id, env') = + Env.enter_typedef env s ty in + emit_elab (elab_loc loc) (Gtypedef(id, ty)); + env' + +let enter_or_refine_ident local loc env s sto ty = + match redef Env.lookup_ident env s with + | Some(id, II_ident(old_sto, old_ty)) -> + let new_ty = + if local then begin + error loc "redefinition of local variable '%s'" s; + ty + end else begin + match combine_types env old_ty ty with + | Some new_ty -> + new_ty + | None -> + warning loc "redefinition of '%s' with incompatible type" s; ty + end in + let new_sto = + if old_sto = Storage_extern then sto else + if sto = Storage_extern then old_sto else + if old_sto = sto then sto else begin + warning loc "redefinition of '%s' with incompatible storage class" s; + sto + end in + (id, Env.add_ident env id new_sto new_ty) + | Some(id, II_enum v) -> + error loc "illegal redefinition of enumerator '%s'" s; + (id, Env.add_ident env id sto ty) + | _ -> + Env.enter_ident env s sto ty + +let rec enter_decdefs local loc env = function + | [] -> + ([], env) + | (s, sto, ty, init) :: rem -> + (* Sanity checks on storage class *) + begin match sto with + | Storage_extern -> + if init <> NO_INIT then error loc + "'extern' declaration cannot have an initializer" + | Storage_register -> + if not local then error loc "'register' on global declaration" + | _ -> () + end; + (* function declarations are always extern *) + let sto' = + match unroll env ty with TFun _ -> Storage_extern | _ -> sto in + (* enter ident in environment with declared type, because + initializer can refer to the ident *) + let (id, env1) = enter_or_refine_ident local loc env s sto' ty in + (* process the initializer *) + let (ty', init') = elab_initializer loc env1 ty init in + (* update environment with refined type *) + let env2 = Env.add_ident env1 id sto' ty' in + (* check for incomplete type *) + if sto' <> Storage_extern && incomplete_type env ty' then + warning loc "'%s' has incomplete type" s; + if local && sto <> Storage_extern && sto <> Storage_static then begin + (* Local definition *) + let (decls, env3) = enter_decdefs local loc env2 rem in + ((sto', id, ty', init') :: decls, env3) + end else begin + (* Global definition *) + emit_elab (elab_loc loc) (Gdecl(sto, id, ty', init')); + enter_decdefs local loc env2 rem + end + +let elab_fundef env (spec, name) body loc1 loc2 = + let (s, sto, inline, ty, env1) = elab_name env spec name in + if sto = Storage_register then + error loc1 "a function definition cannot have 'register' storage class"; + (* Fix up the type. We can have params = None but only for an + old-style parameterless function "int f() {...}" *) + let ty = + match ty with + | TFun(ty_ret, None, vararg, attr) -> TFun(ty_ret, Some [], vararg, attr) + | _ -> ty in + (* Extract info from type *) + let (ty_ret, params, vararg) = + match ty with + | TFun(ty_ret, Some params, vararg, attr) -> (ty_ret, params, vararg) + | _ -> fatal_error loc1 "wrong type for function definition" in + (* Enter function in the environment, for recursive references *) + let (fun_id, env1) = enter_or_refine_ident false loc1 env s sto ty in + (* Enter parameters in the environment *) + let env2 = + List.fold_left (fun e (id, ty) -> Env.add_ident e id Storage_default ty) + (Env.new_scope env1) params in + (* Elaborate function body *) + let body' = !elab_block_f loc2 ty_ret env2 body in + (* Build and emit function definition *) + let fn = + { fd_storage = sto; + fd_inline = inline; + fd_name = fun_id; + fd_ret = ty_ret; + fd_params = params; + fd_vararg = vararg; + fd_locals = []; + fd_body = body' } in + emit_elab (elab_loc loc1) (Gfundef fn); + env1 + +let rec elab_definition (local: bool) (env: Env.t) (def: Cabs.definition) + : decl list * Env.t = + match def with + (* "int f(int x) { ... }" *) + | FUNDEF(spec_name, body, loc1, loc2) -> + if local then error loc1 "local definition of a function"; + let env1 = elab_fundef env spec_name body loc1 loc2 in + ([], env1) + + (* "int x = 12, y[10], *z" *) + | DECDEF(init_name_group, loc) -> + let (dl, env1) = elab_init_name_group env init_name_group in + enter_decdefs local loc env1 dl + + (* "typedef int * x, y[10]; " *) + | TYPEDEF(namegroup, loc) -> + let (dl, env1) = elab_name_group env namegroup in + let env2 = List.fold_left (enter_typedef loc) env1 dl in + ([], env2) + + (* "struct s { ...};" or "union u;" *) + | ONLYTYPEDEF(spec, loc) -> + let (sto, inl, ty, env') = elab_specifier ~only:true loc env spec in + if sto <> Storage_default || inl then + error loc "Non-default storage or 'inline' on 'struct' or 'union' declaration"; + ([], env') + + (* global asm statement *) + | GLOBASM(_, loc) -> + error loc "Top-level 'asm' statement is not supported"; + ([], env) + + (* pragma *) + | PRAGMA(s, loc) -> + emit_elab (elab_loc loc) (Gpragma s); + ([], env) + + (* extern "C" { ... } *) + | LINKAGE(_, loc, defs) -> + elab_definitions local env defs + +and elab_definitions local env = function + | [] -> ([], env) + | d1 :: dl -> + let (decl1, env1) = elab_definition local env d1 in + let (decl2, env2) = elab_definitions local env1 dl in + (decl1 @ decl2, env2) + + +(* Elaboration of statements *) + +(* Extract list of Cabs statements from a Cabs block *) + +let block_body loc b = + if b.blabels <> [] then + error loc "GCC's '__label__' declaration is not supported"; + if b.battrs <> [] then + warning loc "ignoring attributes on this block"; + b.bstmts + +(* Elaboration of a block. Return the corresponding C statement. *) + +let elab_block loc return_typ env b = + +let rec elab_stmt env s = + + match s with + +(* 8.2 Expression statements *) + + | COMPUTATION(a, loc) -> + { sdesc = Sdo (elab_expr loc env a); sloc = elab_loc loc } + +(* 8.3 Labeled statements *) + + | LABEL(lbl, s1, loc) -> + { sdesc = Slabeled(Slabel lbl, elab_stmt env s1); sloc = elab_loc loc } + + | CASE(a, s1, loc) -> + let a' = elab_expr loc env a in + begin match Ceval.integer_expr env a' with + | None -> + error loc "argument of 'case' must be an integer compile-time constant" + | Some n -> () + end; + { sdesc = Slabeled(Scase a', elab_stmt env s1); sloc = elab_loc loc } + + | CASERANGE(_, _, _, loc) -> + error loc "GCC's 'case' with range of values is not supported"; + sskip + + | DEFAULT(s1, loc) -> + { sdesc = Slabeled(Sdefault, elab_stmt env s1); sloc = elab_loc loc } + +(* 8.4 Compound statements *) + + | BLOCK(b, loc) -> + elab_blk loc env b + +(* 8.5 Conditional statements *) + + | IF(a, s1, s2, loc) -> + let a' = elab_expr loc env a in + if not (is_scalar_type env a'.etyp) then + error loc "the condition of 'if' does not have scalar type"; + let s1' = elab_stmt env s1 in + let s2' = elab_stmt env s2 in + { sdesc = Sif(a', s1', s2'); sloc = elab_loc loc } + +(* 8.6 Iterative statements *) + + | WHILE(a, s1, loc) -> + let a' = elab_expr loc env a in + if not (is_scalar_type env a'.etyp) then + error loc "the condition of 'while' does not have scalar type"; + let s1' = elab_stmt env s1 in + { sdesc = Swhile(a', s1'); sloc = elab_loc loc } + + | DOWHILE(a, s1, loc) -> + let s1' = elab_stmt env s1 in + let a' = elab_expr loc env a in + if not (is_scalar_type env a'.etyp) then + error loc "the condition of 'while' does not have scalar type"; + { sdesc = Sdowhile(s1', a'); sloc = elab_loc loc } + + | FOR(fc, a2, a3, s1, loc) -> + let a1' = + match fc with + | FC_EXP a1 -> + elab_for_expr loc env a1 + | FC_DECL def -> + error loc "C99 declaration within `for' not supported"; + sskip in + let a2' = + if a2 = NOTHING + then intconst 1L IInt + else elab_expr loc env a2 in + if not (is_scalar_type env a2'.etyp) then + error loc "the condition of 'for' does not have scalar type"; + let a3' = elab_for_expr loc env a3 in + let s1' = elab_stmt env s1 in + { sdesc = Sfor(a1', a2', a3', s1'); sloc = elab_loc loc } + +(* 8.7 Switch statement *) + | SWITCH(a, s1, loc) -> + let a' = elab_expr loc env a in + if not (is_arith_type env a'.etyp) then + error loc "the argument of 'switch' does not have arithmetic type"; + let s1' = elab_stmt env s1 in + { sdesc = Sswitch(a', s1'); sloc = elab_loc loc } + +(* 8,8 Break and continue statements *) + | BREAK loc -> + { sdesc = Sbreak; sloc = elab_loc loc } + | CONTINUE loc -> + { sdesc = Scontinue; sloc = elab_loc loc } + +(* 8.9 Return statements *) + | RETURN(a, loc) -> + let a' = elab_opt_expr loc env a in + begin match (unroll env return_typ, a') with + | TVoid _, None -> () + | TVoid _, Some _ -> + error loc + "'return' with a value in a function of return type 'void'" + | _, None -> + warning loc + "'return' without a value in a function of return type@ %a" + Cprint.typ return_typ + | _, Some b -> + if not (valid_assignment env b return_typ) then begin + if valid_cast env b.etyp return_typ then + warning loc + "return value has type@ %a@ \ + instead of the expected type@ %a" + Cprint.typ b.etyp Cprint.typ return_typ + else + error loc + "return value has type@ %a@ \ + instead of the expected type@ %a" + Cprint.typ b.etyp Cprint.typ return_typ + end + end; + { sdesc = Sreturn a'; sloc = elab_loc loc } + +(* 8.10 Goto statements *) + | GOTO(lbl, loc) -> + { sdesc = Sgoto lbl; sloc = elab_loc loc } + +(* 8.11 Null statements *) + | NOP loc -> + { sdesc = Sskip; sloc = elab_loc loc } + +(* Unsupported *) + | DEFINITION def -> + error (get_definitionloc def) "ill-placed definition"; + sskip + | COMPGOTO(a, loc) -> + error loc "GCC's computed 'goto' is not supported"; + sskip + | ASM(_, _, _, loc) -> + error loc "'asm' statement is not supported"; + sskip + | TRY_EXCEPT(_, _, _, loc) -> + error loc "'try ... except' statement is not supported"; + sskip + | TRY_FINALLY(_, _, loc) -> + error loc "'try ... finally' statement is not supported"; + sskip + +and elab_blk loc env b = + let b' = elab_blk_body (Env.new_scope env) (block_body loc b) in + { sdesc = Sblock b'; sloc = elab_loc loc } + +and elab_blk_body env sl = + match sl with + | [] -> + [] + | DEFINITION def :: sl1 -> + let (dcl, env') = elab_definition true env def in + let loc = elab_loc (get_definitionloc def) in + List.map (fun d -> {sdesc = Sdecl d; sloc = loc}) dcl + @ elab_blk_body env' sl1 + | s :: sl1 -> + let s' = elab_stmt env s in + s' :: elab_blk_body env sl1 + +in elab_blk loc env b + +(* Filling in forward declaration *) +let _ = elab_block_f := elab_block + + +(** * Entry point *) + +let elab_preprocessed_file lb = + let lb = Lexer.init lb in + reset(); + ignore (elab_definitions false (Builtins.environment()) + (Parser.file Lexer.initial lb)); + Lexer.finish(); + elaborated_program() diff --git a/cparser/Elab.mli b/cparser/Elab.mli new file mode 100644 index 0000000..0715c51 --- /dev/null +++ b/cparser/Elab.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val elab_preprocessed_file : Lexing.lexbuf -> C.program diff --git a/cparser/Env.ml b/cparser/Env.ml new file mode 100644 index 0000000..777b3e1 --- /dev/null +++ b/cparser/Env.ml @@ -0,0 +1,248 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Typing environment *) + +open C + +type error = + | Unbound_identifier of string + | Unbound_tag of string * string + | Tag_mismatch of string * string * string + | Unbound_typedef of string + | No_member of string * string * string + +exception Error of error + +(* Maps over ident, accessible both by name or by name + stamp *) + +module StringMap = Map.Make(String) + +module IdentMap = struct + type 'a t = (ident * 'a) list StringMap.t + let empty : 'a t = StringMap.empty + + (* Search by name and return topmost binding *) + let lookup s m = + match StringMap.find s m with + | id_data :: _ -> id_data + | [] -> assert false + + (* Search by identifier and return associated binding *) + let find id m = + let rec lookup_in = function + | [] -> raise Not_found + | (id', data) :: rem -> + if id'.stamp = id.stamp then data else lookup_in rem in + lookup_in (StringMap.find id.name m) + + (* Insert by identifier *) + let add id data m = + let l = try StringMap.find id.name m with Not_found -> [] in + StringMap.add id.name ((id, data) :: l) m +end + +let gensym = ref 0 + +let fresh_ident s = incr gensym; { name = s; stamp = !gensym } + +(* Infos associated with structs or unions *) + +type composite_info = { + ci_kind: struct_or_union; + ci_members: field list; (* members, in order *) + ci_alignof: int option; (* alignment; None if incomplete *) + ci_sizeof: int option; (* size; None if incomplete *) +} + +(* Infos associated with an ordinary identifier *) + +type ident_info = + | II_ident of storage * typ + | II_enum of int64 (* value of the enum *) + +(* Infos associated with a typedef *) + +type typedef_info = typ + +(* Environments *) + +type t = { + env_scope: int; + env_ident: ident_info IdentMap.t; + env_tag: composite_info IdentMap.t; + env_typedef: typedef_info IdentMap.t +} + +let empty = { + env_scope = 0; + env_ident = IdentMap.empty; + env_tag = IdentMap.empty; + env_typedef = IdentMap.empty +} + +(* Enter a new scope. *) + +let new_scope env = + { env with env_scope = !gensym + 1 } + +let in_current_scope env id = id.stamp >= env.env_scope + +(* Looking up things by source name *) + +let lookup_ident env s = + try + IdentMap.lookup s env.env_ident + with Not_found -> + raise(Error(Unbound_identifier s)) + +let lookup_tag env s = + try + IdentMap.lookup s env.env_tag + with Not_found -> + raise(Error(Unbound_tag(s, "tag"))) + +let lookup_struct env s = + try + let (id, ci as res) = IdentMap.lookup s env.env_tag in + if ci.ci_kind <> Struct then + raise(Error(Tag_mismatch(s, "struct", "union"))); + res + with Not_found -> + raise(Error(Unbound_tag(s, "struct"))) + +let lookup_union env s = + try + let (id, ci as res) = IdentMap.lookup s env.env_tag in + if ci.ci_kind <> Union then + raise(Error(Tag_mismatch(s, "union", "struct"))); + res + with Not_found -> + raise(Error(Unbound_tag(s, "union"))) + +let lookup_composite env s = + try Some (IdentMap.lookup s env.env_tag) + with Not_found -> None + +let lookup_typedef env s = + try + IdentMap.lookup s env.env_typedef + with Not_found -> + raise(Error(Unbound_typedef s)) + +(* Checking if a source name is bound *) + +let ident_is_bound env s = StringMap.mem s env.env_ident + +(* Finding things by translated identifier *) + +let find_ident env id = + try IdentMap.find id env.env_ident + with Not_found -> + raise(Error(Unbound_identifier(id.name))) + +let find_tag env id = + try IdentMap.find id env.env_tag + with Not_found -> + raise(Error(Unbound_tag(id.name, "tag"))) + +let find_struct env id = + try + let ci = IdentMap.find id env.env_tag in + if ci.ci_kind <> Struct then + raise(Error(Tag_mismatch(id.name, "struct", "union"))); + ci + with Not_found -> + raise(Error(Unbound_tag(id.name, "struct"))) + +let find_union env id = + try + let ci = IdentMap.find id env.env_tag in + if ci.ci_kind <> Union then + raise(Error(Tag_mismatch(id.name, "union", "struct"))); + ci + with Not_found -> + raise(Error(Unbound_tag(id.name, "union"))) + +let find_member ci m = + List.find (fun f -> f.fld_name = m) ci + +let find_struct_member env (id, m) = + try + let ci = find_struct env id in + find_member ci.ci_members m + with Not_found -> + raise(Error(No_member(id.name, "struct", m))) + +let find_union_member env (id, m) = + try + let ci = find_union env id in + find_member ci.ci_members m + with Not_found -> + raise(Error(No_member(id.name, "union", m))) + +let find_typedef env id = + try + IdentMap.find id env.env_typedef + with Not_found -> + raise(Error(Unbound_typedef(id.name))) + +(* Inserting things by source name, with generation of a translated name *) + +let enter_ident env s sto ty = + let id = fresh_ident s in + (id, + { env with env_ident = IdentMap.add id (II_ident(sto, ty)) env.env_ident }) + +let enter_composite env s ci = + let id = fresh_ident s in + (id, { env with env_tag = IdentMap.add id ci env.env_tag }) + +let enter_enum_item env s v = + let id = fresh_ident s in + (id, { env with env_ident = IdentMap.add id (II_enum v) env.env_ident }) + +let enter_typedef env s info = + let id = fresh_ident s in + (id, { env with env_typedef = IdentMap.add id info env.env_typedef }) + +(* Inserting things by translated name *) + +let add_ident env id sto ty = + { env with env_ident = IdentMap.add id (II_ident(sto, ty)) env.env_ident } + +let add_composite env id ci = + { env with env_tag = IdentMap.add id ci env.env_tag } + +let add_typedef env id info = + { env with env_typedef = IdentMap.add id info env.env_typedef } + +(* Error reporting *) + +open Printf + +let error_message = function + | Unbound_identifier name -> + sprintf "Unbound identifier '%s'" name + | Unbound_tag(name, kind) -> + sprintf "Unbound %s '%s'" kind name + | Tag_mismatch(name, expected, actual) -> + sprintf "'%s' was declared as a %s but is used as a %s" + name actual expected + | Unbound_typedef name -> + sprintf "Unbound typedef '%s'" name + | No_member(compname, compkind, memname) -> + sprintf "%s '%s' has no member named '%s'" + compkind compname memname diff --git a/cparser/Env.mli b/cparser/Env.mli new file mode 100644 index 0000000..e7a74af --- /dev/null +++ b/cparser/Env.mli @@ -0,0 +1,70 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +type error = + Unbound_identifier of string + | Unbound_tag of string * string + | Tag_mismatch of string * string * string + | Unbound_typedef of string + | No_member of string * string * string +val error_message : error -> string +exception Error of error + +val fresh_ident : string -> C.ident + +type composite_info = { + ci_kind: C.struct_or_union; + ci_members: C.field list; (* members, in order *) + ci_alignof: int option; (* alignment; None if incomplete *) + ci_sizeof: int option; (* size; None if incomplete *) +} + +type ident_info = II_ident of C.storage * C.typ | II_enum of int64 + +type typedef_info = C.typ + +type t + +val empty : t + +val new_scope : t -> t +val in_current_scope : t -> C.ident -> bool + +val lookup_ident : t -> string -> C.ident * ident_info +val lookup_tag : t -> string -> C.ident * composite_info +val lookup_struct : t -> string -> C.ident * composite_info +val lookup_union : t -> string -> C.ident * composite_info +val lookup_composite : t -> string -> (C.ident * composite_info) option +val lookup_typedef : t -> string -> C.ident * typedef_info + +val ident_is_bound : t -> string -> bool + +val find_ident : t -> C.ident -> ident_info +val find_tag : t -> C.ident -> composite_info +val find_struct : t -> C.ident -> composite_info +val find_union : t -> C.ident -> composite_info +val find_member : C.field list -> string -> C.field +val find_struct_member : t -> C.ident * string -> C.field +val find_union_member : t -> C.ident * string -> C.field +val find_typedef : t -> C.ident -> typedef_info + +val enter_ident : t -> string -> C.storage -> C.typ -> C.ident * t +val enter_composite : t -> string -> composite_info -> C.ident * t +val enter_enum_item : t -> string -> int64 -> C.ident * t +val enter_typedef : t -> string -> typedef_info -> C.ident * t + +val add_ident : t -> C.ident -> C.storage -> C.typ -> t +val add_composite : t -> C.ident -> composite_info -> t +val add_typedef : t -> C.ident -> typedef_info -> t diff --git a/cparser/Errors.ml b/cparser/Errors.ml new file mode 100644 index 0000000..188531e --- /dev/null +++ b/cparser/Errors.ml @@ -0,0 +1,55 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Management of errors and warnings *) + +open Format + +let warn_error = ref false + +let num_errors = ref 0 +let num_warnings = ref 0 + +let reset () = num_errors := 0; num_warnings := 0 + +exception Abort + +let fatal_error fmt = + incr num_errors; + kfprintf + (fun _ -> raise Abort) + err_formatter + ("@[" ^^ fmt ^^ ".@]@.@[Fatal error.@]@.") + +let error fmt = + incr num_errors; + eprintf ("@[" ^^ fmt ^^ ".@]@.") + +let warning fmt = + incr num_warnings; + eprintf ("@[" ^^ fmt ^^ ".@]@.") + +let check_errors () = + if !num_errors > 0 then + eprintf "@[%d error%s detected.@]@." + !num_errors + (if !num_errors = 1 then "" else "s"); + if !warn_error && !num_warnings > 0 then + eprintf "@[%d error-enabled warning%s detected.@]@." + !num_warnings + (if !num_warnings = 1 then "" else "s"); + !num_errors > 0 || (!warn_error && !num_warnings > 0) + + diff --git a/cparser/Errors.mli b/cparser/Errors.mli new file mode 100644 index 0000000..557fb14 --- /dev/null +++ b/cparser/Errors.mli @@ -0,0 +1,22 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val warn_error : bool ref +val reset : unit -> unit +exception Abort +val fatal_error : ('a, Format.formatter, unit, unit, unit, 'b) format6 -> 'a +val error : ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a +val warning : ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a +val check_errors : unit -> bool diff --git a/cparser/GCC.ml b/cparser/GCC.ml new file mode 100644 index 0000000..9f864dc --- /dev/null +++ b/cparser/GCC.ml @@ -0,0 +1,230 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* GCC built-ins *) + +open C +open Cutil + +(* Code adapted from CIL *) + +let voidType = TVoid [] +let charType = TInt(IChar, []) +let intType = TInt(IInt, []) +let uintType = TInt(IUInt, []) +let longType = TInt(ILong, []) +let ulongType = TInt(IULong, []) +let ulongLongType = TInt(IULongLong, []) +let floatType = TFloat(FFloat, []) +let doubleType = TFloat(FDouble, []) +let longDoubleType = TFloat (FLongDouble, []) +let voidPtrType = TPtr(TVoid [], []) +let voidConstPtrType = TPtr(TVoid [AConst], []) +let charPtrType = TPtr(TInt(IChar, []), []) +let charConstPtrType = TPtr(TInt(IChar, [AConst]), []) +let intPtrType = TPtr(TInt(IInt, []), []) +let sizeType = TInt(size_t_ikind, []) + +let builtins = { + Builtins.typedefs = [ + "__builtin_va_list", voidPtrType +]; + Builtins.functions = [ + "__builtin___fprintf_chk", (intType, [ voidPtrType; intType; charConstPtrType ], true) (* first argument is really FILE*, not void*, but we don't want to build in the definition for FILE *); + "__builtin___memcpy_chk", (voidPtrType, [ voidPtrType; voidConstPtrType; sizeType; sizeType ], false); + "__builtin___memmove_chk", (voidPtrType, [ voidPtrType; voidConstPtrType; sizeType; sizeType ], false); + "__builtin___mempcpy_chk", (voidPtrType, [ voidPtrType; voidConstPtrType; sizeType; sizeType ], false); + "__builtin___memset_chk", (voidPtrType, [ voidPtrType; intType; sizeType; sizeType ], false); + "__builtin___printf_chk", (intType, [ intType; charConstPtrType ], true); + "__builtin___snprintf_chk", (intType, [ charPtrType; sizeType; intType; sizeType; charConstPtrType ], true); + "__builtin___sprintf_chk", (intType, [ charPtrType; intType; sizeType; charConstPtrType ], true); + "__builtin___stpcpy_chk", (charPtrType, [ charPtrType; charConstPtrType; sizeType ], false); + "__builtin___strcat_chk", (charPtrType, [ charPtrType; charConstPtrType; sizeType ], false); + "__builtin___strcpy_chk", (charPtrType, [ charPtrType; charConstPtrType; sizeType ], false); + "__builtin___strncat_chk", (charPtrType, [ charPtrType; charConstPtrType; sizeType; sizeType ], false); + "__builtin___strncpy_chk", (charPtrType, [ charPtrType; charConstPtrType; sizeType; sizeType ], false); + "__builtin___vfprintf_chk", (intType, [ voidPtrType; intType; charConstPtrType; voidPtrType ], false) (* first argument is really FILE*, not void*, but we don't want to build in the definition for FILE *); + "__builtin___vprintf_chk", (intType, [ intType; charConstPtrType; voidPtrType ], false); + "__builtin___vsnprintf_chk", (intType, [ charPtrType; sizeType; intType; sizeType; charConstPtrType; voidPtrType ], false); + "__builtin___vsprintf_chk", (intType, [ charPtrType; intType; sizeType; charConstPtrType; voidPtrType ], false); + + "__builtin_acos", (doubleType, [ doubleType ], false); + "__builtin_acosf", (floatType, [ floatType ], false); + "__builtin_acosl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_alloca", (voidPtrType, [ uintType ], false); + + "__builtin_asin", (doubleType, [ doubleType ], false); + "__builtin_asinf", (floatType, [ floatType ], false); + "__builtin_asinl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_atan", (doubleType, [ doubleType ], false); + "__builtin_atanf", (floatType, [ floatType ], false); + "__builtin_atanl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_atan2", (doubleType, [ doubleType; doubleType ], false); + "__builtin_atan2f", (floatType, [ floatType; floatType ], false); + "__builtin_atan2l", (longDoubleType, [ longDoubleType; + longDoubleType ], false); + + "__builtin_ceil", (doubleType, [ doubleType ], false); + "__builtin_ceilf", (floatType, [ floatType ], false); + "__builtin_ceill", (longDoubleType, [ longDoubleType ], false); + + "__builtin_cos", (doubleType, [ doubleType ], false); + "__builtin_cosf", (floatType, [ floatType ], false); + "__builtin_cosl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_cosh", (doubleType, [ doubleType ], false); + "__builtin_coshf", (floatType, [ floatType ], false); + "__builtin_coshl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_clz", (intType, [ uintType ], false); + "__builtin_clzl", (intType, [ ulongType ], false); + "__builtin_clzll", (intType, [ ulongLongType ], false); + "__builtin_constant_p", (intType, [ intType ], false); + "__builtin_ctz", (intType, [ uintType ], false); + "__builtin_ctzl", (intType, [ ulongType ], false); + "__builtin_ctzll", (intType, [ ulongLongType ], false); + + "__builtin_exp", (doubleType, [ doubleType ], false); + "__builtin_expf", (floatType, [ floatType ], false); + "__builtin_expl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_expect", (longType, [ longType; longType ], false); + + "__builtin_fabs", (doubleType, [ doubleType ], false); + "__builtin_fabsf", (floatType, [ floatType ], false); + "__builtin_fabsl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_ffs", (intType, [ uintType ], false); + "__builtin_ffsl", (intType, [ ulongType ], false); + "__builtin_ffsll", (intType, [ ulongLongType ], false); + "__builtin_frame_address", (voidPtrType, [ uintType ], false); + + "__builtin_floor", (doubleType, [ doubleType ], false); + "__builtin_floorf", (floatType, [ floatType ], false); + "__builtin_floorl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_huge_val", (doubleType, [], false); + "__builtin_huge_valf", (floatType, [], false); + "__builtin_huge_vall", (longDoubleType, [], false); + "__builtin_inf", (doubleType, [], false); + "__builtin_inff", (floatType, [], false); + "__builtin_infl", (longDoubleType, [], false); + "__builtin_memcpy", (voidPtrType, [ voidPtrType; voidConstPtrType; uintType ], false); + "__builtin_mempcpy", (voidPtrType, [ voidPtrType; voidConstPtrType; sizeType ], false); + + "__builtin_fmod", (doubleType, [ doubleType ], false); + "__builtin_fmodf", (floatType, [ floatType ], false); + "__builtin_fmodl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_frexp", (doubleType, [ doubleType; intPtrType ], false); + "__builtin_frexpf", (floatType, [ floatType; intPtrType ], false); + "__builtin_frexpl", (longDoubleType, [ longDoubleType; + intPtrType ], false); + + "__builtin_ldexp", (doubleType, [ doubleType; intType ], false); + "__builtin_ldexpf", (floatType, [ floatType; intType ], false); + "__builtin_ldexpl", (longDoubleType, [ longDoubleType; + intType ], false); + + "__builtin_log", (doubleType, [ doubleType ], false); + "__builtin_logf", (floatType, [ floatType ], false); + "__builtin_logl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_log10", (doubleType, [ doubleType ], false); + "__builtin_log10f", (floatType, [ floatType ], false); + "__builtin_log10l", (longDoubleType, [ longDoubleType ], false); + + "__builtin_modff", (floatType, [ floatType; + TPtr(floatType,[]) ], false); + "__builtin_modfl", (longDoubleType, [ longDoubleType; + TPtr(longDoubleType, []) ], + false); + + "__builtin_nan", (doubleType, [ charConstPtrType ], false); + "__builtin_nanf", (floatType, [ charConstPtrType ], false); + "__builtin_nanl", (longDoubleType, [ charConstPtrType ], false); + "__builtin_nans", (doubleType, [ charConstPtrType ], false); + "__builtin_nansf", (floatType, [ charConstPtrType ], false); + "__builtin_nansl", (longDoubleType, [ charConstPtrType ], false); + "__builtin_next_arg", (voidPtrType, [], false); + "__builtin_object_size", (sizeType, [ voidPtrType; intType ], false); + + "__builtin_parity", (intType, [ uintType ], false); + "__builtin_parityl", (intType, [ ulongType ], false); + "__builtin_parityll", (intType, [ ulongLongType ], false); + + "__builtin_popcount", (intType, [ uintType ], false); + "__builtin_popcountl", (intType, [ ulongType ], false); + "__builtin_popcountll", (intType, [ ulongLongType ], false); + + "__builtin_powi", (doubleType, [ doubleType; intType ], false); + "__builtin_powif", (floatType, [ floatType; intType ], false); + "__builtin_powil", (longDoubleType, [ longDoubleType; intType ], false); + "__builtin_prefetch", (voidType, [ voidConstPtrType ], true); + "__builtin_return", (voidType, [ voidConstPtrType ], false); + "__builtin_return_address", (voidPtrType, [ uintType ], false); + + "__builtin_sin", (doubleType, [ doubleType ], false); + "__builtin_sinf", (floatType, [ floatType ], false); + "__builtin_sinl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_sinh", (doubleType, [ doubleType ], false); + "__builtin_sinhf", (floatType, [ floatType ], false); + "__builtin_sinhl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_sqrt", (doubleType, [ doubleType ], false); + "__builtin_sqrtf", (floatType, [ floatType ], false); + "__builtin_sqrtl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_stpcpy", (charPtrType, [ charPtrType; charConstPtrType ], false); + "__builtin_strchr", (charPtrType, [ charPtrType; charType ], false); + "__builtin_strcmp", (intType, [ charConstPtrType; charConstPtrType ], false); + "__builtin_strcpy", (charPtrType, [ charPtrType; charConstPtrType ], false); + "__builtin_strcspn", (uintType, [ charConstPtrType; charConstPtrType ], false); + "__builtin_strncat", (charPtrType, [ charPtrType; charConstPtrType; sizeType ], false); + "__builtin_strncmp", (intType, [ charConstPtrType; charConstPtrType; sizeType ], false); + "__builtin_strncpy", (charPtrType, [ charPtrType; charConstPtrType; sizeType ], false); + "__builtin_strspn", (intType, [ charConstPtrType; charConstPtrType ], false); + "__builtin_strpbrk", (charPtrType, [ charConstPtrType; charConstPtrType ], false); + (* When we parse builtin_types_compatible_p, we change its interface *) + "__builtin_types_compatible_p", + (intType, [ uintType; (* Sizeof the type *) + uintType (* Sizeof the type *) ], + false); + "__builtin_tan", (doubleType, [ doubleType ], false); + "__builtin_tanf", (floatType, [ floatType ], false); + "__builtin_tanl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_tanh", (doubleType, [ doubleType ], false); + "__builtin_tanhf", (floatType, [ floatType ], false); + "__builtin_tanhl", (longDoubleType, [ longDoubleType ], false); + + "__builtin_va_end", (voidType, [ voidPtrType ], false); + "__builtin_varargs_start", + (voidType, [ voidPtrType ], false); + (* When we elaborate builtin_stdarg_start/builtin_va_start, + second argument is passed by address *) + "__builtin_va_start", (voidType, [ voidPtrType; voidPtrType ], false); + "__builtin_stdarg_start", (voidType, [ voidPtrType ], false); + (* When we parse builtin_va_arg, type argument becomes sizeof type *) + "__builtin_va_arg", (voidType, [ voidPtrType; sizeType ], false); + "__builtin_va_copy", (voidType, [ voidPtrType; + voidPtrType ], + false) +] +} diff --git a/cparser/GCC.mli b/cparser/GCC.mli new file mode 100644 index 0000000..76f4037 --- /dev/null +++ b/cparser/GCC.mli @@ -0,0 +1,18 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* GCC built-ins *) + +val builtins: Builtins.t diff --git a/cparser/Lexer.mli b/cparser/Lexer.mli new file mode 100644 index 0000000..5238c54 --- /dev/null +++ b/cparser/Lexer.mli @@ -0,0 +1,56 @@ +(* + * + * Copyright (c) 2001-2002, + * George C. Necula + * Scott McPeak + * Wes Weimer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The names of the contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + + +(* This interface is generated manually. The corresponding .ml file is + * generated automatically and is placed in ../obj/clexer.ml. The reason we + * want this interface is to avoid confusing make with freshly generated + * interface files *) + + +val init: Lexing.lexbuf -> Lexing.lexbuf +val finish: unit -> unit + +(* This is the main parser function *) +val initial: Lexing.lexbuf -> Parser.token + + +val push_context: unit -> unit (* Start a context *) +val add_type: string -> unit (* Add a new string as a type name *) +val add_identifier: string -> unit (* Add a new string as a variable name *) +val pop_context: unit -> unit (* Remove all names added in this context *) + diff --git a/cparser/Lexer.mll b/cparser/Lexer.mll new file mode 100644 index 0000000..f7809e7 --- /dev/null +++ b/cparser/Lexer.mll @@ -0,0 +1,604 @@ +(* + * + * Copyright (c) 2001-2003, + * George C. Necula + * Scott McPeak + * Wes Weimer + * Ben Liblit + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The names of the contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) +(* FrontC -- lexical analyzer +** +** 1.0 3.22.99 Hugues Cassé First version. +** 2.0 George Necula 12/12/00: Many extensions +*) +{ +open Lexing +open Parse_aux +open Parser + +exception Eof + +module H = Hashtbl + +let newline lb = + let cp = lb.lex_curr_p in + lb.lex_curr_p <- { cp with pos_lnum = 1 + cp.pos_lnum } + +let setCurrentLine lb lineno = + let cp = lb.lex_curr_p in + lb.lex_curr_p <- { cp with pos_lnum = lineno } + +let setCurrentFile lb file = + let cp = lb.lex_curr_p in + lb.lex_curr_p <- { cp with pos_fname = file } + +let matchingParsOpen = ref 0 + +let currentLoc = Cabshelper.currentLoc_lexbuf + +let int64_to_char value = + assert (value <= 255L && value >= 0L); + Char.chr (Int64.to_int value) + +(* takes a not-nul-terminated list, and converts it to a string. *) +let rec intlist_to_string (str: int64 list):string = + match str with + [] -> "" (* add nul-termination *) + | value::rest -> + let this_char = int64_to_char value in + (String.make 1 this_char) ^ (intlist_to_string rest) + +(* +** Keyword hashtable +*) +let lexicon = H.create 211 +let init_lexicon _ = + H.clear lexicon; + List.iter + (fun (key, builder) -> H.add lexicon key builder) + [ ("_Bool", fun loc -> UNDERSCORE_BOOL loc); + ("auto", fun loc -> AUTO loc); + ("const", fun loc -> CONST loc); + ("__const", fun loc -> CONST loc); + ("__const__", fun loc -> CONST loc); + ("static", fun loc -> STATIC loc); + ("extern", fun loc -> EXTERN loc); + ("long", fun loc -> LONG loc); + ("short", fun loc -> SHORT loc); + ("register", fun loc -> REGISTER loc); + ("signed", fun loc -> SIGNED loc); + ("__signed", fun loc -> SIGNED loc); + ("unsigned", fun loc -> UNSIGNED loc); + ("volatile", fun loc -> VOLATILE loc); + ("__volatile", fun loc -> VOLATILE loc); + (* WW: see /usr/include/sys/cdefs.h for why __signed and __volatile + * are accepted GCC-isms *) + ("char", fun loc -> CHAR loc); + ("int", fun loc -> INT loc); + ("float", fun loc -> FLOAT loc); + ("double", fun loc -> DOUBLE loc); + ("void", fun loc -> VOID loc); + ("enum", fun loc -> ENUM loc); + ("struct", fun loc -> STRUCT loc); + ("typedef", fun loc -> TYPEDEF loc); + ("union", fun loc -> UNION loc); + ("break", fun loc -> BREAK loc); + ("continue", fun loc -> CONTINUE loc); + ("goto", fun loc -> GOTO loc); + ("return", fun loc -> RETURN loc); + ("switch", fun loc -> SWITCH loc); + ("case", fun loc -> CASE loc); + ("default", fun loc -> DEFAULT loc); + ("while", fun loc -> WHILE loc); + ("do", fun loc -> DO loc); + ("for", fun loc -> FOR loc); + ("if", fun loc -> IF loc); + ("else", fun _ -> ELSE); + (*** Implementation specific keywords ***) + ("__signed__", fun loc -> SIGNED loc); + ("__inline__", fun loc -> INLINE loc); + ("inline", fun loc -> INLINE loc); + ("__inline", fun loc -> INLINE loc); + ("_inline", fun loc -> + if !msvcMode then + INLINE loc + else + IDENT ("_inline", loc)); + ("__attribute__", fun loc -> ATTRIBUTE loc); + ("__attribute", fun loc -> ATTRIBUTE loc); +(* + ("__attribute_used__", fun loc -> ATTRIBUTE_USED loc); +*) + ("__blockattribute__", fun _ -> BLOCKATTRIBUTE); + ("__blockattribute", fun _ -> BLOCKATTRIBUTE); + ("__asm__", fun loc -> ASM loc); + ("asm", fun loc -> ASM loc); + ("__typeof__", fun loc -> TYPEOF loc); + ("__typeof", fun loc -> TYPEOF loc); + ("typeof", fun loc -> TYPEOF loc); + ("__alignof", fun loc -> ALIGNOF loc); + ("__alignof__", fun loc -> ALIGNOF loc); + ("__volatile__", fun loc -> VOLATILE loc); + ("__volatile", fun loc -> VOLATILE loc); + + ("__FUNCTION__", fun loc -> FUNCTION__ loc); + ("__func__", fun loc -> FUNCTION__ loc); (* ISO 6.4.2.2 *) + ("__PRETTY_FUNCTION__", fun loc -> PRETTY_FUNCTION__ loc); + ("__label__", fun _ -> LABEL__); + (*** weimer: GCC arcana ***) + ("__restrict", fun loc -> RESTRICT loc); + ("restrict", fun loc -> RESTRICT loc); +(* ("__extension__", EXTENSION); *) + (**** MS VC ***) + ("__int64", fun loc -> INT64 loc); + ("__int32", fun loc -> INT loc); + ("_cdecl", fun loc -> MSATTR ("_cdecl", loc)); + ("__cdecl", fun loc -> MSATTR ("__cdecl", loc)); + ("_stdcall", fun loc -> MSATTR ("_stdcall", loc)); + ("__stdcall", fun loc -> MSATTR ("__stdcall", loc)); + ("_fastcall", fun loc -> MSATTR ("_fastcall", loc)); + ("__fastcall", fun loc -> MSATTR ("__fastcall", loc)); + ("__w64", fun loc -> MSATTR("__w64", loc)); + ("__declspec", fun loc -> DECLSPEC loc); + ("__forceinline", fun loc -> INLINE loc); (* !! we turn forceinline + * into inline *) + ("__try", fun loc -> TRY loc); + ("__except", fun loc -> EXCEPT loc); + ("__finally", fun loc -> FINALLY loc); + (* weimer: some files produced by 'GCC -E' expect this type to be + * defined *) + ("__builtin_va_list", fun loc -> NAMED_TYPE ("__builtin_va_list", loc)); + ("__builtin_va_arg", fun loc -> BUILTIN_VA_ARG loc); + ("__builtin_types_compatible_p", fun loc -> BUILTIN_TYPES_COMPAT loc); + ("__builtin_offsetof", fun loc -> BUILTIN_OFFSETOF loc); + (* On some versions of GCC __thread is a regular identifier *) + ("__thread", fun loc -> THREAD loc) + ] + +(* Mark an identifier as a type name. The old mapping is preserved and will + * be reinstated when we exit this context *) +let add_type name = + (* ignore (print_string ("adding type name " ^ name ^ "\n")); *) + H.add lexicon name (fun loc -> NAMED_TYPE (name, loc)) + +let context : string list list ref = ref [] + +let push_context _ = context := []::!context + +let pop_context _ = + match !context with + [] -> assert false + | con::sub -> + (context := sub; + List.iter (fun name -> + (* ignore (print_string ("removing lexicon for " ^ name ^ "\n")); *) + H.remove lexicon name) con) + +(* Mark an identifier as a variable name. The old mapping is preserved and + * will be reinstated when we exit this context *) +let add_identifier name = + match !context with + [] -> () (* Just ignore raise (InternalError "Empty context stack") *) + | con::sub -> + context := (name::con)::sub; + H.add lexicon name (fun loc -> IDENT (name, loc)) + + +(* +** Useful primitives +*) +let scan_ident lb id = + let here = currentLoc lb in + try (H.find lexicon id) here + (* default to variable name, as opposed to type *) + with Not_found -> IDENT (id, here) + + +(* +** Buffer processor +*) + + +let init source = + init_lexicon (); + (* Inititialize the pointer in Errormsg *) + Parse_aux.add_type := add_type; + Parse_aux.push_context := push_context; + Parse_aux.pop_context := pop_context; + Parse_aux.add_identifier := add_identifier; + (* Build lexbuf *) + let lb = source in + let cp = lb.lex_curr_p in + lb.lex_curr_p <- {cp with pos_lnum = 1}; + lb + +let finish () = + () + +(*** Error handling ***) +let error = parse_error + + +(*** escape character management ***) +let scan_escape (char: char) : int64 = + let result = match char with + 'n' -> '\n' + | 'r' -> '\r' + | 't' -> '\t' + | 'b' -> '\b' + | 'f' -> '\012' (* ASCII code 12 *) + | 'v' -> '\011' (* ASCII code 11 *) + | 'a' -> '\007' (* ASCII code 7 *) + | 'e' | 'E' -> '\027' (* ASCII code 27. This is a GCC extension *) + | '\'' -> '\'' + | '"'-> '"' (* '"' *) + | '?' -> '?' + | '(' when not !msvcMode -> '(' + | '{' when not !msvcMode -> '{' + | '[' when not !msvcMode -> '[' + | '%' when not !msvcMode -> '%' + | '\\' -> '\\' + | other -> error ("Unrecognized escape sequence: \\" ^ (String.make 1 other)); raise Parsing.Parse_error + in + Int64.of_int (Char.code result) + +let scan_hex_escape str = + let radix = Int64.of_int 16 in + let the_value = ref Int64.zero in + (* start at character 2 to skip the \x *) + for i = 2 to (String.length str) - 1 do + let thisDigit = Cabshelper.valueOfDigit (String.get str i) in + (* the_value := !the_value * 16 + thisDigit *) + the_value := Int64.add (Int64.mul !the_value radix) thisDigit + done; + !the_value + +let scan_oct_escape str = + let radix = Int64.of_int 8 in + let the_value = ref Int64.zero in + (* start at character 1 to skip the \x *) + for i = 1 to (String.length str) - 1 do + let thisDigit = Cabshelper.valueOfDigit (String.get str i) in + (* the_value := !the_value * 8 + thisDigit *) + the_value := Int64.add (Int64.mul !the_value radix) thisDigit + done; + !the_value + +let lex_hex_escape remainder lexbuf = + let prefix = scan_hex_escape (Lexing.lexeme lexbuf) in + prefix :: remainder lexbuf + +let lex_oct_escape remainder lexbuf = + let prefix = scan_oct_escape (Lexing.lexeme lexbuf) in + prefix :: remainder lexbuf + +let lex_simple_escape remainder lexbuf = + let lexchar = Lexing.lexeme_char lexbuf 1 in + let prefix = scan_escape lexchar in + prefix :: remainder lexbuf + +let lex_unescaped remainder lexbuf = + let prefix = Int64.of_int (Char.code (Lexing.lexeme_char lexbuf 0)) in + prefix :: remainder lexbuf + +let lex_comment remainder lexbuf = + let ch = Lexing.lexeme_char lexbuf 0 in + let prefix = Int64.of_int (Char.code ch) in + if ch = '\n' then newline lexbuf; + prefix :: remainder lexbuf + +let make_char (i:int64):char = + let min_val = Int64.zero in + let max_val = Int64.of_int 255 in + (* if i < 0 || i > 255 then error*) + if compare i min_val < 0 || compare i max_val > 0 then begin + let msg = Printf.sprintf "clexer:make_char: character 0x%Lx too big" i in + error msg + end; + Char.chr (Int64.to_int i) + + +(* ISO standard locale-specific function to convert a wide character + * into a sequence of normal characters. Here we work on strings. + * We convert L"Hi" to "H\000i\000" + matth: this seems unused. +let wbtowc wstr = + let len = String.length wstr in + let dest = String.make (len * 2) '\000' in + for i = 0 to len-1 do + dest.[i*2] <- wstr.[i] ; + done ; + dest +*) + +(* This function converst the "Hi" in L"Hi" to { L'H', L'i', L'\0' } + matth: this seems unused. +let wstr_to_warray wstr = + let len = String.length wstr in + let res = ref "{ " in + for i = 0 to len-1 do + res := !res ^ (Printf.sprintf "L'%c', " wstr.[i]) + done ; + res := !res ^ "}" ; + !res +*) + +} + +let decdigit = ['0'-'9'] +let octdigit = ['0'-'7'] +let hexdigit = ['0'-'9' 'a'-'f' 'A'-'F'] +let letter = ['a'- 'z' 'A'-'Z'] + + +let usuffix = ['u' 'U'] +let lsuffix = "l"|"L"|"ll"|"LL" +let intsuffix = lsuffix | usuffix | usuffix lsuffix | lsuffix usuffix + | usuffix ? "i64" + + +let hexprefix = '0' ['x' 'X'] + +let intnum = decdigit+ intsuffix? +let octnum = '0' octdigit+ intsuffix? +let hexnum = hexprefix hexdigit+ intsuffix? + +let exponent = ['e' 'E']['+' '-']? decdigit+ +let fraction = '.' decdigit+ +let decfloat = (intnum? fraction) + |(intnum exponent) + |(intnum? fraction exponent) + | (intnum '.') + | (intnum '.' exponent) + +let hexfraction = hexdigit* '.' hexdigit+ | hexdigit+ +let binexponent = ['p' 'P'] ['+' '-']? decdigit+ +let hexfloat = hexprefix hexfraction binexponent + | hexprefix hexdigit+ binexponent + +let floatsuffix = ['f' 'F' 'l' 'L'] +let floatnum = (decfloat | hexfloat) floatsuffix? + +let ident = (letter|'_'|'$')(letter|decdigit|'_'|'$')* +let blank = [' ' '\t' '\012' '\r']+ +let escape = '\\' _ +let hex_escape = '\\' ['x' 'X'] hexdigit+ +let oct_escape = '\\' octdigit octdigit? octdigit? + +rule initial = + parse "/*" { comment lexbuf; + initial lexbuf} +| "//" { onelinecomment lexbuf; + newline lexbuf; + initial lexbuf + } +| blank { initial lexbuf} +| '\n' { newline lexbuf; + initial lexbuf } +| '\\' '\r' * '\n' { newline lexbuf; + initial lexbuf + } +| '#' { hash lexbuf} +(* +| "_Pragma" { PRAGMA (currentLoc lexbuf) } +*) +| '\'' { CST_CHAR (chr lexbuf, currentLoc lexbuf)} +| "L'" { CST_WCHAR (chr lexbuf, currentLoc lexbuf) } +| '"' { (* '"' *) +(* matth: BUG: this could be either a regular string or a wide string. + * e.g. if it's the "world" in + * L"Hello, " "world" + * then it should be treated as wide even though there's no L immediately + * preceding it. See test/small1/wchar5.c for a failure case. *) + CST_STRING (str lexbuf, currentLoc lexbuf) } +| "L\"" { (* weimer: wchar_t string literal *) + CST_WSTRING(str lexbuf, currentLoc lexbuf) } +| floatnum {CST_FLOAT (Lexing.lexeme lexbuf, currentLoc lexbuf)} +| hexnum {CST_INT (Lexing.lexeme lexbuf, currentLoc lexbuf)} +| octnum {CST_INT (Lexing.lexeme lexbuf, currentLoc lexbuf)} +| intnum {CST_INT (Lexing.lexeme lexbuf, currentLoc lexbuf)} +| "!quit!" {EOF} +| "..." {ELLIPSIS} +| "+=" {PLUS_EQ} +| "-=" {MINUS_EQ} +| "*=" {STAR_EQ} +| "/=" {SLASH_EQ} +| "%=" {PERCENT_EQ} +| "|=" {PIPE_EQ} +| "&=" {AND_EQ} +| "^=" {CIRC_EQ} +| "<<=" {INF_INF_EQ} +| ">>=" {SUP_SUP_EQ} +| "<<" {INF_INF} +| ">>" {SUP_SUP} +| "==" {EQ_EQ} +| "!=" {EXCLAM_EQ} +| "<=" {INF_EQ} +| ">=" {SUP_EQ} +| "=" {EQ} +| "<" {INF} +| ">" {SUP} +| "++" {PLUS_PLUS (currentLoc lexbuf)} +| "--" {MINUS_MINUS (currentLoc lexbuf)} +| "->" {ARROW} +| '+' {PLUS (currentLoc lexbuf)} +| '-' {MINUS (currentLoc lexbuf)} +| '*' {STAR (currentLoc lexbuf)} +| '/' {SLASH} +| '%' {PERCENT} +| '!' {EXCLAM (currentLoc lexbuf)} +| "&&" {AND_AND (currentLoc lexbuf)} +| "||" {PIPE_PIPE} +| '&' {AND (currentLoc lexbuf)} +| '|' {PIPE} +| '^' {CIRC} +| '?' {QUEST} +| ':' {COLON} +| '~' {TILDE (currentLoc lexbuf)} + +| '{' {LBRACE (currentLoc lexbuf)} +| '}' {RBRACE (currentLoc lexbuf)} +| '[' {LBRACKET} +| ']' {RBRACKET} +| '(' { (LPAREN (currentLoc lexbuf)) } +| ')' {RPAREN} +| ';' { (SEMICOLON (currentLoc lexbuf)) } +| ',' {COMMA} +| '.' {DOT} +| "sizeof" {SIZEOF (currentLoc lexbuf)} +| "__asm" { if !msvcMode then + MSASM (msasm lexbuf, currentLoc lexbuf) + else (ASM (currentLoc lexbuf)) } + +(* If we see __pragma we eat it and the matching parentheses as well *) +| "__pragma" { matchingParsOpen := 0; + let _ = matchingpars lexbuf in + initial lexbuf + } + +(* __extension__ is a black. The parser runs into some conflicts if we let it + * pass *) +| "__extension__" {initial lexbuf } +| ident {scan_ident lexbuf (Lexing.lexeme lexbuf)} +| eof {EOF} +| _ {parse_error "Invalid symbol"; raise Parsing.Parse_error } +and comment = + parse + "*/" { () } +| eof { () } +| '\n' { newline lexbuf; comment lexbuf } +| _ { comment lexbuf } + + +and onelinecomment = parse + '\n'|eof { () } +| _ { onelinecomment lexbuf } + +and matchingpars = parse + '\n' { newline lexbuf; matchingpars lexbuf } +| blank { matchingpars lexbuf } +| '(' { incr matchingParsOpen; matchingpars lexbuf } +| ')' { decr matchingParsOpen; + if !matchingParsOpen = 0 then + () + else + matchingpars lexbuf + } +| "/*" { comment lexbuf; matchingpars lexbuf} +| '"' { (* '"' *) + let _ = str lexbuf in + matchingpars lexbuf + } +| _ { matchingpars lexbuf } + +(* # ... *) +and hash = parse + '\n' { newline lexbuf; initial lexbuf} +| blank { hash lexbuf} +| intnum { (* We are seeing a line number. This is the number for the + * next line *) + let s = Lexing.lexeme lexbuf in + begin try + setCurrentLine lexbuf (int_of_string s - 1) + with Failure ("int_of_string") -> + (* the int is too big. *) + () + end; + (* A file name may follow *) + file lexbuf } +| "line" { hash lexbuf } (* MSVC line number info *) +| "pragma" blank + { let here = currentLoc lexbuf in + PRAGMA_LINE (pragma lexbuf, here) + } +| _ { endline lexbuf} + +and file = parse + '\n' { newline lexbuf; initial lexbuf} +| blank { file lexbuf} +| '"' [^ '\012' '\t' '"']* '"' { (* '"' *) + let n = Lexing.lexeme lexbuf in + let n1 = String.sub n 1 + ((String.length n) - 2) in + setCurrentFile lexbuf n1; + endline lexbuf} + +| _ { endline lexbuf} + +and endline = parse + '\n' { newline lexbuf; initial lexbuf} +| eof { EOF } +| _ { endline lexbuf} + +and pragma = parse + '\n' { newline lexbuf; "" } +| _ { let cur = Lexing.lexeme lexbuf in + cur ^ (pragma lexbuf) } + +and str = parse + '"' {[]} (* no nul terminiation in CST_STRING '"' *) +| hex_escape { lex_hex_escape str lexbuf} +| oct_escape { lex_oct_escape str lexbuf} +| escape { lex_simple_escape str lexbuf} +| _ { lex_unescaped str lexbuf} + +and chr = parse + '\'' {[]} +| hex_escape {lex_hex_escape chr lexbuf} +| oct_escape {lex_oct_escape chr lexbuf} +| escape {lex_simple_escape chr lexbuf} +| _ {lex_unescaped chr lexbuf} + +and msasm = parse + blank { msasm lexbuf } +| '{' { msasminbrace lexbuf } +| _ { let cur = Lexing.lexeme lexbuf in + cur ^ (msasmnobrace lexbuf) } + +and msasminbrace = parse + '}' { "" } +| _ { let cur = Lexing.lexeme lexbuf in + cur ^ (msasminbrace lexbuf) } +and msasmnobrace = parse + ['}' ';' '\n'] { lexbuf.Lexing.lex_curr_pos <- + lexbuf.Lexing.lex_curr_pos - 1; + "" } +| "__asm" { lexbuf.Lexing.lex_curr_pos <- + lexbuf.Lexing.lex_curr_pos - 5; + "" } +| _ { let cur = Lexing.lexeme lexbuf in + + cur ^ (msasmnobrace lexbuf) } + +{ + +} diff --git a/cparser/Machine.ml b/cparser/Machine.ml new file mode 100644 index 0000000..3783712 --- /dev/null +++ b/cparser/Machine.ml @@ -0,0 +1,136 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Machine-dependent aspects *) + +type t = { + char_signed: bool; + sizeof_ptr: int; + sizeof_short: int; + sizeof_int: int; + sizeof_long: int; + sizeof_longlong: int; + sizeof_float: int; + sizeof_double: int; + sizeof_longdouble: int; + sizeof_void: int option; + sizeof_fun: int option; + sizeof_wchar: int; + sizeof_size_t: int; + sizeof_ptrdiff_t: int; + alignof_ptr: int; + alignof_short: int; + alignof_int: int; + alignof_long: int; + alignof_longlong: int; + alignof_float: int; + alignof_double: int; + alignof_longdouble: int; + alignof_void: int option; + alignof_fun: int option +} + +let ilp32ll64 = { + char_signed = false; + sizeof_ptr = 4; + sizeof_short = 2; + sizeof_int = 4; + sizeof_long = 4; + sizeof_longlong = 8; + sizeof_float = 4; + sizeof_double = 8; + sizeof_longdouble = 16; + sizeof_void = None; + sizeof_fun = None; + sizeof_wchar = 4; + sizeof_size_t = 4; + sizeof_ptrdiff_t = 4; + alignof_ptr = 4; + alignof_short = 2; + alignof_int = 4; + alignof_long = 4; + alignof_longlong = 8; + alignof_float = 4; + alignof_double = 8; + alignof_longdouble = 16; + alignof_void = None; + alignof_fun = None +} + +let i32lpll64 = { + char_signed = false; + sizeof_ptr = 8; + sizeof_short = 2; + sizeof_int = 4; + sizeof_long = 8; + sizeof_longlong = 8; + sizeof_float = 4; + sizeof_double = 8; + sizeof_longdouble = 16; + sizeof_void = None; + sizeof_fun = None; + sizeof_wchar = 4; + sizeof_size_t = 8; + sizeof_ptrdiff_t = 8; + alignof_ptr = 8; + alignof_short = 2; + alignof_int = 4; + alignof_long = 8; + alignof_longlong = 8; + alignof_float = 4; + alignof_double = 8; + alignof_longdouble = 16; + alignof_void = None; + alignof_fun = None +} + +let il32pll64 = { + char_signed = false; + sizeof_ptr = 8; + sizeof_short = 2; + sizeof_int = 4; + sizeof_long = 4; + sizeof_longlong = 8; + sizeof_float = 4; + sizeof_double = 8; + sizeof_longdouble = 16; + sizeof_void = None; + sizeof_fun = None; + sizeof_wchar = 4; + sizeof_size_t = 8; + sizeof_ptrdiff_t = 8; + alignof_ptr = 8; + alignof_short = 2; + alignof_int = 4; + alignof_long = 4; + alignof_longlong = 8; + alignof_float = 4; + alignof_double = 8; + alignof_longdouble = 16; + alignof_void = None; + alignof_fun = None +} + +let make_char_signed c = {c with char_signed = true} + +let gcc_extensions c = + { c with sizeof_void = Some 1; sizeof_fun = Some 1; + alignof_void = Some 1; alignof_fun = Some 1 } + +let config = + ref (match Sys.word_size with + | 32 -> ilp32ll64 + | 64 -> if Sys.os_type = "Win32" then il32pll64 else i32lpll64 + | _ -> assert false) diff --git a/cparser/Machine.mli b/cparser/Machine.mli new file mode 100644 index 0000000..bd3f357 --- /dev/null +++ b/cparser/Machine.mli @@ -0,0 +1,51 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Machine-dependent aspects *) + +type t = { + char_signed: bool; + sizeof_ptr: int; + sizeof_short: int; + sizeof_int: int; + sizeof_long: int; + sizeof_longlong: int; + sizeof_float: int; + sizeof_double: int; + sizeof_longdouble: int; + sizeof_void: int option; + sizeof_fun: int option; + sizeof_wchar: int; + sizeof_size_t: int; + sizeof_ptrdiff_t: int; + alignof_ptr: int; + alignof_short: int; + alignof_int: int; + alignof_long: int; + alignof_longlong: int; + alignof_float: int; + alignof_double: int; + alignof_longdouble: int; + alignof_void: int option; + alignof_fun: int option +} + +val ilp32ll64 : t +val i32lpll64 : t +val il32pll64 : t +val make_char_signed : t -> t +val gcc_extensions : t -> t + +val config : t ref diff --git a/cparser/Main.ml b/cparser/Main.ml new file mode 100644 index 0000000..49b8659 --- /dev/null +++ b/cparser/Main.ml @@ -0,0 +1,89 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Wrapper around gcc to parse, transform, pretty-print, and call gcc on result *) + +let transfs = ref "" + +let safe_remove name = + try Sys.remove name with Sys_error _ -> () + +let process_c_file prepro_opts name = + let ppname = Filename.temp_file "cparser" ".i" in + let cpname = Filename.chop_suffix name ".c" ^ ".i" in + let rc = + Sys.command + (Printf.sprintf "gcc -E -U__GNUC__ %s %s > %s" + (String.concat " " (List.map Filename.quote prepro_opts)) + (Filename.quote name) (Filename.quote ppname)) in + if rc <> 0 then begin + safe_remove ppname; + exit 2 + end; + let ic = open_in ppname in + let lexbuf = Lexing.from_channel ic in + lexbuf.Lexing.lex_curr_p <- { lexbuf.Lexing.lex_curr_p with Lexing.pos_fname = ppname }; + let r = Parse.preprocessed_file !transfs name lexbuf in + close_in ic; + safe_remove ppname; + match r with + | None -> exit 2 + | Some p -> + let oc = open_out cpname in + let oform = Format.formatter_of_out_channel oc in + Cprint.program oform p; + close_out oc; + cpname + +let starts_with pref s = + String.length s >= String.length pref + && String.sub s 0 (String.length pref) = pref + +let ends_with suff s = + String.length s >= String.length suff + && String.sub s (String.length s - String.length suff) (String.length suff) + = suff + +let rec parse_cmdline prepro args i = + if i >= Array.length Sys.argv then List.rev args else begin + (* should skip arguments more cleanly... *) + let s = Sys.argv.(i) in + if s = "-Xsimplif" && i + 1 < Array.length Sys.argv then begin + transfs := Sys.argv.(i+1); + parse_cmdline prepro args (i+2) + end else if (s = "-I" || s = "-D" || s = "-U") + && i + 1 < Array.length Sys.argv then + parse_cmdline (Sys.argv.(i+1) :: s :: prepro) args (i+2) + else if starts_with "-I" s + || starts_with "-D" s + || starts_with "-U" s then + parse_cmdline (s :: prepro) args (i + 1) + else if s = "-Wall" then + parse_cmdline prepro ("-Wno-parentheses" :: "-Wall" :: args) (i+1) + else if ends_with ".c" s then begin + let s' = process_c_file (List.rev prepro) s in + parse_cmdline prepro (s' :: args) (i + 1) + end else + parse_cmdline prepro (s :: args) (i + 1) + end + + +let _ = + Builtins.set GCC.builtins; + let args = parse_cmdline [] [] 1 in + let cmd = "gcc " ^ String.concat " " (List.map Filename.quote args) in + let rc = Sys.command cmd in + exit rc + diff --git a/cparser/Makefile b/cparser/Makefile new file mode 100644 index 0000000..9b331b9 --- /dev/null +++ b/cparser/Makefile @@ -0,0 +1,86 @@ +OCAMLC=ocamlc -g +OCAMLOPT=ocamlopt -g +OCAMLLEX=ocamllex +OCAMLYACC=ocamlyacc -v +OCAMLDEP=ocamldep +OCAMLMKLIB=ocamlmklib + +LIBDIR=../lib + +INTFS=C.mli + +SRCS=Errors.ml Cabs.ml Cabshelper.ml Parse_aux.ml Parser.ml Lexer.ml \ + Machine.ml \ + Env.ml Cprint.ml Cutil.ml Ceval.ml \ + Builtins.ml GCC.ml CBuiltins.ml \ + Cleanup.ml Elab.ml Rename.ml \ + Transform.ml \ + Unblock.ml SimplExpr.ml AddCasts.ml StructByValue.ml StructAssign.ml \ + Bitfields.ml \ + Parse.ml + +COBJS=uint64.o +BOBJS=$(SRCS:.ml=.cmo) +NOBJS=$(SRCS:.ml=.cmx) +IOBJS=$(INTFS:.mli=.cmi) +NATIVETARGETS=$(shell if `which ocamlopt`; \ + then echo "cparser.cmxa cparser cparser.a libcparser.a dllcparser.so"; fi) + +all: $(NATIVETARGETS) cparser.cma cparser.byte + +install: + mkdir -p $(LIBDIR) + cp -p Cparser.cmi cparser.cma $(NATIVETARGETS) $(LIBDIR) + +cparser: $(COBJS) $(NOBJS) Main.cmx + $(OCAMLOPT) -o cparser $(COBJS) $(NOBJS) Main.cmx + +cparser.byte: $(COBJS) $(BOBJS) Main.cmo + $(OCAMLC) -custom -o cparser.byte $(COBJS) $(BOBJS) Main.cmo + +cparser.cma libcparser.a: uint64.o Cparser.cmo + $(OCAMLMKLIB) -o cparser uint64.o Cparser.cmo + +cparser.cmxa: uint64.o Cparser.cmx + $(OCAMLMKLIB) -o cparser uint64.o Cparser.cmx + +Cparser.cmo Cparser.cmi: $(IOBJS) $(BOBJS) + $(OCAMLC) -pack -o Cparser.cmo $(IOBJS) $(BOBJS) + +Cparser.cmx: $(IOBJS) $(NOBJS) + $(OCAMLOPT) -pack -o Cparser.cmx $(IOBJS) $(NOBJS) + +Parser.ml Parser.mli: Parser.mly + $(OCAMLYACC) Parser.mly + +clean:: + rm -f Parser.ml Parser.mli Parser.output + +beforedepend:: Parser.ml Parser.mli + +Lexer.ml: Lexer.mll + $(OCAMLLEX) Lexer.mll + +clean:: + rm -f Lexer.ml + +beforedepend:: Lexer.ml + +.SUFFIXES: .ml .mli .cmi .cmo .cmx + +.mli.cmi: + $(OCAMLC) -c $*.mli +.ml.cmo: + $(OCAMLC) -c $*.ml +.ml.cmx: + $(OCAMLOPT) -c -for-pack Cparser $*.ml +.c.o: + $(OCAMLC) -c $*.c + +clean:: + rm -f *.cm? *.o *.so *.a *.cmxa *.byte cparser + +depend: beforedepend + $(OCAMLDEP) *.mli *.ml > .depend + +include .depend diff --git a/cparser/Parse.ml b/cparser/Parse.ml new file mode 100644 index 0000000..b3ac524 --- /dev/null +++ b/cparser/Parse.ml @@ -0,0 +1,57 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Entry point for the library: parse, elaborate, and transform *) + +module CharSet = Set.Make(struct type t = char let compare = compare end) + +let transform_program t p = + let run_pass pass flag p = if CharSet.mem flag t then pass p else p in + Rename.program + (run_pass (AddCasts.program ~all:(CharSet.mem 'C' t)) 'c' + (run_pass StructAssign.program 'S' + (run_pass StructByValue.program 's' + (run_pass Bitfields.program 'f' + (run_pass (SimplExpr.program ~volatile:(CharSet.mem 'v' t)) 'e' + (run_pass Unblock.program 'b' + p)))))) + +let parse_transformations s = + let t = ref CharSet.empty in + let set s = String.iter (fun c -> t := CharSet.add c !t) s in + String.iter + (function 'b' -> set "b" + | 'e' -> set "e" + | 'c' -> set "ec" + | 'C' -> set "ecC" + | 's' -> set "s" + | 'S' -> set "esS" + | 'v' -> set "ev" + | 'f' -> set "bef" + | _ -> ()) + s; + !t + +let preprocessed_file transfs name lb = + Errors.reset(); + let t = parse_transformations transfs in + let p = + try + Rename.program (transform_program t (Elab.elab_preprocessed_file lb)) + with Parsing.Parse_error -> + Errors.error "Error during parsing"; [] + | Errors.Abort -> + [] in + if Errors.check_errors() then None else Some p diff --git a/cparser/Parse.mli b/cparser/Parse.mli new file mode 100644 index 0000000..f1c6c53 --- /dev/null +++ b/cparser/Parse.mli @@ -0,0 +1,22 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Entry point for the library: parse, elaborate, and transform *) + +val preprocessed_file: string -> string -> Lexing.lexbuf -> C.program option + +(* first arg: desired transformations + second arg: source file name before preprocessing + third arg: file after preprocessing *) diff --git a/cparser/Parse_aux.ml b/cparser/Parse_aux.ml new file mode 100755 index 0000000..6592245 --- /dev/null +++ b/cparser/Parse_aux.ml @@ -0,0 +1,46 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +open Format +open Errors +open Cabshelper + +(* Report parsing errors *) + +let parse_error msg = + error "%a: %s" format_cabsloc (currentLoc()) msg + +(* Are we parsing msvc syntax? *) + +let msvcMode = ref false + +(* We provide here a pointer to a function. It will be set by the lexer and + * used by the parser. In Ocaml lexers depend on parsers, so we we have put + * such functions in a separate module. *) +let add_identifier: (string -> unit) ref = + ref (fun _ -> assert false) + +let add_type: (string -> unit) ref = + ref (fun _ -> assert false) + +let push_context: (unit -> unit) ref = + ref (fun _ -> assert false) + +let pop_context: (unit -> unit) ref = + ref (fun _ -> assert false) + +(* Keep here the current pattern for formatparse *) +let currentPattern = ref "" + diff --git a/cparser/Parse_aux.mli b/cparser/Parse_aux.mli new file mode 100644 index 0000000..7366aed --- /dev/null +++ b/cparser/Parse_aux.mli @@ -0,0 +1,22 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val parse_error : string -> unit +val msvcMode : bool ref +val add_identifier : (string -> unit) ref +val add_type : (string -> unit) ref +val push_context : (unit -> unit) ref +val pop_context : (unit -> unit) ref +val currentPattern : string ref diff --git a/cparser/Parser.mly b/cparser/Parser.mly new file mode 100644 index 0000000..0eebb84 --- /dev/null +++ b/cparser/Parser.mly @@ -0,0 +1,1490 @@ +/*(* + * + * Copyright (c) 2001-2003, + * George C. Necula + * Scott McPeak + * Wes Weimer + * Ben Liblit + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The names of the contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + **) +(** +** 1.0 3.22.99 Hugues Cassé First version. +** 2.0 George Necula 12/12/00: Practically complete rewrite. +*) +*/ +%{ +open Cabs +open Cabshelper +open Parse_aux + +(* +** Expression building +*) +let smooth_expression lst = + match lst with + [] -> NOTHING + | [expr] -> expr + | _ -> COMMA (lst) + + +let currentFunctionName = ref "" + +let announceFunctionName ((n, decl, _, _):name) = + !add_identifier n; + (* Start a context that includes the parameter names and the whole body. + * Will pop when we finish parsing the function body *) + !push_context (); + (* Go through all the parameter names and mark them as identifiers *) + let rec findProto = function + PROTO (d, args, _) when isJUSTBASE d -> + List.iter (fun (_, (an, _, _, _)) -> !add_identifier an) args + + | PROTO (d, _, _) -> findProto d + | PARENTYPE (_, d, _) -> findProto d + | PTR (_, d) -> findProto d + | ARRAY (d, _, _) -> findProto d + | _ -> parse_error "Cannot find the prototype in a function definition"; + raise Parsing.Parse_error + + and isJUSTBASE = function + JUSTBASE -> true + | PARENTYPE (_, d, _) -> isJUSTBASE d + | _ -> false + in + findProto decl; + currentFunctionName := n + + + +let applyPointer (ptspecs: attribute list list) (dt: decl_type) + : decl_type = + (* Outer specification first *) + let rec loop = function + [] -> dt + | attrs :: rest -> PTR(attrs, loop rest) + in + loop ptspecs + +let doDeclaration (loc: cabsloc) (specs: spec_elem list) (nl: init_name list) : definition = + if isTypedef specs then begin + (* Tell the lexer about the new type names *) + List.iter (fun ((n, _, _, _), _) -> !add_type n) nl; + TYPEDEF ((specs, List.map (fun (n, _) -> n) nl), loc) + end else + if nl = [] then + ONLYTYPEDEF (specs, loc) + else begin + (* Tell the lexer about the new variable names *) + List.iter (fun ((n, _, _, _), _) -> !add_identifier n) nl; + DECDEF ((specs, nl), loc) + end + + +let doFunctionDef (loc: cabsloc) + (lend: cabsloc) + (specs: spec_elem list) + (n: name) + (b: block) : definition = + let fname = (specs, n) in + FUNDEF (fname, b, loc, lend) + + +let doOldParDecl (names: string list) + ((pardefs: name_group list), (isva: bool)) + : single_name list * bool = + let findOneName n = + (* Search in pardefs for the definition for this parameter *) + let rec loopGroups = function + [] -> ([SpecType Tint], (n, JUSTBASE, [], cabslu)) + | (specs, names) :: restgroups -> + let rec loopNames = function + [] -> loopGroups restgroups + | ((n',_, _, _) as sn) :: _ when n' = n -> (specs, sn) + | _ :: restnames -> loopNames restnames + in + loopNames names + in + loopGroups pardefs + in + let args = List.map findOneName names in + (args, isva) + +let int64_to_char value = + if (compare value (Int64.of_int 255) > 0) || (compare value Int64.zero < 0) then + begin + let msg = Printf.sprintf "cparser:intlist_to_string: character 0x%Lx too big" value in + parse_error msg; + raise Parsing.Parse_error + end + else + Char.chr (Int64.to_int value) + +(* takes a not-nul-terminated list, and converts it to a string. *) +let rec intlist_to_string (str: int64 list):string = + match str with + [] -> "" (* add nul-termination *) + | value::rest -> + let this_char = int64_to_char value in + (String.make 1 this_char) ^ (intlist_to_string rest) + +let fst3 (result, _, _) = result +let snd3 (_, result, _) = result +let trd3 (_, _, result) = result + + +(* + transform: __builtin_offsetof(type, member) + into : (size_t) (&(type * ) 0)->member + *) + +let transformOffsetOf (speclist, dtype) member = + let rec addPointer = function + | JUSTBASE -> + PTR([], JUSTBASE) + | PARENTYPE (attrs1, dtype, attrs2) -> + PARENTYPE (attrs1, addPointer dtype, attrs2) + | ARRAY (dtype, attrs, expr) -> + ARRAY (addPointer dtype, attrs, expr) + | PTR (attrs, dtype) -> + PTR (attrs, addPointer dtype) + | PROTO (dtype, names, variadic) -> + PROTO (addPointer dtype, names, variadic) + in + let nullType = (speclist, addPointer dtype) in + let nullExpr = CONSTANT (CONST_INT "0") in + let castExpr = CAST (nullType, SINGLE_INIT nullExpr) in + + let rec replaceBase = function + | VARIABLE field -> + MEMBEROFPTR (castExpr, field) + | MEMBEROF (base, field) -> + MEMBEROF (replaceBase base, field) + | INDEX (base, index) -> + INDEX (replaceBase base, index) + | _ -> + parse_error "malformed offset expression in __builtin_offsetof"; + raise Parsing.Parse_error + in + let memberExpr = replaceBase member in + let addrExpr = UNARY (ADDROF, memberExpr) in + (* slight cheat: hard-coded assumption that size_t == unsigned int *) + let sizeofType = [SpecType Tunsigned], JUSTBASE in + let resultExpr = CAST (sizeofType, SINGLE_INIT addrExpr) in + resultExpr + +%} + +%token IDENT +%token CST_CHAR +%token CST_WCHAR +%token CST_INT +%token CST_FLOAT +%token NAMED_TYPE + +/* Each character is its own list element, and the terminating nul is not + included in this list. */ +%token CST_STRING +%token CST_WSTRING + +%token EOF +%token CHAR INT DOUBLE FLOAT VOID INT64 INT32 UNDERSCORE_BOOL +%token ENUM STRUCT TYPEDEF UNION +%token SIGNED UNSIGNED LONG SHORT +%token VOLATILE EXTERN STATIC CONST RESTRICT AUTO REGISTER +%token THREAD + +%token SIZEOF ALIGNOF + +%token EQ PLUS_EQ MINUS_EQ STAR_EQ SLASH_EQ PERCENT_EQ +%token AND_EQ PIPE_EQ CIRC_EQ INF_INF_EQ SUP_SUP_EQ +%token ARROW DOT + +%token EQ_EQ EXCLAM_EQ INF SUP INF_EQ SUP_EQ +%token PLUS MINUS STAR +%token SLASH PERCENT +%token TILDE AND +%token PIPE CIRC +%token EXCLAM AND_AND +%token PIPE_PIPE +%token INF_INF SUP_SUP +%token PLUS_PLUS MINUS_MINUS + +%token RPAREN +%token LPAREN RBRACE +%token LBRACE +%token LBRACKET RBRACKET +%token COLON +%token SEMICOLON +%token COMMA ELLIPSIS QUEST + +%token BREAK CONTINUE GOTO RETURN +%token SWITCH CASE DEFAULT +%token WHILE DO FOR +%token IF TRY EXCEPT FINALLY +%token ELSE + +%token ATTRIBUTE INLINE ASM TYPEOF FUNCTION__ PRETTY_FUNCTION__ +%token LABEL__ +%token BUILTIN_VA_ARG ATTRIBUTE_USED +%token BUILTIN_VA_LIST +%token BLOCKATTRIBUTE +%token BUILTIN_TYPES_COMPAT BUILTIN_OFFSETOF +%token DECLSPEC +%token MSASM MSATTR +%token PRAGMA_LINE +%token PRAGMA_EOL + +/* operator precedence */ +%nonassoc IF +%nonassoc ELSE + + +%left COMMA +%right EQ PLUS_EQ MINUS_EQ STAR_EQ SLASH_EQ PERCENT_EQ + AND_EQ PIPE_EQ CIRC_EQ INF_INF_EQ SUP_SUP_EQ +%right QUEST COLON +%left PIPE_PIPE +%left AND_AND +%left PIPE +%left CIRC +%left AND +%left EQ_EQ EXCLAM_EQ +%left INF SUP INF_EQ SUP_EQ +%left INF_INF SUP_SUP +%left PLUS MINUS +%left STAR SLASH PERCENT CONST RESTRICT VOLATILE +%right EXCLAM TILDE PLUS_PLUS MINUS_MINUS CAST RPAREN ADDROF SIZEOF ALIGNOF +%left LBRACKET +%left DOT ARROW LPAREN LBRACE +%right NAMED_TYPE /* We'll use this to handle redefinitions of + * NAMED_TYPE as variables */ +%left IDENT + +/* Non-terminals informations */ +%start interpret file +%type file interpret globals + +%type global + + +%type attributes attributes_with_asm asmattr +%type statement +%type constant +%type string_constant +%type expression +%type opt_expression +%type init_expression +%type comma_expression +%type paren_comma_expression +%type arguments +%type bracket_comma_expression +%type string_list +%type wstring_list + +%type initializer +%type <(Cabs.initwhat * Cabs.init_expression) list> initializer_list +%type init_designators init_designators_opt + +%type decl_spec_list +%type type_spec +%type struct_decl_list + + +%type old_proto_decl +%type parameter_decl +%type enumerator +%type enum_list +%type declaration function_def +%type function_def_start +%type type_name +%type block +%type block_element_list +%type local_labels local_label_names +%type old_parameter_list_ne + +%type init_declarator +%type init_declarator_list +%type declarator +%type field_decl +%type <(Cabs.name * expression option) list> field_decl_list +%type direct_decl +%type abs_direct_decl abs_direct_decl_opt +%type abstract_decl + + /* (* Each element is a "* ". *) */ +%type pointer pointer_opt +%type location +%type cvspec +%% + +interpret: + file EOF {$1} +; +file: globals {$1} +; +globals: + /* empty */ { [] } +| global globals { $1 :: $2 } +| SEMICOLON globals { $2 } +; + +location: + /* empty */ { currentLoc () } %prec IDENT + + +/*** Global Definition ***/ +global: +| declaration { $1 } +| function_def { $1 } +/*(* Some C header files ar shared with the C++ compiler and have linkage + * specification *)*/ +| EXTERN string_constant declaration { LINKAGE (fst $2, (*handleLoc*) (snd $2), [ $3 ]) } +| EXTERN string_constant LBRACE globals RBRACE + { LINKAGE (fst $2, (*handleLoc*) (snd $2), $4) } +| ASM LPAREN string_constant RPAREN SEMICOLON + { GLOBASM (fst $3, (*handleLoc*) $1) } +| pragma { $1 } +/* (* Old-style function prototype. This should be somewhere else, like in + * "declaration". For now we keep it at global scope only because in local + * scope it looks too much like a function call *) */ +| IDENT LPAREN old_parameter_list_ne RPAREN old_pardef_list SEMICOLON + { (* Convert pardecl to new style *) + let pardecl, isva = doOldParDecl $3 $5 in + (* Make the function declarator *) + doDeclaration ((*handleLoc*) (snd $1)) [] + [((fst $1, PROTO(JUSTBASE, pardecl,isva), [], cabslu), + NO_INIT)] + } +/* (* Old style function prototype, but without any arguments *) */ +| IDENT LPAREN RPAREN SEMICOLON + { (* Make the function declarator *) + doDeclaration ((*handleLoc*)(snd $1)) [] + [((fst $1, PROTO(JUSTBASE,[],false), [], cabslu), + NO_INIT)] + } +/* | location error SEMICOLON { PRAGMA (VARIABLE "parse_error", $1) } */ +; + +id_or_typename: + IDENT {fst $1} +| NAMED_TYPE {fst $1} +; + +maybecomma: + /* empty */ { () } +| COMMA { () } +; + +/* *** Expressions *** */ + +primary_expression: /*(* 6.5.1. *)*/ +| IDENT + {VARIABLE (fst $1), snd $1} +| constant + {CONSTANT (fst $1), snd $1} +| paren_comma_expression + {PAREN (smooth_expression (fst $1)), snd $1} +| LPAREN block RPAREN + { GNU_BODY (fst3 $2), $1 } +; + +postfix_expression: /*(* 6.5.2 *)*/ +| primary_expression + { $1 } +| postfix_expression bracket_comma_expression + {INDEX (fst $1, smooth_expression $2), snd $1} +| postfix_expression LPAREN arguments RPAREN + {CALL (fst $1, $3), snd $1} +| BUILTIN_VA_ARG LPAREN expression COMMA type_name RPAREN + { let b, d = $5 in + CALL (VARIABLE "__builtin_va_arg", + [fst $3; TYPE_SIZEOF (b, d)]), $1 } +| BUILTIN_TYPES_COMPAT LPAREN type_name COMMA type_name RPAREN + { let b1,d1 = $3 in + let b2,d2 = $5 in + CALL (VARIABLE "__builtin_types_compatible_p", + [TYPE_SIZEOF(b1,d1); TYPE_SIZEOF(b2,d2)]), $1 } +| BUILTIN_OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN + { transformOffsetOf $3 $5, $1 } +| postfix_expression DOT id_or_typename + {MEMBEROF (fst $1, $3), snd $1} +| postfix_expression ARROW id_or_typename + {MEMBEROFPTR (fst $1, $3), snd $1} +| postfix_expression PLUS_PLUS + {UNARY (POSINCR, fst $1), snd $1} +| postfix_expression MINUS_MINUS + {UNARY (POSDECR, fst $1), snd $1} +/* (* We handle GCC constructor expressions *) */ +| LPAREN type_name RPAREN LBRACE initializer_list_opt RBRACE + { CAST($2, COMPOUND_INIT $5), $1 } +; + +offsetof_member_designator: /* GCC extension for __builtin_offsetof */ +| id_or_typename + { VARIABLE ($1) } +| offsetof_member_designator DOT IDENT + { MEMBEROF ($1, fst $3) } +| offsetof_member_designator bracket_comma_expression + { INDEX ($1, smooth_expression $2) } +; + +unary_expression: /*(* 6.5.3 *)*/ +| postfix_expression + { $1 } +| PLUS_PLUS unary_expression + {UNARY (PREINCR, fst $2), $1} +| MINUS_MINUS unary_expression + {UNARY (PREDECR, fst $2), $1} +| SIZEOF unary_expression + {EXPR_SIZEOF (fst $2), $1} +| SIZEOF LPAREN type_name RPAREN + {let b, d = $3 in TYPE_SIZEOF (b, d), $1} +| ALIGNOF unary_expression + {EXPR_ALIGNOF (fst $2), $1} +| ALIGNOF LPAREN type_name RPAREN + {let b, d = $3 in TYPE_ALIGNOF (b, d), $1} +| PLUS cast_expression + {UNARY (PLUS, fst $2), $1} +| MINUS cast_expression + {UNARY (MINUS, fst $2), $1} +| STAR cast_expression + {UNARY (MEMOF, fst $2), $1} +| AND cast_expression + {UNARY (ADDROF, fst $2), $1} +| EXCLAM cast_expression + {UNARY (NOT, fst $2), $1} +| TILDE cast_expression + {UNARY (BNOT, fst $2), $1} +| AND_AND IDENT { LABELADDR (fst $2), $1 } +; + +cast_expression: /*(* 6.5.4 *)*/ +| unary_expression + { $1 } +| LPAREN type_name RPAREN cast_expression + { CAST($2, SINGLE_INIT (fst $4)), $1 } +; + +multiplicative_expression: /*(* 6.5.5 *)*/ +| cast_expression + { $1 } +| multiplicative_expression STAR cast_expression + {BINARY(MUL, fst $1, fst $3), snd $1} +| multiplicative_expression SLASH cast_expression + {BINARY(DIV, fst $1, fst $3), snd $1} +| multiplicative_expression PERCENT cast_expression + {BINARY(MOD, fst $1, fst $3), snd $1} +; + +additive_expression: /*(* 6.5.6 *)*/ +| multiplicative_expression + { $1 } +| additive_expression PLUS multiplicative_expression + {BINARY(ADD, fst $1, fst $3), snd $1} +| additive_expression MINUS multiplicative_expression + {BINARY(SUB, fst $1, fst $3), snd $1} +; + +shift_expression: /*(* 6.5.7 *)*/ +| additive_expression + { $1 } +| shift_expression INF_INF additive_expression + {BINARY(SHL, fst $1, fst $3), snd $1} +| shift_expression SUP_SUP additive_expression + {BINARY(SHR, fst $1, fst $3), snd $1} +; + + +relational_expression: /*(* 6.5.8 *)*/ +| shift_expression + { $1 } +| relational_expression INF shift_expression + {BINARY(LT, fst $1, fst $3), snd $1} +| relational_expression SUP shift_expression + {BINARY(GT, fst $1, fst $3), snd $1} +| relational_expression INF_EQ shift_expression + {BINARY(LE, fst $1, fst $3), snd $1} +| relational_expression SUP_EQ shift_expression + {BINARY(GE, fst $1, fst $3), snd $1} +; + +equality_expression: /*(* 6.5.9 *)*/ +| relational_expression + { $1 } +| equality_expression EQ_EQ relational_expression + {BINARY(EQ, fst $1, fst $3), snd $1} +| equality_expression EXCLAM_EQ relational_expression + {BINARY(NE, fst $1, fst $3), snd $1} +; + + +bitwise_and_expression: /*(* 6.5.10 *)*/ +| equality_expression + { $1 } +| bitwise_and_expression AND equality_expression + {BINARY(BAND, fst $1, fst $3), snd $1} +; + +bitwise_xor_expression: /*(* 6.5.11 *)*/ +| bitwise_and_expression + { $1 } +| bitwise_xor_expression CIRC bitwise_and_expression + {BINARY(XOR, fst $1, fst $3), snd $1} +; + +bitwise_or_expression: /*(* 6.5.12 *)*/ +| bitwise_xor_expression + { $1 } +| bitwise_or_expression PIPE bitwise_xor_expression + {BINARY(BOR, fst $1, fst $3), snd $1} +; + +logical_and_expression: /*(* 6.5.13 *)*/ +| bitwise_or_expression + { $1 } +| logical_and_expression AND_AND bitwise_or_expression + {BINARY(AND, fst $1, fst $3), snd $1} +; + +logical_or_expression: /*(* 6.5.14 *)*/ +| logical_and_expression + { $1 } +| logical_or_expression PIPE_PIPE logical_and_expression + {BINARY(OR, fst $1, fst $3), snd $1} +; + +conditional_expression: /*(* 6.5.15 *)*/ +| logical_or_expression + { $1 } +| logical_or_expression QUEST opt_expression COLON conditional_expression + {QUESTION (fst $1, $3, fst $5), snd $1} +; + +/*(* The C spec says that left-hand sides of assignment expressions are unary + * expressions. GCC allows cast expressions in there ! *)*/ + +assignment_expression: /*(* 6.5.16 *)*/ +| conditional_expression + { $1 } +| cast_expression EQ assignment_expression + {BINARY(ASSIGN, fst $1, fst $3), snd $1} +| cast_expression PLUS_EQ assignment_expression + {BINARY(ADD_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression MINUS_EQ assignment_expression + {BINARY(SUB_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression STAR_EQ assignment_expression + {BINARY(MUL_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression SLASH_EQ assignment_expression + {BINARY(DIV_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression PERCENT_EQ assignment_expression + {BINARY(MOD_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression AND_EQ assignment_expression + {BINARY(BAND_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression PIPE_EQ assignment_expression + {BINARY(BOR_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression CIRC_EQ assignment_expression + {BINARY(XOR_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression INF_INF_EQ assignment_expression + {BINARY(SHL_ASSIGN, fst $1, fst $3), snd $1} +| cast_expression SUP_SUP_EQ assignment_expression + {BINARY(SHR_ASSIGN, fst $1, fst $3), snd $1} +; + +expression: /*(* 6.5.17 *)*/ + assignment_expression + { $1 } +; + + +constant: + CST_INT {CONST_INT (fst $1), snd $1} +| CST_FLOAT {CONST_FLOAT (fst $1), snd $1} +| CST_CHAR {CONST_CHAR (fst $1), snd $1} +| CST_WCHAR {CONST_WCHAR (fst $1), snd $1} +| string_constant {CONST_STRING (fst $1), snd $1} +| wstring_list {CONST_WSTRING (fst $1), snd $1} +; + +string_constant: +/* Now that we know this constant isn't part of a wstring, convert it + back to a string for easy viewing. */ + string_list { + let queue, location = $1 in + let buffer = Buffer.create (Queue.length queue) in + Queue.iter + (List.iter + (fun value -> + let char = int64_to_char value in + Buffer.add_char buffer char)) + queue; + Buffer.contents buffer, location + } +; +one_string_constant: +/* Don't concat multiple strings. For asm templates. */ + CST_STRING {intlist_to_string (fst $1) } +; +string_list: + one_string { + let queue = Queue.create () in + Queue.add (fst $1) queue; + queue, snd $1 + } +| string_list one_string { + Queue.add (fst $2) (fst $1); + $1 + } +; + +wstring_list: + CST_WSTRING { $1 } +| wstring_list one_string { (fst $1) @ (fst $2), snd $1 } +| wstring_list CST_WSTRING { (fst $1) @ (fst $2), snd $1 } +/* Only the first string in the list needs an L, so L"a" "b" is the same + * as L"ab" or L"a" L"b". */ + +one_string: + CST_STRING {$1} +| FUNCTION__ {(Cabshelper.explodeStringToInts + !currentFunctionName), $1} +| PRETTY_FUNCTION__ {(Cabshelper.explodeStringToInts + !currentFunctionName), $1} +; + +init_expression: + expression { SINGLE_INIT (fst $1) } +| LBRACE initializer_list_opt RBRACE + { COMPOUND_INIT $2} + +initializer_list: /* ISO 6.7.8. Allow a trailing COMMA */ + initializer { [$1] } +| initializer COMMA initializer_list_opt { $1 :: $3 } +; +initializer_list_opt: + /* empty */ { [] } +| initializer_list { $1 } +; +initializer: + init_designators eq_opt init_expression { ($1, $3) } +| gcc_init_designators init_expression { ($1, $2) } +| init_expression { (NEXT_INIT, $1) } +; +eq_opt: + EQ { () } + /*(* GCC allows missing = *)*/ +| /*(* empty *)*/ { () } +; +init_designators: + DOT id_or_typename init_designators_opt { INFIELD_INIT($2, $3) } +| LBRACKET expression RBRACKET init_designators_opt + { ATINDEX_INIT(fst $2, $4) } +| LBRACKET expression ELLIPSIS expression RBRACKET + { ATINDEXRANGE_INIT(fst $2, fst $4) } +; +init_designators_opt: + /* empty */ { NEXT_INIT } +| init_designators { $1 } +; + +gcc_init_designators: /*(* GCC supports these strange things *)*/ + id_or_typename COLON { INFIELD_INIT($1, NEXT_INIT) } +; + +arguments: + /* empty */ { [] } +| comma_expression { fst $1 } +; + +opt_expression: + /* empty */ + {NOTHING} +| comma_expression + {smooth_expression (fst $1)} +; + +comma_expression: + expression {[fst $1], snd $1} +| expression COMMA comma_expression { fst $1 :: fst $3, snd $1 } +| error COMMA comma_expression { $3 } +; + +comma_expression_opt: + /* empty */ { NOTHING } +| comma_expression { smooth_expression (fst $1) } +; + +paren_comma_expression: + LPAREN comma_expression RPAREN { $2 } +| LPAREN error RPAREN { [], $1 } +; + +bracket_comma_expression: + LBRACKET comma_expression RBRACKET { fst $2 } +| LBRACKET error RBRACKET { [] } +; + + +/*** statements ***/ +block: /* ISO 6.8.2 */ + block_begin local_labels block_attrs block_element_list RBRACE + {!pop_context(); + { blabels = $2; + battrs = $3; + bstmts = $4 }, + $1, $5 + } +| error location RBRACE { { blabels = []; + battrs = []; + bstmts = [] }, + $2, $3 + } +; +block_begin: + LBRACE {!push_context (); $1} +; + +block_attrs: + /* empty */ { [] } +| BLOCKATTRIBUTE paren_attr_list_ne + { [("__blockattribute__", $2)] } +; + +/* statements and declarations in a block, in any order (for C99 support) */ +block_element_list: + /* empty */ { [] } +| declaration block_element_list { DEFINITION($1) :: $2 } +| statement block_element_list { $1 :: $2 } +/*(* GCC accepts a label at the end of a block *)*/ +| IDENT COLON { [ LABEL (fst $1, NOP (snd $1), + snd $1)] } +| pragma block_element_list { $2 } +; + +local_labels: + /* empty */ { [] } +| LABEL__ local_label_names SEMICOLON local_labels { $2 @ $4 } +; +local_label_names: + IDENT { [ fst $1 ] } +| IDENT COMMA local_label_names { fst $1 :: $3 } +; + + + +statement: + SEMICOLON {NOP ((*handleLoc*) $1) } +| comma_expression SEMICOLON + {COMPUTATION (smooth_expression (fst $1), (*handleLoc*)(snd $1))} +| block {BLOCK (fst3 $1, (*handleLoc*)(snd3 $1))} +| IF paren_comma_expression statement %prec IF + {IF (smooth_expression (fst $2), $3, NOP $1, $1)} +| IF paren_comma_expression statement ELSE statement + {IF (smooth_expression (fst $2), $3, $5, (*handleLoc*) $1)} +| SWITCH paren_comma_expression statement + {SWITCH (smooth_expression (fst $2), $3, (*handleLoc*) $1)} +| WHILE paren_comma_expression statement + {WHILE (smooth_expression (fst $2), $3, (*handleLoc*) $1)} +| DO statement WHILE paren_comma_expression SEMICOLON + {DOWHILE (smooth_expression (fst $4), $2, (*handleLoc*) $1)} +| FOR LPAREN for_clause opt_expression + SEMICOLON opt_expression RPAREN statement + {FOR ($3, $4, $6, $8, (*handleLoc*) $1)} +| IDENT COLON attribute_nocv_list statement + {(* The only attribute that should appear here + is "unused". For now, we drop this on the + floor, since unused labels are usually + removed anyways by Rmtmps. *) + LABEL (fst $1, $4, (snd $1))} +| CASE expression COLON statement + {CASE (fst $2, $4, (*handleLoc*) $1)} +| CASE expression ELLIPSIS expression COLON statement + {CASERANGE (fst $2, fst $4, $6, (*handleLoc*) $1)} +| DEFAULT COLON + {DEFAULT (NOP $1, (*handleLoc*) $1)} +| RETURN SEMICOLON {RETURN (NOTHING, (*handleLoc*) $1)} +| RETURN comma_expression SEMICOLON + {RETURN (smooth_expression (fst $2), (*handleLoc*) $1)} +| BREAK SEMICOLON {BREAK ((*handleLoc*) $1)} +| CONTINUE SEMICOLON {CONTINUE ((*handleLoc*) $1)} +| GOTO IDENT SEMICOLON + {GOTO (fst $2, (*handleLoc*) $1)} +| GOTO STAR comma_expression SEMICOLON + { COMPGOTO (smooth_expression (fst $3), (*handleLoc*) $1) } +| ASM asmattr LPAREN asmtemplate asmoutputs RPAREN SEMICOLON + { ASM ($2, $4, $5, (*handleLoc*) $1) } +| MSASM { ASM ([], [fst $1], None, (*handleLoc*)(snd $1))} +| TRY block EXCEPT paren_comma_expression block + { let b, _, _ = $2 in + let h, _, _ = $5 in + if not !msvcMode then + parse_error "try/except in GCC code"; + TRY_EXCEPT (b, COMMA (fst $4), h, (*handleLoc*) $1) } +| TRY block FINALLY block + { let b, _, _ = $2 in + let h, _, _ = $4 in + if not !msvcMode then + parse_error "try/finally in GCC code"; + TRY_FINALLY (b, h, (*handleLoc*) $1) } + +| error location SEMICOLON { (NOP $2)} +; + + +for_clause: + opt_expression SEMICOLON { FC_EXP $1 } +| declaration { FC_DECL $1 } +; + +declaration: /* ISO 6.7.*/ + decl_spec_list init_declarator_list SEMICOLON + { doDeclaration ((*handleLoc*)(snd $1)) (fst $1) $2 } +| decl_spec_list SEMICOLON + { doDeclaration ((*handleLoc*)(snd $1)) (fst $1) [] } +; +init_declarator_list: /* ISO 6.7 */ + init_declarator { [$1] } +| init_declarator COMMA init_declarator_list { $1 :: $3 } + +; +init_declarator: /* ISO 6.7 */ + declarator { ($1, NO_INIT) } +| declarator EQ init_expression + { ($1, $3) } +; + +decl_spec_list: /* ISO 6.7 */ + /* ISO 6.7.1 */ +| TYPEDEF decl_spec_list_opt { SpecTypedef :: $2, $1 } +| EXTERN decl_spec_list_opt { SpecStorage EXTERN :: $2, $1 } +| STATIC decl_spec_list_opt { SpecStorage STATIC :: $2, $1 } +| AUTO decl_spec_list_opt { SpecStorage AUTO :: $2, $1 } +| REGISTER decl_spec_list_opt { SpecStorage REGISTER :: $2, $1} + /* ISO 6.7.2 */ +| type_spec decl_spec_list_opt_no_named { SpecType (fst $1) :: $2, snd $1 } + /* ISO 6.7.4 */ +| INLINE decl_spec_list_opt { SpecInline :: $2, $1 } +| cvspec decl_spec_list_opt { (fst $1) :: $2, snd $1 } +| attribute_nocv decl_spec_list_opt { SpecAttr (fst $1) :: $2, snd $1 } +; +/* (* In most cases if we see a NAMED_TYPE we must shift it. Thus we declare + * NAMED_TYPE to have right associativity *) */ +decl_spec_list_opt: + /* empty */ { [] } %prec NAMED_TYPE +| decl_spec_list { fst $1 } +; +/* (* We add this separate rule to handle the special case when an appearance + * of NAMED_TYPE should not be considered as part of the specifiers but as + * part of the declarator. IDENT has higher precedence than NAMED_TYPE *) + */ +decl_spec_list_opt_no_named: + /* empty */ { [] } %prec IDENT +| decl_spec_list { fst $1 } +; +type_spec: /* ISO 6.7.2 */ + VOID { Tvoid, $1} +| UNDERSCORE_BOOL { T_Bool, $1 } +| CHAR { Tchar, $1 } +| SHORT { Tshort, $1 } +| INT { Tint, $1 } +| LONG { Tlong, $1 } +| INT64 { Tint64, $1 } +| FLOAT { Tfloat, $1 } +| DOUBLE { Tdouble, $1 } +| SIGNED { Tsigned, $1 } +| UNSIGNED { Tunsigned, $1 } +| STRUCT id_or_typename + { Tstruct ($2, None, []), $1 } +| STRUCT just_attributes id_or_typename + { Tstruct ($3, None, $2), $1 } +| STRUCT id_or_typename LBRACE struct_decl_list RBRACE + { Tstruct ($2, Some $4, []), $1 } +| STRUCT LBRACE struct_decl_list RBRACE + { Tstruct ("", Some $3, []), $1 } +| STRUCT just_attributes id_or_typename LBRACE struct_decl_list RBRACE + { Tstruct ($3, Some $5, $2), $1 } +| STRUCT just_attributes LBRACE struct_decl_list RBRACE + { Tstruct ("", Some $4, $2), $1 } +| UNION id_or_typename + { Tunion ($2, None, []), $1 } +| UNION id_or_typename LBRACE struct_decl_list RBRACE + { Tunion ($2, Some $4, []), $1 } +| UNION LBRACE struct_decl_list RBRACE + { Tunion ("", Some $3, []), $1 } +| UNION just_attributes id_or_typename LBRACE struct_decl_list RBRACE + { Tunion ($3, Some $5, $2), $1 } +| UNION just_attributes LBRACE struct_decl_list RBRACE + { Tunion ("", Some $4, $2), $1 } +| ENUM id_or_typename + { Tenum ($2, None, []), $1 } +| ENUM id_or_typename LBRACE enum_list maybecomma RBRACE + { Tenum ($2, Some $4, []), $1 } +| ENUM LBRACE enum_list maybecomma RBRACE + { Tenum ("", Some $3, []), $1 } +| ENUM just_attributes id_or_typename LBRACE enum_list maybecomma RBRACE + { Tenum ($3, Some $5, $2), $1 } +| ENUM just_attributes LBRACE enum_list maybecomma RBRACE + { Tenum ("", Some $4, $2), $1 } +| NAMED_TYPE { Tnamed (fst $1), snd $1 } +| TYPEOF LPAREN expression RPAREN { TtypeofE (fst $3), $1 } +| TYPEOF LPAREN type_name RPAREN { let s, d = $3 in + TtypeofT (s, d), $1 } +; +struct_decl_list: /* (* ISO 6.7.2. Except that we allow empty structs. We + * also allow missing field names. *) + */ + /* empty */ { [] } +| decl_spec_list SEMICOLON struct_decl_list + { (fst $1, + [(missingFieldDecl, None)]) :: $3 } +/*(* GCC allows extra semicolons *)*/ +| SEMICOLON struct_decl_list + { $2 } +| decl_spec_list field_decl_list SEMICOLON struct_decl_list + { (fst $1, $2) + :: $4 } +/*(* MSVC allows pragmas in strange places *)*/ +| pragma struct_decl_list { $2 } + +| error SEMICOLON struct_decl_list + { $3 } +; +field_decl_list: /* (* ISO 6.7.2 *) */ + field_decl { [$1] } +| field_decl COMMA field_decl_list { $1 :: $3 } +; +field_decl: /* (* ISO 6.7.2. Except that we allow unnamed fields. *) */ +| declarator { ($1, None) } +| declarator COLON expression attributes + { let (n,decl,al,loc) = $1 in + let al' = al @ $4 in + ((n,decl,al',loc), Some (fst $3)) } +| COLON expression { (missingFieldDecl, Some (fst $2)) } +; + +enum_list: /* (* ISO 6.7.2.2 *) */ + enumerator {[$1]} +| enum_list COMMA enumerator {$1 @ [$3]} +| enum_list COMMA error { $1 } +; +enumerator: + IDENT {(fst $1, NOTHING, snd $1)} +| IDENT EQ expression {(fst $1, fst $3, snd $1)} +; + + +declarator: /* (* ISO 6.7.5. Plus Microsoft declarators.*) */ + pointer_opt direct_decl attributes_with_asm + { let (n, decl) = $2 in + (n, applyPointer (fst $1) decl, $3, (snd $1)) } +; + + +direct_decl: /* (* ISO 6.7.5 *) */ + /* (* We want to be able to redefine named + * types as variable names *) */ +| id_or_typename { ($1, JUSTBASE) } + +| LPAREN attributes declarator RPAREN + { let (n,decl,al,loc) = $3 in + (n, PARENTYPE($2,decl,al)) } + +| direct_decl LBRACKET attributes comma_expression_opt RBRACKET + { let (n, decl) = $1 in + (n, ARRAY(decl, $3, $4)) } +| direct_decl LBRACKET attributes error RBRACKET + { let (n, decl) = $1 in + (n, ARRAY(decl, $3, NOTHING)) } +| direct_decl parameter_list_startscope rest_par_list RPAREN + { let (n, decl) = $1 in + let (params, isva) = $3 in + !pop_context (); + (n, PROTO(decl, params, isva)) + } +; +parameter_list_startscope: + LPAREN { !push_context () } +; +rest_par_list: +| /* empty */ { ([], false) } +| parameter_decl rest_par_list1 { let (params, isva) = $2 in + ($1 :: params, isva) + } +; +rest_par_list1: + /* empty */ { ([], false) } +| COMMA ELLIPSIS { ([], true) } +| COMMA parameter_decl rest_par_list1 { let (params, isva) = $3 in + ($2 :: params, isva) + } +; + + +parameter_decl: /* (* ISO 6.7.5 *) */ + decl_spec_list declarator { (fst $1, $2) } +| decl_spec_list abstract_decl { let d, a = $2 in + (fst $1, ("", d, a, cabslu)) } +| decl_spec_list { (fst $1, ("", JUSTBASE, [], cabslu)) } +| LPAREN parameter_decl RPAREN { $2 } +; + +/* (* Old style prototypes. Like a declarator *) */ +old_proto_decl: + pointer_opt direct_old_proto_decl { let (n, decl, a) = $2 in + (n, applyPointer (fst $1) decl, + a, snd $1) + } + +; + +direct_old_proto_decl: + direct_decl LPAREN old_parameter_list_ne RPAREN old_pardef_list + { let par_decl, isva = doOldParDecl $3 $5 in + let n, decl = $1 in + (n, PROTO(decl, par_decl, isva), []) + } +| direct_decl LPAREN RPAREN + { let n, decl = $1 in + (n, PROTO(decl, [], false), []) + } + +/* (* appears sometimesm but generates a shift-reduce conflict. *) +| LPAREN STAR direct_decl LPAREN old_parameter_list_ne RPAREN RPAREN LPAREN RPAREN old_pardef_list + { let par_decl, isva + = doOldParDecl $5 $10 in + let n, decl = $3 in + (n, PROTO(decl, par_decl, isva), []) + } +*/ +; + +old_parameter_list_ne: +| IDENT { [fst $1] } +| IDENT COMMA old_parameter_list_ne { let rest = $3 in + (fst $1 :: rest) } +; + +old_pardef_list: + /* empty */ { ([], false) } +| decl_spec_list old_pardef SEMICOLON ELLIPSIS + { ([(fst $1, $2)], true) } +| decl_spec_list old_pardef SEMICOLON old_pardef_list + { let rest, isva = $4 in + ((fst $1, $2) :: rest, isva) + } +; + +old_pardef: + declarator { [$1] } +| declarator COMMA old_pardef { $1 :: $3 } +| error { [] } +; + + +pointer: /* (* ISO 6.7.5 *) */ + STAR attributes pointer_opt { $2 :: fst $3, $1 } +; +pointer_opt: + /**/ { let l = currentLoc () in + ([], l) } +| pointer { $1 } +; + +type_name: /* (* ISO 6.7.6 *) */ + decl_spec_list abstract_decl { let d, a = $2 in + if a <> [] then begin + parse_error "attributes in type name"; + raise Parsing.Parse_error + end; + (fst $1, d) + } +| decl_spec_list { (fst $1, JUSTBASE) } +; +abstract_decl: /* (* ISO 6.7.6. *) */ + pointer_opt abs_direct_decl attributes { applyPointer (fst $1) $2, $3 } +| pointer { applyPointer (fst $1) JUSTBASE, [] } +; + +abs_direct_decl: /* (* ISO 6.7.6. We do not support optional declarator for + * functions. Plus Microsoft attributes. See the + * discussion for declarator. *) */ +| LPAREN attributes abstract_decl RPAREN + { let d, a = $3 in + PARENTYPE ($2, d, a) + } + +| LPAREN error RPAREN + { JUSTBASE } + +| abs_direct_decl_opt LBRACKET comma_expression_opt RBRACKET + { ARRAY($1, [], $3) } +/*(* The next should be abs_direct_decl_opt but we get conflicts *)*/ +| abs_direct_decl parameter_list_startscope rest_par_list RPAREN + { let (params, isva) = $3 in + !pop_context (); + PROTO ($1, params, isva) + } +; +abs_direct_decl_opt: + abs_direct_decl { $1 } +| /* empty */ { JUSTBASE } +; +function_def: /* (* ISO 6.9.1 *) */ + function_def_start block + { let (loc, specs, decl) = $1 in + currentFunctionName := "<__FUNCTION__ used outside any functions>"; + !pop_context (); (* The context pushed by + * announceFunctionName *) + doFunctionDef ((*handleLoc*) loc) (trd3 $2) specs decl (fst3 $2) + } + + +function_def_start: /* (* ISO 6.9.1 *) */ + decl_spec_list declarator + { announceFunctionName $2; + (snd $1, fst $1, $2) + } + +/* (* Old-style function prototype *) */ +| decl_spec_list old_proto_decl + { announceFunctionName $2; + (snd $1, fst $1, $2) + } +/* (* New-style function that does not have a return type *) */ +| IDENT parameter_list_startscope rest_par_list RPAREN + { let (params, isva) = $3 in + let fdec = + (fst $1, PROTO(JUSTBASE, params, isva), [], snd $1) in + announceFunctionName fdec; + (* Default is int type *) + let defSpec = [SpecType Tint] in + (snd $1, defSpec, fdec) + } + +/* (* No return type and old-style parameter list *) */ +| IDENT LPAREN old_parameter_list_ne RPAREN old_pardef_list + { (* Convert pardecl to new style *) + let pardecl, isva = doOldParDecl $3 $5 in + (* Make the function declarator *) + let fdec = (fst $1, + PROTO(JUSTBASE, pardecl,isva), + [], snd $1) in + announceFunctionName fdec; + (* Default is int type *) + let defSpec = [SpecType Tint] in + (snd $1, defSpec, fdec) + } +/* (* No return type and no parameters *) */ +| IDENT LPAREN RPAREN + { (* Make the function declarator *) + let fdec = (fst $1, + PROTO(JUSTBASE, [], false), + [], snd $1) in + announceFunctionName fdec; + (* Default is int type *) + let defSpec = [SpecType Tint] in + (snd $1, defSpec, fdec) + } +; + +/* const/volatile as type specifier elements */ +cvspec: + CONST { SpecCV(CV_CONST), $1 } +| VOLATILE { SpecCV(CV_VOLATILE), $1 } +| RESTRICT { SpecCV(CV_RESTRICT), $1 } +; + +/*** GCC attributes ***/ +attributes: + /* empty */ { []} +| attribute attributes { fst $1 :: $2 } +; + +/* (* In some contexts we can have an inline assembly to specify the name to + * be used for a global. We treat this as a name attribute *) */ +attributes_with_asm: + /* empty */ { [] } +| attribute attributes_with_asm { fst $1 :: $2 } +| ASM LPAREN string_constant RPAREN attributes + { ("__asm__", + [CONSTANT(CONST_STRING (fst $3))]) :: $5 } +; + +/* things like __attribute__, but no const/volatile */ +attribute_nocv: + ATTRIBUTE LPAREN paren_attr_list RPAREN + { ("__attribute__", $3), $1 } +/*(* +| ATTRIBUTE_USED { ("__attribute__", + [ VARIABLE "used" ]), $1 } +*)*/ +| DECLSPEC paren_attr_list_ne { ("__declspec", $2), $1 } +| MSATTR { (fst $1, []), snd $1 } + /* ISO 6.7.3 */ +| THREAD { ("__thread",[]), $1 } +; + +attribute_nocv_list: + /* empty */ { []} +| attribute_nocv attribute_nocv_list { fst $1 :: $2 } +; + +/* __attribute__ plus const/volatile */ +attribute: + attribute_nocv { $1 } +| CONST { ("const", []), $1 } +| RESTRICT { ("restrict",[]), $1 } +| VOLATILE { ("volatile",[]), $1 } +; + +/* (* sm: I need something that just includes __attribute__ and nothing more, + * to support them appearing between the 'struct' keyword and the type name. + * Actually, a declspec can appear there as well (on MSVC) *) */ +just_attribute: + ATTRIBUTE LPAREN paren_attr_list RPAREN + { ("__attribute__", $3) } +| DECLSPEC paren_attr_list_ne { ("__declspec", $2) } +; + +/* this can't be empty, b/c I folded that possibility into the calling + * productions to avoid some S/R conflicts */ +just_attributes: + just_attribute { [$1] } +| just_attribute just_attributes { $1 :: $2 } +; + +/** (* PRAGMAS and ATTRIBUTES *) ***/ +pragma: +| PRAGMA_LINE { PRAGMA (fst $1, snd $1) } +; + +/* (* We want to allow certain strange things that occur in pragmas, so we + * cannot use directly the language of expressions *) */ +primary_attr: + IDENT { VARIABLE (fst $1) } + /*(* The NAMED_TYPE here creates conflicts with IDENT *)*/ +| NAMED_TYPE { VARIABLE (fst $1) } +| LPAREN attr RPAREN { $2 } +| IDENT IDENT { CALL(VARIABLE (fst $1), [VARIABLE (fst $2)]) } +| CST_INT { CONSTANT(CONST_INT (fst $1)) } +| string_constant { CONSTANT(CONST_STRING (fst $1)) } + /*(* Const when it appears in + * attribute lists, is translated + * to aconst *)*/ +| CONST { VARIABLE "aconst" } + +| IDENT COLON CST_INT { VARIABLE (fst $1 ^ ":" ^ fst $3) } + +/*(* The following rule conflicts with the ? : attributes. We give it a very + * low priority *)*/ +| CST_INT COLON CST_INT { VARIABLE (fst $1 ^ ":" ^ fst $3) } + +| DEFAULT COLON CST_INT { VARIABLE ("default:" ^ fst $3) } + + /*(** GCC allows this as an + * attribute for functions, + * synonim for noreturn **)*/ +| VOLATILE { VARIABLE ("__noreturn__") } +; + +postfix_attr: + primary_attr { $1 } + /* (* use a VARIABLE "" so that the + * parentheses are printed *) */ +| IDENT LPAREN RPAREN { CALL(VARIABLE (fst $1), [VARIABLE ""]) } +| IDENT paren_attr_list_ne { CALL(VARIABLE (fst $1), $2) } + +| postfix_attr ARROW id_or_typename {MEMBEROFPTR ($1, $3)} +| postfix_attr DOT id_or_typename {MEMBEROF ($1, $3)} +| postfix_attr LBRACKET attr RBRACKET {INDEX ($1, $3) } +; + +/*(* Since in attributes we use both IDENT and NAMED_TYPE as indentifiers, + * that leads to conflicts for SIZEOF and ALIGNOF. In those cases we require + * that their arguments be expressions, not attributes *)*/ +unary_attr: + postfix_attr { $1 } +| SIZEOF unary_expression {EXPR_SIZEOF (fst $2) } +| SIZEOF LPAREN type_name RPAREN + {let b, d = $3 in TYPE_SIZEOF (b, d)} + +| ALIGNOF unary_expression {EXPR_ALIGNOF (fst $2) } +| ALIGNOF LPAREN type_name RPAREN {let b, d = $3 in TYPE_ALIGNOF (b, d)} +| PLUS cast_attr {UNARY (PLUS, $2)} +| MINUS cast_attr {UNARY (MINUS, $2)} +| STAR cast_attr {UNARY (MEMOF, $2)} +| AND cast_attr + {UNARY (ADDROF, $2)} +| EXCLAM cast_attr {UNARY (NOT, $2)} +| TILDE cast_attr {UNARY (BNOT, $2)} +; + +cast_attr: + unary_attr { $1 } +; + +multiplicative_attr: + cast_attr { $1 } +| multiplicative_attr STAR cast_attr {BINARY(MUL ,$1 , $3)} +| multiplicative_attr SLASH cast_attr {BINARY(DIV ,$1 , $3)} +| multiplicative_attr PERCENT cast_attr {BINARY(MOD ,$1 , $3)} +; + + +additive_attr: + multiplicative_attr { $1 } +| additive_attr PLUS multiplicative_attr {BINARY(ADD ,$1 , $3)} +| additive_attr MINUS multiplicative_attr {BINARY(SUB ,$1 , $3)} +; + +shift_attr: + additive_attr { $1 } +| shift_attr INF_INF additive_attr {BINARY(SHL ,$1 , $3)} +| shift_attr SUP_SUP additive_attr {BINARY(SHR ,$1 , $3)} +; + +relational_attr: + shift_attr { $1 } +| relational_attr INF shift_attr {BINARY(LT ,$1 , $3)} +| relational_attr SUP shift_attr {BINARY(GT ,$1 , $3)} +| relational_attr INF_EQ shift_attr {BINARY(LE ,$1 , $3)} +| relational_attr SUP_EQ shift_attr {BINARY(GE ,$1 , $3)} +; + +equality_attr: + relational_attr { $1 } +| equality_attr EQ_EQ relational_attr {BINARY(EQ ,$1 , $3)} +| equality_attr EXCLAM_EQ relational_attr {BINARY(NE ,$1 , $3)} +; + + +bitwise_and_attr: + equality_attr { $1 } +| bitwise_and_attr AND equality_attr {BINARY(BAND ,$1 , $3)} +; + +bitwise_xor_attr: + bitwise_and_attr { $1 } +| bitwise_xor_attr CIRC bitwise_and_attr {BINARY(XOR ,$1 , $3)} +; + +bitwise_or_attr: + bitwise_xor_attr { $1 } +| bitwise_or_attr PIPE bitwise_xor_attr {BINARY(BOR ,$1 , $3)} +; + +logical_and_attr: + bitwise_or_attr { $1 } +| logical_and_attr AND_AND bitwise_or_attr {BINARY(AND ,$1 , $3)} +; + +logical_or_attr: + logical_and_attr { $1 } +| logical_or_attr PIPE_PIPE logical_and_attr {BINARY(OR ,$1 , $3)} +; + +conditional_attr: + logical_or_attr { $1 } +/* This is in conflict for now */ +| logical_or_attr QUEST conditional_attr COLON conditional_attr + { QUESTION($1, $3, $5) } + + +attr: conditional_attr { $1 } +; + +attr_list_ne: +| attr { [$1] } +| attr COMMA attr_list_ne { $1 :: $3 } +| error COMMA attr_list_ne { $3 } +; +attr_list: + /* empty */ { [] } +| attr_list_ne { $1 } +; +paren_attr_list_ne: + LPAREN attr_list_ne RPAREN { $2 } +| LPAREN error RPAREN { [] } +; +paren_attr_list: + LPAREN attr_list RPAREN { $2 } +| LPAREN error RPAREN { [] } +; +/*** GCC ASM instructions ***/ +asmattr: + /* empty */ { [] } +| VOLATILE asmattr { ("volatile", []) :: $2 } +| CONST asmattr { ("const", []) :: $2 } +; +asmtemplate: + one_string_constant { [$1] } +| one_string_constant asmtemplate { $1 :: $2 } +; +asmoutputs: + /* empty */ { None } +| COLON asmoperands asminputs + { let (ins, clobs) = $3 in + Some {aoutputs = $2; ainputs = ins; aclobbers = clobs} } +; +asmoperands: + /* empty */ { [] } +| asmoperandsne { List.rev $1 } +; +asmoperandsne: + asmoperand { [$1] } +| asmoperandsne COMMA asmoperand { $3 :: $1 } +; +asmoperand: + asmopname string_constant LPAREN expression RPAREN { ($1, fst $2, fst $4) } +| asmopname string_constant LPAREN error RPAREN { ($1, fst $2, NOTHING ) } +; +asminputs: + /* empty */ { ([], []) } +| COLON asmoperands asmclobber + { ($2, $3) } +; +asmopname: + /* empty */ { None } +| LBRACKET IDENT RBRACKET { Some (fst $2) } +; + +asmclobber: + /* empty */ { [] } +| COLON asmcloberlst_ne { $2 } +; +asmcloberlst_ne: + one_string_constant { [$1] } +| one_string_constant COMMA asmcloberlst_ne { $1 :: $3 } +; + +%% + + + diff --git a/cparser/Rename.ml b/cparser/Rename.ml new file mode 100644 index 0000000..4b2f350 --- /dev/null +++ b/cparser/Rename.ml @@ -0,0 +1,254 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Renaming of identifiers *) + +open C +open Cutil + +module StringSet = Set.Make(String) + +type rename_env = { + re_id: ident IdentMap.t; + re_used: StringSet.t +} + +let empty_env = { re_id = IdentMap.empty; re_used = StringSet.empty } + +(* For public global identifiers, we must keep their names *) + +let enter_global env id = + { re_id = IdentMap.add id id env.re_id; + re_used = StringSet.add id.name env.re_used } + +(* For static or local identifiers, we make up a new name if needed *) +(* If the same identifier has already been declared, + don't rename a second time *) + +let rename env id = + if IdentMap.mem id env.re_id then (id, env) else begin + let basename = + if id.name = "" then Printf.sprintf "_%d" id.stamp else id.name in + let newname = + if not (StringSet.mem basename env.re_used) then basename else begin + let rec find_name n = + let s = Printf.sprintf "%s__%d" basename n in + if StringSet.mem s env.re_used + then find_name (n+1) + else s + in find_name 1 + end in + let newid = {name = newname; stamp = id.stamp } in + ( newid, + { re_id = IdentMap.add id newid env.re_id; + re_used = StringSet.add newname env.re_used } ) + end + +(* Monadic map to thread an environment *) + +let rec mmap (f: rename_env -> 'a -> 'b * rename_env) env = function + | [] -> ([], env) + | hd :: tl -> + let (hd', env1) = f env hd in + let (tl', env2) = mmap f env1 tl in + (hd' :: tl', env2) + +(* Renaming *) + +let ident env id = + try + IdentMap.find id env.re_id + with Not_found -> + Errors.fatal_error "Internal error: Rename: %s__%d unbound" + id.name id.stamp + +let rec typ env = function + | TPtr(ty, a) -> TPtr(typ env ty, a) + | TArray(ty, sz, a) -> TArray(typ env ty, sz, a) + | TFun(res, None, va, a) -> TFun(typ env res, None, va, a) + | TFun(res, Some p, va, a) -> + let (p', _) = mmap param env p in + TFun(typ env res, Some p', va, a) + | TNamed(id, a) -> TNamed(ident env id, a) + | TStruct(id, a) -> TStruct(ident env id, a) + | TUnion(id, a) -> TUnion(ident env id, a) + | ty -> ty + +and param env (id, ty) = + if id.name = "" then + ((id, typ env ty), env) + else + let (id', env') = rename env id in ((id', typ env' ty), env') + +let constant env = function + | CEnum(id, v) -> CEnum(ident env id, v) + | cst -> cst + +let rec exp env e = + { edesc = exp_desc env e.edesc; etyp = typ env e.etyp } + +and exp_desc env = function + | EConst cst -> EConst(constant env cst) + | ESizeof ty -> ESizeof(typ env ty) + | EVar id -> EVar(ident env id) + | EUnop(op, a) -> EUnop(op, exp env a) + | EBinop(op, a, b, ty) -> EBinop(op, exp env a, exp env b, typ env ty) + | EConditional(a, b, c) -> EConditional(exp env a, exp env b, exp env c) + | ECast(ty, a) -> ECast(typ env ty, exp env a) + | ECall(a, al) -> ECall(exp env a, List.map (exp env) al) + +let optexp env = function + | None -> None + | Some a -> Some (exp env a) + +let field env f = + { fld_name = f.fld_name; + fld_typ = typ env f.fld_typ; + fld_bitfield = f.fld_bitfield } + +let rec init env = function + | Init_single e -> Init_single(exp env e) + | Init_array il -> Init_array (List.map (init env) il) + | Init_struct(id, il) -> + Init_struct(ident env id, + List.map (fun (f, i) -> (field env f, init env i)) il) + | Init_union(id, f, i) -> + Init_union(ident env id, field env f, init env i) + +let decl env (sto, id, ty, int) = + let (id', env') = rename env id in + ((sto, + id', + typ env' ty, + match int with None -> None | Some i -> Some(init env' i)), + env') + +let rec stmt env s = + { sdesc = stmt_desc env s.sdesc; sloc = s.sloc } + +and stmt_desc env = function + | Sskip -> Sskip + | Sdo a -> Sdo (exp env a) + | Sseq(s1, s2) -> Sseq(stmt env s1, stmt env s2) + | Sif(a, s1, s2) -> Sif(exp env a, stmt env s1, stmt env s2) + | Swhile(a, s) -> Swhile(exp env a, stmt env s) + | Sdowhile(s, a) -> Sdowhile(stmt env s, exp env a) + | Sfor(a1, a2, a3, s) -> + Sfor(stmt env a1, exp env a2, stmt env a3, stmt env s) + | Sbreak -> Sbreak + | Scontinue -> Scontinue + | Sswitch(a, s) -> Sswitch(exp env a, stmt env s) + | Slabeled(lbl, s) -> Slabeled(slabel env lbl, stmt env s) + | Sgoto lbl -> Sgoto lbl + | Sreturn a -> Sreturn (optexp env a) + | Sblock sl -> let (sl', _) = mmap stmt_or_decl env sl in Sblock sl' + | Sdecl d -> assert false + +and stmt_or_decl env s = + match s.sdesc with + | Sdecl d -> + let (d', env') = decl env d in + ({ sdesc = Sdecl d'; sloc = s.sloc}, env') + | _ -> + (stmt env s, env) + +and slabel env = function + | Scase e -> Scase(exp env e) + | sl -> sl + +let fundef env f = + let (name', env0) = rename env f.fd_name in + let (params', env1) = mmap param env0 f.fd_params in + let (locals', env2) = mmap decl env1 f.fd_locals in + ( { fd_storage = f.fd_storage; + fd_inline = f.fd_inline; + fd_name = name'; + fd_ret = typ env0 f.fd_ret; + fd_params = params'; + fd_vararg = f.fd_vararg; + fd_locals = locals'; + fd_body = stmt env2 f.fd_body }, + env0 ) + +let enum env (id, opte) = + let (id', env') = rename env id in + ((id', optexp env' opte), env') + +let rec globdecl env g = + let (desc', env') = globdecl_desc env g.gdesc in + ( { gdesc = desc'; gloc = g.gloc }, env' ) + +and globdecl_desc env = function + | Gdecl d -> + let (d', env') = decl env d in + (Gdecl d', env') + | Gfundef fd -> + let (fd', env') = fundef env fd in + (Gfundef fd', env') + | Gcompositedecl(kind, id) -> + let (id', env') = rename env id in + (Gcompositedecl(kind, id'), env') + | Gcompositedef(kind, id, members) -> + (Gcompositedef(kind, ident env id, List.map (field env) members), env) + | Gtypedef(id, ty) -> + let (id', env') = rename env id in + (Gtypedef(id', typ env' ty), env') + | Genumdef(id, members) -> + let (id', env') = rename env id in + let (members', env'') = mmap enum env' members in + (Genumdef(id', members'), env'') + | Gpragma s -> + (Gpragma s, env) + +let rec globdecls env accu = function + | [] -> List.rev accu + | dcl :: rem -> + let (dcl', env') = globdecl env dcl in + globdecls env' (dcl' :: accu) rem + +(* Reserve names of builtins *) + +let reserve_builtins () = + List.fold_left enter_global empty_env (Builtins.identifiers()) + +(* Reserve global declarations with public visibility *) + +let rec reserve_public env = function + | [] -> env + | dcl :: rem -> + let env' = + match dcl.gdesc with + | Gdecl(sto, id, _, _) -> + begin match sto with + | Storage_default | Storage_extern -> enter_global env id + | Storage_static -> env + | _ -> assert false + end + | Gfundef f -> + begin match f.fd_storage with + | Storage_default | Storage_extern -> enter_global env f.fd_name + | Storage_static -> env + | _ -> assert false + end + | _ -> env in + reserve_public env' rem + +(* Rename the program *) + +let program p = + globdecls + (reserve_public (reserve_builtins()) p) + [] p + diff --git a/cparser/Rename.mli b/cparser/Rename.mli new file mode 100644 index 0000000..818a51b --- /dev/null +++ b/cparser/Rename.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val program : C.program -> C.program diff --git a/cparser/SimplExpr.ml b/cparser/SimplExpr.ml new file mode 100644 index 0000000..330b184 --- /dev/null +++ b/cparser/SimplExpr.ml @@ -0,0 +1,568 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Pulling side-effects out of expressions *) + +(* Assumes: nothing + Produces: simplified code *) + +open C +open Cutil +open Transform + +(* Grammar of simplified expressions: + e ::= EConst cst + | ESizeof ty + | EVar id + | EUnop pure-unop e + | EBinop pure-binop e e + | EConditional e e e + | ECast ty e + + Grammar of statements produced to reflect side-effects in expressions: + s ::= Sskip + | Sdo (EBinop Oassign e e) + | Sdo (EBinop Oassign e (ECall e e* )) + | Sdo (Ecall e el) + | Sseq s s + | Sif e s s +*) + +let rec is_simpl_expr e = + match e.edesc with + | EConst cst -> true + | ESizeof ty -> true + | EVar id -> true + | EUnop((Ominus|Oplus|Olognot|Onot|Oderef|Oaddrof), e1) -> + is_simpl_expr e1 + | EBinop((Oadd|Osub|Omul|Odiv|Omod|Oand|Oor|Oxor|Oshl|Oshr| + Oeq|One|Olt|Ogt|Ole|Oge|Oindex|Ologand|Ologor), e1, e2, _) -> + is_simpl_expr e1 && is_simpl_expr e2 + | EConditional(e1, e2, e3) -> + is_simpl_expr e1 && is_simpl_expr e2 && is_simpl_expr e3 + | ECast(ty, e1) -> + is_simpl_expr e1 + | _ -> + false + +(* "Destination" of a simplified expression *) + +type exp_destination = + | RHS (* evaluate as a r-value *) + | LHS (* evaluate as a l-value *) + | Drop (* drop its value, we only need the side-effects *) + | Set of exp (* assign it to the given simplified l.h.s. *) + +let voidconst = { nullconst with etyp = TVoid [] } + +(* Reads from volatile lvalues are also considered as side-effects if + [volatilize] is true. *) + +let volatilize = ref false + +(* [simpl_expr loc env e act] returns a pair [s, e'] of + a statement that performs the side-effects present in [e] and + a simplified, side-effect-free expression [e']. + If [act] is [RHS], [e'] evaluates to the same value as [e]. + If [act] is [LHS], [e'] evaluates to the same location as [e]. + If [act] is [Drop], [e'] is not meaningful and must be ignored. + If [act] is [Set lhs], [s] also performs an assignment + equivalent to [lhs = e]. [e'] is not meaningful. *) + +let simpl_expr loc env e act = + + (* Temporaries should not be [const] because we assign into them, + and need not be [volatile] because no one else is writing into them. + As for [restrict] it doesn't make sense anyway. *) + + let new_temp ty = + Transform.new_temp (erase_attributes_type env ty) in + + let eboolvalof e = + { edesc = EBinop(One, e, intconst 0L IInt, TInt(IInt, [])); + etyp = TInt(IInt, []) } in + + let sseq s1 s2 = Cutil.sseq loc s1 s2 in + + let sassign e1 e2 = + { sdesc = Sdo {edesc = EBinop(Oassign, e1, e2, e1.etyp); etyp = e1.etyp}; + sloc = loc } in + + let sif e s1 s2 = + { sdesc = Sif(e, s1, s2); sloc = loc } in + + let is_volatile_read e = + !volatilize + && List.mem AVolatile (attributes_of_type env e.etyp) + && is_lvalue env e in + + let lhs_to_rhs e = + if is_volatile_read e + then (let t = new_temp e.etyp in (sassign t e, t)) + else (sskip, e) in + + let finish act s e = + match act with + | RHS -> + if is_volatile_read e + then (let t = new_temp e.etyp in (sseq s (sassign t e), t)) + else (s, e) + | LHS -> + (s, e) + | Drop -> + if is_volatile_read e + then (let t = new_temp e.etyp in (sseq s (sassign t e), voidconst)) + else (s, voidconst) + | Set lhs -> + if is_volatile_read e + then (let t = new_temp e.etyp in + (sseq s (sseq (sassign t e) (sassign lhs t)), voidconst)) + else (sseq s (sassign lhs e), voidconst) in + + let rec simpl e act = + match e.edesc with + + | EConst cst -> + finish act sskip e + + | ESizeof ty -> + finish act sskip e + + | EVar id -> + finish act sskip e + + | EUnop(op, e1) -> + + begin match op with + + | Ominus | Oplus | Olognot | Onot | Oderef | Oarrow _ -> + let (s1, e1') = simpl e1 RHS in + finish act s1 {edesc = EUnop(op, e1'); etyp = e.etyp} + + | Oaddrof -> + let (s1, e1') = simpl e1 LHS in + finish act s1 {edesc = EUnop(op, e1'); etyp = e.etyp} + + | Odot _ -> + let (s1, e1') = simpl e1 (if act = LHS then LHS else RHS) in + finish act s1 {edesc = EUnop(op, e1'); etyp = e.etyp} + + | Opreincr | Opredecr -> + let (s1, e1') = simpl e1 LHS in + let (s2, e2') = lhs_to_rhs e1' in + let op' = match op with Opreincr -> Oadd | _ -> Osub in + let ty = unary_conversion env e.etyp in + let e3 = + {edesc = EBinop(op', e2', intconst 1L IInt, ty); etyp = ty} in + begin match act with + | Drop -> + (sseq s1 (sseq s2 (sassign e1' e3)), voidconst) + | _ -> + let tmp = new_temp e.etyp in + finish act (sseq s1 (sseq s2 (sseq (sassign tmp e3) + (sassign e1' tmp)))) + tmp + end + + | Opostincr | Opostdecr -> + let (s1, e1') = simpl e1 LHS in + let op' = match op with Opostincr -> Oadd | _ -> Osub in + let ty = unary_conversion env e.etyp in + begin match act with + | Drop -> + let (s2, e2') = lhs_to_rhs e1' in + let e3 = + {edesc = EBinop(op', e2', intconst 1L IInt, ty); etyp = ty} in + (sseq s1 (sseq s2 (sassign e1' e3)), voidconst) + | _ -> + let tmp = new_temp e.etyp in + let e3 = + {edesc = EBinop(op', tmp, intconst 1L IInt, ty); etyp = ty} in + finish act (sseq s1 (sseq (sassign tmp e1') (sassign e1' e3))) + tmp + end + + end + + | EBinop(op, e1, e2, ty) -> + + begin match op with + + | Oadd | Osub | Omul | Odiv | Omod | Oand | Oor | Oxor + | Oshl | Oshr | Oeq | One | Olt | Ogt | Ole | Oge | Oindex -> + let (s1, e1') = simpl e1 RHS in + let (s2, e2') = simpl e2 RHS in + finish act (sseq s1 s2) + {edesc = EBinop(op, e1', e2', ty); etyp = e.etyp} + + | Oassign -> + if act = Drop && is_simpl_expr e1 then + simpl e2 (Set e1) + else begin + match act with + | Drop -> + let (s1, e1') = simpl e1 LHS in + let (s2, e2') = simpl e2 RHS in + (sseq s1 (sseq s2 (sassign e1' e2')), voidconst) + | _ -> + let tmp = new_temp e.etyp in + let (s1, e1') = simpl e1 LHS in + let (s2, e2') = simpl e2 (Set tmp) in + finish act (sseq s1 (sseq s2 (sassign e1' tmp))) + tmp + end + + | Oadd_assign | Osub_assign | Omul_assign | Odiv_assign + | Omod_assign | Oand_assign | Oor_assign | Oxor_assign + | Oshl_assign | Oshr_assign -> + let (s1, e1') = simpl e1 LHS in + let (s11, e11') = lhs_to_rhs e1' in + let (s2, e2') = simpl e2 RHS in + let op' = + match op with + | Oadd_assign -> Oadd | Osub_assign -> Osub + | Omul_assign -> Omul | Odiv_assign -> Odiv + | Omod_assign -> Omod | Oand_assign -> Oand + | Oor_assign -> Oor | Oxor_assign -> Oxor + | Oshl_assign -> Oshl | Oshr_assign -> Oshr + | _ -> assert false in + let e3 = + { edesc = EBinop(op', e11', e2', ty); etyp = ty } in + begin match act with + | Drop -> + (sseq s1 (sseq s11 (sseq s2 (sassign e1' e3))), voidconst) + | _ -> + let tmp = new_temp e.etyp in + finish act (sseq s1 (sseq s11 (sseq s2 + (sseq (sassign tmp e3) (sassign e1' tmp))))) + tmp + end + + | Ocomma -> + let (s1, _) = simpl e1 Drop in + let (s2, e2') = simpl e2 act in + (sseq s1 s2, e2') + + | Ologand -> + let (s1, e1') = simpl e1 RHS in + if is_simpl_expr e2 then begin + finish act s1 + {edesc = EBinop(Ologand, e1', e2, ty); etyp = e.etyp} + end else begin + match act with + | Drop -> + let (s2, _) = simpl e2 Drop in + (sseq s1 (sif e1' s2 sskip), voidconst) + | RHS | LHS -> (* LHS should not happen *) + let (s2, e2') = simpl e2 RHS in + let tmp = new_temp e.etyp in + (sseq s1 (sif e1' + (sseq s2 (sassign tmp (eboolvalof e2'))) + (sassign tmp (intconst 0L IInt))), + tmp) + | Set lv -> + let (s2, e2') = simpl e2 RHS in + (sseq s1 (sif e1' + (sseq s2 (sassign lv (eboolvalof e2'))) + (sassign lv (intconst 0L IInt))), + voidconst) + end + + | Ologor -> + let (s1, e1') = simpl e1 RHS in + if is_simpl_expr e2 then begin + finish act s1 + {edesc = EBinop(Ologor, e1', e2, ty); etyp = e.etyp} + end else begin + match act with + | Drop -> + let (s2, _) = simpl e2 Drop in + (sseq s1 (sif e1' sskip s2), voidconst) + | RHS | LHS -> (* LHS should not happen *) + let (s2, e2') = simpl e2 RHS in + let tmp = new_temp e.etyp in + (sseq s1 (sif e1' + (sassign tmp (intconst 1L IInt)) + (sseq s2 (sassign tmp (eboolvalof e2')))), + tmp) + | Set lv -> + let (s2, e2') = simpl e2 RHS in + (sseq s1 (sif e1' + (sassign lv (intconst 1L IInt)) + (sseq s2 (sassign lv (eboolvalof e2')))), + voidconst) + end + + end + + | EConditional(e1, e2, e3) -> + let (s1, e1') = simpl e1 RHS in + if is_simpl_expr e2 && is_simpl_expr e3 then begin + finish act s1 {edesc = EConditional(e1', e2, e3); etyp = e.etyp} + end else begin + match act with + | Drop -> + let (s2, _) = simpl e2 Drop in + let (s3, _) = simpl e3 Drop in + (sseq s1 (sif e1' s2 s3), voidconst) + | RHS | LHS -> (* LHS should not happen *) + let tmp = new_temp e.etyp in + let (s2, _) = simpl e2 (Set tmp) in + let (s3, _) = simpl e3 (Set tmp) in + (sseq s1 (sif e1' s2 s3), tmp) + | Set lv -> + let (s2, _) = simpl e2 (Set lv) in + let (s3, _) = simpl e3 (Set lv) in + (sseq s1 (sif e1' s2 s3), voidconst) + end + + | ECast(ty, e1) -> + if is_void_type env ty then begin + if act <> Drop then + Errors.warning "%acast to 'void' in a context expecting a value\n" + formatloc loc; + simpl e1 act + end else begin + let (s1, e1') = simpl e1 RHS in + finish act s1 {edesc = ECast(ty, e1'); etyp = e.etyp} + end + + | ECall(e1, el) -> + let (s1, e1') = simpl e1 RHS in + let (s2, el') = simpl_list el in + let e2 = { edesc = ECall(e1', el'); etyp = e.etyp } in + begin match act with + | Drop -> + (sseq s1 (sseq s2 {sdesc = Sdo e2; sloc=loc}), voidconst) + | Set({edesc = EVar _} as lhs) -> + (* CompCert wants the destination of a call to be a variable, + not a more complex lhs. In the latter case, we + fall through the catch-all case below *) + (sseq s1 (sseq s2 (sassign lhs e2)), voidconst) + | _ -> + let tmp = new_temp e.etyp in + finish act (sseq s1 (sseq s2 (sassign tmp e2))) tmp + end + + and simpl_list = function + | [] -> (sskip, []) + | e1 :: el -> + let (s1, e1') = simpl e1 RHS in + let (s2, el') = simpl_list el in + (sseq s1 s2, e1' :: el') + + in simpl e act + +(* Simplification of an initializer *) + +let simpl_initializer loc env i = + + let rec simpl_init = function + | Init_single e -> + let (s, e') = simpl_expr loc env e RHS in + (s, Init_single e) + | Init_array il -> + let rec simpl = function + | [] -> (sskip, []) + | i1 :: il -> + let (s1, i1') = simpl_init i1 in + let (s2, il') = simpl il in + (sseq loc s1 s2, i1' :: il') in + let (s, il') = simpl il in + (s, Init_array il') + | Init_struct(id, il) -> + let rec simpl = function + | [] -> (sskip, []) + | (f1, i1) :: il -> + let (s1, i1') = simpl_init i1 in + let (s2, il') = simpl il in + (sseq loc s1 s2, (f1, i1') :: il') in + let (s, il') = simpl il in + (s, Init_struct(id, il')) + | Init_union(id, f, i) -> + let (s, i') = simpl_init i in + (s, Init_union(id, f, i')) + + in simpl_init i + +(* Construct a simplified statement equivalent to [if (e) s1; else s2;]. + Optimizes the case where e contains [&&] or [||] or [?]. + [s1] or [s2] can be duplicated, so use only for small [s1] and [s2] + that do not define any labels. *) + +let rec simpl_if loc env e s1 s2 = + match e.edesc with + | EUnop(Olognot, e1) -> + simpl_if loc env e1 s2 s1 + | EBinop(Ologand, e1, e2, _) -> + simpl_if loc env e1 + (simpl_if loc env e2 s1 s2) + s2 + | EBinop(Ologor, e1, e2, _) -> + simpl_if loc env e1 + s1 + (simpl_if loc env e2 s1 s2) + | EConditional(e1, e2, e3) -> + simpl_if loc env e1 + (simpl_if loc env e2 s1 s2) + (simpl_if loc env e3 s1 s2) + | _ -> + let (s, e') = simpl_expr loc env e RHS in + sseq loc s {sdesc = Sif(e', s1, s2); sloc = loc} + +(* Trivial statements for which [simpl_if] is applicable *) + +let trivial_stmt s = + match s.sdesc with + | Sskip | Scontinue | Sbreak | Sgoto _ -> true + | _ -> false + +(* Construct a simplified statement equivalent to [if (!e) exit; ]. *) + +let break_if_false loc env e = + simpl_if loc env e + {sdesc = Sskip; sloc = loc} + {sdesc = Sbreak; sloc = loc} + +(* Simplification of a statement *) + +let simpl_statement env s = + + let rec simpl_stmt s = + match s.sdesc with + + | Sskip -> + s + + | Sdo e -> + let (s', _) = simpl_expr s.sloc env e Drop in + s' + + | Sseq(s1, s2) -> + {sdesc = Sseq(simpl_stmt s1, simpl_stmt s2); sloc = s.sloc} + + | Sif(e, s1, s2) -> + if trivial_stmt s1 && trivial_stmt s2 then + simpl_if s.sloc env e (simpl_stmt s1) (simpl_stmt s2) + else begin + let (s', e') = simpl_expr s.sloc env e RHS in + sseq s.sloc s' + {sdesc = Sif(e', simpl_stmt s1, simpl_stmt s2); + sloc = s.sloc} + end + + | Swhile(e, s1) -> + if is_simpl_expr e then + {sdesc = Swhile(e, simpl_stmt s1); sloc = s.sloc} + else + {sdesc = + Swhile(intconst 1L IInt, + sseq s.sloc (break_if_false s.sloc env e) + (simpl_stmt s1)); + sloc = s.sloc} + + | Sdowhile(s1, e) -> + if is_simpl_expr e then + {sdesc = Sdowhile(simpl_stmt s1, e); sloc = s.sloc} + else begin + let tmp = new_temp (TInt(IInt, [])) in + let (s', _) = simpl_expr s.sloc env e (Set tmp) in + let s_init = + {sdesc = Sdo {edesc = EBinop(Oassign, tmp, intconst 1L IInt, tmp.etyp); + etyp = tmp.etyp}; + sloc = s.sloc} in + {sdesc = Sfor(s_init, tmp, s', simpl_stmt s1); sloc = s.sloc} + end +(*** Alternate translation that unfortunately puts a "break" in the + "next" part of a "for", something that is not supported + by Clight semantics, and has unknown behavior in gcc. + {sdesc = + Sfor(sskip, + intconst 1L IInt, + break_if_false s.sloc env e, + simpl_stmt s1); + sloc = s.sloc} +***) + + | Sfor(s1, e, s2, s3) -> + if is_simpl_expr e then + {sdesc = Sfor(simpl_stmt s1, + e, + simpl_stmt s2, + simpl_stmt s3); + sloc = s.sloc} + else + let (s', e') = simpl_expr s.sloc env e RHS in + {sdesc = Sfor(sseq s.sloc (simpl_stmt s1) s', + e', + sseq s.sloc (simpl_stmt s2) s', + simpl_stmt s3); + sloc = s.sloc} + + | Sbreak -> + s + | Scontinue -> + s + + | Sswitch(e, s1) -> + let (s', e') = simpl_expr s.sloc env e RHS in + sseq s.sloc s' {sdesc = Sswitch(e', simpl_stmt s1); sloc = s.sloc} + + | Slabeled(lbl, s1) -> + {sdesc = Slabeled(lbl, simpl_stmt s1); sloc = s.sloc} + + | Sgoto lbl -> + s + + | Sreturn None -> + s + + | Sreturn (Some e) -> + let (s', e') = simpl_expr s.sloc env e RHS in + sseq s.sloc s' {sdesc = Sreturn(Some e'); sloc = s.sloc} + + | Sblock sl -> + {sdesc = Sblock(simpl_block sl); sloc = s.sloc} + + | Sdecl d -> assert false + + and simpl_block = function + | [] -> [] + | ({sdesc = Sdecl(sto, id, ty, None)} as s) :: sl -> + s :: simpl_block sl + | ({sdesc = Sdecl(sto, id, ty, Some i)} as s) :: sl -> + let (s', i') = simpl_initializer s.sloc env i in + let sl' = + {sdesc = Sdecl(sto, id, ty, Some i'); sloc = s.sloc} + :: simpl_block sl in + if s'.sdesc = Sskip then sl' else s' :: sl' + | s :: sl -> + simpl_stmt s :: simpl_block sl + + in simpl_stmt s + +(* Simplification of a function definition *) + +let simpl_fundef env f = + reset_temps(); + let body' = simpl_statement env f.fd_body in + let temps = get_temps() in + { f with fd_locals = f.fd_locals @ temps; fd_body = body' } + +(* Entry point *) + +let program ?(volatile = false) p = + volatilize := volatile; + Transform.program ~fundef:simpl_fundef p diff --git a/cparser/SimplExpr.mli b/cparser/SimplExpr.mli new file mode 100644 index 0000000..cdeb30c --- /dev/null +++ b/cparser/SimplExpr.mli @@ -0,0 +1,20 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Pulling side effects out of expressions. + If [volatile] is [true], treats reads from volatile rvalues + as side-effects *) + +val program: ?volatile: bool -> C.program -> C.program diff --git a/cparser/StructAssign.ml b/cparser/StructAssign.ml new file mode 100644 index 0000000..f5cecfc --- /dev/null +++ b/cparser/StructAssign.ml @@ -0,0 +1,157 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Expand assignments between structs and between unions *) + +(* Assumes: simplified code. + Preserves: simplified code, unblocked code *) + +open C +open Cutil +open Env +open Errors + +let maxsize = ref 8 + +let need_memcpy = ref (None: ident option) + +let memcpy_type = + TFun(TPtr(TVoid [], []), + Some [(Env.fresh_ident "", TPtr(TVoid [], [])); + (Env.fresh_ident "", TPtr(TVoid [AConst], [])); + (Env.fresh_ident "", TInt(size_t_ikind, []))], + false, []) + +let memcpy_ident () = + match !need_memcpy with + | None -> + let id = Env.fresh_ident "memcpy" in + need_memcpy := Some id; + id + | Some id -> + id + +let transf_assign env loc lhs rhs = + + let num_assign = ref 0 in + + let assign l r = + incr num_assign; + if !num_assign > !maxsize + then raise Exit + else sassign loc l r in + + let rec transf l r = + match unroll env l.etyp with + | TStruct(id, attr) -> + let ci = Env.find_struct env id in + if ci.ci_sizeof = None then + error "%a: Error: incomplete struct '%s'" formatloc loc id.name; + transf_struct l r ci.ci_members + | TUnion(id, attr) -> + raise Exit + | TArray(ty_elt, Some sz, attr) -> + transf_array l r ty_elt 0L sz + | TArray(ty_elt, None, attr) -> + error "%a: Error: array of unknown size" formatloc loc; + sskip (* will be ignored later *) + | _ -> + assign l r + + and transf_struct l r = function + | [] -> sskip + | f :: fl -> + sseq loc (transf {edesc = EUnop(Odot f.fld_name, l); etyp = f.fld_typ} + {edesc = EUnop(Odot f.fld_name, r); etyp = f.fld_typ}) + (transf_struct l r fl) + + and transf_array l r ty idx sz = + if idx >= sz then sskip else begin + let e = intconst idx size_t_ikind in + sseq loc (transf {edesc = EBinop(Oindex, l, e, ty); etyp = ty} + {edesc = EBinop(Oindex, r, e, ty); etyp = ty}) + (transf_array l r ty (Int64.add idx 1L) sz) + end + in + + try + transf lhs rhs + with Exit -> + let memcpy = {edesc = EVar(memcpy_ident()); etyp = memcpy_type} in + let e_lhs = {edesc = EUnop(Oaddrof, lhs); etyp = TPtr(lhs.etyp, [])} in + let e_rhs = {edesc = EUnop(Oaddrof, rhs); etyp = TPtr(rhs.etyp, [])} in + let e_size = {edesc = ESizeof(lhs.etyp); etyp = TInt(size_t_ikind, [])} in + {sdesc = Sdo {edesc = ECall(memcpy, [e_lhs; e_rhs; e_size]); + etyp = TVoid[]}; + sloc = loc} + +let rec transf_stmt env s = + match s.sdesc with + | Sskip -> s + | Sdo {edesc = EBinop(Oassign, lhs, rhs, _)} + when is_composite_type env lhs.etyp -> + transf_assign env s.sloc lhs rhs + | Sdo _ -> s + | Sseq(s1, s2) -> + {s with sdesc = Sseq(transf_stmt env s1, transf_stmt env s2)} + | Sif(e, s1, s2) -> + {s with sdesc = Sif(e, transf_stmt env s1, transf_stmt env s2)} + | Swhile(e, s1) -> + {s with sdesc = Swhile(e, transf_stmt env s1)} + | Sdowhile(s1, e) -> + {s with sdesc = Sdowhile(transf_stmt env s1, e)} + | Sfor(s1, e, s2, s3) -> + {s with sdesc = Sfor(transf_stmt env s1, e, + transf_stmt env s2, transf_stmt env s3)} + | Sbreak -> s + | Scontinue -> s + | Sswitch(e, s1) -> + {s with sdesc = Sswitch(e, transf_stmt env s1)} + | Slabeled(lbl, s1) -> + {s with sdesc = Slabeled(lbl, transf_stmt env s1)} + | Sgoto lbl -> s + | Sreturn _ -> s + | Sblock sl -> + {s with sdesc = Sblock(List.map (transf_stmt env) sl)} + | Sdecl d -> s + +let transf_fundef env fd = + {fd with fd_body = transf_stmt env fd.fd_body} + +let program p = + need_memcpy := None; + let p' = Transform.program ~fundef:transf_fundef p in + match !need_memcpy with + | None -> p' + | Some id -> + {gdesc = Gdecl(Storage_extern, id, memcpy_type, None); gloc = no_loc} + :: p' + +(* Horrible hack *) +(*** + let has_memcpy = ref false in + need_memcpy := None; + List.iter + (function {gdesc = Gdecl(_, ({name = "memcpy"} as id), _, _)} -> + need_memcpy := Some id; has_memcpy := true + | _ -> ()) + p; + let p' = Transform.program ~fundef:transf_fundef p in + match !need_memcpy with + | Some id when not !has_memcpy -> + {gdesc = Gdecl(Storage_extern, id, memcpy_type, None); gloc = no_loc} + :: p' + | _ -> p' +***) diff --git a/cparser/StructAssign.mli b/cparser/StructAssign.mli new file mode 100644 index 0000000..5549282 --- /dev/null +++ b/cparser/StructAssign.mli @@ -0,0 +1,18 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Expand assignments between structs and between unions *) + +val program: C.program -> C.program diff --git a/cparser/StructByValue.ml b/cparser/StructByValue.ml new file mode 100644 index 0000000..de79737 --- /dev/null +++ b/cparser/StructByValue.ml @@ -0,0 +1,235 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Eliminate by-value passing of structs and unions. *) + +(* Assumes: nothing. + Preserves: simplified code, unblocked code *) + +open C +open Cutil +open Transform + +(* In function argument types, struct s -> struct s * + In function result types, struct s -> void + add 1st parameter struct s * + Try to preserve original typedef names when no change. +*) + +let rec transf_type env t = + match unroll env t with + | TFun(tres, None, vararg, attr) -> + let tres' = transf_type env tres in + TFun((if is_composite_type env tres then TVoid [] else tres'), + None, vararg, attr) + | TFun(tres, Some args, vararg, attr) -> + let args' = List.map (transf_funarg env) args in + let tres' = transf_type env tres in + if is_composite_type env tres then begin + let res = Env.fresh_ident "_res" in + TFun(TVoid [], Some((res, TPtr(tres', [])) :: args'), vararg, attr) + end else + TFun(tres', Some args', vararg, attr) + | TPtr(t1, attr) -> + let t1' = transf_type env t1 in + if t1' = t1 then t else TPtr(transf_type env t1, attr) + | TArray(t1, sz, attr) -> + let t1' = transf_type env t1 in + if t1' = t1 then t else TArray(transf_type env t1, sz, attr) + | _ -> t + +and transf_funarg env (id, t) = + let t = transf_type env t in + if is_composite_type env t + then (id, TPtr(add_attributes_type [AConst] t, [])) + else (id, t) + +(* Simple exprs: no change in structure, since calls cannot occur within, + but need to rewrite the types. *) + +let rec transf_expr env e = + { etyp = transf_type env e.etyp; + edesc = match e.edesc with + | EConst c -> EConst c + | ESizeof ty -> ESizeof (transf_type env ty) + | EVar x -> EVar x + | EUnop(op, e1) -> EUnop(op, transf_expr env e1) + | EBinop(op, e1, e2, ty) -> + EBinop(op, transf_expr env e1, transf_expr env e2, transf_type env ty) + | EConditional(e1, e2, e3) -> + assert (not (is_composite_type env e.etyp)); + EConditional(transf_expr env e1, transf_expr env e2, transf_expr env e3) + | ECast(ty, e1) -> ECast(transf_type env ty, transf_expr env e1) + | ECall(e1, el) -> assert false + } + +(* Initializers *) + +let rec transf_init env = function + | Init_single e -> + Init_single (transf_expr env e) + | Init_array il -> + Init_array (List.map (transf_init env) il) + | Init_struct(id, fil) -> + Init_struct (id, List.map (fun (fld, i) -> (fld, transf_init env i)) fil) + | Init_union(id, fld, i) -> + Init_union(id, fld, transf_init env i) + +(* Declarations *) + +let transf_decl env (sto, id, ty, init) = + (sto, id, transf_type env ty, + match init with None -> None | Some i -> Some (transf_init env i)) + +(* Transformation of statements and function bodies *) + +let transf_funbody env body optres = + +let transf_type t = transf_type env t +and transf_expr e = transf_expr env e in + +(* Function arguments: pass by reference those having struct/union type *) + +let transf_arg e = + let e' = transf_expr e in + if is_composite_type env e'.etyp + then {edesc = EUnop(Oaddrof, e'); etyp = TPtr(e'.etyp, [])} + else e' +in + +(* Function calls: if return type is struct or union, + lv = f(...) -> f(&lv, ...) + f(...) -> f(&newtemp, ...) + Returns: if return type is struct or union, + return x -> _res = x; return +*) + +let rec transf_stmt s = + match s.sdesc with + | Sskip -> s + | Sdo {edesc = ECall(fn, args); etyp = ty} -> + let fn = transf_expr fn in + let args = List.map transf_arg args in + if is_composite_type env ty then begin + let tmp = new_temp ~name:"_res" ty in + let arg0 = {edesc = EUnop(Oaddrof, tmp); etyp = TPtr(ty, [])} in + {s with sdesc = Sdo {edesc = ECall(fn, arg0 :: args); etyp = TVoid []}} + end else + {s with sdesc = Sdo {edesc = ECall(fn, args); etyp = ty}} + | Sdo {edesc = EBinop(Oassign, dst, {edesc = ECall(fn, args); etyp = ty}, _)} -> + let dst = transf_expr dst in + let fn = transf_expr fn in + let args = List.map transf_arg args in + let ty = transf_type ty in + if is_composite_type env ty then begin + let arg0 = {edesc = EUnop(Oaddrof, dst); etyp = TPtr(dst.etyp, [])} in + {s with sdesc = Sdo {edesc = ECall(fn, arg0 :: args); etyp = TVoid []}} + end else + sassign s.sloc dst {edesc = ECall(fn, args); etyp = ty} + | Sdo e -> + {s with sdesc = Sdo(transf_expr e)} + | Sseq(s1, s2) -> + {s with sdesc = Sseq(transf_stmt s1, transf_stmt s2)} + | Sif(e, s1, s2) -> + {s with sdesc = Sif(transf_expr e, transf_stmt s1, transf_stmt s2)} + | Swhile(e, s1) -> + {s with sdesc = Swhile(transf_expr e, transf_stmt s1)} + | Sdowhile(s1, e) -> + {s with sdesc = Sdowhile(transf_stmt s1, transf_expr e)} + | Sfor(s1, e, s2, s3) -> + {s with sdesc = Sfor(transf_stmt s1, transf_expr e, + transf_stmt s2, transf_stmt s3)} + | Sbreak -> s + | Scontinue -> s + | Sswitch(e, s1) -> + {s with sdesc = Sswitch(transf_expr e, transf_stmt s1)} + | Slabeled(lbl, s1) -> + {s with sdesc = Slabeled(lbl, transf_stmt s1)} + | Sgoto lbl -> s + | Sreturn None -> s + | Sreturn(Some e) -> + let e = transf_expr e in + begin match optres with + | None -> + {s with sdesc = Sreturn(Some e)} + | Some dst -> + sseq s.sloc + (sassign s.sloc dst e) + {sdesc = Sreturn None; sloc = s.sloc} + end + | Sblock sl -> + {s with sdesc = Sblock(List.map transf_stmt sl)} + | Sdecl d -> + {s with sdesc = Sdecl(transf_decl env d)} + +in + transf_stmt body + +let transf_params loc env params = + let rec transf_prm = function + | [] -> + ([], [], sskip) + | (id, ty) :: params -> + let ty = transf_type env ty in + if is_composite_type env ty then begin + let id' = Env.fresh_ident id.name in + let ty' = TPtr(add_attributes_type [AConst] ty, []) in + let (params', decls, init) = transf_prm params in + ((id', ty') :: params', + (Storage_default, id, ty, None) :: decls, + sseq loc + (sassign loc {edesc = EVar id; etyp = ty} + {edesc = EUnop(Oderef, {edesc = EVar id'; etyp = ty'}); + etyp = ty}) + init) + end else begin + let (params', decls, init) = transf_prm params in + ((id, ty) :: params', decls, init) + end + in transf_prm params + +let transf_fundef env f = + reset_temps(); + let ret = transf_type env f.fd_ret in + let (params, newdecls, init) = transf_params f.fd_body.sloc env f.fd_params in + let (ret1, params1, body1) = + if is_composite_type env ret then begin + let vres = Env.fresh_ident "_res" in + let tres = TPtr(ret, []) in + let eres = {edesc = EVar vres; etyp = tres} in + let eeres = {edesc = EUnop(Oderef, eres); etyp = ret} in + (TVoid [], + (vres, tres) :: params, + transf_funbody env f.fd_body (Some eeres)) + end else + (ret, params, transf_funbody env f.fd_body None) in + let body2 = sseq body1.sloc init body1 in + let temps = get_temps() in + {f with fd_ret = ret1; fd_params = params1; + fd_locals = newdecls @ f.fd_locals @ temps; fd_body = body2} + +(* Composites *) + +let transf_composite env su id fl = + List.map (fun f -> {f with fld_typ = transf_type env f.fld_typ}) fl + +(* Entry point *) + +let program p = + Transform.program + ~decl:transf_decl + ~fundef:transf_fundef + ~composite:transf_composite + ~typedef:(fun env id ty -> transf_type env ty) + p diff --git a/cparser/StructByValue.mli b/cparser/StructByValue.mli new file mode 100644 index 0000000..45899a4 --- /dev/null +++ b/cparser/StructByValue.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +val program: C.program -> C.program diff --git a/cparser/Transform.ml b/cparser/Transform.ml new file mode 100644 index 0000000..b7f57f3 --- /dev/null +++ b/cparser/Transform.ml @@ -0,0 +1,79 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Generic program transformation *) + +open C +open Cutil +open Env + +(* Recording fresh temporaries *) + +let temporaries = ref ([]: decl list) + +let reset_temps () = + temporaries := [] + +let new_temp_var ?(name = "t") ty = + let id = Env.fresh_ident name in + temporaries := (Storage_default, id, ty, None) :: !temporaries; + id + +let new_temp ?(name = "t") ty = + let id = new_temp_var ~name ty in + { edesc = EVar id; etyp = ty } + +let get_temps () = + let temps = !temporaries in + temporaries := []; + List.rev temps + +(* Generic transformation *) + +let program + ?(decl = fun env d -> d) + ?(fundef = fun env fd -> fd) + ?(composite = fun env su id fl -> fl) + ?(typedef = fun env id ty -> ty) + p = + +(* In all transformations of interest so far, the environment is used only + for its type definitions and struct/union definitions, + so we do not update it for other definitions. *) + + let rec transf_globdecls env accu = function + | [] -> List.rev accu + | g :: gl -> + let (desc', env') = + match g.gdesc with + | Gdecl((sto, id, ty, init) as d) -> + (Gdecl(decl env d), Env.add_ident env id sto ty) + | Gfundef f -> + (Gfundef(fundef env f), + Env.add_ident env f.fd_name f.fd_storage (fundef_typ f)) + | Gcompositedecl(su, id) -> + (Gcompositedecl(su, id), + Env.add_composite env id (composite_info_decl env su)) + | Gcompositedef(su, id, fl) -> + (Gcompositedef(su, id, composite env su id fl), + Env.add_composite env id (composite_info_def env su fl)) + | Gtypedef(id, ty) -> + (Gtypedef(id, typedef env id ty), Env.add_typedef env id ty) + | Genumdef _ as gd -> (gd, env) + | Gpragma _ as gd -> (gd, env) + in + transf_globdecls env' ({g with gdesc = desc'} :: accu) gl + + in transf_globdecls (Builtins.environment()) [] p diff --git a/cparser/Transform.mli b/cparser/Transform.mli new file mode 100644 index 0000000..960d890 --- /dev/null +++ b/cparser/Transform.mli @@ -0,0 +1,30 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Generic program transformation *) + +val reset_temps : unit -> unit +val new_temp_var : ?name:string -> C.typ -> C.ident +val new_temp : ?name:string -> C.typ -> C.exp +val get_temps : unit -> C.decl list + +val program : + ?decl:(Env.t -> C.decl -> C.decl) -> + ?fundef:(Env.t -> C.fundef -> C.fundef) -> + ?composite:(Env.t -> + C.struct_or_union -> C.ident -> C.field list -> C.field list) -> + ?typedef:(Env.t -> C.ident -> Env.typedef_info -> Env.typedef_info) -> + C.program -> + C.program diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml new file mode 100644 index 0000000..fa304b7 --- /dev/null +++ b/cparser/Unblock.ml @@ -0,0 +1,133 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Simplification of blocks and initializers within functions *) + +(* Assumes: nothing + Produces: unblocked code *) + +open C +open Cutil +open Errors + +(* Convert an initializer to a list of assignments. + Prepend those assignments to the given statement. *) + +let sdoseq loc e s = + sseq loc {sdesc = Sdo e; sloc = loc} s + +let rec local_initializer loc env path init k = + match init with + | Init_single e -> + sdoseq loc + { edesc = EBinop(Oassign, path, e, path.etyp); etyp = path.etyp } + k + | Init_array il -> + let ty_elt = + match unroll env path.etyp with + | TArray(ty_elt, _, _) -> ty_elt + | _ -> fatal_error "%aWrong type for array initializer" + formatloc loc in + let rec array_init pos = function + | [] -> k + | i :: il -> + local_initializer loc env + { edesc = EBinop(Oindex, path, intconst pos IInt, TPtr(ty_elt, [])); + etyp = ty_elt } + i + (array_init (Int64.succ pos) il) in + array_init 0L il + | Init_struct(id, fil) -> + let field_init (fld, i) k = + local_initializer loc env + { edesc = EUnop(Odot fld.fld_name, path); etyp = fld.fld_typ } + i k in + List.fold_right field_init fil k + | Init_union(id, fld, i) -> + local_initializer loc env + { edesc = EUnop(Odot fld.fld_name, path); etyp = fld.fld_typ } + i k + +(* Record new variables to be locally defined *) + +let local_variables = ref ([]: decl list) + +(* Note: "const int x = y - 1;" is legal, but we turn it into + "const int x; x = y - 1;", which is not. Therefore, remove + top-level 'const' attribute. Also remove it on element type of + array type. *) + +let remove_const env ty = remove_attributes_type env [AConst] ty + +(* Process a variable declaration. + The variable is entered in [local_variables]. + The initializer, if any, is converted into assignments and + prepended to [k]. *) + +let process_decl loc env (sto, id, ty, optinit) k = + let ty' = remove_const env ty in + local_variables := (sto, id, ty', None) :: !local_variables; + match optinit with + | None -> k + | Some init -> + local_initializer loc env { edesc = EVar id; etyp = ty' } init k + +(* Simplification of blocks within a statement *) + +let rec unblock_stmt env s = + match s.sdesc with + | Sskip -> s + | Sdo e -> s + | Sseq(s1, s2) -> + {s with sdesc = Sseq(unblock_stmt env s1, unblock_stmt env s2)} + | Sif(e, s1, s2) -> + {s with sdesc = Sif(e, unblock_stmt env s1, unblock_stmt env s2)} + | Swhile(e, s1) -> + {s with sdesc = Swhile(e, unblock_stmt env s1)} + | Sdowhile(s1, e) -> + {s with sdesc = Sdowhile(unblock_stmt env s1, e)} + | Sfor(s1, e, s2, s3) -> + {s with sdesc = Sfor(unblock_stmt env s1, e, unblock_stmt env s2, unblock_stmt env s3)} + | Sbreak -> s + | Scontinue -> s + | Sswitch(e, s1) -> + {s with sdesc = Sswitch(e, unblock_stmt env s1)} + | Slabeled(lbl, s1) -> + {s with sdesc = Slabeled(lbl, unblock_stmt env s1)} + | Sgoto lbl -> s + | Sreturn opte -> s + | Sblock sl -> unblock_block env sl + | Sdecl d -> assert false + +and unblock_block env = function + | [] -> sskip + | {sdesc = Sdecl d; sloc = loc} :: sl -> + process_decl loc env d (unblock_block env sl) + | s :: sl -> + sseq s.sloc (unblock_stmt env s) (unblock_block env sl) + +(* Simplification of blocks within a function *) + +let unblock_fundef env f = + local_variables := []; + let body = unblock_stmt env f.fd_body in + let decls = !local_variables in + local_variables := []; + { f with fd_locals = f.fd_locals @ decls; fd_body = body } + +(* Entry point *) + +let program p = + Transform.program ~fundef:unblock_fundef p diff --git a/cparser/Unblock.mli b/cparser/Unblock.mli new file mode 100644 index 0000000..e6bea9e --- /dev/null +++ b/cparser/Unblock.mli @@ -0,0 +1,18 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Simplification of blocks and initializers within functions *) + +val program: C.program -> C.program diff --git a/cparser/uint64.c b/cparser/uint64.c new file mode 100644 index 0000000..5396617 --- /dev/null +++ b/cparser/uint64.c @@ -0,0 +1,42 @@ +/* *********************************************************************/ +/* */ +/* The Compcert verified compiler */ +/* */ +/* Xavier Leroy, INRIA Paris-Rocquencourt */ +/* */ +/* Copyright Institut National de Recherche en Informatique et en */ +/* Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 2 of the License, or */ +/* (at your option) any later version. This file is also distributed */ +/* under the terms of the INRIA Non-Commercial License Agreement. */ +/* */ +/* *********************************************************************/ + +#include +#include + +value cparser_int64_unsigned_to_float(value v) +{ + return caml_copy_double((double)((uint64) Int64_val(v))); +} + +value cparser_int64_unsigned_div(value v1, value v2) +{ + return caml_copy_int64((uint64) Int64_val(v1) / (uint64) Int64_val(v2)); +} + +value cparser_int64_unsigned_mod(value v1, value v2) +{ + return caml_copy_int64((uint64) Int64_val(v1) % (uint64) Int64_val(v2)); +} + +value cparser_int64_unsigned_compare(value v1, value v2) +{ + uint64 n1 = (uint64) Int64_val(v1); + uint64 n2 = (uint64) Int64_val(v2); + if (n1 < n2) return Val_int(-1); + if (n1 > n2) return Val_int(1); + return Val_int(0); +} + diff --git a/distributed_files b/distributed_files new file mode 100644 index 0000000..384b29f --- /dev/null +++ b/distributed_files @@ -0,0 +1,1950 @@ +. +./_tags +./configure +./Makefile.in +./README +./_tags.common +./Makefile.local +./myocamlbuild.ml +./Makefile.config +./distributed_files +./Makefile.variables.in +./_tags.compiler +./cparser +./cparser/SimplExpr.ml +./cparser/Env.mli +./cparser/C.mli +./cparser/Builtins.mli +./cparser/CBuiltins.ml +./cparser/Lexer.mli +./cparser/Elab.mli +./cparser/StructAssign.mli +./cparser/Parse.mli +./cparser/Bitfields.ml +./cparser/Machine.mli +./cparser/Unblock.ml +./cparser/Cleanup.mli +./cparser/Ceval.mli +./cparser/StructByValue.ml +./cparser/Unblock.mli +./cparser/Cabshelper.ml +./cparser/AddCasts.ml +./cparser/.depend +./cparser/Main.ml +./cparser/Cprint.ml +./cparser/Machine.ml +./cparser/StructByValue.mli +./cparser/GCC.ml +./cparser/uint64.c +./cparser/Cabs.ml +./cparser/Cutil.ml +./cparser/Env.ml +./cparser/Rename.ml +./cparser/Bitfields.mli +./cparser/Transform.ml +./cparser/Errors.ml +./cparser/Parse_aux.ml +./cparser/Elab.ml +./cparser/Cleanup.ml +./cparser/Ceval.ml +./cparser/Parser.mly +./cparser/Makefile +./cparser/Cutil.mli +./cparser/Parse_aux.mli +./cparser/GCC.mli +./cparser/AddCasts.mli +./cparser/SimplExpr.mli +./cparser/Parse.ml +./cparser/Errors.mli +./cparser/Rename.mli +./cparser/StructAssign.ml +./cparser/Builtins.ml +./cparser/Lexer.mll +./cparser/Cprint.mli +./cparser/Transform.mli +./Makefile.generic +./web +./web/fetopen.png +./web/accweb.js +./web/make-cerco-input.sh +./web/cerco_input.xml +./web/accweb.html +./web/accweb_oclosure.js +./configure.ac +./tests +./tests/review1 +./tests/review1/bubble_sort.c +./tests/review1/search.c +./tests/tmp_tests +./tests/tmp_tests/Backend +./tests/tmp_tests/Backend/struct_and_ptr_and_fact_u.c +./tests/tmp_tests/Backend/bubble_sort_u.c +./tests/tmp_tests/Backend/quicksort.c +./tests/tmp_tests/Backend/bubble_sort.c +./tests/tmp_tests/Backend/array_copy_u.c +./tests/tmp_tests/Backend/array_copy.c +./tests/tmp_tests/Backend/struct_and_ptr_and_fact.c +./tests/tmp_tests/Backend/search.c +./tests/tmp_tests/Backend/quicksort_u.c +./tests/tmp_tests/Frontend +./tests/tmp_tests/Frontend/bubble_sort.RTLabs +./tests/tmp_tests/Frontend/call.c +./tests/tmp_tests/Frontend/struct_and_ptr_and_fact.RTLabs +./tests/tmp_tests/Frontend/quicksort.RTLabs +./tests/tmp_tests/Frontend/array_copy.RTLabs +./tests/tmp_tests/Frontend/quicksort.c +./tests/tmp_tests/Frontend/cparser294ccc9.i +./tests/tmp_tests/Frontend/bubble_sort.c +./tests/tmp_tests/Frontend/array_copy.c +./tests/tmp_tests/Frontend/struct_and_ptr_and_fact.c +./tests/tmp_tests/Frontend/cparser19c05bb.c +./tests/tmp_tests/Frontend/search.RTLabs +./tests/tmp_tests/Frontend/search.c +./tests/GCCTestSuite +./tests/GCCTestSuite/label-compound-stmt-1.c +./tests/GCCTestSuite/wchar_t-2.s.expected +./tests/GCCTestSuite/intermod-1.hex.expected +./tests/GCCTestSuite/pr22335-1.c +./tests/GCCTestSuite/pack-test-2.hex.expected +./tests/GCCTestSuite/pr26570.s.expected +./tests/GCCTestSuite/darwin-ld-3.s.expected +./tests/GCCTestSuite/decl-4.hex.expected +./tests/GCCTestSuite/attr-used.c.expected +./tests/GCCTestSuite/c90-impl-int-1.hex.expected +./tests/GCCTestSuite/arm-scd42-1.s.expected +./tests/GCCTestSuite/declspec-12.s.expected +./tests/GCCTestSuite/darwin-ld-20040828-2.s.expected +./tests/GCCTestSuite/arm-scd42-3.s.expected +./tests/GCCTestSuite/symbian4.c +./tests/GCCTestSuite/compare8.hex.expected +./tests/GCCTestSuite/visibility-4.c.expected +./tests/GCCTestSuite/c90-dupqual-1.s.expected +./tests/GCCTestSuite/profile-generate-1.s.expected +./tests/GCCTestSuite/register-var-2.c.expected +./tests/GCCTestSuite/array-quals-2.hex.expected +./tests/GCCTestSuite/winline-7.s.expected +./tests/GCCTestSuite/pr11459-1.hex.expected +./tests/GCCTestSuite/pragma-isr-trap_exit.s.expected +./tests/GCCTestSuite/uninit-6.c.expected +./tests/GCCTestSuite/inline-8.hex.expected +./tests/GCCTestSuite/pr11864-1.c +./tests/GCCTestSuite/bitfld-5.c +./tests/GCCTestSuite/void-cast-1.c +./tests/GCCTestSuite/darwin-ld-5.hex.expected +./tests/GCCTestSuite/darwin-ld-20040828-1.c.expected +./tests/GCCTestSuite/local1.hex.expected +./tests/GCCTestSuite/qual-return-4.hex.expected +./tests/GCCTestSuite/noreturn-7.c.expected +./tests/GCCTestSuite/951130-1.hex.expected +./tests/GCCTestSuite/empty-source-3.hex.expected +./tests/GCCTestSuite/pr22308-1.s.expected +./tests/GCCTestSuite/pr23584.s.expected +./tests/GCCTestSuite/winline-3.hex.expected +./tests/GCCTestSuite/concat2.c.expected +./tests/GCCTestSuite/pr17635.hex.expected +./tests/GCCTestSuite/empty-source-1.c +./tests/GCCTestSuite/visibility-8.s.expected +./tests/GCCTestSuite/parm-mismatch-1.c.expected +./tests/GCCTestSuite/980502-1.c.expected +./tests/GCCTestSuite/profile-generate-2.hex.expected +./tests/GCCTestSuite/wchar_t-1.hex.expected +./tests/GCCTestSuite/symbian1.c.expected +./tests/GCCTestSuite/noreturn-2.c +./tests/GCCTestSuite/pr15825-1.hex.expected +./tests/GCCTestSuite/inline2.c +./tests/GCCTestSuite/c90-idem-qual-3.c +./tests/GCCTestSuite/pr29581-1.hex.expected +./tests/GCCTestSuite/anon-struct-6.c.expected +./tests/GCCTestSuite/inline-17.s.expected +./tests/GCCTestSuite/pr25795-1.c +./tests/GCCTestSuite/c99-main-1.s.expected +./tests/GCCTestSuite/pr30473.c +./tests/GCCTestSuite/arm-scd42-3.hex.expected +./tests/GCCTestSuite/darwin-ld-4.s.expected +./tests/GCCTestSuite/c99-idem-qual-3.c.expected +./tests/GCCTestSuite/register-var-1.c +./tests/GCCTestSuite/section1.c +./tests/GCCTestSuite/inline-7.c.expected +./tests/GCCTestSuite/funroll-loops-all.c.expected +./tests/GCCTestSuite/inline-18.hex.expected +./tests/GCCTestSuite/c90-mixdecl-1.c.expected +./tests/GCCTestSuite/attr-mode-1.c.expected +./tests/GCCTestSuite/c90-flex-array-1.c +./tests/GCCTestSuite/c90-impl-int-1.c +./tests/GCCTestSuite/pr18241-5.hex.expected +./tests/GCCTestSuite/uninit-D.s.expected +./tests/GCCTestSuite/pr17036-1.hex.expected +./tests/GCCTestSuite/cris-peep2-andu2.hex.expected +./tests/GCCTestSuite/c99-tag-2.c +./tests/GCCTestSuite/c90-array-quals-2.c +./tests/GCCTestSuite/bitfld-6.c.expected +./tests/GCCTestSuite/void-cast-2.hex.expected +./tests/GCCTestSuite/pr24367.hex.expected +./tests/GCCTestSuite/c99-array-lval-6.hex.expected +./tests/GCCTestSuite/noreturn-7.hex.expected +./tests/GCCTestSuite/const-elim-2.c +./tests/GCCTestSuite/c90-idem-qual-2.c +./tests/GCCTestSuite/940409-1.c +./tests/GCCTestSuite/pr21085.s.expected +./tests/GCCTestSuite/c99-array-lval-6.c.expected +./tests/GCCTestSuite/align-1.s.expected +./tests/GCCTestSuite/volatile1.s.expected +./tests/GCCTestSuite/uninit-C.c.expected +./tests/GCCTestSuite/decl-4.c +./tests/GCCTestSuite/winline-1.s.expected +./tests/GCCTestSuite/always_inline2.c.expected +./tests/GCCTestSuite/simd-1b.hex.expected +./tests/GCCTestSuite/winline-2.c +./tests/GCCTestSuite/c99-tag-2.s.expected +./tests/GCCTestSuite/pr22335-2.s.expected +./tests/GCCTestSuite/attr-mode-1.hex.expected +./tests/GCCTestSuite/inline-8.c.expected +./tests/GCCTestSuite/c99-array-nonobj-1.s.expected +./tests/GCCTestSuite/compare7.c +./tests/GCCTestSuite/darwin-ld-20040809-2.c +./tests/GCCTestSuite/pr23625.s.expected +./tests/GCCTestSuite/uninit-5.c.expected +./tests/GCCTestSuite/const-elim-2.hex.expected +./tests/GCCTestSuite/pr15698-3.c.expected +./tests/GCCTestSuite/pr25559.c.expected +./tests/GCCTestSuite/pr26004.c +./tests/GCCTestSuite/always_inline3.c +./tests/GCCTestSuite/inline-21.c +./tests/GCCTestSuite/always_inline3.s.expected +./tests/GCCTestSuite/empty-source-2.hex.expected +./tests/GCCTestSuite/pr11459-1.s.expected +./tests/GCCTestSuite/inline-6.c.expected +./tests/GCCTestSuite/unused-3.s.expected +./tests/GCCTestSuite/wtr-switch-1.s.expected +./tests/GCCTestSuite/pr18921-1.s.expected +./tests/GCCTestSuite/empty-source-3.c +./tests/GCCTestSuite/inline-10.c +./tests/GCCTestSuite/nonnull-1.c +./tests/GCCTestSuite/dll-4.c +./tests/GCCTestSuite/cleanup-6.c.expected +./tests/GCCTestSuite/pr17957.hex.expected +./tests/GCCTestSuite/unused-4.s.expected +./tests/GCCTestSuite/winline-5.hex.expected +./tests/GCCTestSuite/inline2.c.expected +./tests/GCCTestSuite/pragma-ep-2.c.expected +./tests/GCCTestSuite/cast-qual-1.hex.expected +./tests/GCCTestSuite/uninit-F.c.expected +./tests/GCCTestSuite/uninit-H.hex.expected +./tests/GCCTestSuite/visibility-9.c.expected +./tests/GCCTestSuite/winline-7.c.expected +./tests/GCCTestSuite/ultrasp4.hex.expected +./tests/GCCTestSuite/unused-5.c.expected +./tests/GCCTestSuite/redecl-9.hex.expected +./tests/GCCTestSuite/c99-impl-int-2.c.expected +./tests/GCCTestSuite/dollar.c.expected +./tests/GCCTestSuite/fold-xor-2.c.expected +./tests/GCCTestSuite/deprecated-3.c +./tests/GCCTestSuite/c90-array-lval-5.c +./tests/GCCTestSuite/pr15784-4.c +./tests/GCCTestSuite/anon-struct-6.s.expected +./tests/GCCTestSuite/c99-restrict-2.c +./tests/GCCTestSuite/null-pointer-1.s.expected +./tests/GCCTestSuite/inline-18.s.expected +./tests/GCCTestSuite/comp-return-1.s.expected +./tests/GCCTestSuite/cleanup-6.s.expected +./tests/GCCTestSuite/alias-8.c.expected +./tests/GCCTestSuite/c90-array-quals-2.c.expected +./tests/GCCTestSuite/uninit-11.c.expected +./tests/GCCTestSuite/c99-dupqual-1.c.expected +./tests/GCCTestSuite/pr22329.c +./tests/GCCTestSuite/fold-abs-3.c +./tests/GCCTestSuite/pr3074-1.s.expected +./tests/GCCTestSuite/pr15698-4.c.expected +./tests/GCCTestSuite/pragma-ep-3.s.expected +./tests/GCCTestSuite/pr15698-6.s.expected +./tests/GCCTestSuite/struct-ret-2.c.expected +./tests/GCCTestSuite/inline5.s.expected +./tests/GCCTestSuite/redecl-13.c +./tests/GCCTestSuite/inline1.s.expected +./tests/GCCTestSuite/sparc-constant-1.c +./tests/GCCTestSuite/pr15698-6.c.expected +./tests/GCCTestSuite/darwin-ld-1.s.expected +./tests/GCCTestSuite/funcdef-var-2.hex.expected +./tests/GCCTestSuite/unused-5.hex.expected +./tests/GCCTestSuite/pr29581-3.hex.expected +./tests/GCCTestSuite/always_inline3.c.expected +./tests/GCCTestSuite/parm-mismatch-1.hex.expected +./tests/GCCTestSuite/fdata-sections-1.hex.expected +./tests/GCCTestSuite/label-compound-stmt-1.c.expected +./tests/GCCTestSuite/ultrasp2.c.expected +./tests/GCCTestSuite/c99-func-2.c +./tests/GCCTestSuite/alias-2.c.expected +./tests/GCCTestSuite/struct-empty-2.hex.expected +./tests/GCCTestSuite/attr-isr-trap_exit.c.expected +./tests/GCCTestSuite/assign-warn-3.c +./tests/GCCTestSuite/c99-array-lval-7.c +./tests/GCCTestSuite/pr18921-1.c +./tests/GCCTestSuite/uninit-2.c +./tests/GCCTestSuite/visibility-b.c.expected +./tests/GCCTestSuite/c90-enum-comma-1.s.expected +./tests/GCCTestSuite/profile-generate-1.hex.expected +./tests/GCCTestSuite/winline-2.s.expected +./tests/GCCTestSuite/null-pointer-1.hex.expected +./tests/GCCTestSuite/always_inline2.hex.expected +./tests/GCCTestSuite/visibility-1.c.expected +./tests/GCCTestSuite/990213-1.s.expected +./tests/GCCTestSuite/void-cast-2.c.expected +./tests/GCCTestSuite/uninit-11.hex.expected +./tests/GCCTestSuite/redecl-8.hex.expected +./tests/GCCTestSuite/pr24445.c.expected +./tests/GCCTestSuite/nrv2.hex.expected +./tests/GCCTestSuite/uninit-B.c +./tests/GCCTestSuite/pr24683.c.expected +./tests/GCCTestSuite/c99-array-lval-1.c.expected +./tests/GCCTestSuite/pr14796-1.c.expected +./tests/GCCTestSuite/990213-1.c +./tests/GCCTestSuite/if-empty-1.c.expected +./tests/GCCTestSuite/register-var-2.hex.expected +./tests/GCCTestSuite/funcdef-attr-1.c +./tests/GCCTestSuite/uninit-D.hex.expected +./tests/GCCTestSuite/inline4.s.expected +./tests/GCCTestSuite/winline-7.c +./tests/GCCTestSuite/pr15698-7.c +./tests/GCCTestSuite/c90-static-1.c +./tests/GCCTestSuite/transparent-union-3.s.expected +./tests/GCCTestSuite/visibility-9.c +./tests/GCCTestSuite/pr15698-4.hex.expected +./tests/GCCTestSuite/builtin-strstr.s.expected +./tests/GCCTestSuite/assign-warn-3.hex.expected +./tests/GCCTestSuite/darwin-ld-20040828-3.c +./tests/GCCTestSuite/uninit-G.hex.expected +./tests/GCCTestSuite/pr15784-4.hex.expected +./tests/GCCTestSuite/pr24683.c +./tests/GCCTestSuite/attr-isr-trap_exit.c +./tests/GCCTestSuite/c99-func-2.s.expected +./tests/GCCTestSuite/enum3.s.expected +./tests/GCCTestSuite/uninit-2.c.expected +./tests/GCCTestSuite/pragma-ep-3.c.expected +./tests/GCCTestSuite/darwin-ld-20040809-2.c.expected +./tests/GCCTestSuite/visibility-5.c +./tests/GCCTestSuite/dll-2.hex.expected +./tests/GCCTestSuite/if-empty-1.c +./tests/GCCTestSuite/pr28402.c +./tests/GCCTestSuite/pr22308-1.hex.expected +./tests/GCCTestSuite/darwin-20040809-2.c.expected +./tests/GCCTestSuite/array-1.s.expected +./tests/GCCTestSuite/pr22308-1.c.expected +./tests/GCCTestSuite/old-style-then-proto-1.s.expected +./tests/GCCTestSuite/bitfld-14.c.expected +./tests/GCCTestSuite/anon-struct-7.c.expected +./tests/GCCTestSuite/old-style-then-proto-1.c +./tests/GCCTestSuite/pr20017.c.expected +./tests/GCCTestSuite/visibility-a.s.expected +./tests/GCCTestSuite/inline-4.c +./tests/GCCTestSuite/920413-1.hex.expected +./tests/GCCTestSuite/profile-generate-1.c +./tests/GCCTestSuite/declspec-12.hex.expected +./tests/GCCTestSuite/c99-tag-2.c.expected +./tests/GCCTestSuite/cast-qual-1.c +./tests/GCCTestSuite/cris-peep2-xsrand.s.expected +./tests/GCCTestSuite/merge-all-constants-1.c +./tests/GCCTestSuite/c90-impl-int-2.c +./tests/GCCTestSuite/visibility-b.c +./tests/GCCTestSuite/pragma-pack-4.s.expected +./tests/GCCTestSuite/declspec-3.c.expected +./tests/GCCTestSuite/qual-return-3.hex.expected +./tests/GCCTestSuite/compare8.c +./tests/GCCTestSuite/compare9.s.expected +./tests/GCCTestSuite/c90-static-1.s.expected +./tests/GCCTestSuite/980502-1.c +./tests/GCCTestSuite/wtr-strcat-1.hex.expected +./tests/GCCTestSuite/nested-redef-1.s.expected +./tests/GCCTestSuite/c90-dupqual-1.hex.expected +./tests/GCCTestSuite/pr24620.c +./tests/GCCTestSuite/doloop-2.s.expected +./tests/GCCTestSuite/compare8.s.expected +./tests/GCCTestSuite/merge-all-constants-1.c.expected +./tests/GCCTestSuite/simd-1b.c.expected +./tests/GCCTestSuite/warn-1.s.expected +./tests/GCCTestSuite/920413-1.c.expected +./tests/GCCTestSuite/cris-peep2-andu1.hex.expected +./tests/GCCTestSuite/doloop-2.c.expected +./tests/GCCTestSuite/c90-static-1.hex.expected +./tests/GCCTestSuite/uninit-1.s.expected +./tests/GCCTestSuite/fold-abs-3.hex.expected +./tests/GCCTestSuite/uninit-1.c +./tests/GCCTestSuite/winline-1.c +./tests/GCCTestSuite/struct-empty-2.s.expected +./tests/GCCTestSuite/struct-empty-3.s.expected +./tests/GCCTestSuite/winline-1.c.expected +./tests/GCCTestSuite/pr15784-4.c.expected +./tests/GCCTestSuite/ultrasp10.c.expected +./tests/GCCTestSuite/dll-4.hex.expected +./tests/GCCTestSuite/fold-abs-1.hex.expected +./tests/GCCTestSuite/typedef-init.hex.expected +./tests/GCCTestSuite/declspec-3.hex.expected +./tests/GCCTestSuite/uninit-1.hex.expected +./tests/GCCTestSuite/compare6.s.expected +./tests/GCCTestSuite/label-compound-stmt-1.s.expected +./tests/GCCTestSuite/pr14796-1.hex.expected +./tests/GCCTestSuite/cris-peep2-andu2.s.expected +./tests/GCCTestSuite/pr14475.c.expected +./tests/GCCTestSuite/h8300-stack-1.c.expected +./tests/GCCTestSuite/fold-mod-1.c.expected +./tests/GCCTestSuite/asm-fs-1.c.expected +./tests/GCCTestSuite/pr24615.s.expected +./tests/GCCTestSuite/pr24615.c +./tests/GCCTestSuite/pr23165.hex.expected +./tests/GCCTestSuite/inline-1.c +./tests/GCCTestSuite/local1.s.expected +./tests/GCCTestSuite/m-un-1.s.expected +./tests/GCCTestSuite/postincr-1.c.expected +./tests/GCCTestSuite/pr24445.c +./tests/GCCTestSuite/wtr-strcat-1.s.expected +./tests/GCCTestSuite/anon-struct-3.c +./tests/GCCTestSuite/inline-6.s.expected +./tests/GCCTestSuite/c90-impl-int-2.hex.expected +./tests/GCCTestSuite/warn-1.c.expected +./tests/GCCTestSuite/wtr-unary-plus-1.c.expected +./tests/GCCTestSuite/kpice1.hex.expected +./tests/GCCTestSuite/pr23625.hex.expected +./tests/GCCTestSuite/c90-restrict-1.c.expected +./tests/GCCTestSuite/uninit-F.c +./tests/GCCTestSuite/return-type-1.hex.expected +./tests/GCCTestSuite/visibility-3.s.expected +./tests/GCCTestSuite/pragma-isr-trap_exit.c +./tests/GCCTestSuite/pr22335-2.hex.expected +./tests/GCCTestSuite/warn-1.c +./tests/GCCTestSuite/pr25993.s.expected +./tests/GCCTestSuite/struct-ret-2.hex.expected +./tests/GCCTestSuite/pr15698-7.s.expected +./tests/GCCTestSuite/align-1.c +./tests/GCCTestSuite/pr28402.hex.expected +./tests/GCCTestSuite/fold-abs-1.s.expected +./tests/GCCTestSuite/uninit-3.c +./tests/GCCTestSuite/nested-calls-1.s.expected +./tests/GCCTestSuite/inline-mcpy.c.expected +./tests/GCCTestSuite/cris-peep2-andu2.c.expected +./tests/GCCTestSuite/bitfld-10.c +./tests/GCCTestSuite/uninit-I.c +./tests/GCCTestSuite/pr22311-1.s.expected +./tests/GCCTestSuite/attr-alwaysinline.s.expected +./tests/GCCTestSuite/funroll-loops-all.hex.expected +./tests/GCCTestSuite/951130-1.c +./tests/GCCTestSuite/empty-source-1.hex.expected +./tests/GCCTestSuite/pr15443-2.hex.expected +./tests/GCCTestSuite/uninit-I.c.expected +./tests/GCCTestSuite/c99-flex-array-3.c +./tests/GCCTestSuite/anon-struct-7.s.expected +./tests/GCCTestSuite/pr24620.hex.expected +./tests/GCCTestSuite/typedef-init.c.expected +./tests/GCCTestSuite/uninit-9.hex.expected +./tests/GCCTestSuite/pragma-ep-3.c +./tests/GCCTestSuite/wtr-escape-1.hex.expected +./tests/GCCTestSuite/attr-used-2.c +./tests/GCCTestSuite/uninit-8.c.expected +./tests/GCCTestSuite/anon-struct-5.s.expected +./tests/GCCTestSuite/c99-array-lval-7.s.expected +./tests/GCCTestSuite/symbian5.c +./tests/GCCTestSuite/visibility-3.hex.expected +./tests/GCCTestSuite/inline-10.hex.expected +./tests/GCCTestSuite/array-quals-2.c +./tests/GCCTestSuite/darwin-ld-3.hex.expected +./tests/GCCTestSuite/pr15698-3.c +./tests/GCCTestSuite/pr17957.c.expected +./tests/GCCTestSuite/struct-ret-2.s.expected +./tests/GCCTestSuite/visibility-c.c +./tests/GCCTestSuite/compare7.hex.expected +./tests/GCCTestSuite/null-pointer-1.c.expected +./tests/GCCTestSuite/funcdef-attr-1.hex.expected +./tests/GCCTestSuite/940409-1.s.expected +./tests/GCCTestSuite/visibility-7.s.expected +./tests/GCCTestSuite/fold-abs-1.c.expected +./tests/GCCTestSuite/void-cast-2.c +./tests/GCCTestSuite/pr29736.c +./tests/GCCTestSuite/darwin-ld-3.c +./tests/GCCTestSuite/wint_t-1.c +./tests/GCCTestSuite/darwin-ld-5.s.expected +./tests/GCCTestSuite/cris-peep2-andu1.c +./tests/GCCTestSuite/compare6.c +./tests/GCCTestSuite/label-compound-stmt-1.hex.expected +./tests/GCCTestSuite/unroll-1.c.expected +./tests/GCCTestSuite/redecl-8.c +./tests/GCCTestSuite/c99-impl-int-1.c +./tests/GCCTestSuite/uninit-9.c +./tests/GCCTestSuite/bitfld-6.hex.expected +./tests/GCCTestSuite/pr14475.hex.expected +./tests/GCCTestSuite/pr18809-1.c.expected +./tests/GCCTestSuite/funcdef-var-2.c +./tests/GCCTestSuite/c99-array-nonobj-1.hex.expected +./tests/GCCTestSuite/c90-array-lval-6.c +./tests/GCCTestSuite/uninit-E.c.expected +./tests/GCCTestSuite/wtr-union-init-1.c.expected +./tests/GCCTestSuite/visibility-10.hex.expected +./tests/GCCTestSuite/ftrapv-1.c.expected +./tests/GCCTestSuite/visibility-4.hex.expected +./tests/GCCTestSuite/darwin-ld-20040809-1.hex.expected +./tests/GCCTestSuite/inline-8.s.expected +./tests/GCCTestSuite/uninit-C.c +./tests/GCCTestSuite/c90-longlong-1.hex.expected +./tests/GCCTestSuite/pr24683.s.expected +./tests/GCCTestSuite/pr32450.c +./tests/GCCTestSuite/c90-enum-comma-1.c +./tests/GCCTestSuite/inline-mcpy.s.expected +./tests/GCCTestSuite/inline1.c +./tests/GCCTestSuite/visibility-8.c.expected +./tests/GCCTestSuite/inline-7.s.expected +./tests/GCCTestSuite/pr23625.c +./tests/GCCTestSuite/noreturn-6.hex.expected +./tests/GCCTestSuite/postincr-1.s.expected +./tests/GCCTestSuite/visibility-a.c.expected +./tests/GCCTestSuite/reg-vol-struct-1.c.expected +./tests/GCCTestSuite/concat2.c +./tests/GCCTestSuite/pragma-isr-trap_exit.c.expected +./tests/GCCTestSuite/winline-3.c.expected +./tests/GCCTestSuite/merge-all-constants-1.s.expected +./tests/GCCTestSuite/c99-array-lval-1.c +./tests/GCCTestSuite/pr22329.s.expected +./tests/GCCTestSuite/nested-redef-1.c +./tests/GCCTestSuite/enum3.c.expected +./tests/GCCTestSuite/profile-generate-2.s.expected +./tests/GCCTestSuite/pr17581-1.c +./tests/GCCTestSuite/c90-dupqual-1.c.expected +./tests/GCCTestSuite/winline-6.c.expected +./tests/GCCTestSuite/pr15698-3.hex.expected +./tests/GCCTestSuite/pr29581-3.c +./tests/GCCTestSuite/winline-5.c +./tests/GCCTestSuite/unused-2.c +./tests/GCCTestSuite/if-empty-1.hex.expected +./tests/GCCTestSuite/concat.c.expected +./tests/GCCTestSuite/c90-array-quals.c +./tests/GCCTestSuite/return-type-3.c +./tests/GCCTestSuite/darwin-ld-1.hex.expected +./tests/GCCTestSuite/postincr-1.hex.expected +./tests/GCCTestSuite/c90-impl-int-2.s.expected +./tests/GCCTestSuite/doloop-2.hex.expected +./tests/GCCTestSuite/cast-qual-1.c.expected +./tests/GCCTestSuite/inline5.c +./tests/GCCTestSuite/bitfld-10.hex.expected +./tests/GCCTestSuite/darwin-ld-3.c.expected +./tests/GCCTestSuite/void-cast-1.s.expected +./tests/GCCTestSuite/pr26004.hex.expected +./tests/GCCTestSuite/assign-warn-3.s.expected +./tests/GCCTestSuite/align-1.hex.expected +./tests/GCCTestSuite/return-type-1.s.expected +./tests/GCCTestSuite/pr25196.hex.expected +./tests/GCCTestSuite/unused-6.hex.expected +./tests/GCCTestSuite/section1.s.expected +./tests/GCCTestSuite/c90-array-lval-5.s.expected +./tests/GCCTestSuite/c99-tag-2.hex.expected +./tests/GCCTestSuite/pr26004.c.expected +./tests/GCCTestSuite/switch-1.c +./tests/GCCTestSuite/c99-restrict-1.c +./tests/GCCTestSuite/uninit-E.hex.expected +./tests/GCCTestSuite/uninit-D.c +./tests/GCCTestSuite/c99-idem-qual-1.s.expected +./tests/GCCTestSuite/alias-8.c +./tests/GCCTestSuite/struct-empty-3.c +./tests/GCCTestSuite/nrv2.c +./tests/GCCTestSuite/c90-array-lval-7.c +./tests/GCCTestSuite/intmax_t-1.s.expected +./tests/GCCTestSuite/anon-struct-8.c.expected +./tests/GCCTestSuite/asm-fs-1.s.expected +./tests/GCCTestSuite/c99-func-4.s.expected +./tests/GCCTestSuite/nonnull-2.s.expected +./tests/GCCTestSuite/c99-func-2.hex.expected +./tests/GCCTestSuite/qual-return-2.c +./tests/GCCTestSuite/darwin-ld-20040828-2.c +./tests/GCCTestSuite/compare8.c.expected +./tests/GCCTestSuite/c99-idem-qual-2.c +./tests/GCCTestSuite/void-cast-1.c.expected +./tests/GCCTestSuite/pr3074-1.c.expected +./tests/GCCTestSuite/pr20115.s.expected +./tests/GCCTestSuite/c99-restrict-1.hex.expected +./tests/GCCTestSuite/gnu89-dupqual-1.s.expected +./tests/GCCTestSuite/unused-6.s.expected +./tests/GCCTestSuite/old-style-then-proto-1.hex.expected +./tests/GCCTestSuite/m-un-1.hex.expected +./tests/GCCTestSuite/verbose-asm.c +./tests/GCCTestSuite/return-type-2.c +./tests/GCCTestSuite/attr-used.s.expected +./tests/GCCTestSuite/always_inline2.s.expected +./tests/GCCTestSuite/pr20130-1.c +./tests/GCCTestSuite/builtin-strstr.hex.expected +./tests/GCCTestSuite/cris-peep2-xsrand.c.expected +./tests/GCCTestSuite/nested-redef-1.hex.expected +./tests/GCCTestSuite/pr18928-1.c +./tests/GCCTestSuite/fdata-sections-1.c.expected +./tests/GCCTestSuite/darwin-ld-20040828-2.c.expected +./tests/GCCTestSuite/uninit-3.s.expected +./tests/GCCTestSuite/darwin-ld-20040828-3.s.expected +./tests/GCCTestSuite/pr17036-1.c.expected +./tests/GCCTestSuite/ftrapv-1.c +./tests/GCCTestSuite/if-empty-1.s.expected +./tests/GCCTestSuite/uninit-9.c.expected +./tests/GCCTestSuite/c99-longlong-1.c +./tests/GCCTestSuite/uninit-4.c +./tests/GCCTestSuite/qual-return-4.c +./tests/GCCTestSuite/dll-4.c.expected +./tests/GCCTestSuite/visibility-7.c.expected +./tests/GCCTestSuite/pack-test-2.s.expected +./tests/GCCTestSuite/redecl-9.s.expected +./tests/GCCTestSuite/uninit-G.c +./tests/GCCTestSuite/c99-impl-int-1.hex.expected +./tests/GCCTestSuite/doloop-2.c +./tests/GCCTestSuite/inline4.c +./tests/GCCTestSuite/h8300-stack-1.c +./tests/GCCTestSuite/c99-array-lval-5.c +./tests/GCCTestSuite/bitfld-5.c.expected +./tests/GCCTestSuite/unused-1.c +./tests/GCCTestSuite/empty-source-1.s.expected +./tests/GCCTestSuite/pr12625-1.c.expected +./tests/GCCTestSuite/bitfld-10.c.expected +./tests/GCCTestSuite/transparent-union-2.c.expected +./tests/GCCTestSuite/return-type-3.s.expected +./tests/GCCTestSuite/pr32450.c.expected +./tests/GCCTestSuite/visibility-11.c +./tests/GCCTestSuite/intermod-1.c.expected +./tests/GCCTestSuite/c90-idem-qual-1.hex.expected +./tests/GCCTestSuite/pure-1.c.expected +./tests/GCCTestSuite/extra-semi-1.s.expected +./tests/GCCTestSuite/visibility-9.s.expected +./tests/GCCTestSuite/inline-9.hex.expected +./tests/GCCTestSuite/pr17635.c.expected +./tests/GCCTestSuite/darwin-ld-1.c.expected +./tests/GCCTestSuite/pr28402.s.expected +./tests/GCCTestSuite/pr15825-1.c.expected +./tests/GCCTestSuite/pr26570.c +./tests/GCCTestSuite/const-elim-2.c.expected +./tests/GCCTestSuite/pr25993.c.expected +./tests/GCCTestSuite/arm-scd42-1.c.expected +./tests/GCCTestSuite/visibility-10.s.expected +./tests/GCCTestSuite/profile-generate-2.c +./tests/GCCTestSuite/c90-longlong-1.c +./tests/GCCTestSuite/unused-6.c.expected +./tests/GCCTestSuite/pr28187.s.expected +./tests/GCCTestSuite/uninit-C.hex.expected +./tests/GCCTestSuite/c99-idem-qual-2.c.expected +./tests/GCCTestSuite/attr-isr-trap_exit.hex.expected +./tests/GCCTestSuite/c90-longlong-1.s.expected +./tests/GCCTestSuite/c99-flex-array-3.s.expected +./tests/GCCTestSuite/pr11864-1.c.expected +./tests/GCCTestSuite/qual-return-4.c.expected +./tests/GCCTestSuite/unused-1.s.expected +./tests/GCCTestSuite/pr30473.c.expected +./tests/GCCTestSuite/pr14796-1.c +./tests/GCCTestSuite/verbose-asm.c.expected +./tests/GCCTestSuite/enum2.c +./tests/GCCTestSuite/pragma-isr2.c +./tests/GCCTestSuite/winline-6.hex.expected +./tests/GCCTestSuite/darwin-weakimport-1.s.expected +./tests/GCCTestSuite/pure-1.hex.expected +./tests/GCCTestSuite/noreturn-6.c.expected +./tests/GCCTestSuite/inline5.hex.expected +./tests/GCCTestSuite/pr18479.s.expected +./tests/GCCTestSuite/winline-2.hex.expected +./tests/GCCTestSuite/kpice1.s.expected +./tests/GCCTestSuite/visibility-5.s.expected +./tests/GCCTestSuite/enum2.s.expected +./tests/GCCTestSuite/compare1.c.expected +./tests/GCCTestSuite/winline-3.c +./tests/GCCTestSuite/noreturn-6.s.expected +./tests/GCCTestSuite/redecl-6.hex.expected +./tests/GCCTestSuite/decl-6.hex.expected +./tests/GCCTestSuite/symbian1.c +./tests/GCCTestSuite/pr24367.c +./tests/GCCTestSuite/wtr-static-1.s.expected +./tests/GCCTestSuite/c90-array-quals.hex.expected +./tests/GCCTestSuite/noreturn-2.c.expected +./tests/GCCTestSuite/cleanup-3.s.expected +./tests/GCCTestSuite/pr18809-1.hex.expected +./tests/GCCTestSuite/unused-7.s.expected +./tests/GCCTestSuite/c99-longlong-1.hex.expected +./tests/GCCTestSuite/ultrasp2.hex.expected +./tests/GCCTestSuite/local1.c.expected +./tests/GCCTestSuite/pr22335-1.hex.expected +./tests/GCCTestSuite/builtins-35.c.expected +./tests/GCCTestSuite/unused-5.s.expected +./tests/GCCTestSuite/c99-func-4.c +./tests/GCCTestSuite/wtr-unary-plus-1.c +./tests/GCCTestSuite/fold-abs-3.c.expected +./tests/GCCTestSuite/qual-return-2.hex.expected +./tests/GCCTestSuite/anon-struct-3.s.expected +./tests/GCCTestSuite/visibility-c.s.expected +./tests/GCCTestSuite/pr23584.c +./tests/GCCTestSuite/pr24620.s.expected +./tests/GCCTestSuite/visibility-b.hex.expected +./tests/GCCTestSuite/sparc-constant-1.c.expected +./tests/GCCTestSuite/noreturn-1.s.expected +./tests/GCCTestSuite/pr14796-2.c +./tests/GCCTestSuite/switch-1.c.expected +./tests/GCCTestSuite/h8300-stack-1.hex.expected +./tests/GCCTestSuite/c99-restrict-1.c.expected +./tests/GCCTestSuite/simd-3.c +./tests/GCCTestSuite/noreturn-1.c +./tests/GCCTestSuite/pr25196.s.expected +./tests/GCCTestSuite/register-var-1.c.expected +./tests/GCCTestSuite/transparent-union-2.c +./tests/GCCTestSuite/arm-scd42-1.c +./tests/GCCTestSuite/wtr-switch-1.c +./tests/GCCTestSuite/c99-impl-int-2.c +./tests/GCCTestSuite/cleanup-3.c.expected +./tests/GCCTestSuite/arm-g2.c +./tests/GCCTestSuite/c99-const-expr-1.c +./tests/GCCTestSuite/uninit-11.c +./tests/GCCTestSuite/wchar_t-1.c +./tests/GCCTestSuite/pr20130-1.c.expected +./tests/GCCTestSuite/anon-struct-3.c.expected +./tests/GCCTestSuite/conv-3.hex.expected +./tests/GCCTestSuite/pr24600.s.expected +./tests/GCCTestSuite/pr25559.s.expected +./tests/GCCTestSuite/c99-flex-array-3.c.expected +./tests/GCCTestSuite/pragma-isr2.s.expected +./tests/GCCTestSuite/attr-mode-1.s.expected +./tests/GCCTestSuite/visibility-5.hex.expected +./tests/GCCTestSuite/uninit-6.s.expected +./tests/GCCTestSuite/bitfld-14.c +./tests/GCCTestSuite/extra-semi-3.c +./tests/GCCTestSuite/990213-1.hex.expected +./tests/GCCTestSuite/gnu89-dupqual-1.hex.expected +./tests/GCCTestSuite/uninit-6.c +./tests/GCCTestSuite/kpice1.c.expected +./tests/GCCTestSuite/builtins-35.hex.expected +./tests/GCCTestSuite/inline-19.c +./tests/GCCTestSuite/uninit-B.s.expected +./tests/GCCTestSuite/visibility-a.hex.expected +./tests/GCCTestSuite/inline-1.s.expected +./tests/GCCTestSuite/pack-test-3.c.expected +./tests/GCCTestSuite/bitfld-5.s.expected +./tests/GCCTestSuite/c99-idem-qual-3.hex.expected +./tests/GCCTestSuite/uninit-B.c.expected +./tests/GCCTestSuite/funroll-loops-all.s.expected +./tests/GCCTestSuite/funcdef-var-2.c.expected +./tests/GCCTestSuite/c90-idem-qual-2.c.expected +./tests/GCCTestSuite/darwin-ld-2.c.expected +./tests/GCCTestSuite/inline5.c.expected +./tests/GCCTestSuite/extra-semi-2.s.expected +./tests/GCCTestSuite/pr20115.hex.expected +./tests/GCCTestSuite/uninit-G.s.expected +./tests/GCCTestSuite/asm-fs-1.c +./tests/GCCTestSuite/align-1.c.expected +./tests/GCCTestSuite/pr26961-1.hex.expected +./tests/GCCTestSuite/pragma-ep-2.s.expected +./tests/GCCTestSuite/darwin-ld-20040809-1.c.expected +./tests/GCCTestSuite/pr21085.hex.expected +./tests/GCCTestSuite/alias-8.hex.expected +./tests/GCCTestSuite/pr28402.c.expected +./tests/GCCTestSuite/pr22311-1.c.expected +./tests/GCCTestSuite/symbian3.c +./tests/GCCTestSuite/inline-2.c.expected +./tests/GCCTestSuite/pr20115-1.hex.expected +./tests/GCCTestSuite/pack-test-3.hex.expected +./tests/GCCTestSuite/visibility-8.hex.expected +./tests/GCCTestSuite/darwin-ld-4.hex.expected +./tests/GCCTestSuite/darwin-ld-6.c.expected +./tests/GCCTestSuite/pr11459-1.c +./tests/GCCTestSuite/redecl-6.c +./tests/GCCTestSuite/noreturn-7.c +./tests/GCCTestSuite/wtr-unary-plus-1.hex.expected +./tests/GCCTestSuite/unused-4.c +./tests/GCCTestSuite/pr18928-1.hex.expected +./tests/GCCTestSuite/symbian1.s.expected +./tests/GCCTestSuite/attr-alwaysinline.c +./tests/GCCTestSuite/pr14475.c +./tests/GCCTestSuite/pr17957.s.expected +./tests/GCCTestSuite/smod-1.c.expected +./tests/GCCTestSuite/pr25993.c +./tests/GCCTestSuite/c99-main-1.c.expected +./tests/GCCTestSuite/uninit-3.c.expected +./tests/GCCTestSuite/pr25196.c.expected +./tests/GCCTestSuite/c90-idem-qual-3.s.expected +./tests/GCCTestSuite/visibility-7.hex.expected +./tests/GCCTestSuite/wtr-escape-1.c +./tests/GCCTestSuite/smod-1.hex.expected +./tests/GCCTestSuite/c90-idem-qual-3.hex.expected +./tests/GCCTestSuite/qual-return-1.s.expected +./tests/GCCTestSuite/visibility-b.s.expected +./tests/GCCTestSuite/m-un-1.c.expected +./tests/GCCTestSuite/pr24600.c.expected +./tests/GCCTestSuite/pr18809-1.s.expected +./tests/GCCTestSuite/c90-static-1.c.expected +./tests/GCCTestSuite/return-type-3.c.expected +./tests/GCCTestSuite/compare7.c.expected +./tests/GCCTestSuite/c90-array-lval-5.c.expected +./tests/GCCTestSuite/c90-array-lval-7.hex.expected +./tests/GCCTestSuite/section1.c.expected +./tests/GCCTestSuite/inline-5.c.expected +./tests/GCCTestSuite/anon-struct-7.hex.expected +./tests/GCCTestSuite/trunc-1.hex.expected +./tests/GCCTestSuite/cast-qual-1.s.expected +./tests/GCCTestSuite/attr-invalid.c.expected +./tests/GCCTestSuite/anon-struct-4.hex.expected +./tests/GCCTestSuite/pr18921-1.c.expected +./tests/GCCTestSuite/c99-impl-int-2.s.expected +./tests/GCCTestSuite/c99-flex-array-3.hex.expected +./tests/GCCTestSuite/c99-array-nonobj-1.c +./tests/GCCTestSuite/inline-4.hex.expected +./tests/GCCTestSuite/cris-peep2-xsrand2.s.expected +./tests/GCCTestSuite/declspec-2.s.expected +./tests/GCCTestSuite/c99-enum-comma-1.hex.expected +./tests/GCCTestSuite/pr29736.c.expected +./tests/GCCTestSuite/c90-const-expr-1.s.expected +./tests/GCCTestSuite/nested-redef-1.c.expected +./tests/GCCTestSuite/null-pointer-1.c +./tests/GCCTestSuite/c99-const-expr-1.s.expected +./tests/GCCTestSuite/verbose-asm.s.expected +./tests/GCCTestSuite/pragma-isr-trap_exit.hex.expected +./tests/GCCTestSuite/c90-restrict-1.s.expected +./tests/GCCTestSuite/980502-1.hex.expected +./tests/GCCTestSuite/anon-struct-5.c.expected +./tests/GCCTestSuite/struct-empty-1.c.expected +./tests/GCCTestSuite/pragma-isr2.hex.expected +./tests/GCCTestSuite/declspec-12.c +./tests/GCCTestSuite/inline-mcpy.c +./tests/GCCTestSuite/pr17319.c.expected +./tests/GCCTestSuite/wtr-union-init-1.s.expected +./tests/GCCTestSuite/inline-5.hex.expected +./tests/GCCTestSuite/decl-4.s.expected +./tests/GCCTestSuite/pure-1.c +./tests/GCCTestSuite/kpice1.c +./tests/GCCTestSuite/c99-restrict-2.s.expected +./tests/GCCTestSuite/pr15698-3.s.expected +./tests/GCCTestSuite/darwin-ld-20040809-2.hex.expected +./tests/GCCTestSuite/winline-5.s.expected +./tests/GCCTestSuite/wint_t-1.s.expected +./tests/GCCTestSuite/uninit-F.s.expected +./tests/GCCTestSuite/uninit-D.c.expected +./tests/GCCTestSuite/arm-scd42-3.c +./tests/GCCTestSuite/compare6.c.expected +./tests/GCCTestSuite/inline-mcpy.hex.expected +./tests/GCCTestSuite/typedef-init.c +./tests/GCCTestSuite/pr17635.c +./tests/GCCTestSuite/pr17581-1.s.expected +./tests/GCCTestSuite/inline-1.hex.expected +./tests/GCCTestSuite/inline-6.c +./tests/GCCTestSuite/struct-empty-1.c +./tests/GCCTestSuite/inline-9.c.expected +./tests/GCCTestSuite/pr22335-2.c +./tests/GCCTestSuite/smod-1.s.expected +./tests/GCCTestSuite/darwin-ld-4.c.expected +./tests/GCCTestSuite/uninit-4.hex.expected +./tests/GCCTestSuite/wint_t-1.c.expected +./tests/GCCTestSuite/darwin-ld-2.s.expected +./tests/GCCTestSuite/intermod-1.c +./tests/GCCTestSuite/c99-restrict-2.c.expected +./tests/GCCTestSuite/pr29581-1.c.expected +./tests/GCCTestSuite/extra-semi-2.hex.expected +./tests/GCCTestSuite/string-opt-1.s.expected +./tests/GCCTestSuite/darwin-weakimport-1.c.expected +./tests/GCCTestSuite/visibility-d.hex.expected +./tests/GCCTestSuite/inline-6.hex.expected +./tests/GCCTestSuite/pr22311-1.c +./tests/GCCTestSuite/darwin-20040812-1.c.expected +./tests/GCCTestSuite/visibility-11.c.expected +./tests/GCCTestSuite/uninit-I.hex.expected +./tests/GCCTestSuite/pr22335-1.s.expected +./tests/GCCTestSuite/pr3074-1.c +./tests/GCCTestSuite/pr23165.c.expected +./tests/GCCTestSuite/pr18809-1.c +./tests/GCCTestSuite/compare1.c +./tests/GCCTestSuite/register-var-1.s.expected +./tests/GCCTestSuite/array-1.c.expected +./tests/GCCTestSuite/funcdef-attr-1.c.expected +./tests/GCCTestSuite/string-opt-1.c.expected +./tests/GCCTestSuite/return-type-2.hex.expected +./tests/GCCTestSuite/unused-7.c +./tests/GCCTestSuite/alias-2.c +./tests/GCCTestSuite/pr17581-1.hex.expected +./tests/GCCTestSuite/unused-7.hex.expected +./tests/GCCTestSuite/pr14475.s.expected +./tests/GCCTestSuite/redecl-9.c +./tests/GCCTestSuite/dollar.hex.expected +./tests/GCCTestSuite/c99-array-lval-5.hex.expected +./tests/GCCTestSuite/const-compare.c.expected +./tests/GCCTestSuite/pr17581-1.c.expected +./tests/GCCTestSuite/inline-2.s.expected +./tests/GCCTestSuite/overflow-1.c.expected +./tests/GCCTestSuite/uninit-E.c +./tests/GCCTestSuite/inline-21.s.expected +./tests/GCCTestSuite/pr24600.hex.expected +./tests/GCCTestSuite/pr18241-5.c +./tests/GCCTestSuite/fold-mod-1.hex.expected +./tests/GCCTestSuite/volatile1.c.expected +./tests/GCCTestSuite/attr-mode-1.c +./tests/GCCTestSuite/wchar_t-1.c.expected +./tests/GCCTestSuite/pr29637.hex.expected +./tests/GCCTestSuite/fold-mod-1.c +./tests/GCCTestSuite/extra-semi-1.hex.expected +./tests/GCCTestSuite/wtr-escape-1.c.expected +./tests/GCCTestSuite/pr29581-3.s.expected +./tests/GCCTestSuite/declspec-2.hex.expected +./tests/GCCTestSuite/return-type-3.hex.expected +./tests/GCCTestSuite/990213-1.c.expected +./tests/GCCTestSuite/pr23584.hex.expected +./tests/GCCTestSuite/920413-1.c +./tests/GCCTestSuite/qual-return-1.c.expected +./tests/GCCTestSuite/declspec-2.c +./tests/GCCTestSuite/visibility-11.s.expected +./tests/GCCTestSuite/pr12625-1.hex.expected +./tests/GCCTestSuite/comp-return-1.hex.expected +./tests/GCCTestSuite/uninit-4.c.expected +./tests/GCCTestSuite/unused-4.c.expected +./tests/GCCTestSuite/attr-weakref-1a.c.expected +./tests/GCCTestSuite/const-compare.c +./tests/GCCTestSuite/attr-isr-trap_exit.s.expected +./tests/GCCTestSuite/pr22311-1.hex.expected +./tests/GCCTestSuite/darwin-20040812-1.c +./tests/GCCTestSuite/pr15698-6.c +./tests/GCCTestSuite/pr11459-1.c.expected +./tests/GCCTestSuite/nonnull-1.c.expected +./tests/GCCTestSuite/c90-array-quals.s.expected +./tests/GCCTestSuite/darwin-20040812-1.s.expected +./tests/GCCTestSuite/pr14092-1.c +./tests/GCCTestSuite/array-1.hex.expected +./tests/GCCTestSuite/decl-6.c.expected +./tests/GCCTestSuite/unroll-1.c +./tests/GCCTestSuite/pr17036-1.c +./tests/GCCTestSuite/pragma-re-2.c +./tests/GCCTestSuite/ultrasp1.hex.expected +./tests/GCCTestSuite/reg-vol-struct-1.c +./tests/GCCTestSuite/unused-4.hex.expected +./tests/GCCTestSuite/simd-3.c.expected +./tests/GCCTestSuite/switch-1.hex.expected +./tests/GCCTestSuite/c99-impl-int-1.s.expected +./tests/GCCTestSuite/attr-weakref-1a.c +./tests/GCCTestSuite/980502-1.s.expected +./tests/GCCTestSuite/c99-enum-comma-1.c +./tests/GCCTestSuite/pr26961-1.c.expected +./tests/GCCTestSuite/dll-2.c.expected +./tests/GCCTestSuite/pr20115-1.c +./tests/GCCTestSuite/c99-idem-qual-3.s.expected +./tests/GCCTestSuite/nested-calls-1.hex.expected +./tests/GCCTestSuite/compare5.c.expected +./tests/GCCTestSuite/pr24600.c +./tests/GCCTestSuite/fold-mod-1.s.expected +./tests/GCCTestSuite/darwin-ld-20040828-3.hex.expected +./tests/GCCTestSuite/noreturn-5.hex.expected +./tests/GCCTestSuite/struct-empty-3.hex.expected +./tests/GCCTestSuite/pr30473.hex.expected +./tests/GCCTestSuite/darwin-ld-1.c +./tests/GCCTestSuite/pr22329.c.expected +./tests/GCCTestSuite/c99-idem-qual-3.c +./tests/GCCTestSuite/c99-idem-qual-1.hex.expected +./tests/GCCTestSuite/darwin-ld-6.s.expected +./tests/GCCTestSuite/attr-invalid.c +./tests/GCCTestSuite/ultrasp1.c +./tests/GCCTestSuite/arm-scd42-2.hex.expected +./tests/GCCTestSuite/redecl-16.c +./tests/GCCTestSuite/pr26961-1.c +./tests/GCCTestSuite/compare5.c +./tests/GCCTestSuite/redecl-8.s.expected +./tests/GCCTestSuite/visibility-6.hex.expected +./tests/GCCTestSuite/parm-mismatch-1.s.expected +./tests/GCCTestSuite/wtr-union-init-1.c +./tests/GCCTestSuite/bitfld-14.hex.expected +./tests/GCCTestSuite/uninit-G.c.expected +./tests/GCCTestSuite/extra-semi-1.c +./tests/GCCTestSuite/darwin-ld-20040828-2.hex.expected +./tests/GCCTestSuite/struct-ret-2.c +./tests/GCCTestSuite/uninit-2.s.expected +./tests/GCCTestSuite/pack-test-3.c +./tests/GCCTestSuite/trunc-1.c.expected +./tests/GCCTestSuite/c90-impl-int-1.s.expected +./tests/GCCTestSuite/darwin-ld-5.c.expected +./tests/GCCTestSuite/pr15698-4.c +./tests/GCCTestSuite/940409-1.hex.expected +./tests/GCCTestSuite/visibility-11.hex.expected +./tests/GCCTestSuite/pr23049.s.expected +./tests/GCCTestSuite/cleanup-3.hex.expected +./tests/GCCTestSuite/asm-fs-1.hex.expected +./tests/GCCTestSuite/void-cast-2.s.expected +./tests/GCCTestSuite/pr20017.c +./tests/GCCTestSuite/string-opt-1.c +./tests/GCCTestSuite/uninit-8.c +./tests/GCCTestSuite/wtr-static-1.hex.expected +./tests/GCCTestSuite/nested-calls-1.c +./tests/GCCTestSuite/nonnull-2.c.expected +./tests/GCCTestSuite/pr20130-1.hex.expected +./tests/GCCTestSuite/compare5.hex.expected +./tests/GCCTestSuite/c99-restrict-1.s.expected +./tests/GCCTestSuite/pr24615.c.expected +./tests/GCCTestSuite/merge-all-constants-1.hex.expected +./tests/GCCTestSuite/c90-array-quals.c.expected +./tests/GCCTestSuite/arm-g2.hex.expected +./tests/GCCTestSuite/unused-6.c +./tests/GCCTestSuite/ultrasp10.c +./tests/GCCTestSuite/return-type-1.c +./tests/GCCTestSuite/visibility-6.s.expected +./tests/GCCTestSuite/pragma-ep-2.hex.expected +./tests/GCCTestSuite/wtr-switch-1.hex.expected +./tests/GCCTestSuite/noreturn-5.c.expected +./tests/GCCTestSuite/fold-xor-1.hex.expected +./tests/GCCTestSuite/pr22308-1.c +./tests/GCCTestSuite/c90-enum-comma-1.hex.expected +./tests/GCCTestSuite/wtr-strcat-1.c.expected +./tests/GCCTestSuite/compare9.hex.expected +./tests/GCCTestSuite/comp-return-1.c +./tests/GCCTestSuite/builtin-strstr.c.expected +./tests/GCCTestSuite/attr-used.hex.expected +./tests/GCCTestSuite/visibility-2.c.expected +./tests/GCCTestSuite/pr14796-2.hex.expected +./tests/GCCTestSuite/anon-struct-8.hex.expected +./tests/GCCTestSuite/declspec-2.c.expected +./tests/GCCTestSuite/wchar_t-2.hex.expected +./tests/GCCTestSuite/darwin-version-1.hex.expected +./tests/GCCTestSuite/switch-4.c.expected +./tests/GCCTestSuite/unroll-1.hex.expected +./tests/GCCTestSuite/darwin-20040812-1.hex.expected +./tests/GCCTestSuite/compare1.hex.expected +./tests/GCCTestSuite/nonnull-1.hex.expected +./tests/GCCTestSuite/string-opt-1.hex.expected +./tests/GCCTestSuite/anon-struct-7.c +./tests/GCCTestSuite/alias-2.hex.expected +./tests/GCCTestSuite/cris-peep2-xsrand2.c.expected +./tests/GCCTestSuite/bitfld-6.c +./tests/GCCTestSuite/ultrasp2.c +./tests/GCCTestSuite/pr23165.c +./tests/GCCTestSuite/nrv2.s.expected +./tests/GCCTestSuite/pr24615.hex.expected +./tests/GCCTestSuite/redecl-8.c.expected +./tests/GCCTestSuite/dollar.c +./tests/GCCTestSuite/pr3074-1.hex.expected +./tests/GCCTestSuite/switch-4.hex.expected +./tests/GCCTestSuite/inline-4.c.expected +./tests/GCCTestSuite/darwin-20040809-2.c +./tests/GCCTestSuite/sparc-constant-1.hex.expected +./tests/GCCTestSuite/declspec-3.c +./tests/GCCTestSuite/return-type-2.s.expected +./tests/GCCTestSuite/loop-5.c +./tests/GCCTestSuite/simd-1b.c +./tests/GCCTestSuite/arm-scd42-3.c.expected +./tests/GCCTestSuite/inline-9.s.expected +./tests/GCCTestSuite/pr23049.c.expected +./tests/GCCTestSuite/darwin-weakimport-1.c +./tests/GCCTestSuite/attr-used-2.hex.expected +./tests/GCCTestSuite/always_inline2.c +./tests/GCCTestSuite/redecl-16.s.expected +./tests/GCCTestSuite/enum2.c.expected +./tests/GCCTestSuite/attr-weakref-1a.s.expected +./tests/GCCTestSuite/concat.s.expected +./tests/GCCTestSuite/inline-21.hex.expected +./tests/GCCTestSuite/qual-return-3.c +./tests/GCCTestSuite/fold-abs-1.c +./tests/GCCTestSuite/uninit-2.hex.expected +./tests/GCCTestSuite/wchar_t-1.s.expected +./tests/GCCTestSuite/c99-idem-qual-1.c.expected +./tests/GCCTestSuite/pr17036-1.s.expected +./tests/GCCTestSuite/reg-vol-struct-1.s.expected +./tests/GCCTestSuite/intermod-1.s.expected +./tests/GCCTestSuite/inline-17.c.expected +./tests/GCCTestSuite/pr12625-1.s.expected +./tests/GCCTestSuite/wtr-static-1.c +./tests/GCCTestSuite/qual-return-3.s.expected +./tests/GCCTestSuite/typedef-init.s.expected +./tests/GCCTestSuite/inline-7.c +./tests/GCCTestSuite/pr30473.s.expected +./tests/GCCTestSuite/c90-longlong-1.c.expected +./tests/GCCTestSuite/builtin-strstr.c +./tests/GCCTestSuite/inline1.c.expected +./tests/GCCTestSuite/unroll-1.s.expected +./tests/GCCTestSuite/attr-weakref-1a.hex.expected +./tests/GCCTestSuite/c99-const-expr-1.hex.expected +./tests/GCCTestSuite/uninit-B.hex.expected +./tests/GCCTestSuite/c90-idem-qual-1.c.expected +./tests/GCCTestSuite/dollar.s.expected +./tests/GCCTestSuite/winline-7.hex.expected +./tests/GCCTestSuite/transparent-union-3.c +./tests/GCCTestSuite/c90-array-lval-5.hex.expected +./tests/GCCTestSuite/inline-9.c +./tests/GCCTestSuite/c99-impl-int-1.c.expected +./tests/GCCTestSuite/winline-1.hex.expected +./tests/GCCTestSuite/uninit-H.c.expected +./tests/GCCTestSuite/inline-1.c.expected +./tests/GCCTestSuite/c90-restrict-1.c +./tests/GCCTestSuite/register-var-2.s.expected +./tests/GCCTestSuite/c90-mixdecl-1.hex.expected +./tests/GCCTestSuite/compare6.hex.expected +./tests/GCCTestSuite/c90-enum-comma-1.c.expected +./tests/GCCTestSuite/profile-generate-1.c.expected +./tests/GCCTestSuite/darwin-ld-20040809-1.s.expected +./tests/GCCTestSuite/array-1.c +./tests/GCCTestSuite/anon-struct-8.c +./tests/GCCTestSuite/noreturn-7.s.expected +./tests/GCCTestSuite/dll-2.c +./tests/GCCTestSuite/loop-5.hex.expected +./tests/GCCTestSuite/trunc-1.c +./tests/GCCTestSuite/cris-peep2-andu1.s.expected +./tests/GCCTestSuite/pr14092-1.hex.expected +./tests/GCCTestSuite/anon-struct-3.hex.expected +./tests/GCCTestSuite/uninit-6.hex.expected +./tests/GCCTestSuite/pr15698-4.s.expected +./tests/GCCTestSuite/overflow-1.s.expected +./tests/GCCTestSuite/c99-array-lval-7.hex.expected +./tests/GCCTestSuite/anon-struct-5.hex.expected +./tests/GCCTestSuite/inline-7.hex.expected +./tests/GCCTestSuite/pr23049.c +./tests/GCCTestSuite/c90-dupqual-1.c +./tests/GCCTestSuite/bitfld-10.s.expected +./tests/GCCTestSuite/pr11864-1.hex.expected +./tests/GCCTestSuite/alias-8.s.expected +./tests/GCCTestSuite/visibility-5.c.expected +./tests/GCCTestSuite/pr15825-1.s.expected +./tests/GCCTestSuite/darwin-version-1.c +./tests/GCCTestSuite/winline-2.c.expected +./tests/GCCTestSuite/c99-func-4.c.expected +./tests/GCCTestSuite/sparc-constant-1.s.expected +./tests/GCCTestSuite/nested-calls-1.c.expected +./tests/GCCTestSuite/arm-scd42-2.c.expected +./tests/GCCTestSuite/Makefile +./tests/GCCTestSuite/arm-scd42-1.hex.expected +./tests/GCCTestSuite/visibility-c.hex.expected +./tests/GCCTestSuite/anon-struct-8.s.expected +./tests/GCCTestSuite/attr-alwaysinline.hex.expected +./tests/GCCTestSuite/inline-18.c +./tests/GCCTestSuite/pack-test-2.c.expected +./tests/GCCTestSuite/pack-test-3.s.expected +./tests/GCCTestSuite/darwin-version-1.c.expected +./tests/GCCTestSuite/inline4.hex.expected +./tests/GCCTestSuite/funcdef-attr-1.s.expected +./tests/GCCTestSuite/intmax_t-1.c.expected +./tests/GCCTestSuite/funcdef-var-2.s.expected +./tests/GCCTestSuite/enum3.c +./tests/GCCTestSuite/anon-struct-4.c.expected +./tests/GCCTestSuite/pr17957.c +./tests/GCCTestSuite/cris-peep2-xsrand.c +./tests/GCCTestSuite/intmax_t-1.c +./tests/GCCTestSuite/decl-6.s.expected +./tests/GCCTestSuite/c99-idem-qual-2.hex.expected +./tests/GCCTestSuite/qual-return-1.hex.expected +./tests/GCCTestSuite/visibility-1.c +./tests/GCCTestSuite/const-elim-2.s.expected +./tests/GCCTestSuite/section1.hex.expected +./tests/GCCTestSuite/redecl-13.hex.expected +./tests/GCCTestSuite/uninit-5.c +./tests/GCCTestSuite/pr25795.c +./tests/GCCTestSuite/switch-1.s.expected +./tests/GCCTestSuite/pr28187.hex.expected +./tests/GCCTestSuite/darwin-20040809-2.s.expected +./tests/GCCTestSuite/pragma-re-2.s.expected +./tests/GCCTestSuite/pr29637.c +./tests/GCCTestSuite/cris-peep2-andu2.c +./tests/GCCTestSuite/pr25559.c +./tests/GCCTestSuite/wtr-strcat-1.c +./tests/GCCTestSuite/const-compare.hex.expected +./tests/GCCTestSuite/redecl-13.s.expected +./tests/GCCTestSuite/cleanup-6.hex.expected +./tests/GCCTestSuite/fold-abs-3.s.expected +./tests/GCCTestSuite/c99-longlong-1.s.expected +./tests/GCCTestSuite/c99-idem-qual-2.s.expected +./tests/GCCTestSuite/c90-flex-array-1.hex.expected +./tests/GCCTestSuite/inline-18.c.expected +./tests/GCCTestSuite/c99-idem-qual-1.c +./tests/GCCTestSuite/c99-func-2.c.expected +./tests/GCCTestSuite/ultrasp4.s.expected +./tests/GCCTestSuite/unused-1.hex.expected +./tests/GCCTestSuite/decl-4.c.expected +./tests/GCCTestSuite/array-quals-2.s.expected +./tests/GCCTestSuite/pr18928-1.c.expected +./tests/GCCTestSuite/cris-peep2-andu1.c.expected +./tests/GCCTestSuite/pr14796-2.c.expected +./tests/GCCTestSuite/pr22335-2.c.expected +./tests/GCCTestSuite/pure-1.s.expected +./tests/GCCTestSuite/wint_t-1.hex.expected +./tests/GCCTestSuite/const-compare.s.expected +./tests/GCCTestSuite/volatile1.hex.expected +./tests/GCCTestSuite/fdata-sections-1.c +./tests/GCCTestSuite/c90-idem-qual-1.s.expected +./tests/GCCTestSuite/ultrasp1.c.expected +./tests/GCCTestSuite/redecl-9.c.expected +./tests/GCCTestSuite/inline-2.hex.expected +./tests/GCCTestSuite/empty-source-3.s.expected +./tests/GCCTestSuite/symbian4.c.expected +./tests/GCCTestSuite/simd-3.hex.expected +./tests/GCCTestSuite/inline-10.s.expected +./tests/GCCTestSuite/transparent-union-2.hex.expected +./tests/GCCTestSuite/951130-1.s.expected +./tests/GCCTestSuite/noreturn-1.hex.expected +./tests/GCCTestSuite/pr18479.c +./tests/GCCTestSuite/pr14092-1.c.expected +./tests/GCCTestSuite/transparent-union-3.c.expected +./tests/GCCTestSuite/nonnull-2.hex.expected +./tests/GCCTestSuite/pr21085.c.expected +./tests/GCCTestSuite/cris-peep2-xsrand.hex.expected +./tests/GCCTestSuite/c99-dupqual-1.hex.expected +./tests/GCCTestSuite/pr25559.hex.expected +./tests/GCCTestSuite/pr18479.c.expected +./tests/GCCTestSuite/pr12625-1.c +./tests/GCCTestSuite/fold-xor-2.hex.expected +./tests/GCCTestSuite/c99-array-nonobj-1.c.expected +./tests/GCCTestSuite/visibility-2.c +./tests/GCCTestSuite/anon-struct-5.c +./tests/GCCTestSuite/visibility-c.c.expected +./tests/GCCTestSuite/inline-19.s.expected +./tests/GCCTestSuite/qual-return-4.s.expected +./tests/GCCTestSuite/symbian5.s.expected +./tests/GCCTestSuite/pr23584.c.expected +./tests/GCCTestSuite/loop-5.c.expected +./tests/GCCTestSuite/inline-19.hex.expected +./tests/GCCTestSuite/ultrasp4.c.expected +./tests/GCCTestSuite/c99-array-lval-6.s.expected +./tests/GCCTestSuite/pr24367.c.expected +./tests/GCCTestSuite/pr29736.hex.expected +./tests/GCCTestSuite/c90-array-lval-7.c.expected +./tests/GCCTestSuite/pr21085.c +./tests/GCCTestSuite/attr-used-2.c.expected +./tests/GCCTestSuite/c99-main-1.c +./tests/GCCTestSuite/profile-generate-2.c.expected +./tests/GCCTestSuite/c99-array-lval-6.c +./tests/GCCTestSuite/verbose-asm.hex.expected +./tests/GCCTestSuite/inline-19.c.expected +./tests/GCCTestSuite/wtr-escape-1.s.expected +./tests/GCCTestSuite/arm-g2.c.expected +./tests/GCCTestSuite/pr15443-2.c +./tests/GCCTestSuite/wchar_t-2.c +./tests/GCCTestSuite/bitfld-5.hex.expected +./tests/GCCTestSuite/arm-scd42-2.c +./tests/GCCTestSuite/winline-3.s.expected +./tests/GCCTestSuite/ultrasp10.s.expected +./tests/GCCTestSuite/pr29637.c.expected +./tests/GCCTestSuite/comp-return-1.c.expected +./tests/GCCTestSuite/redecl-16.c.expected +./tests/GCCTestSuite/c90-impl-int-1.c.expected +./tests/GCCTestSuite/darwin-ld-20040828-1.hex.expected +./tests/GCCTestSuite/deprecated-3.s.expected +./tests/GCCTestSuite/pr18928-1.s.expected +./tests/GCCTestSuite/pr24445.s.expected +./tests/GCCTestSuite/c90-array-quals-2.s.expected +./tests/GCCTestSuite/noreturn-2.s.expected +./tests/GCCTestSuite/m-un-1.c +./tests/GCCTestSuite/pr22335-1.c.expected +./tests/GCCTestSuite/visibility-4.s.expected +./tests/GCCTestSuite/wtr-unary-plus-1.s.expected +./tests/GCCTestSuite/noreturn-2.hex.expected +./tests/GCCTestSuite/extra-semi-3.hex.expected +./tests/GCCTestSuite/uninit-C.s.expected +./tests/GCCTestSuite/c90-const-expr-1.c.expected +./tests/GCCTestSuite/attr-used-2.s.expected +./tests/GCCTestSuite/920413-1.s.expected +./tests/GCCTestSuite/darwin-ld-6.c +./tests/GCCTestSuite/dll-2.s.expected +./tests/GCCTestSuite/empty-source-2.c +./tests/GCCTestSuite/c90-array-lval-6.c.expected +./tests/GCCTestSuite/extra-semi-1.c.expected +./tests/GCCTestSuite/pr15443-2.s.expected +./tests/GCCTestSuite/pr23165.s.expected +./tests/GCCTestSuite/pr15825-1.c +./tests/GCCTestSuite/inline4.c.expected +./tests/GCCTestSuite/redecl-6.c.expected +./tests/GCCTestSuite/pr26004.s.expected +./tests/GCCTestSuite/inline-2.c +./tests/GCCTestSuite/register-var-1.hex.expected +./tests/GCCTestSuite/darwin-version-1.s.expected +./tests/GCCTestSuite/c99-array-lval-1.hex.expected +./tests/GCCTestSuite/unused-2.c.expected +./tests/GCCTestSuite/arm-g2.s.expected +./tests/GCCTestSuite/uninit-8.s.expected +./tests/GCCTestSuite/compare3.c.expected +./tests/GCCTestSuite/c90-flex-array-1.s.expected +./tests/GCCTestSuite/pr14092-1.s.expected +./tests/GCCTestSuite/inline2.s.expected +./tests/GCCTestSuite/darwin-ld-2.hex.expected +./tests/GCCTestSuite/c99-restrict-2.hex.expected +./tests/GCCTestSuite/pr25795.hex.expected +./tests/GCCTestSuite/cris-peep2-xsrand2.hex.expected +./tests/GCCTestSuite/gnu89-dupqual-1.c +./tests/GCCTestSuite/c90-array-lval-7.s.expected +./tests/GCCTestSuite/pragma-ep-2.c +./tests/GCCTestSuite/pr15698-7.c.expected +./tests/GCCTestSuite/cris-peep2-xsrand2.c +./tests/GCCTestSuite/c99-array-lval-7.c.expected +./tests/GCCTestSuite/overflow-1.hex.expected +./tests/GCCTestSuite/unused-1.c.expected +./tests/GCCTestSuite/c99-func-4.hex.expected +./tests/GCCTestSuite/pr25795.c.expected +./tests/GCCTestSuite/c99-dupqual-1.s.expected +./tests/GCCTestSuite/visibility-4.c +./tests/GCCTestSuite/compare3.c +./tests/GCCTestSuite/c90-const-expr-1.hex.expected +./tests/GCCTestSuite/pr17319.c +./tests/GCCTestSuite/pragma-pack-4.c +./tests/GCCTestSuite/cleanup-6.c +./tests/GCCTestSuite/return-type-2.c.expected +./tests/GCCTestSuite/enum3.hex.expected +./tests/GCCTestSuite/anon-struct-6.hex.expected +./tests/GCCTestSuite/darwin-ld-4.c +./tests/GCCTestSuite/redecl-6.s.expected +./tests/GCCTestSuite/concat2.hex.expected +./tests/GCCTestSuite/declspec-3.s.expected +./tests/GCCTestSuite/symbian4.hex.expected +./tests/GCCTestSuite/darwin-ld-20040809-1.c +./tests/GCCTestSuite/builtins-35.s.expected +./tests/GCCTestSuite/gnu89-dupqual-1.c.expected +./tests/GCCTestSuite/uninit-5.hex.expected +./tests/GCCTestSuite/local1.c +./tests/GCCTestSuite/symbian5.c.expected +./tests/GCCTestSuite/intmax_t-1.hex.expected +./tests/GCCTestSuite/c90-impl-int-2.c.expected +./tests/GCCTestSuite/switch-4.c +./tests/GCCTestSuite/symbian3.s.expected +./tests/GCCTestSuite/darwin-ld-6.hex.expected +./tests/GCCTestSuite/compare3.hex.expected +./tests/GCCTestSuite/pr20115-1.c.expected +./tests/GCCTestSuite/visibility-9.hex.expected +./tests/GCCTestSuite/pragma-pack-4.hex.expected +./tests/GCCTestSuite/struct-empty-2.c.expected +./tests/GCCTestSuite/pr20115.c.expected +./tests/GCCTestSuite/visibility-3.c.expected +./tests/GCCTestSuite/pr18479.hex.expected +./tests/GCCTestSuite/darwin-ld-20040809-2.s.expected +./tests/GCCTestSuite/pr25795-1.c.expected +./tests/GCCTestSuite/pr23049.hex.expected +./tests/GCCTestSuite/pr17319.hex.expected +./tests/GCCTestSuite/uninit-I.s.expected +./tests/GCCTestSuite/pr19967.c +./tests/GCCTestSuite/pr26570.c.expected +./tests/GCCTestSuite/pr24445.hex.expected +./tests/GCCTestSuite/visibility-d.c.expected +./tests/GCCTestSuite/pr32450.s.expected +./tests/GCCTestSuite/decl-6.c +./tests/GCCTestSuite/pr18241-5.s.expected +./tests/GCCTestSuite/return-type-1.c.expected +./tests/GCCTestSuite/redecl-13.c.expected +./tests/GCCTestSuite/ultrasp2.s.expected +./tests/GCCTestSuite/uninit-4.s.expected +./tests/GCCTestSuite/pr14796-1.s.expected +./tests/GCCTestSuite/anon-struct-6.c +./tests/GCCTestSuite/fold-xor-1.c +./tests/GCCTestSuite/c90-idem-qual-3.c.expected +./tests/GCCTestSuite/pr20017.hex.expected +./tests/GCCTestSuite/pr15698-6.hex.expected +./tests/GCCTestSuite/pragma-isr2.c.expected +./tests/GCCTestSuite/darwin-ld-20040828-1.c +./tests/GCCTestSuite/pr19967.hex.expected +./tests/GCCTestSuite/c90-mixdecl-1.s.expected +./tests/GCCTestSuite/pr25795.s.expected +./tests/GCCTestSuite/trunc-1.s.expected +./tests/GCCTestSuite/pr29581-3.c.expected +./tests/GCCTestSuite/ftrapv-1.s.expected +./tests/GCCTestSuite/winline-5.c.expected +./tests/GCCTestSuite/940409-1.c.expected +./tests/GCCTestSuite/winline-6.c +./tests/GCCTestSuite/pr25795-1.s.expected +./tests/GCCTestSuite/simd-3.s.expected +./tests/GCCTestSuite/uninit-H.c +./tests/GCCTestSuite/uninit-5.s.expected +./tests/GCCTestSuite/register-var-2.c +./tests/GCCTestSuite/unused-3.hex.expected +./tests/GCCTestSuite/concat2.s.expected +./tests/GCCTestSuite/extra-semi-2.c +./tests/GCCTestSuite/951130-1.c.expected +./tests/GCCTestSuite/visibility-3.c +./tests/GCCTestSuite/pragma-pack-4.c.expected +./tests/GCCTestSuite/bitfld-14.s.expected +./tests/GCCTestSuite/uninit-3.hex.expected +./tests/GCCTestSuite/c90-const-expr-1.c +./tests/GCCTestSuite/always_inline3.hex.expected +./tests/GCCTestSuite/declspec-12.c.expected +./tests/GCCTestSuite/bitfld-6.s.expected +./tests/GCCTestSuite/pr22329.hex.expected +./tests/GCCTestSuite/inline-5.s.expected +./tests/GCCTestSuite/attr-used.c +./tests/GCCTestSuite/qual-return-2.c.expected +./tests/GCCTestSuite/visibility-10.c.expected +./tests/GCCTestSuite/inline-5.c +./tests/GCCTestSuite/darwin-ld-5.c +./tests/GCCTestSuite/pr15443-2.c.expected +./tests/GCCTestSuite/warn-1.hex.expected +./tests/GCCTestSuite/pr25196.c +./tests/GCCTestSuite/c90-array-lval-6.hex.expected +./tests/GCCTestSuite/pr18921-1.hex.expected +./tests/GCCTestSuite/compare1.s.expected +./tests/GCCTestSuite/pack-test-2.c +./tests/GCCTestSuite/pr15698-7.hex.expected +./tests/GCCTestSuite/parm-mismatch-1.c +./tests/GCCTestSuite/overflow-1.c +./tests/GCCTestSuite/darwin-ld-20040828-3.c.expected +./tests/GCCTestSuite/array-quals-2.c.expected +./tests/GCCTestSuite/conv-3.c +./tests/GCCTestSuite/visibility-d.s.expected +./tests/GCCTestSuite/h8300-stack-1.s.expected +./tests/GCCTestSuite/qual-return-3.c.expected +./tests/GCCTestSuite/ultrasp1.s.expected +./tests/GCCTestSuite/visibility-7.c +./tests/GCCTestSuite/conv-3.c.expected +./tests/GCCTestSuite/symbian4.s.expected +./tests/GCCTestSuite/visibility-2.s.expected +./tests/GCCTestSuite/pr26961-1.s.expected +./tests/GCCTestSuite/attr-invalid.s.expected +./tests/GCCTestSuite/visibility-8.c +./tests/GCCTestSuite/symbian3.c.expected +./tests/GCCTestSuite/c99-array-lval-1.s.expected +./tests/GCCTestSuite/unused-5.c +./tests/GCCTestSuite/wtr-static-1.c.expected +./tests/GCCTestSuite/c90-restrict-1.hex.expected +./tests/GCCTestSuite/pr29581-1.s.expected +./tests/GCCTestSuite/pr24620.c.expected +./tests/GCCTestSuite/compare3.s.expected +./tests/GCCTestSuite/ftrapv-1.hex.expected +./tests/GCCTestSuite/c90-array-quals-2.hex.expected +./tests/GCCTestSuite/darwin-weakimport-1.hex.expected +./tests/GCCTestSuite/c90-mixdecl-1.c +./tests/GCCTestSuite/symbian1.hex.expected +./tests/GCCTestSuite/darwin-20040809-2.hex.expected +./tests/GCCTestSuite/c99-enum-comma-1.c.expected +./tests/GCCTestSuite/smod-1.c +./tests/GCCTestSuite/pr25993.hex.expected +./tests/GCCTestSuite/redecl-16.hex.expected +./tests/GCCTestSuite/struct-empty-2.c +./tests/GCCTestSuite/symbian3.hex.expected +./tests/GCCTestSuite/fold-xor-2.s.expected +./tests/GCCTestSuite/pr11864-1.s.expected +./tests/GCCTestSuite/c90-flex-array-1.c.expected +./tests/GCCTestSuite/pr17319.s.expected +./tests/GCCTestSuite/inline-21.c.expected +./tests/GCCTestSuite/c90-idem-qual-2.s.expected +./tests/GCCTestSuite/pragma-re-2.c.expected +./tests/GCCTestSuite/extra-semi-3.c.expected +./tests/GCCTestSuite/c99-longlong-1.c.expected +./tests/GCCTestSuite/inline1.hex.expected +./tests/GCCTestSuite/assign-warn-3.c.expected +./tests/GCCTestSuite/pr29637.s.expected +./tests/GCCTestSuite/fold-xor-1.c.expected +./tests/GCCTestSuite/deprecated-3.c.expected +./tests/GCCTestSuite/c90-idem-qual-2.hex.expected +./tests/GCCTestSuite/uninit-1.c.expected +./tests/GCCTestSuite/visibility-1.hex.expected +./tests/GCCTestSuite/uninit-11.s.expected +./tests/GCCTestSuite/anon-struct-4.s.expected +./tests/GCCTestSuite/noreturn-6.c +./tests/GCCTestSuite/c99-array-lval-5.s.expected +./tests/GCCTestSuite/visibility-a.c +./tests/GCCTestSuite/pr24683.hex.expected +./tests/GCCTestSuite/enum2.hex.expected +./tests/GCCTestSuite/visibility-6.c.expected +./tests/GCCTestSuite/unused-3.c.expected +./tests/GCCTestSuite/transparent-union-3.hex.expected +./tests/GCCTestSuite/pragma-ep-3.hex.expected +./tests/GCCTestSuite/pr19967.s.expected +./tests/GCCTestSuite/fold-xor-1.s.expected +./tests/GCCTestSuite/inline-17.c +./tests/GCCTestSuite/empty-source-1.c.expected +./tests/GCCTestSuite/inline2.hex.expected +./tests/GCCTestSuite/uninit-F.hex.expected +./tests/GCCTestSuite/nrv2.c.expected +./tests/GCCTestSuite/inline-4.s.expected +./tests/GCCTestSuite/wtr-union-init-1.hex.expected +./tests/GCCTestSuite/pr28187.c +./tests/GCCTestSuite/c99-enum-comma-1.s.expected +./tests/GCCTestSuite/c99-const-expr-1.c.expected +./tests/GCCTestSuite/inline-8.c +./tests/GCCTestSuite/pr15784-4.s.expected +./tests/GCCTestSuite/uninit-9.s.expected +./tests/GCCTestSuite/transparent-union-2.s.expected +./tests/GCCTestSuite/inline-10.c.expected +./tests/GCCTestSuite/empty-source-3.c.expected +./tests/GCCTestSuite/pr20017.s.expected +./tests/GCCTestSuite/alias-2.s.expected +./tests/GCCTestSuite/uninit-E.s.expected +./tests/GCCTestSuite/compare9.c +./tests/GCCTestSuite/pr20115-1.s.expected +./tests/GCCTestSuite/wtr-switch-1.c.expected +./tests/GCCTestSuite/arm-scd42-2.s.expected +./tests/GCCTestSuite/qual-return-1.c +./tests/GCCTestSuite/noreturn-5.c +./tests/GCCTestSuite/reg-vol-struct-1.hex.expected +./tests/GCCTestSuite/pr24367.s.expected +./tests/GCCTestSuite/compare5.s.expected +./tests/GCCTestSuite/pr23625.c.expected +./tests/GCCTestSuite/nonnull-2.c +./tests/GCCTestSuite/compare9.c.expected +./tests/GCCTestSuite/c90-array-lval-6.s.expected +./tests/GCCTestSuite/attr-alwaysinline.c.expected +./tests/GCCTestSuite/attr-invalid.hex.expected +./tests/GCCTestSuite/c99-impl-int-2.hex.expected +./tests/GCCTestSuite/struct-empty-3.c.expected +./tests/GCCTestSuite/pr17635.s.expected +./tests/GCCTestSuite/unused-2.s.expected +./tests/GCCTestSuite/pr20130-1.s.expected +./tests/GCCTestSuite/concat.hex.expected +./tests/GCCTestSuite/visibility-6.c +./tests/GCCTestSuite/dll-4.s.expected +./tests/GCCTestSuite/fdata-sections-1.s.expected +./tests/GCCTestSuite/unused-7.c.expected +./tests/GCCTestSuite/pr32450.hex.expected +./tests/GCCTestSuite/concat.c +./tests/GCCTestSuite/switch-4.s.expected +./tests/GCCTestSuite/darwin-ld-2.c +./tests/GCCTestSuite/unused-2.hex.expected +./tests/GCCTestSuite/pr25795-1.hex.expected +./tests/GCCTestSuite/winline-6.s.expected +./tests/GCCTestSuite/pr29581-1.c +./tests/GCCTestSuite/anon-struct-4.c +./tests/GCCTestSuite/visibility-10.c +./tests/GCCTestSuite/pragma-re-2.hex.expected +./tests/GCCTestSuite/empty-source-2.s.expected +./tests/GCCTestSuite/void-cast-1.hex.expected +./tests/GCCTestSuite/noreturn-5.s.expected +./tests/GCCTestSuite/visibility-2.hex.expected +./tests/GCCTestSuite/pr19967.c.expected +./tests/GCCTestSuite/empty-source-2.c.expected +./tests/GCCTestSuite/wchar_t-2.c.expected +./tests/GCCTestSuite/simd-1b.s.expected +./tests/GCCTestSuite/pr18241-5.c.expected +./tests/GCCTestSuite/struct-empty-1.hex.expected +./tests/GCCTestSuite/extra-semi-2.c.expected +./tests/GCCTestSuite/extra-semi-3.s.expected +./tests/GCCTestSuite/c90-idem-qual-1.c +./tests/GCCTestSuite/pr20115.c +./tests/GCCTestSuite/volatile1.c +./tests/GCCTestSuite/symbian5.hex.expected +./tests/GCCTestSuite/pr14796-2.s.expected +./tests/GCCTestSuite/noreturn-1.c.expected +./tests/GCCTestSuite/qual-return-2.s.expected +./tests/GCCTestSuite/compare7.s.expected +./tests/GCCTestSuite/visibility-d.c +./tests/GCCTestSuite/pr29736.s.expected +./tests/GCCTestSuite/c99-main-1.hex.expected +./tests/GCCTestSuite/pr28187.c.expected +./tests/GCCTestSuite/struct-empty-1.s.expected +./tests/GCCTestSuite/darwin-ld-20040828-1.s.expected +./tests/GCCTestSuite/old-style-then-proto-1.c.expected +./tests/GCCTestSuite/uninit-H.s.expected +./tests/GCCTestSuite/fold-xor-2.c +./tests/GCCTestSuite/conv-3.s.expected +./tests/GCCTestSuite/uninit-8.hex.expected +./tests/GCCTestSuite/ultrasp10.hex.expected +./tests/GCCTestSuite/cleanup-3.c +./tests/GCCTestSuite/c99-dupqual-1.c +./tests/GCCTestSuite/deprecated-3.hex.expected +./tests/GCCTestSuite/inline-17.hex.expected +./tests/GCCTestSuite/funroll-loops-all.c +./tests/GCCTestSuite/c99-array-lval-5.c.expected +./tests/GCCTestSuite/ultrasp4.c +./tests/GCCTestSuite/postincr-1.c +./tests/GCCTestSuite/nonnull-1.s.expected +./tests/GCCTestSuite/pr26570.hex.expected +./tests/GCCTestSuite/visibility-1.s.expected +./tests/GCCTestSuite/unused-3.c +./tests/GCCTestSuite/builtins-35.c +./tests/GCCTestSuite/loop-5.s.expected +./tests/clight +./tests/clight/binop.log.expected +./tests/clight/complets.c.expected +./tests/clight/array.RTLabs.expected +./tests/clight/ifthenelse.c.expected +./tests/clight/binop.RTLabs.expected +./tests/clight/complets.RTL.expected +./tests/clight/testTB_Array_ecriture.c +./tests/clight/testTB_Array_lecture.LIN.expected +./tests/clight/complets.c +./tests/clight/fib.Cminor.expected +./tests/clight/fir_complexe.RTL.expected +./tests/clight/array.c +./tests/clight/testTB_boucle.ASM.expected +./tests/clight/testTB_Array_LE.c +./tests/clight/fir4.ERTL.expected +./tests/clight/fib.RTLabs.expected +./tests/clight/fib.LIN.expected +./tests/clight/01-array.c +./tests/clight/complets.RTLabs.expected +./tests/clight/fir_complexe.LTL.expected +./tests/clight/testTB_Array_double.RTLabs.expected +./tests/clight/testTB_Array_lecture.ERTL.expected +./tests/clight/testTB_Array_ecriture.Clight.expected +./tests/clight/ifthenelse.Cminor.expected +./tests/clight/ifthenelse.Clight.expected +./tests/clight/testTB_Array_double.Clight.expected +./tests/clight/01-testTB_Array_ecriture.c +./tests/clight/testTB_boucle.ERTL.expected +./tests/clight/testCOMP_tri.Clight.expected +./tests/clight/testTB_Array_LE.Clight.expected +./tests/clight/fir4.ASM.expected +./tests/clight/testTB_Array_ecriture.RTL.expected +./tests/clight/testTB_boucle.LIN.expected +./tests/clight/testCOMP_tri.c +./tests/clight/testCOMP_tri.log.expected +./tests/clight/testCOMP_tri.LTL.expected +./tests/clight/testTB_Array_LE.LIN.expected +./tests/clight/for.Clight.expected +./tests/clight/testCOMP_tri.LIN.expected +./tests/clight/testTB_boucle.c +./tests/clight/for.ERTL.expected +./tests/clight/ifthenelse.LIN.expected +./tests/clight/complets.ERTL.expected +./tests/clight/array.LIN.expected +./tests/clight/01-testTB_Array_ecriture.hex +./tests/clight/testTB_Array_LE.c.expected +./tests/clight/testTB_Array_double.c +./tests/clight/fir_complexe.c.expected +./tests/clight/for.LTL.expected +./tests/clight/ifthenelse.ERTL.expected +./tests/clight/array.s +./tests/clight/fir_complexe.c +./tests/clight/fir4.c +./tests/clight/array.LTL.expected +./tests/clight/fib.c +./tests/clight/binop.c.expected +./tests/clight/fib.LTL.expected +./tests/clight/fir_complexe.RTLabs.expected +./tests/clight/array.Clight.expected +./tests/clight/for.RTL.expected +./tests/clight/for.LIN.expected +./tests/clight/testTB_Array_lecture.c +./tests/clight/fir4.c.expected +./tests/clight/for.ASM.expected +./tests/clight/testTB_Array_double.Cminor.expected +./tests/clight/fir4.Clight.expected +./tests/clight/ifthenelse.ASM.expected +./tests/clight/testTB_Array_double.RTL.expected +./tests/clight/testTB_Array_ecriture.LTL.expected +./tests/clight/testCOMP_tri.ERTL.expected +./tests/clight/fir_complexe.Clight.expected +./tests/clight/testTB_Array_LE.hex +./tests/clight/testCOMP_tri.RTLabs.expected +./tests/clight/complets.LTL.expected +./tests/clight/fib.ERTL.expected +./tests/clight/testTB_Array_double.c.expected +./tests/clight/array.ASM.expected +./tests/clight/fir4.LIN.expected +./tests/clight/binop.c +./tests/clight/testTB_boucle.RTLabs.expected +./tests/clight/testTB_Array_double.LTL.expected +./tests/clight/fir_complexe.ERTL.expected +./tests/clight/testTB_Array_LE.s +./tests/clight/for.Cminor.expected +./tests/clight/testTB_Array_ecriture.RTLabs.expected +./tests/clight/testTB_Array_ecriture.log.expected +./tests/clight/testTB_boucle.Clight.expected +./tests/clight/array.hex +./tests/clight/complets.Clight.expected +./tests/clight/binop.RTL.expected +./tests/clight/fir_complexe.log.expected +./tests/clight/complets.ASM.expected +./tests/clight/for.RTLabs.expected +./tests/clight/fir4.RTLabs.expected +./tests/clight/testTB_Array_lecture.RTL.expected +./tests/clight/binop.Clight.expected +./tests/clight/array.RTL.expected +./tests/clight/fir4.LTL.expected +./tests/clight/testTB_Array_LE.ASM.expected +./tests/clight/01-testTB_Array_LE.c +./tests/clight/testTB_boucle.log.expected +./tests/clight/testTB_Array_lecture.c.expected +./tests/clight/testTB_Array_lecture.Clight.expected +./tests/clight/ifthenelse.RTL.expected +./tests/clight/testTB_Array_double.ASM.expected +./tests/clight/fib.log.expected +./tests/clight/testTB_boucle.RTL.expected +./tests/clight/testTB_Array_lecture.ASM.expected +./tests/clight/testTB_Array_lecture.RTLabs.expected +./tests/clight/ok-counter +./tests/clight/testCOMP_tri.Cminor.expected +./tests/clight/for.c.expected +./tests/clight/binop.LIN.expected +./tests/clight/ifthenelse.LTL.expected +./tests/clight/fib.ASM.expected +./tests/clight/testTB_Array_ecriture.hex +./tests/clight/array.Cminor.expected +./tests/clight/ko-counter +./tests/clight/testTB_Array_ecriture.ERTL.expected +./tests/clight/for.log.expected +./tests/clight/testTB_Array_LE.Cminor.expected +./tests/clight/testTB_Array_LE.RTLabs.expected +./tests/clight/testTB_Array_ecriture.s +./tests/clight/fib.Clight.expected +./tests/clight/testTB_Array_double.log.expected +./tests/clight/testTB_Array_LE.RTL.expected +./tests/clight/Makefile +./tests/clight/testTB_Array_LE.LTL.expected +./tests/clight/testTB_boucle.c.expected +./tests/clight/02-testTB_Array_ecriture.c +./tests/clight/binop.ASM.expected +./tests/clight/testTB_Array_LE.log.expected +./tests/clight/01-testTB_Array_ecriture.s +./tests/clight/fib.c.expected +./tests/clight/testCOMP_tri.ASM.expected +./tests/clight/testTB_Array_ecriture.ASM.expected +./tests/clight/testTB_boucle.LTL.expected +./tests/clight/fib.RTL.expected +./tests/clight/testTB_Array_lecture.log.expected +./tests/clight/array.c.expected +./tests/clight/binop.Cminor.expected +./tests/clight/testTB_Array_ecriture.Cminor.expected +./tests/clight/fir4.log.expected +./tests/clight/testCOMP_tri.c.expected +./tests/clight/testCOMP_tri.RTL.expected +./tests/clight/testTB_Array_double.ERTL.expected +./tests/clight/complets.log.expected +./tests/clight/for.c +./tests/clight/array.log.expected +./tests/clight/ifthenelse.RTLabs.expected +./tests/clight/fir_complexe.LIN.expected +./tests/clight/testTB_Array_ecriture.LIN.expected +./tests/clight/ifthenelse.c +./tests/clight/ifthenelse.log.expected +./tests/clight/binop.ERTL.expected +./tests/clight/fir4.RTL.expected +./tests/clight/testTB_boucle.Cminor.expected +./tests/clight/testTB_Array_LE.ERTL.expected +./tests/clight/binop.LTL.expected +./tests/clight/testTB_Array_lecture.Cminor.expected +./tests/clight/fib.s.expected +./tests/clight/fir4.Cminor.expected +./tests/clight/array.ERTL.expected +./tests/clight/complets.Cminor.expected +./tests/clight/fir_complexe.Cminor.expected +./tests/clight/testTB_Array_lecture.LTL.expected +./tests/clight/complets.LIN.expected +./tests/clight/testTB_Array_ecriture.c.expected +./tests/clight/fir_complexe.ASM.expected +./tests/clight/testTB_Array_double.LIN.expected +./tests/Makefile +./tests/benchs +./tests/benchs/cparser18c1246.c +./tests/benchs/cparser162cc31.c +./tests/benchs/mat_det.c +./tests/benchs/cparser2ad371c.i +./tests/benchs/fib.c +./tests/benchs/min.c +./tests/benchs/badsort.c +./tests/benchs/cparser2dcc632.i +./tests/benchs/acc.run +./tests/benchs/meantime.sh +./tests/benchs/quicksort.c +./tests/benchs/cparser27e7643.i +./tests/benchs/cparser1ecc129.c +./tests/benchs/Makefile +./tests/benchs/cparser1b43f7a.c +./tests/benchs/cparser296cfe9.i +./tests/benchs/cparser1e57fb4.c +./tests/benchs/cparser23ae4e0.i +./tests/benchs/search.c +./acc.odocl +./Makefile +./doc +./doc/src +./doc/src/main +./doc/html +./doc/html/style.css +./src +./src/accweb.ml +./src/options.ml +./src/annotStackSize.ml +./src/ASM +./src/ASM/ASMInterpret.mli +./src/ASM/Parser.mli +./src/ASM/BitVectors.ml +./src/ASM/MIPSOps.mli +./src/ASM/printOps.ml +./src/ASM/Pretty.ml +./src/ASM/MIPS.ml +./src/ASM/ASMPrinter.mli +./src/ASM/BitVectors.mli +./src/ASM/MIPSInterpret.mli +./src/ASM/Physical.mli +./src/ASM/ASMCosts.ml +./src/ASM/Pretty.mli +./src/ASM/IntelHex.ml +./src/ASM/I8051.mli +./src/ASM/ASM.mli +./src/ASM/IntelHex.mli +./src/ASM/MIPS.mli +./src/ASM/MIPSInterpret.ml +./src/ASM/I8051.ml +./src/ASM/Util.ml +./src/ASM/ASMPrinter.ml +./src/ASM/ASMInterpret.ml +./src/ASM/printOps.mli +./src/ASM/arch.mli +./src/ASM/Parser.ml +./src/ASM/Physical.ml +./src/ASM/ASMCosts.mli +./src/driver.mli +./src/utilities +./src/utilities/option.ml +./src/utilities/webify.mli +./src/utilities/setMap.mli +./src/utilities/Fix.mli +./src/utilities/printPottier.ml +./src/utilities/print.ml +./src/utilities/syntacticAnalysis.ml +./src/utilities/unionFind.ml +./src/utilities/print.mli +./src/utilities/misc.mli +./src/utilities/unionFind.mli +./src/utilities/misc.ml +./src/utilities/checkOClosure.ml +./src/utilities/stringTools.mli +./src/utilities/bijection.mli +./src/utilities/printPottier.mli +./src/utilities/stringTools.ml +./src/utilities/optionsParsing.ml +./src/utilities/webify.ml +./src/utilities/interference.mli +./src/utilities/bijection.ml +./src/utilities/position.mli +./src/utilities/prioritySet.mli +./src/utilities/position.ml +./src/utilities/integer.mli +./src/utilities/stringSig.mli +./src/utilities/coloring.mli +./src/utilities/coloring.ml +./src/utilities/interference.ml +./src/utilities/prioritySet.ml +./src/utilities/Fix.ml +./src/utilities/printCFG.ml +./src/utilities/myMap.ml +./src/utilities/integer.ml +./src/utilities/printCFG.mli +./src/utilities/miscPottier.ml +./src/utilities/error.ml +./src/utilities/syntacticAnalysis.mli +./src/utilities/setMap.ml +./src/utilities/option.mli +./src/utilities/miscPottier.mli +./src/utilities/myMap.mli +./src/utilities/error.mli +./src/utilities/eformat.ml +./src/utilities/eformat.mli +./src/driver.ml +./src/RTL +./src/RTL/RTLInterpret.mli +./src/RTL/RTL.mli +./src/RTL/RTLPrinter.ml +./src/RTL/RTLtailcall.mli +./src/RTL/RTLToERTL.ml +./src/RTL/RTLPrinter.mli +./src/RTL/RTLtailcall.ml +./src/RTL/RTLInterpret.ml +./src/RTL/RTLToERTL.mli +./src/acc.mli +./src/dev_test.ml +./src/acc.ml +./src/clight +./src/clight/clightLustreMain.mli +./src/clight/clightToCminor.mli +./src/clight/runtime.ml +./src/clight/clightFromC.ml +./src/clight/clightFlags.ml +./src/clight/clightInterpret.ml +./src/clight/clightAnnotator.ml +./src/clight/clightParser.ml +./src/clight/clightUtils.mli +./src/clight/clightInterpret.mli +./src/clight/clight.mli +./src/clight/clightLustre.ml +./src/clight/clightFold.mli +./src/clight/clightAnnotator.mli +./src/clight/clightLabelling.mli +./src/clight/clightFold.ml +./src/clight/runtime.mli +./src/clight/clightLustreMain.ml +./src/clight/clightCasts.mli +./src/clight/clightParser.mli +./src/clight/clight32ToClight8.mli +./src/clight/clightUtils.ml +./src/clight/clightPrinter.mli +./src/clight/clight32ToClight8.ml +./src/clight/clightSwitch.mli +./src/clight/clightToCminor.ml +./src/clight/clightLustre.mli +./src/clight/clightSwitch.ml +./src/clight/clightLabelling.ml +./src/clight/clightPrinter.ml +./src/clight/clightCasts.ml +./src/checker.mli +./src/languages.ml +./src/ERTL +./src/ERTL/spill.ml +./src/ERTL/uses.mli +./src/ERTL/ERTLPrinter.mli +./src/ERTL/ERTLInterpret.mli +./src/ERTL/build.ml +./src/ERTL/spill.mli +./src/ERTL/ERTLInterpret.ml +./src/ERTL/liveness.ml +./src/ERTL/ERTLPrinter.ml +./src/ERTL/ERTLToLTL.mli +./src/ERTL/ERTLToLTLI.mli +./src/ERTL/liveness.mli +./src/ERTL/build.mli +./src/ERTL/ERTL.mli +./src/ERTL/ERTLToLTLI.ml +./src/ERTL/ERTLToLTL.ml +./src/ERTL/uses.ml +./src/options.mli +./src/checker.ml +./src/cminor +./src/cminor/cminorInterpret.mli +./src/cminor/cminorLexer.mll +./src/cminor/cminorPrinter.ml +./src/cminor/cminorLabelling.ml +./src/cminor/cminorPrinter.mli +./src/cminor/cminorAnnotator.ml +./src/cminor/cminorToRTLabs.ml +./src/cminor/cminorFold.ml +./src/cminor/cminorInterpret.ml +./src/cminor/cminorFold.mli +./src/cminor/cminorToRTLabs.mli +./src/cminor/cminorAnnotator.mli +./src/cminor/cminorLabelling.mli +./src/cminor/cminorParser.mly +./src/cminor/cminor.mli +./src/LIN +./src/LIN/LINPrinter.mli +./src/LIN/LINToASM.ml +./src/LIN/LINInterpret.ml +./src/LIN/LINInterpret.mli +./src/LIN/LIN.mli +./src/LIN/LINToASM.mli +./src/LIN/LINPrinter.ml +./src/common +./src/common/register.mli +./src/common/hdwRegister.ml +./src/common/intByBig_int.ml +./src/common/label.ml +./src/common/value.mli +./src/common/intValue.ml +./src/common/intValue.mli +./src/common/costLabel.ml +./src/common/primitive.mli +./src/common/register.ml +./src/common/costLabel.mli +./src/common/AST.mli +./src/common/label.mli +./src/common/atom.mli +./src/common/memory.mli +./src/common/atom.ml +./src/common/atomSig.mli +./src/common/intByInt64.ml +./src/common/primitive.ml +./src/common/hdwRegister.mli +./src/common/memory.ml +./src/common/intValue.in +./src/common/value.ml +./src/common/intValueConfig.ml +./src/languages.mli +./src/LTL +./src/LTL/branch.mli +./src/LTL/LTLToLIN.mli +./src/LTL/LTLPrinter.mli +./src/LTL/LTLPrinter.ml +./src/LTL/LTLToLINI.ml +./src/LTL/LTLInterpret.mli +./src/LTL/LTLToLIN.ml +./src/LTL/LTLInterpret.ml +./src/LTL/branch.ml +./src/LTL/LTLToLINI.mli +./src/LTL/LTL.mli +./src/RTLabs +./src/RTLabs/RTLabs.mli +./src/RTLabs/RTLabsPrinter.ml +./src/RTLabs/RTLabsInterpret.mli +./src/RTLabs/RTLabsInterpret.ml +./src/RTLabs/RTLabsToRTL.mli +./src/RTLabs/RTLabsPrinter.mli +./src/RTLabs/RTLabsToRTL.ml +./configure-oclosure.sh +./admin +./admin/_build +./admin/_build/_log +./admin/_build/_digests +./admin/configure-oclosure.sh +./admin/myocamldoc +./_tags.js_of_ocaml +./lib diff --git a/doc/html/style.css b/doc/html/style.css new file mode 100644 index 0000000..0b637e9 --- /dev/null +++ b/doc/html/style.css @@ -0,0 +1,196 @@ +/* FIXME: This style.css was automatically generated by ocamldoc. + FIXME: This should be customized. */ + +body { + margin-left : 5em; + margin-right : 5em; + padding-left : 5em; + padding-right: 5em; + border-left : solid 1px; + border-right : solid 1px; + border-bottom: 0px; +} + +a:visited { + color : #416DFF; + text-decoration : none; +} +a:link { + color : #416DFF; + text-decoration : none;} + +a:hover { + color : Red; + text-decoration : none; + background-color: #5FFF88} + +a:active { + color : Red; + text-decoration : underline; +} + +.keyword { + font-weight : bold ; + color : Black +} + +.keywordsign { + color : #C04600 +} + +.superscript { + font-size : 4 +} + +.subscript { + font-size : 4 +} + +.comment { + color : Green +} + +.constructor { + color : Blue +} + +.type { + color : #5C6585 +} + +.string { + color : Maroon +} + +.warning { + color : Red ; + font-weight : bold +} +.info { + margin-left : 0em; + margin-right : 0em ; + font-family : Verdana; + font-style: italic +} + +.param_info { + margin-top: 4px; + margin-left : 3em; + margin-right : 3em +} + +.code { + color : #465F91 ; +} + +h1 { + font-size : 30pt ; + text-align: right; + font-variant : small-caps; +} + +h2 { + font-size : 20pt ; + border-bottom: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px; + margin-left: 0px; + margin-right: 0px; + padding-left: 0px; + padding-right: 0px; + text-align: left; + padding-top: 1em; + font-variant : small-caps; +} + +h3 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #90DDFF ;p + adding: 2px; + } + +h4 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #90EDFF ;p + adding: 2px; + } + +h5 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #90FDFF ;p + adding: 2px; + } + +h6 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #C0FFFF ; + padding: 2px; + } + +div.h7 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #E0FFFF ; + padding: 2px; + } + +div.h8 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #F0FFFF ; + padding: 2px; + } + +div.h9 { font-size : 20pt ; + border: 1px solid #000000; + margin-top: 5px; + margin-bottom: 2px;t + ext-align: center; + background-color: #FFFFFF ; + padding: 2px; + } + +.typetable { border-style : hidden } + +.indextable { border-style : hidden } + +.paramstable { + border-style : hidden ; + padding: 5pt 5pt +} + +tr { + background-color : White + +} +td.typefieldcomment { + background-color : #FFFFFF ; + font-size: smaller ; +} + +pre { + margin-bottom: 4px; + margin-top: 2em; + margin-left: 0em; + font-size: 11pt; +} + +div.sig_block { + margin-left: 2em +} \ No newline at end of file diff --git a/doc/src/main b/doc/src/main new file mode 100644 index 0000000..209583f --- /dev/null +++ b/doc/src/main @@ -0,0 +1,56 @@ +{2 Driver} + +{!modules: Acc Checker Languages Options AnnotationOptions} + +{2 Cminor} + +{!modules: Cminor CminorAnnotator CminorInterpret CminorLabelling + CminorPrinter CminorToRTLabs +} + +{2 Clight} + +{!modules: Clight ClightAnnotator ClightInterpret ClightLabelling + ClightParser ClightPrinter ClightToCminor +} + +{2 RTLabs} + +{!modules: RTLabs RTLabsInterpret RTLabsPrinter RTLabsToRTL} + +{2 RTL} + +{!modules: RTL RTLInterpret RTLPrinter RTLToERTLI RTLToERTL} + +{2 ERTL} + +{!modules: ERTL ERTLInterpret Spill Coloring ERTLPrinter + ERTLToLTLI ERTLToLTL Liveness Uses Zero +} + +{2 LTL} + +{!modules: LTL LTLInterpret LTLPrinter LTLToLINI LTLToLIN} + +{2 LIN} + +{!modules: LIN LINInterpret LINPrinter LINToASM Branch} + +{2 ASM} + +{!modules: ASM ASMInterpret ASMCompute_costs ASMPrinter + MIPSInterpret MIPS MIPSOps PrintOps} + +{2 Language-independent modules} + +{!modules: AST Atom AtomSig CostLabel Label Memory + Primitive PrintPrimitive Register Value Build +} + +{2 General utilities} + +{!modules: OptionsParsing Position Misc Error + Error Fix Integer Interference Misc MiscPottier MyMap + Option Position PrintCFG Print PrintPottier PrioritySet SetMap + StringSig StringTools SyntacticAnalysis UnionFind +} \ No newline at end of file diff --git a/myocamlbuild.ml b/myocamlbuild.ml new file mode 100644 index 0000000..451a8fd --- /dev/null +++ b/myocamlbuild.ml @@ -0,0 +1,59 @@ +open Ocamlbuild_plugin +open Myocamlbuild_config + +let run_and_read = Ocamlbuild_pack.My_unix.run_and_read +let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings + +let find_packages () = + blank_sep_strings & + Lexing.from_string & + run_and_read "ocamlfind list | cut -d' ' -f1" + +let find_syntaxes () = ["camlp4o"; "camlp4r"] + +let ocamlfind x = S[A"ocamlfind"; x] + + +let _ = dispatch begin function + | Before_options -> + Options.ocamlc := ocamlfind & A"ocamlc"; + Options.ocamlopt := ocamlfind & A"ocamlopt"; + Options.ocamldep := ocamlfind & A"ocamldep"; + Options.ocamldoc := A"admin/myocamldoc.exe"; + Options.ocamlmktop := ocamlfind & A"ocamlmktop"; + + | After_rules -> + flag ["ocaml"; "link"; "program"] & A"-linkpkg"; + List.iter begin fun pkg -> + flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg]; + flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg]; + flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg]; + flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg]; + end (find_packages ()); + List.iter begin fun s -> + flag ["ocaml"; "compile"; "syntax_"^s] & S[A"-syntax"; A s]; + flag ["ocaml"; "ocamldep"; "syntax_"^s] & S[A"-syntax"; A s]; + flag ["ocaml"; "doc"; "syntax_"^s] & S[A"-syntax"; A s]; + end (find_syntaxes ()); + flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); + flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); + + rule "admin/myocamldoc" + ~prod:"admin/myocamldoc.exe" + ~deps:["admin/myocamldoc"] + begin fun _ _ -> + Seq [ cp "admin/myocamldoc" "admin/myocamldoc.exe"; + chmod (A"+rx") "admin/myocamldoc.exe" ] + end; + + dep ["doc"] ["admin/myocamldoc.exe"]; + dep ["doc"; "docdir"; "extension:html"; "ocaml"] [ "doc/src/main" ]; + flag ["doc"; "docdir"; "extension:html"; "ocaml"] + (S[A "-intro"; A "doc/src/main" ]); + flag ["doc"] (S[A "-keep-code"]); + flag ["doc"] (S[A ("-I "^parser_lib)]); + + ocaml_lib ~extern:true ~dir:parser_lib "cparser"; + + | _ -> () +end diff --git a/src/ASM/ASM.mli b/src/ASM/ASM.mli new file mode 100644 index 0000000..46d7d17 --- /dev/null +++ b/src/ASM/ASM.mli @@ -0,0 +1,127 @@ +open BitVectors;; + +type ('a,'b) union2 = [ `U1 of 'a | `U2 of 'b ] +type ('a,'b,'c) union3 = [ `U1 of 'a | `U2 of 'b | `U3 of 'c ] +type ('a,'b,'c,'d,'e,'f) union6 = [ `U1 of 'a | `U2 of 'b | `U3 of 'c | `U4 of 'd | `U5 of 'e | `U6 of 'f ] + +type direct = [ `DIRECT of byte ] +type indirect = [ `INDIRECT of bit ] +type ext_indirect = [ `EXT_INDIRECT of bit ] +type reg = [ `REG of bit * bit * bit ] +type acc = [ `A ] +type b = [ `B ] +type dptr = [ `DPTR ] +type data = [ `DATA of byte ] +type data16 = [ `DATA16 of word ] +type acc_dptr = [ `A_DPTR ] +type acc_pc = [ `A_PC ] +type ext_indirect_dptr = [ `EXT_IND_DPTR ] +type indirect_dptr = [ `IND_DPTR ] +type carry = [ `C ] +type bit = [ `BIT of byte ] +type nbit = [ `NBIT of byte ] +type rel = [ `REL of byte ] +type addr11 = [ `ADDR11 of word11 ] +type addr16 = [ `ADDR16 of word ] + +type 'addr jump = + [ `JC of 'addr + | `JNC of 'addr + | `JB of bit * 'addr + | `JNB of bit * 'addr + | `JBC of bit * 'addr + | `JZ of 'addr + | `JNZ of 'addr + | `CJNE of (acc * [ direct | data ], [ reg | indirect ] * data) union2 * 'addr + | `DJNZ of [ reg | direct ] * 'addr + ] + +type 'addr preinstruction = + (* arithmetic operations *) + [ `ADD of acc * [ reg | direct | indirect | data ] + | `ADDC of acc * [ reg | direct | indirect | data ] + | `SUBB of acc * [ reg | direct | indirect | data ] + | `INC of [ acc | reg | direct | indirect | dptr ] + | `DEC of [ acc | reg | direct | indirect ] + | `MUL of acc * b + | `DIV of acc * b + | `DA of acc + + (* logical operations *) + | `ANL of + (acc * [ reg | direct | indirect | data ], + direct * [ acc | data ], + carry * [ bit | nbit]) union3 + | `ORL of + (acc * [ reg | data | direct | indirect ], + direct * [ acc | data ], + carry * [ bit | nbit]) union3 + | `XRL of + (acc * [ data | reg | direct | indirect ], + direct * [ acc | data ]) union2 + | `CLR of [ acc | carry | bit ] + | `CPL of [ acc | carry | bit ] + | `RL of acc + | `RLC of acc + | `RR of acc + | `RRC of acc + | `SWAP of acc + + (* data transfer *) + | `MOV of + (acc * [ reg | direct | indirect | data ], + [ reg | indirect ] * [ acc | direct | data ], + direct * [ acc | reg | direct | indirect | data ], + dptr * data16, + carry * bit, + bit * carry + ) union6 + | `MOVC of acc * [ acc_dptr | acc_pc ] + | `MOVX of (acc * [ ext_indirect | ext_indirect_dptr ], + [ ext_indirect | ext_indirect_dptr ] * acc) union2 + | `SETB of [ carry | bit ] + | `PUSH of direct + | `POP of direct + | `XCH of acc * [ reg | direct | indirect ] + | `XCHD of acc * indirect + + (* program branching *) + | 'addr jump + | `ACALL of addr11 + | `LCALL of addr16 + | `RET + | `RETI + | `AJMP of addr11 + | `LJMP of addr16 + | `SJMP of rel + | `JMP of indirect_dptr + | `NOP ] + +type instruction = rel preinstruction + +type labelled_instruction = + [ instruction + | `Cost of string + | `Label of string + | `Jmp of string + | `Call of string + | `Mov of dptr * string + | `WithLabel of [`Label of string] jump + ] + +(* pairs *) +type preamble = (string * int) list + +(* has_main currently unused *) +type 'a pretty_program = + { ppreamble : preamble ; + pexit_label : string ; + pcode : 'a list ; + phas_main : bool } + +type program = + { code : BitVectors.byte list ; + cost_labels : string BitVectors.WordMap.t ; + labels : BitVectors.word StringTools.Map.t ; + exit_addr : BitVectors.word ; + has_main : bool } diff --git a/src/ASM/ASMCosts.ml b/src/ASM/ASMCosts.ml new file mode 100644 index 0000000..1ace0ca --- /dev/null +++ b/src/ASM/ASMCosts.ml @@ -0,0 +1,120 @@ + +let error_prefix = "ASMCosts" +let warning s = prerr_endline (error_prefix ^ s) + + +type instruction_nature = + | Goto of BitVectors.word | Branch of BitVectors.word + | Direct_fun_call of BitVectors.word | Return + | Other + +let inst_infos mem pc = + let (inst, next_pc, inst_cost) = ASMInterpret.fetch mem pc in + let (nature, next_pcs) = match inst with + | `LCALL (`ADDR16 addr16) -> (Direct_fun_call addr16, [next_pc]) + | `ACALL (`ADDR11 addr11) -> + (Direct_fun_call (Physical.addr16_of_addr11 pc addr11), [next_pc]) + | `LJMP (`ADDR16 addr16) -> (Goto addr16, [addr16]) + | `AJMP (`ADDR11 addr11) -> + let addr = Physical.addr16_of_addr11 pc addr11 in + (Goto addr, [addr]) + | `SJMP (`REL addr) -> + let _, addr = + BitVectors.half_add next_pc (BitVectors.sign_extension addr) in + (Goto addr, [addr]) + | `JMP idptr -> + (Other, [next_pc]) (* Indirect jump; precondition: every possible + destination should start with its own label *) + | `JC addr + | `JNC addr + | `JB (_,addr) + | `JNB (_,addr) + | `JBC (_,addr) + | `JZ addr + | `JNZ addr + | `CJNE (_,addr) + | `DJNZ (_,addr) -> + let `REL addr = addr in + let _, addr = + BitVectors.half_add next_pc (BitVectors.sign_extension addr) in + (Branch addr, [next_pc ; addr]) + | `RET | `RETI -> (Return, []) + | _ -> (Other, [next_pc]) in + (nature, next_pc, next_pcs, inst_cost) + + +let rec compare = function + | [] -> assert false (* do not use an this argument *) + | [(_, cost)] -> cost + | (pc1, cost1) :: (pc2, cost2) :: l when cost1 <> cost2 -> + warning + (Printf.sprintf + "Warning: branching to %s has cost %d, branching to %s has cost %d" + (string_of_int (BitVectors.int_of_vect pc1)) cost1 + (string_of_int (BitVectors.int_of_vect pc2)) cost2) ; + max cost1 (compare ((pc2, cost2) :: l)) + | _ :: l -> compare l + +let rec block_costl mem costs = function + | [] -> 0 + | [pc] when BitVectors.WordMap.mem pc costs -> 0 + | [pc] -> block_cost mem costs pc + | next_pcs -> + compare (List.map (fun pc -> (pc, block_costl mem costs [pc])) next_pcs) + +and block_cost mem costs pc = + let (_, _, next_pcs, cost) = inst_infos mem pc in + cost + (block_costl mem costs next_pcs) + + +let traverse_code mem p = + let rec aux pc code = + let (_, newpc, _, _) = inst_infos mem pc in + match code with + | [] -> CostLabel.Map.empty + | _::tl when BitVectors.WordMap.mem pc p.ASM.cost_labels -> + let lbl = BitVectors.WordMap.find pc p.ASM.cost_labels in + let cost = block_cost mem p.ASM.cost_labels pc in + let costs_mapping = aux newpc tl in + CostLabel.Map.add lbl cost costs_mapping + | _::tl -> aux newpc tl + in + aux (BitVectors.zero `Sixteen) p.ASM.code + + +let first_cost_label mem costs = + let rec aux oldpc = + if BitVectors.WordMap.mem oldpc costs then + (BitVectors.WordMap.find oldpc costs, 0) + else + let (nature, pc, _, inst_cost) = inst_infos mem oldpc in + match nature with + | Direct_fun_call pc -> + let (lbl, cost) = aux pc in + (lbl, inst_cost + cost) + | Return + | Goto _ + | Branch _ -> + assert false (* no such instructions before calling main *) + | Other -> + let (lbl, cost) = aux pc in + (lbl, inst_cost + cost) + in + aux (BitVectors.zero `Sixteen) + + +let initialize_cost mem costs costs_mapping = + let (lbl, cost) = first_cost_label mem costs in + let old_cost = + if CostLabel.Map.mem lbl costs_mapping then + CostLabel.Map.find lbl costs_mapping + else 0 in + let new_cost = old_cost + cost in + CostLabel.Map.add lbl new_cost costs_mapping + + +let compute p = + let mem = ASMInterpret.load_code_memory p.ASM.code in + let costs_mapping = traverse_code mem p in + if p.ASM.has_main then initialize_cost mem p.ASM.cost_labels costs_mapping + else costs_mapping diff --git a/src/ASM/ASMCosts.mli b/src/ASM/ASMCosts.mli new file mode 100644 index 0000000..8c1917c --- /dev/null +++ b/src/ASM/ASMCosts.mli @@ -0,0 +1,5 @@ + +(** This module defines the cost increment associated to each cost + label of a [ASM] program. *) + +val compute : ASM.program -> int CostLabel.Map.t diff --git a/src/ASM/ASMInterpret.ml b/src/ASM/ASMInterpret.ml new file mode 100644 index 0000000..ae53f2d --- /dev/null +++ b/src/ASM/ASMInterpret.ml @@ -0,0 +1,2028 @@ +open BitVectors;; +open Physical;; +open ASM;; +open IntelHex;; +open Util;; +open Parser;; + +exception Fetch_exception of string;; +exception CodeTooLarge;; +exception Halt;; + +let extract = function + | Some a -> a + | None -> raise (Failure "ASMInterpret.extract") + +type time = int;; +type line = [ `P1 of byte + | `P3 of byte + | `SerialBuff of [ `Eight of byte | `Nine of BitVectors.bit * byte ]];; + +let string_of_line = + function + `P1 b -> + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" ^ + "P1 OUTPUT: " ^ hex_string_of_vect b ^ "\n" ^ + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" + | `P3 b -> + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" ^ + "P2 OUTPUT: " ^ hex_string_of_vect b ^ "\n" ^ + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" + | `SerialBuff (`Eight b) -> + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" ^ + "SERIAL 8b OUTPUT: " ^ string_of_vect b ^ "\n" ^ + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" + | `SerialBuff (`Nine (b, b')) -> + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" ^ + "SERIAL 9b OUTPUT: " ^ + (let i = int_of_vect b' in + if b then + string_of_int (128 + i) + else + string_of_int i) ^ + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" + +(* In: reception time, line of input, new continuation, + Out: transmission time, output line, expected duration until reply, + new continuation. +*) + +type epsilon = int + +type continuation = + [`In of time * line * epsilon * continuation] option * + [`Out of (time -> line -> time * continuation)] + +let rec debug_continuation = + (Some (`In (1, (`SerialBuff (`Eight (vect_of_int 5 `Eight))), 0, debug_continuation))), `Out ( + fun time line -> + (* let _ = prerr_endline <*> string_of_line $ line in *) + (time + 1),debug_continuation) + +(* no differentiation between internal and external code memory *) +type status = +{ + (* Memory *) + code_memory: Physical.WordMap.map; (* can be reduced *) + low_internal_ram: Byte7Map.map; + high_internal_ram: Byte7Map.map; + external_ram: Physical.WordMap.map; + + (* Program counter *) + pc: word; + + (* SFRs *) + sp: byte; + dpl: byte; + dph: byte; + pcon: byte; + tcon: byte; + tmod: byte; + tl0: byte; + tl1: byte; + th0: byte; + th1: byte; + p1: byte; + scon: byte; + sbuf: byte; + ie: byte; + p3: byte; + ip: byte; + psw: byte; + acc: byte; + b: byte; + t2con: byte; (* 8052 only *) + rcap2l: byte; (* 8052 only *) + rcap2h: byte; (* 8052 only *) + tl2: byte; (* 8052 only *) + th2: byte; (* 8052 only *) + + (* Latches for the output lines *) + p1_latch: byte; + p3_latch: byte; + + (* Fields for tracking the state of the processor. *) + + (* IO specific *) + previous_p1_val: bool; + previous_p3_val: bool; + + serial_epsilon_out: epsilon option; + serial_epsilon_in: epsilon option; + + io_epsilon: epsilon; + + serial_v_in: [`Eight of byte | `Nine of (BitVectors.bit * byte) ] option; + serial_v_out: [`Eight of byte | `Nine of (BitVectors.bit * byte) ] option; + + serial_k_out: continuation option; + + io: continuation; + expected_out_time: [ `None | `Now | `At of time ]; + + (* Timer and clock specific *) + clock: time; + timer0: word; + timer1: word; + timer2: word; (* can be missing *) + + esi_running: bool; + t0i_running: bool; + t1i_running: bool; + e0i_running: bool; + e1i_running: bool; + es_running: bool; + + exit_addr : BitVectors.word; + cost_labels : string BitVectors.WordMap.t +} + +(* Try to understand what DEC really does!!! *) +(* Try to understand I/O *) +let get_sfr status addr from_latch = + match int_of_vect addr with + (* I/O and timer ports *) + 0x80 -> assert false (* P0 not modeled *) + | 0x90 -> + if from_latch then + status.p1_latch + else status.p1 + | 0xA0 -> assert false (* P2 not modeled *) + | 0xB0 -> + if from_latch then + status.p3_latch + else status.p3 + | 0x99 -> status.sbuf + | 0x8A -> status.tl0 + | 0x8B -> status.tl1 + | 0x8C -> status.th0 + | 0x8D -> status.th1 + | 0xC8 -> status.t2con + | 0xCA -> status.rcap2l + | 0xCB -> status.rcap2h + | 0xCC -> status.tl2 + | 0xCD -> status.th2 + + (* control ports *) + | 0x87 -> status.pcon + | 0x88 -> status.tcon + | 0x89 -> status.tmod + | 0x98 -> status.scon + | 0xA8 -> status.ie + | 0xB8 -> status.ip + + (* registers *) + | 0x81 -> status.sp + | 0x82 -> status.dpl + | 0x83 -> status.dph + | 0xD0 -> status.psw + | 0xE0 -> status.acc + | 0xF0 -> status.b + | _ -> assert false +;; + +(* Try to understand I/O *) +let set_sfr status addr v = + match int_of_vect addr with + (* I/O and timer ports *) + 0x80 -> assert false (* P0 not modeled *) + | 0x90 -> { status with p1 = v; p1_latch = v } + | 0xA0 -> assert false (* P2 not modeled *) + | 0xB0 -> { status with p3 = v; p3_latch = v } + | 0x99 -> + if status.expected_out_time = `None then + { status with sbuf = v; expected_out_time = `Now } + else + (* a real assert false: trying to initiate a transmission whilst one is still active *) + assert false + | 0x8A -> { status with tl0 = v } + | 0x8B -> { status with tl1 = v } + | 0x8C -> { status with th0 = v } + | 0x8D -> { status with th1 = v } + | 0xC8 -> { status with t2con = v } + | 0xCA -> { status with rcap2l = v } + | 0xCB -> { status with rcap2h = v } + | 0xCD -> { status with tl2 = v } + | 0xCE -> { status with th2 = v } + + (* control ports *) + | 0x87 -> { status with pcon = v } + | 0x88 -> { status with tcon = v } + | 0x89 -> { status with tmod = v } + | 0x98 -> { status with scon = v } + | 0xA8 -> { status with ie = v } + | 0xB8 -> { status with ip = v } + + (* registers *) + | 0x81 -> { status with sp = v } + | 0x82 -> { status with dpl = v } + | 0x83 -> { status with dph = v } + | 0xD0 -> { status with psw = v } + | 0xE0 -> { status with acc = v } + | 0xF0 -> { status with b = v } + | _ -> assert false +;; + +let initialize = { + code_memory = Physical.WordMap.empty; + low_internal_ram = Byte7Map.empty; + high_internal_ram = Byte7Map.empty; + external_ram = Physical.WordMap.empty; + + pc = zero `Sixteen; + + sp = vect_of_int 7 `Eight; + dpl = zero `Eight; + dph = zero `Eight; + pcon = zero `Eight; + tcon = zero `Eight; + tmod = zero `Eight; + tl0 = zero `Eight; + tl1 = zero `Eight; + th0 = zero `Eight; + th1 = zero `Eight; + p1 = zero `Eight; + p1_latch = zero `Eight; + scon = zero `Eight; + sbuf = zero `Eight; + ie = zero `Eight; + p3 = zero `Eight; + p3_latch = zero `Eight; + ip = zero `Eight; + psw = zero `Eight; + acc = zero `Eight; + b = zero `Eight; + t2con = zero `Eight; + rcap2l = zero `Eight; + rcap2h = zero `Eight; + tl2 = zero `Eight; + th2 = zero `Eight; + + previous_p1_val = false; + previous_p3_val = false; + + serial_v_in = None; + serial_v_out = None; + serial_epsilon_in = None; + serial_epsilon_out = None; + serial_k_out = None; + + io_epsilon = 5; + + clock = 0; + timer0 = zero `Sixteen; + timer1 = zero `Sixteen; + timer2 = zero `Sixteen; + + expected_out_time = `None; + + io = debug_continuation; (* a real assert false: unprepared for i/o *) + + (* Initially no interrupts are executing *) + esi_running = false; + t0i_running = false; + t1i_running = false; + e0i_running = false; + e1i_running = false; + es_running = false; + + exit_addr = BitVectors.zero `Sixteen; + cost_labels = BitVectors.WordMap.empty +} + +let get_cy_flag status = + let (cy,_,_,_),(_,_,_,_) = bits_of_byte status.psw in cy +let get_ac_flag status = + let (_,ac,_,_),(_,_,_,_) = bits_of_byte status.psw in ac +let get_fo_flag status = + let (_,_,fo,_),(_,_,_,_) = bits_of_byte status.psw in fo +let get_rs1_flag status = + let (_,_,_,rs1),(_,_,_,_) = bits_of_byte status.psw in rs1 +let get_rs0_flag status = + let (_,_,_,_),(rs0,_,_,_) = bits_of_byte status.psw in rs0 +let get_ov_flag status = + let (_,_,_,_),(_,ov,_,_) = bits_of_byte status.psw in ov +let get_ud_flag status = + let (_,_,_,_),(_,_,ud,_) = bits_of_byte status.psw in ud +let get_p_flag status = + let (_,_,_,_),(_,_,_,p) = bits_of_byte status.psw in p + +let get_address_of_register status (b1,b2,b3) = + let bu,_bl = from_byte status.psw in + let (_,_,rs1,rs0) = from_nibble bu in + let base = + match rs1,rs0 with + false,false -> 0x00 + | false,true -> 0x08 + | true,false -> 0x10 + | true,true -> 0x18 + in + vect_of_int (base + int_of_vect (mk_nibble false b1 b2 b3)) `Seven +;; + +let get_register status reg = + let addr = get_address_of_register status reg in + Byte7Map.find addr status.low_internal_ram +;; + +let string_of_status status = + let acc_str = (string_of_int <*> int_of_vect $ status.acc) ^ " (" ^ string_of_vect status.acc ^ ")" in + let b_str = (string_of_int <*> int_of_vect $ status.b) ^ " (" ^ string_of_vect status.b ^ ")" in + let psw_str = (string_of_int <*> int_of_vect $ status.psw) ^ " (" ^ string_of_vect status.psw ^ ")" in + let sp_str = (string_of_int <*> int_of_vect $ status.sp) ^ " (" ^ string_of_vect status.sp ^ ")" in + let ip_str = (string_of_int <*> int_of_vect $ status.ip) ^ " (" ^ string_of_vect status.ip ^ ")" in + let pc_str = (string_of_int <*> int_of_vect $ status.pc) ^ " (" ^ string_of_vect status.pc ^ ")" in + let dpl_str = (string_of_int <*> int_of_vect $ status.dpl) ^ " (" ^ string_of_vect status.dpl ^ ")" in + let dph_str = (string_of_int <*> int_of_vect $ status.dph) ^ " (" ^ string_of_vect status.dph ^ ")" in + let scn_str = (string_of_int <*> int_of_vect $ status.scon) ^ " (" ^ string_of_vect status.scon ^ ")" in + let sbf_str = (string_of_int <*> int_of_vect $ status.sbuf) ^ " (" ^ string_of_vect status.sbuf ^ ")" in + let tcn_str = (string_of_int <*> int_of_vect $ status.tcon) ^ " (" ^ string_of_vect status.tcon ^ ")" in + let tmd_str = (string_of_int <*> int_of_vect $ status.tmod) ^ " (" ^ string_of_vect status.tmod ^ ")" in + let r0_str = (string_of_int <*> int_of_vect $ get_register status (false, false, false)) ^ " (" ^ (string_of_vect $ get_register status (false, false, false)) ^ ")" in + let r1_str = (string_of_int <*> int_of_vect $ get_register status (false, false, true)) ^ " (" ^ (string_of_vect $ get_register status (false, false, true)) ^ ")" in + let r2_str = (string_of_int <*> int_of_vect $ get_register status (false, true, false)) ^ " (" ^ (string_of_vect $ get_register status (false, true, false)) ^ ")" in + let r3_str = (string_of_int <*> int_of_vect $ get_register status (false, true, true)) ^ " (" ^ (string_of_vect $ get_register status (false, true, true)) ^ ")" in + let r4_str = (string_of_int <*> int_of_vect $ get_register status (true, false, false)) ^ " (" ^ (string_of_vect $ get_register status (true, false, false)) ^ ")" in + let r5_str = (string_of_int <*> int_of_vect $ get_register status (true, false, true)) ^ " (" ^ (string_of_vect $ get_register status (true, false, true)) ^ ")" in + let r6_str = (string_of_int <*> int_of_vect $ get_register status (true, true, false)) ^ " (" ^ (string_of_vect $ get_register status (true, true, false)) ^ ")" in + let r7_str = (string_of_int <*> int_of_vect $ get_register status (true, true, true)) ^ " (" ^ (string_of_vect $ get_register status (true, true, true)) ^ ")" in + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" ^ + " Processor status: \n" ^ + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" ^ + " ACC : " ^ acc_str ^ "\n" ^ + " B : " ^ b_str ^ "\n" ^ + " PSW : " ^ psw_str ^ "\n" ^ + " with flags set as \n" ^ + " CY : " ^ (string_of_bool <*> get_cy_flag $ status) ^ "\n" ^ + " AC : " ^ (string_of_bool <*> get_ac_flag $ status) ^ "\n" ^ + " FO : " ^ (string_of_bool <*> get_fo_flag $ status) ^ "\n" ^ + " RS1 : " ^ (string_of_bool <*> get_rs1_flag $ status) ^ "\n" ^ + " RS0 : " ^ (string_of_bool <*> get_rs0_flag $ status) ^ "\n" ^ + " OV : " ^ (string_of_bool <*> get_ov_flag $ status) ^ "\n" ^ + " UD : " ^ (string_of_bool <*> get_ud_flag $ status) ^ "\n" ^ + " P : " ^ (string_of_bool <*> get_p_flag $ status) ^ "\n" ^ + " SP : " ^ sp_str ^ "\n" ^ + " IP : " ^ ip_str ^ "\n" ^ + " PC : " ^ pc_str ^ "\n" ^ + " DPL : " ^ dpl_str ^ "\n" ^ + " DPH : " ^ dph_str ^ "\n" ^ + " SCON: " ^ scn_str ^ "\n" ^ + " SBUF: " ^ sbf_str ^ "\n" ^ + " TMOD: " ^ tmd_str ^ "\n" ^ + " TCON: " ^ tcn_str ^ "\n" ^ + " Registers: \n" ^ + " R0 : " ^ r0_str ^ "\n" ^ + " R1 : " ^ r1_str ^ "\n" ^ + " R2 : " ^ r2_str ^ "\n" ^ + " R3 : " ^ r3_str ^ "\n" ^ + " R4 : " ^ r4_str ^ "\n" ^ + " R5 : " ^ r5_str ^ "\n" ^ + " R6 : " ^ r6_str ^ "\n" ^ + " R7 : " ^ r7_str ^ "\n" ^ + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" + +(* timings taken from SIEMENS *) + +let fetch pmem pc = + let next pc = + let _carry, res = half_add pc (vect_of_int 1 `Sixteen) in + res, Physical.WordMap.find pc pmem + in + let pc,instr = next pc in + let un, ln = from_byte instr in + let bits = (from_nibble un, from_nibble ln) in + match bits with + (a10,a9,a8,true),(false,false,false,true) -> + let pc,b1 = next pc in + `ACALL (`ADDR11 (mk_word11 a10 a9 a8 b1)), pc, 2 + | (false,false,true,false),(true,r1,r2,r3) -> + `ADD (`A,`REG (r1,r2,r3)), pc, 1 + | (false,false,true,false),(false,true,false,true) -> + let pc,b1 = next pc in + `ADD (`A,`DIRECT b1), pc, 1 + | (false,false,true,false),(false,true,true,i1) -> + `ADD (`A,`INDIRECT i1), pc, 1 + | (false,false,true,false),(false,true,false,false) -> + let pc,b1 = next pc in + `ADD (`A,`DATA b1), pc, 1 + | (false,false,true,true),(true,r1,r2,r3) -> + `ADDC (`A,`REG (r1,r2,r3)), pc, 1 + | (false,false,true,true),(false,true,false,true) -> + let pc,b1 = next pc in + `ADDC (`A,`DIRECT b1), pc, 1 + | (false,false,true,true),(false,true,true,i1) -> + `ADDC (`A,`INDIRECT i1), pc, 1 + | (false,false,true,true),(false,true,false,false) -> + let pc,b1 = next pc in + `ADDC (`A,`DATA b1), pc, 1 + | (a10,a9,a8,false),(false,false,false,true) -> + let pc,b1 = next pc in + `AJMP (`ADDR11 (mk_word11 a10 a9 a8 b1)), pc, 2 + | (false,true,false,true),(true,r1,r2,r3) -> + `ANL (`U1 (`A, `REG (r1,r2,r3))), pc, 1 + | (false,true,false,true),(false,true,false,true) -> + let pc,b1 = next pc in + `ANL (`U1 (`A, `DIRECT b1)), pc, 1 + | (false,true,false,true),(false,true,true,i1) -> + `ANL (`U1 (`A, `INDIRECT i1)), pc, 1 + | (false,true,false,true),(false,true,false,false) -> + let pc,b1 = next pc in + `ANL (`U1 (`A, `DATA b1)), pc, 1 + | (false,true,false,true),(false,false,true,false) -> + let pc,b1 = next pc in + `ANL (`U2 (`DIRECT b1,`A)), pc, 1 + | (false,true,false,true),(false,false,true,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `ANL (`U2 (`DIRECT b1,`DATA b2)), pc, 2 + | (true,false,false,false),(false,false,true,false) -> + let pc,b1 = next pc in + `ANL (`U3 (`C,`BIT b1)), pc, 2 + | (true,false,true,true),(false,false,false,false) -> + let pc,b1 = next pc in + `ANL (`U3 (`C,`NBIT b1)), pc, 2 + | (true,false,true,true),(false,true,false,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `CJNE (`U1 (`A, `DIRECT b1), `REL b2), pc, 2 + | (true,false,true,true),(false,true,false,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `CJNE (`U1 (`A, `DATA b1), `REL b2), pc, 2 + | (true,false,true,true),(true,r1,r2,r3) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `CJNE (`U2 (`REG(r1,r2,r3), `DATA b1), `REL b2), pc, 2 + | (true,false,true,true),(false,true,true,i1) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `CJNE (`U2 (`INDIRECT i1, `DATA b1), `REL b2), pc, 2 + | (true,true,true,false),(false,true,false,false) -> + `CLR `A, pc, 1 + | (true,true,false,false),(false,false,true,true) -> + `CLR `C, pc, 1 + | (true,true,false,false),(false,false,true,false) -> + let pc,b1 = next pc in + `CLR (`BIT b1), pc, 1 + | (true,true,true,true),(false,true,false,false) -> + `CPL `A, pc, 1 + | (true,false,true,true),(false,false,true,true) -> + `CPL `C, pc, 1 + | (true,false,true,true),(false,false,true,false) -> + let pc,b1 = next pc in + `CPL (`BIT b1), pc, 1 + | (true,true,false,true),(false,true,false,false) -> + `DA `A, pc, 1 + | (false,false,false,true),(false,true,false,false) -> + `DEC `A, pc, 1 + | (false,false,false,true),(true,r1,r2,r3) -> + `DEC (`REG(r1,r2,r3)), pc, 1 + | (false,false,false,true),(false,true,false,true) -> + let pc,b1 = next pc in + `DEC (`DIRECT b1), pc, 1 + | (false,false,false,true),(false,true,true,i1) -> + `DEC (`INDIRECT i1), pc, 1 + | (true,false,false,false),(false,true,false,false) -> + `DIV (`A, `B), pc, 4 + | (true,true,false,true),(true,r1,r2,r3) -> + let pc,b1 = next pc in + `DJNZ (`REG(r1,r2,r3), `REL b1), pc, 2 + | (true,true,false,true),(false,true,false,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `DJNZ (`DIRECT b1, `REL b2), pc, 2 + | (false,false,false,false),(false,true,false,false) -> + `INC `A, pc, 1 + | (false,false,false,false),(true,r1,r2,r3) -> + `INC (`REG(r1,r2,r3)), pc, 1 + | (false,false,false,false),(false,true,false,true) -> + let pc,b1 = next pc in + `INC (`DIRECT b1), pc, 1 + | (false,false,false,false),(false,true,true,i1) -> + `INC (`INDIRECT i1), pc, 1 + | (true,false,true,false),(false,false,true,true) -> + `INC `DPTR, pc, 2 + | (false,false,true,false),(false,false,false,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `JB (`BIT b1, `REL b2), pc, 2 + | (false,false,false,true),(false,false,false,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `JBC (`BIT b1, `REL b2), pc, 2 + | (false,true,false,false),(false,false,false,false) -> + let pc,b1 = next pc in + `JC (`REL b1), pc, 2 + | (false,true,true,true),(false,false,true,true) -> + `JMP `IND_DPTR, pc, 2 + | (false,false,true,true),(false,false,false,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `JNB (`BIT b1, `REL b2), pc, 2 + | (false,true,false,true),(false,false,false,false) -> + let pc,b1 = next pc in + `JNC (`REL b1), pc, 2 + | (false,true,true,true),(false,false,false,false) -> + let pc,b1 = next pc in + `JNZ (`REL b1), pc, 2 + | (false,true,true,false),(false,false,false,false) -> + let pc,b1 = next pc in + `JZ (`REL b1), pc, 2 + | (false,false,false,true),(false,false,true,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `LCALL (`ADDR16 (mk_word b1 b2)), pc, 2 + | (false,false,false,false),(false,false,true,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `LJMP (`ADDR16 (mk_word b1 b2)), pc, 2 + | (true,true,true,false),(true,r1,r2,r3) -> + `MOV (`U1 (`A, `REG(r1,r2,r3))), pc, 1 + | (true,true,true,false),(false,true,false,true) -> + let pc,b1 = next pc in + `MOV (`U1 (`A, `DIRECT b1)), pc, 1 + | (true,true,true,false),(false,true,true,i1) -> + `MOV (`U1 (`A, `INDIRECT i1)), pc, 1 + | (false,true,true,true),(false,true,false,false) -> + let pc,b1 = next pc in + `MOV (`U1 (`A, `DATA b1)), pc, 1 + | (true,true,true,true),(true,r1,r2,r3) -> + `MOV (`U2 (`REG(r1,r2,r3), `A)), pc, 1 + | (true,false,true,false),(true,r1,r2,r3) -> + let pc,b1 = next pc in + `MOV (`U2 (`REG(r1,r2,r3), (`DIRECT b1))), pc, 2 + | (false,true,true,true),(true,r1,r2,r3) -> + let pc,b1 = next pc in + `MOV (`U2 (`REG(r1,r2,r3), (`DATA b1))), pc, 1 + | (true,true,true,true),(false,true,false,true) -> + let pc,b1 = next pc in + `MOV (`U3 (`DIRECT b1, `A)), pc, 1 + | (true,false,false,false),(true,r1,r2,r3) -> + let pc,b1 = next pc in + `MOV (`U3 (`DIRECT b1, `REG(r1,r2,r3))), pc, 2 + | (true,false,false,false),(false,true,false,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `MOV (`U3 (`DIRECT b1, `DIRECT b2)), pc, 2 + | (true,false,false,false),(false,true,true,i1) -> + let pc,b1 = next pc in + `MOV (`U3 (`DIRECT b1, `INDIRECT i1)), pc, 2 + | (false,true,true,true),(false,true,false,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `MOV (`U3 (`DIRECT b1, `DATA b2)), pc, 3 + | (true,true,true,true),(false,true,true,i1) -> + `MOV (`U2 (`INDIRECT i1, `A)), pc, 1 + | (true,false,true,false),(false,true,true,i1) -> + let pc,b1 = next pc in + `MOV (`U2 (`INDIRECT i1, `DIRECT b1)), pc, 2 + | (false,true,true,true),(false,true,true,i1) -> + let pc,b1 = next pc in + `MOV (`U2 (`INDIRECT i1, `DATA b1)), pc, 1 + | (true,false,true,false),(false,false,true,false) -> + let pc,b1 = next pc in + `MOV (`U5 (`C, `BIT b1)), pc, 1 + | (true,false,false,true),(false,false,true,false) -> + let pc,b1 = next pc in + `MOV (`U6 (`BIT b1, `C)), pc, 2 + | (true,false,false,true),(false,false,false,false) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `MOV (`U4 (`DPTR, `DATA16(mk_word b1 b2))), pc, 2 + | (true,false,false,true),(false,false,true,true) -> + `MOVC (`A, `A_DPTR), pc, 2 + | (true,false,false,false),(false,false,true,true) -> + `MOVC (`A, `A_PC), pc, 2 + | (true,true,true,false),(false,false,true,i1) -> + `MOVX (`U1 (`A, `EXT_INDIRECT i1)), pc, 2 + | (true,true,true,false),(false,false,false,false) -> + `MOVX (`U1 (`A, `EXT_IND_DPTR)), pc, 2 + | (true,true,true,true),(false,false,true,i1) -> + `MOVX (`U2 (`EXT_INDIRECT i1, `A)), pc, 2 + | (true,true,true,true),(false,false,false,false) -> + `MOVX (`U2 (`EXT_IND_DPTR, `A)), pc, 2 + | (true,false,true,false),(false,true,false,false) -> + `MUL(`A, `B), pc, 4 + | (false,false,false,false),(false,false,false,false) -> + `NOP, pc, 1 + | (false,true,false,false),(true,r1,r2,r3) -> + `ORL (`U1(`A, `REG(r1,r2,r3))), pc, 1 + | (false,true,false,false),(false,true,false,true) -> + let pc,b1 = next pc in + `ORL (`U1(`A, `DIRECT b1)), pc, 1 + | (false,true,false,false),(false,true,true,i1) -> + `ORL (`U1(`A, `INDIRECT i1)), pc, 1 + | (false,true,false,false),(false,true,false,false) -> + let pc,b1 = next pc in + `ORL (`U1(`A, `DATA b1)), pc, 1 + | (false,true,false,false),(false,false,true,false) -> + let pc,b1 = next pc in + `ORL (`U2(`DIRECT b1, `A)), pc, 1 + | (false,true,false,false),(false,false,true,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `ORL (`U2 (`DIRECT b1, `DATA b2)), pc, 2 + | (false,true,true,true),(false,false,true,false) -> + let pc,b1 = next pc in + `ORL (`U3 (`C, `BIT b1)), pc, 2 + | (true,false,true,false),(false,false,false,false) -> + let pc,b1 = next pc in + `ORL (`U3 (`C, `NBIT b1)), pc, 2 + | (true,true,false,true),(false,false,false,false) -> + let pc,b1 = next pc in + `POP (`DIRECT b1), pc, 2 + | (true,true,false,false),(false,false,false,false) -> + let pc,b1 = next pc in + `PUSH (`DIRECT b1), pc, 2 + | (false,false,true,false),(false,false,true,false) -> + `RET, pc, 2 + | (false,false,true,true),(false,false,true,false) -> + `RETI, pc, 2 + | (false,false,true,false),(false,false,true,true) -> + `RL `A, pc, 1 + | (false,false,true,true),(false,false,true,true) -> + `RLC `A, pc, 1 + | (false,false,false,false),(false,false,true,true) -> + `RR `A, pc, 1 + | (false,false,false,true),(false,false,true,true) -> + `RRC `A, pc, 1 + | (true,true,false,true),(false,false,true,true) -> + `SETB `C, pc, 1 + | (true,true,false,true),(false,false,true,false) -> + let pc,b1 = next pc in + `SETB (`BIT b1), pc, 1 + | (true,false,false,false),(false,false,false,false) -> + let pc,b1 = next pc in + `SJMP (`REL b1), pc, 2 + | (true,false,false,true),(true,r1,r2,r3) -> + `SUBB (`A, `REG(r1,r2,r3)), pc, 1 + | (true,false,false,true),(false,true,false,true) -> + let pc,b1 = next pc in + `SUBB (`A, `DIRECT b1), pc, 1 + | (true,false,false,true),(false,true,true,i1) -> + `SUBB (`A, `INDIRECT i1), pc, 1 + | (true,false,false,true),(false,true,false,false) -> + let pc,b1 = next pc in + `SUBB (`A, `DATA b1), pc, 1 + | (true,true,false,false),(false,true,false,false) -> + `SWAP `A, pc, 1 + | (true,true,false,false),(true,r1,r2,r3) -> + `XCH (`A, `REG(r1,r2,r3)), pc, 1 + | (true,true,false,false),(false,true,false,true) -> + let pc,b1 = next pc in + `XCH (`A, `DIRECT b1), pc, 1 + | (true,true,false,false),(false,true,true,i1) -> + `XCH (`A, `INDIRECT i1), pc, 1 + | (true,true,false,true),(false,true,true,i1) -> + `XCHD(`A, `INDIRECT i1), pc, 1 + | (false,true,true,false),(true,r1,r2,r3) -> + `XRL(`U1(`A, `REG(r1,r2,r3))), pc, 1 + | (false,true,true,false),(false,true,false,true) -> + let pc,b1 = next pc in + `XRL(`U1(`A, `DIRECT b1)), pc, 1 + | (false,true,true,false),(false,true,true,i1) -> + `XRL(`U1(`A, `INDIRECT i1)), pc, 1 + | (false,true,true,false),(false,true,false,false) -> + let pc,b1 = next pc in + `XRL(`U1(`A, `DATA b1)), pc, 1 + | (false,true,true,false),(false,false,true,false) -> + let pc,b1 = next pc in + `XRL(`U2(`DIRECT b1, `A)), pc, 1 + | (false,true,true,false),(false,false,true,true) -> + let pc,b1 = next pc in + let pc,b2 = next pc in + `XRL(`U2(`DIRECT b1, `DATA b2)), pc, 2 + | (true,false,true,false),(false,true,false,true) -> + (* undefined opcode *) assert false +;; + +let assembly1 = + function + `ACALL (`ADDR11 w) -> + let (a10,a9,a8,b1) = from_word11 w in + [mk_byte_from_bits ((a10,a9,a8,true),(false,false,false,true)); b1] + | `ADD (`A,`REG (r1,r2,r3)) -> + [mk_byte_from_bits ((false,false,true,false),(true,r1,r2,r3))] + | `ADD (`A, `DIRECT b1) -> + [mk_byte_from_bits ((false,false,true,false),(false,true,false,true)); b1] + | `ADD (`A, `INDIRECT i1) -> + [mk_byte_from_bits ((false,false,true,false),(false,true,true,i1))] + | `ADD (`A, `DATA b1) -> + [mk_byte_from_bits ((false,false,true,false),(false,true,false,false)); b1] + | `ADDC (`A, `REG(r1,r2,r3)) -> + [mk_byte_from_bits ((false,false,true,true),(true,r1,r2,r3))] + | `ADDC (`A, `DIRECT b1) -> + [mk_byte_from_bits ((false,false,true,true),(false,true,false,true)); b1] + | `ADDC (`A,`INDIRECT i1) -> + [mk_byte_from_bits ((false,false,true,true),(false,true,true,i1))] + | `ADDC (`A,`DATA b1) -> + [mk_byte_from_bits ((false,false,true,true),(false,true,false,false)); b1] + | `AJMP (`ADDR11 w) -> + let (a10,a9,a8,b1) = from_word11 w in + [mk_byte_from_bits ((a10,a9,a8,false),(false,false,false,true)); b1] + | `ANL (`U1 (`A, `REG (r1,r2,r3))) -> + [mk_byte_from_bits ((false,true,false,true),(true,r1,r2,r3))] + | `ANL (`U1 (`A, `DIRECT b1)) -> + [mk_byte_from_bits ((false,true,false,true),(false,true,false,true)); b1] + | `ANL (`U1 (`A, `INDIRECT i1)) -> + [mk_byte_from_bits ((false,true,false,true),(false,true,true,i1))] + | `ANL (`U1 (`A, `DATA b1)) -> + [mk_byte_from_bits ((false,true,false,true),(false,true,false,false)); b1] + | `ANL (`U2 (`DIRECT b1,`A)) -> + [mk_byte_from_bits ((false,true,false,true),(false,false,true,false)); b1] + | `ANL (`U2 (`DIRECT b1,`DATA b2)) -> + [mk_byte_from_bits ((false,true,false,true),(false,false,true,true)); b1; b2] + | `ANL (`U3 (`C,`BIT b1)) -> + [mk_byte_from_bits ((true,false,false,false),(false,false,true,false)); b1] + | `ANL (`U3 (`C,`NBIT b1)) -> + [mk_byte_from_bits ((true,false,true,true),(false,false,false,false)); b1] + | `CJNE (`U1 (`A, `DIRECT b1), `REL b2) -> + [mk_byte_from_bits ((true,false,true,true),(false,true,false,true)); b1; b2] + | `CJNE (`U1 (`A, `DATA b1), `REL b2) -> + [mk_byte_from_bits ((true,false,true,true),(false,true,false,false)); b1; b2] + | `CJNE (`U2 (`REG(r1,r2,r3), `DATA b1), `REL b2) -> + [mk_byte_from_bits ((true,false,true,true),(true,r1,r2,r3)); b1; b2] + | `CJNE (`U2 (`INDIRECT i1, `DATA b1), `REL b2) -> + [mk_byte_from_bits ((true,false,true,true),(false,true,true,i1)); b1; b2] + | `CLR `A -> + [mk_byte_from_bits ((true,true,true,false),(false,true,false,false))] + | `CLR `C -> + [mk_byte_from_bits ((true,true,false,false),(false,false,true,true))] + | `CLR (`BIT b1) -> + [mk_byte_from_bits ((true,true,false,false),(false,false,true,false)); b1] + | `CPL `A -> + [mk_byte_from_bits ((true,true,true,true),(false,true,false,false))] + | `CPL `C -> + [mk_byte_from_bits ((true,false,true,true),(false,false,true,true))] + | `CPL (`BIT b1) -> + [mk_byte_from_bits ((true,false,true,true),(false,false,true,false)); b1] + | `DA `A -> + [mk_byte_from_bits ((true,true,false,true),(false,true,false,false))] + | `DEC `A -> + [mk_byte_from_bits ((false,false,false,true),(false,true,false,false))] + | `DEC (`REG(r1,r2,r3)) -> + [mk_byte_from_bits ((false,false,false,true),(true,r1,r2,r3))] + | `DEC (`DIRECT b1) -> + [mk_byte_from_bits ((false,false,false,true),(false,true,false,true)); b1] + | `DEC (`INDIRECT i1) -> + [mk_byte_from_bits ((false,false,false,true),(false,true,true,i1))] + | `DIV (`A, `B) -> + [mk_byte_from_bits ((true,false,false,false),(false,true,false,false))] + | `DJNZ (`REG(r1,r2,r3), `REL b1) -> + [mk_byte_from_bits ((true,true,false,true),(true,r1,r2,r3)); b1] + | `DJNZ (`DIRECT b1, `REL b2) -> + [mk_byte_from_bits ((true,true,false,true),(false,true,false,true)); b1; b2] + | `INC `A -> + [mk_byte_from_bits ((false,false,false,false),(false,true,false,false))] + | `INC (`REG(r1,r2,r3)) -> + [mk_byte_from_bits ((false,false,false,false),(true,r1,r2,r3))] + | `INC (`DIRECT b1) -> + [mk_byte_from_bits ((false,false,false,false),(false,true,false,true)); b1] + | `INC (`INDIRECT i1) -> + [mk_byte_from_bits ((false,false,false,false),(false,true,true,i1))] + | `INC `DPTR -> + [mk_byte_from_bits ((true,false,true,false),(false,false,true,true))] + | `JB (`BIT b1, `REL b2) -> + [mk_byte_from_bits ((false,false,true,false),(false,false,false,false)); b1; b2] + | `JBC (`BIT b1, `REL b2) -> + [mk_byte_from_bits ((false,false,false,true),(false,false,false,false)); b1; b2] + | `JC (`REL b1) -> + [mk_byte_from_bits ((false,true,false,false),(false,false,false,false)); b1] + | `JMP `IND_DPTR -> + [mk_byte_from_bits ((false,true,true,true),(false,false,true,true))] + | `JNB (`BIT b1, `REL b2) -> + [mk_byte_from_bits ((false,false,true,true),(false,false,false,false)); b1; b2] + | `JNC (`REL b1) -> + [mk_byte_from_bits ((false,true,false,true),(false,false,false,false)); b1] + | `JNZ (`REL b1) -> + [mk_byte_from_bits ((false,true,true,true),(false,false,false,false)); b1] + | `JZ (`REL b1) -> + [mk_byte_from_bits ((false,true,true,false),(false,false,false,false)); b1] + | `LCALL (`ADDR16 w) -> + let (b1,b2) = from_word w in + [mk_byte_from_bits ((false,false,false,true),(false,false,true,false)); b1; b2] + | `LJMP (`ADDR16 w) -> + let (b1,b2) = from_word w in + [mk_byte_from_bits ((false,false,false,false),(false,false,true,false)); b1; b2] + | `MOV (`U1 (`A, `REG(r1,r2,r3))) -> + [mk_byte_from_bits ((true,true,true,false),(true,r1,r2,r3))] + | `MOV (`U1 (`A, `DIRECT b1)) -> + [mk_byte_from_bits ((true,true,true,false),(false,true,false,true)); b1] + | `MOV (`U1 (`A, `INDIRECT i1)) -> + [mk_byte_from_bits ((true,true,true,false),(false,true,true,i1))] + | `MOV (`U1 (`A, `DATA b1)) -> + [mk_byte_from_bits ((false,true,true,true),(false,true,false,false)); b1] + | `MOV (`U2 (`REG(r1,r2,r3), `A)) -> + [mk_byte_from_bits ((true,true,true,true),(true,r1,r2,r3))] + | `MOV (`U2 (`REG(r1,r2,r3), (`DIRECT b1))) -> + [mk_byte_from_bits ((true,false,true,false),(true,r1,r2,r3)); b1] + | `MOV (`U2 (`REG(r1,r2,r3), (`DATA b1))) -> + [mk_byte_from_bits ((false,true,true,true),(true,r1,r2,r3)); b1] + | `MOV (`U3 (`DIRECT b1, `A)) -> + [mk_byte_from_bits ((true,true,true,true),(false,true,false,true)); b1] + | `MOV (`U3 (`DIRECT b1, `REG(r1,r2,r3))) -> + [mk_byte_from_bits ((true,false,false,false),(true,r1,r2,r3)); b1] + | `MOV (`U3 (`DIRECT b1, `DIRECT b2)) -> + [mk_byte_from_bits ((true,false,false,false),(false,true,false,true)); b1; b2] + | `MOV (`U3 (`DIRECT b1, `INDIRECT i1)) -> + [mk_byte_from_bits ((true,false,false,false),(false,true,true,i1)); b1] + | `MOV (`U3 (`DIRECT b1, `DATA b2)) -> + [mk_byte_from_bits ((false,true,true,true),(false,true,false,true)); b1; b2] + | `MOV (`U2 (`INDIRECT i1, `A)) -> + [mk_byte_from_bits ((true,true,true,true),(false,true,true,i1))] + | `MOV (`U2 (`INDIRECT i1, `DIRECT b1)) -> + [mk_byte_from_bits ((true,false,true,false),(false,true,true,i1)); b1] + | `MOV (`U2 (`INDIRECT i1, `DATA b1)) -> + [mk_byte_from_bits ((false,true,true,true),(false,true,true,i1)); b1] + | `MOV (`U5 (`C, `BIT b1)) -> + [mk_byte_from_bits ((true,false,true,false),(false,false,true,false)); b1] + | `MOV (`U6 (`BIT b1, `C)) -> + [mk_byte_from_bits ((true,false,false,true),(false,false,true,false)); b1] + | `MOV (`U4 (`DPTR, `DATA16 w)) -> + let (b1,b2) = from_word w in + [mk_byte_from_bits ((true,false,false,true),(false,false,false,false)); b1; b2] + | `MOVC (`A, `A_DPTR) -> + [mk_byte_from_bits ((true,false,false,true),(false,false,true,true))] + | `MOVC (`A, `A_PC) -> + [mk_byte_from_bits ((true,false,false,false),(false,false,true,true))] + | `MOVX (`U1 (`A, `EXT_INDIRECT i1)) -> + [mk_byte_from_bits ((true,true,true,false),(false,false,true,i1))] + | `MOVX (`U1 (`A, `EXT_IND_DPTR)) -> + [mk_byte_from_bits ((true,true,true,false),(false,false,false,false))] + | `MOVX (`U2 (`EXT_INDIRECT i1, `A)) -> + [mk_byte_from_bits ((true,true,true,true),(false,false,true,i1))] + | `MOVX (`U2 (`EXT_IND_DPTR, `A)) -> + [mk_byte_from_bits ((true,true,true,true),(false,false,false,false))] + | `MUL(`A, `B) -> + [mk_byte_from_bits ((true,false,true,false),(false,true,false,false))] + | `NOP -> + [mk_byte_from_bits ((false,false,false,false),(false,false,false,false))] + | `ORL (`U1(`A, `REG(r1,r2,r3))) -> + [mk_byte_from_bits ((false,true,false,false),(true,r1,r2,r3))] + | `ORL (`U1(`A, `DIRECT b1)) -> + [mk_byte_from_bits ((false,true,false,false),(false,true,false,true)); b1] + | `ORL (`U1(`A, `INDIRECT i1)) -> + [mk_byte_from_bits ((false,true,false,false),(false,true,true,i1))] + | `ORL (`U1(`A, `DATA b1)) -> + [mk_byte_from_bits ((false,true,false,false),(false,true,false,false)); b1] + | `ORL (`U2(`DIRECT b1, `A)) -> + [mk_byte_from_bits ((false,true,false,false),(false,false,true,false)); b1] + | `ORL (`U2 (`DIRECT b1, `DATA b2)) -> + [mk_byte_from_bits ((false,true,false,false),(false,false,true,true)); b1; b2] + | `ORL (`U3 (`C, `BIT b1)) -> + [mk_byte_from_bits ((false,true,true,true),(false,false,true,false)); b1] + | `ORL (`U3 (`C, `NBIT b1)) -> + [mk_byte_from_bits ((true,false,true,false),(false,false,false,false)); b1] + | `POP (`DIRECT b1) -> + [mk_byte_from_bits ((true,true,false,true),(false,false,false,false)); b1] + | `PUSH (`DIRECT b1) -> + [mk_byte_from_bits ((true,true,false,false),(false,false,false,false)); b1] + | `RET -> + [mk_byte_from_bits ((false,false,true,false),(false,false,true,false))] + | `RETI -> + [mk_byte_from_bits ((false,false,true,true),(false,false,true,false))] + | `RL `A -> + [mk_byte_from_bits ((false,false,true,false),(false,false,true,true))] + | `RLC `A -> + [mk_byte_from_bits ((false,false,true,true),(false,false,true,true))] + | `RR `A -> + [mk_byte_from_bits ((false,false,false,false),(false,false,true,true))] + | `RRC `A -> + [mk_byte_from_bits ((false,false,false,true),(false,false,true,true))] + | `SETB `C -> + [mk_byte_from_bits ((true,true,false,true),(false,false,true,true))] + | `SETB (`BIT b1) -> + [mk_byte_from_bits ((true,true,false,true),(false,false,true,false)); b1] + | `SJMP (`REL b1) -> + [mk_byte_from_bits ((true,false,false,false),(false,false,false,false)); b1] + | `SUBB (`A, `REG(r1,r2,r3)) -> + [mk_byte_from_bits ((true,false,false,true),(true,r1,r2,r3))] + | `SUBB (`A, `DIRECT b1) -> + [mk_byte_from_bits ((true,false,false,true),(false,true,false,true)); b1] + | `SUBB (`A, `INDIRECT i1) -> + [mk_byte_from_bits ((true,false,false,true),(false,true,true,i1))] + | `SUBB (`A, `DATA b1) -> + [mk_byte_from_bits ((true,false,false,true),(false,true,false,false)); b1] + | `SWAP `A -> + [mk_byte_from_bits ((true,true,false,false),(false,true,false,false))] + | `XCH (`A, `REG(r1,r2,r3)) -> + [mk_byte_from_bits ((true,true,false,false),(true,r1,r2,r3))] + | `XCH (`A, `DIRECT b1) -> + [mk_byte_from_bits ((true,true,false,false),(false,true,false,true)); b1] + | `XCH (`A, `INDIRECT i1) -> + [mk_byte_from_bits ((true,true,false,false),(false,true,true,i1))] + | `XCHD(`A, `INDIRECT i1) -> + [mk_byte_from_bits ((true,true,false,true),(false,true,true,i1))] + | `XRL(`U1(`A, `REG(r1,r2,r3))) -> + [mk_byte_from_bits ((false,true,true,false),(true,r1,r2,r3))] + | `XRL(`U1(`A, `DIRECT b1)) -> + [mk_byte_from_bits ((false,true,true,false),(false,true,false,true)); b1] + | `XRL(`U1(`A, `INDIRECT i1)) -> + [mk_byte_from_bits ((false,true,true,false),(false,true,true,i1))] + | `XRL(`U1(`A, `DATA b1)) -> + [mk_byte_from_bits ((false,true,true,false),(false,true,false,false)); b1] + | `XRL(`U2(`DIRECT b1, `A)) -> + [mk_byte_from_bits ((false,true,true,false),(false,false,true,false)); b1] + | `XRL(`U2(`DIRECT b1, `DATA b2)) -> + [mk_byte_from_bits ((false,true,true,false),(false,false,true,true)); b1; b2] +;; + +let load_code_memory = MiscPottier.foldi (fun i mem v -> Physical.WordMap.add (vect_of_int i `Sixteen) v mem) Physical.WordMap.empty + +let load_mem mem status = { status with code_memory = mem } +let load l = load_mem (load_code_memory l) + +let assembly_jump addr_of = + function + `JC a1 -> `JC (addr_of a1) + | `JNC a1 -> `JNC (addr_of a1) + | `JB (a1,a2) -> `JB (a1,addr_of a2) + | `JNB (a1,a2) -> `JNB (a1,addr_of a2) + | `JBC (a1,a2) -> `JBC (a1,addr_of a2) + | `JZ a1 -> `JZ (addr_of a1) + | `JNZ a1 -> `JNZ (addr_of a1) + | `CJNE (a1,a2) -> `CJNE (a1,addr_of a2) + | `DJNZ (a1,a2) -> `DJNZ (a1,addr_of a2) +;; + +let assembly p = + let datalabels,_ = + List.fold_left + (fun (datalabels,addr) (name,size) -> + let addr16 = vect_of_int addr `Sixteen in + StringTools.Map.add name addr16 datalabels, addr+size + ) (StringTools.Map.empty,0) p.ASM.ppreamble + in + let pc,exit_addr,labels,costs = + List.fold_left + (fun (pc,exit_addr,labels,costs) i -> + match i with + `Label s when s = p.ASM.pexit_label -> pc, pc, StringTools.Map.add s pc labels, costs + | `Label s -> pc, exit_addr, StringTools.Map.add s pc labels, costs + | `Cost s -> pc, exit_addr, labels, BitVectors.WordMap.add pc s costs + | `Mov (_,_) -> (snd (half_add pc (vect_of_int 3 `Sixteen))), exit_addr, labels, costs + | `Jmp _ + | `Call _ -> (snd (half_add pc (BitVectors.vect_of_int 3 `Sixteen))), exit_addr, labels, costs + (*CSC: very stupid: always expand to worst opcode *) + | `WithLabel i -> + let fake_addr _ = `REL (zero `Eight) in + let fake_jump = assembly_jump fake_addr i in + let i',pc',_ = fetch (load_code_memory (assembly1 fake_jump)) (vect_of_int 0 `Sixteen) in + assert (fake_jump = i'); + let pc' = snd (half_add pc' (vect_of_int 5 `Sixteen)) in + (snd (half_add pc pc'), exit_addr, labels, costs) + | #instruction as i -> + let i',pc',_ = fetch (load_code_memory (assembly1 i)) (vect_of_int 0 `Sixteen) in + assert (i = i'); + (snd (half_add pc pc'),exit_addr,labels, costs) + ) + (BitVectors.zero `Sixteen,BitVectors.zero `Sixteen, + StringTools.Map.empty, BitVectors.WordMap.empty) p.ASM.pcode + in + let code = + List.flatten (List.map + (function + `Label _ + | `Cost _ -> [] + | `WithLabel i -> + (* We need to expand a conditional jump to a label to a machine language + conditional jump. Suppose we have: + JC label + This should be expanded to: + JC 2 -- size of a short jump + SJMP 3 -- size of a long jump + LJMP offset -- offset = position of label in code + And, for ever label appearing after the location of the jump in code + memory, we must increment by 5, as we added two new instructions. *) + let to_ljmp = `REL (vect_of_int 2 `Eight) in + (* let offset = 5 in *) + let jmp_address, translated_jump = + match i with + `JC (`Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JC to_ljmp in + address, reconstructed + | `JNC (`Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JNC to_ljmp in + address, reconstructed + | `JB (b, `Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JB (b, to_ljmp) in + address, reconstructed + | `JNB (b, `Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JNB (b, to_ljmp) in + address, reconstructed + | `JBC (b, `Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JBC (b, to_ljmp) in + address, reconstructed + | `JZ (`Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JZ (to_ljmp) in + address, reconstructed + | `JNZ (`Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `JNZ (to_ljmp) in + address, reconstructed + | `CJNE (args, `Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `CJNE (args, to_ljmp) in + address, reconstructed + | `DJNZ (args, `Label a) -> + let address = StringTools.Map.find a labels in + let reconstructed = `DJNZ (args, to_ljmp) in + address, reconstructed + in + let sjmp, jmp = `SJMP (`REL (vect_of_int 3 `Eight)), `LJMP (`ADDR16 jmp_address) in + let translation = [ translated_jump; sjmp; jmp ] in + List.flatten (List.map assembly1 translation) + | `Mov (`DPTR,s) -> + (* let addr16 = StringTools.Map.find s datalabels in *) + let addrr16 = + try StringTools.Map.find s datalabels + with Not_found -> StringTools.Map.find s labels in + assembly1 (`MOV (`U4 (`DPTR,`DATA16 addrr16))) + | `Jmp s -> + let pc_offset = StringTools.Map.find s labels in + assembly1 (`LJMP (`ADDR16 pc_offset)) + | `Call s -> + let pc_offset = StringTools.Map.find s labels in + assembly1 (`LCALL (`ADDR16 pc_offset )) + | #instruction as i -> assembly1 i) p.ASM.pcode) in + { ASM.code = code ; ASM.cost_labels = costs ; + ASM.labels = StringTools.Map.empty ; + ASM.exit_addr = exit_addr ; ASM.has_main = p.ASM.phas_main } +;; + +let set_register status v reg = + let addr = get_address_of_register status reg in + { status with low_internal_ram = + Byte7Map.add addr v status.low_internal_ram } +;; + +let get_arg_8 status from_latch = + function + `DIRECT addr -> + let n0, n1 = from_byte addr in + (match from_nibble n0 with + (false,r1,r2,r3) -> + Byte7Map.find (mk_byte7 r1 r2 r3 n1) status.low_internal_ram + | _ -> get_sfr status addr from_latch) + | `INDIRECT b -> + let (b1, b2) = from_byte (get_register status (false,false,b)) in + (match (from_nibble b1, b2) with + (false,r1,r2,r3),b2 -> + Byte7Map.find (mk_byte7 r1 r2 r3 b2) status.low_internal_ram + | (true,r1,r2,r3),b2 -> + Byte7Map.find (mk_byte7 r1 r2 r3 b2) status.high_internal_ram) + | `REG (b1,b2,b3) -> get_register status (b1,b2,b3) + | `A -> status.acc + | `B -> status.b + | `DATA b -> b + | `A_DPTR -> + let dpr = mk_word status.dph status.dpl in + (* CSC: what is the right behaviour in case of overflow? + assert false for now. Try to understand what DEC really does *) + let cry,addr = half_add dpr (mk_word (vect_of_int 0 `Eight) status.acc) in + Physical.WordMap.find addr status.external_ram + | `A_PC -> + (* CSC: what is the right behaviour in case of overflow? + assert false for now *) + let cry,addr = half_add status.pc (mk_word (vect_of_int 0 `Eight) status.acc) in + Physical.WordMap.find addr status.external_ram + | `EXT_INDIRECT b -> + let addr = get_register status (false,false,b) in + Physical.WordMap.find (mk_word (zero `Eight) addr) status.external_ram + | `EXT_IND_DPTR -> + let dpr = mk_word status.dph status.dpl in + Physical.WordMap.find dpr status.external_ram +;; + +let get_arg_16 _status = function `DATA16 w -> w + +let get_arg_1 status from_latch = + function + `BIT addr + | `NBIT addr as x -> + let n1, n2 = from_byte addr in + let res = + (match from_nibble n1 with + (false,r1,r2,r3) -> + let addr = (int_of_vect (mk_byte7 r1 r2 r3 n2)) in + let addr' = vect_of_int ((addr / 8) + 32) `Seven in + get_bit (Byte7Map.find addr' status.low_internal_ram) (addr mod 8) + | (true,r1,r2,r3) -> + let addr = int_of_vect $ mk_byte7 r1 r2 r3 n2 in + let div = addr / 8 in + let rem = addr mod 8 in + get_bit (get_sfr status (vect_of_int ((div * 8) + 128) `Eight) from_latch) rem) + in (match x with `NBIT _ -> not res | _ -> res) + | `C -> get_cy_flag status + +let set_arg_1 status v = + function + `BIT addr -> + let n1, n2 = from_byte addr in + (match from_nibble n1 with + (false,r1,r2,r3) -> + let addr = (int_of_vect (mk_byte7 r1 r2 r3 n2)) in + let addr' = vect_of_int ((addr / 8) + 32) `Seven in + let n_bit = set_bit (Byte7Map.find addr' status.low_internal_ram) (addr mod 8) v in + { status with low_internal_ram = Byte7Map.add addr' n_bit status.low_internal_ram } + | (true,r1,r2,r3) -> + let addr = int_of_vect $ mk_byte7 r1 r2 r3 n2 in + let div = addr / 8 in + let rem = addr mod 8 in + let addr' = vect_of_int ((div * 8) + 128) `Eight in + let sfr = get_sfr status addr' true in (* are we reading from the latch here? *) + let sfr' = set_bit sfr rem v in + set_sfr status addr' sfr') + | `C -> + let (n1,n2) = from_byte status.psw in + let (_,b2,b3,b4) = from_nibble n1 in + { status with psw = (mk_byte (mk_nibble v b2 b3 b4) n2) } + +let set_arg_8 status v = + function + `DIRECT addr -> + let (b1, b2) = from_byte addr in + (match from_nibble b1 with + (false,r1,r2,r3) -> + { status with low_internal_ram = + Byte7Map.add (mk_byte7 r1 r2 r3 b2) v status.low_internal_ram } + | _ -> set_sfr status addr v) + | `INDIRECT b -> + let (b1, b2) = from_byte (get_register status (false,false,b)) in + (match (from_nibble b1, b2) with + (false,r1,r2,r3),n1 -> + { status with low_internal_ram = + Byte7Map.add (mk_byte7 r1 r2 r3 n1) v status.low_internal_ram } + | (true,r1,r2,r3),n1 -> + { status with high_internal_ram = + Byte7Map.add (mk_byte7 r1 r2 r3 n1) v status.high_internal_ram }) + | `REG (b1,b2,b3) -> + set_register status v (b1,b2,b3) + | `A -> { status with acc = v } + | `B -> { status with b = v } + | `EXT_IND_DPTR -> + let dpr = mk_word status.dph status.dpl in + { status with external_ram = + Physical.WordMap.add dpr v status.external_ram } + | `EXT_INDIRECT b -> + let addr = get_register status (false,false,b) in + { status with external_ram = + Physical.WordMap.add (mk_word (zero `Eight) addr) v status.external_ram } +;; + +let set_arg_16 status wrd = + function + `DPTR -> + let (dh, dl) = from_word wrd in + { status with dph = dh; dpl = dl } + +let set_flags status c ac ov = + { status with psw = + let bu,bl = from_byte status.psw in + let (_c,oac,fo,rs1),(rs0,_ov,ud,p) = from_nibble bu, from_nibble bl in + let ac = match ac with None -> oac | Some v -> v in + mk_byte (mk_nibble c ac fo rs1) (mk_nibble rs0 ov ud p) + } +;; + +let xor b1 b2 = + if b1 = true && b2 = true then + false + else if b1 = false && b2 = false then + false + else true +;; + +let read_at_sp status = + let n1,n2 = from_byte status.sp in + let m,r1,r2,r3 = from_nibble n1 in + Byte7Map.find (mk_byte7 r1 r2 r3 n2) + (if m then status.low_internal_ram else status.high_internal_ram) +;; + +let write_at_sp status v = + let n1,n2 = from_byte status.sp in + match from_nibble n1 with + true,r1,r2,r3 -> + let memory = + Byte7Map.add (mk_byte7 r1 r2 r3 n2) v status.low_internal_ram + in + { status with low_internal_ram = memory } + | false,r1,r2,r3 -> + let memory = + Byte7Map.add (mk_byte7 r1 r2 r3 n2) v status.high_internal_ram + in + { status with high_internal_ram = memory } +;; + +let timer0 status b1 b2 ticks = + let b = get_bit status.tcon 4 in + (* Timer0 first *) + (match b1,b2 with + true,true -> + (* Archaic 13 bit mode. *) + if b then + let res,_,_,_ = add8_with_c status.tl0 (vect_of_int ticks `Eight) false in + let res = int_of_vect res in + if res > 31 then + let res = res mod 32 in + let res',cy',ov',ac' = add8_with_c status.th0 (vect_of_int 1 `Eight) false in + if ov' then + let b = set_bit status.tcon 7 true in + { status with tcon = b; th0 = res'; tl0 = vect_of_int res `Eight } + else + { status with th0 = res'; tl0 = vect_of_int res `Eight } + else + { status with tl0 = vect_of_int res `Eight } + else + status + | false,false -> + (* 8 bit split timer mode. *) + let status = + (if b then + let res,cy,ov,ac = add8_with_c status.tl0 (vect_of_int ticks `Eight) false in + if ov then + let b = set_bit status.tcon 5 true in + { status with tcon = b; tl0 = res } + else + { status with tl0 = res } + else + status) + in + if get_bit status.tcon 6 then + let res,cy,ov,ac = add8_with_c status.th0 (vect_of_int ticks `Eight) false in + if ov then + let b = set_bit status.tcon 7 true in + { status with tcon = b; th0 = res } + else + { status with th0 = res } + else + status + | false,true -> + (* 16 bit timer mode. *) + if b then + let res,_,ov,_ = add16_with_c (mk_word status.th0 status.tl0) (vect_of_int ticks `Sixteen) false in + if ov then + let b = set_bit status.tcon 5 true in + let new_th0,new_tl0 = from_word res in + { status with tcon = b; th0 = new_th0; tl0 = new_tl0 } + else + let new_th0,new_tl0 = from_word res in + { status with th0 = new_th0; tl0 = new_tl0 } + else + status + | true,false -> + (* 8 bit single timer mode. *) + if b then + let res,_,ov,_ = add8_with_c status.tl0 (vect_of_int ticks `Eight) false in + if ov then + let b = set_bit status.tcon 5 true in + { status with tcon = b; tl0 = status.th0; } + else + { status with tl0 = res } + else + status) + +let timer1 status b3 b4 ticks = + let b = get_bit status.tcon 4 in + (match b3,b4 with + true,true -> + (* Archaic 13 bit mode. *) + if b then + let res,_,_,_ = add8_with_c status.tl1 (vect_of_int ticks `Eight) false in + let res = int_of_vect res in + if res > 31 then + let res = res mod 32 in + let res',cy',ov',ac' = add8_with_c status.th1 (vect_of_int 1 `Eight) false in + if ov' then + let b = set_bit status.tcon 7 true in + { status with tcon = b; th1 = res'; tl1 = vect_of_int res `Eight } + else + { status with th1 = res'; tl0 = vect_of_int res `Eight } + else + { status with tl1 = vect_of_int res `Eight } + else + status + | false,false -> + (* 8 bit split timer mode. *) + let status = + (if b then + let res,cy,ov,ac = add8_with_c status.tl1 (vect_of_int ticks `Eight) false in + if ov then + let b = set_bit status.tcon 5 true in + { status with tcon = b; tl1 = res } + else + { status with tl1 = res } + else + status) + in + if get_bit status.tcon 6 then + let res,cy,ov,ac = add8_with_c status.th1 (vect_of_int ticks `Eight) false in + if ov then + let b = set_bit status.tcon 7 true in + { status with tcon = b; th1 = res } + else + { status with th1 = res } + else + status + | false,true -> + (* 16 bit timer mode. *) + if b then + let res,_,ov,_ = add16_with_c (mk_word status.th0 status.tl1) (vect_of_int ticks `Sixteen) false in + if ov then + let b = set_bit status.tcon 5 true in + let new_th1,new_tl1 = from_word res in + { status with tcon = b; th1 = new_th1; tl1 = new_tl1 } + else + let new_th1,new_tl1 = from_word res in + { status with th1 = new_th1; tl1 = new_tl1 } + else + status + | true,false -> + (* 8 bit single timer mode. *) + if b then + let res,_,ov,_ = add8_with_c status.tl1 (vect_of_int ticks `Eight) false in + if ov then + let b = set_bit status.tcon 5 true in + { status with tcon = b; tl1 = status.th1; } + else + { status with tl1 = res } + else + status) +;; + +let timers status ticks = + (* DPM: Clock/Timer code follows. *) + match bits_of_byte status.tmod with + | (g1,c1,b1,b2),(g0,c0,b3,b4) -> + let status = + (if g0 then + if get_bit status.p3 2 then + if c0 then + if status.previous_p1_val && not $ get_bit status.p3 4 then + timer0 status b1 b2 ticks + else + status + else + timer0 status b1 b2 ticks + else + status + else + timer0 status b1 b2 ticks) in + (* Timer 1 follows. *) + let status = + (if g1 then + if get_bit status.p1 3 then + if c1 then + if status.previous_p3_val && not $ get_bit status.p3 5 then + timer1 status b3 b4 ticks + else + status + else + timer1 status b3 b4 ticks + else + status + else + timer1 status b3 b4 ticks) in + (* Timer 2 follows *) + let status = + (let (tf2,exf2,rclk,tclk),(exen2,tr2,ct2,cp2) = bits_of_byte status.t2con in + (* Timer2 is enabled *) + if tr2 then + (* Counter/interval mode *) + if ct2 && not cp2 then + let word = mk_word status.th2 status.tl2 in + let res,_,ov,_ = add16_with_c word (vect_of_int ticks `Sixteen) false in + if ov then + let new_th2 = status.rcap2h in + let new_tl2 = status.rcap2l in + (* Overflow flag not set if either of the following flags are set *) + if not rclk && not tclk then + let b = set_bit status.t2con 7 true in + { status with t2con = b; + th2 = new_th2; + tl2 = new_tl2 } + else + { status with th2 = new_th2; + tl2 = new_tl2 } + else + (* Reload also signalled when a 1-0 transition is detected *) + if status.previous_p1_val && not $ get_bit status.p1 1 then + (* In which case signal reload by setting T2CON.6 *) + let b = set_bit status.t2con 6 true in + { status with th2 = status.rcap2h; + tl2 = status.rcap2l; + t2con = b } + else + let new_th2, new_tl2 = from_word res in + { status with th2 = new_th2; + tl2 = new_tl2 } + (* Capture mode *) + else if cp2 && exen2 then + (* 1-0 transition detected *) + (* DPM: look at this: is the timer still running throughout? *) + if status.previous_p1_val && not $ get_bit status.p1 1 then + status (* Implement clock here *) + else + status (* Implement clock here *) + else + status + else + status) in status + +;; + +let serial_port_input status in_cont = + (* Serial port input *) + match in_cont with + Some (`In(time, line, epsilon, cont)) when get_bit status.scon 4 -> + (let status = + (match line with + `P1 b -> + if status.clock >= time then + { status with p1 = b; p1_latch = b; } + else + status + | `P3 b -> + if status.clock >= time then + { status with p3 = b; p3_latch = b; } + else + status + | `SerialBuff (`Eight b) -> + let sm0 = get_bit status.scon 7 in + let sm1 = get_bit status.scon 6 in + (match (sm0, sm1) with + (false, false) -> + (* Mode 0: shift register. No delay. *) + if status.clock >= time then + { status with scon = set_bit status.scon 0 true; + io = cont; + sbuf = b } + else + status + | (false, true) -> + (* Mode 1: 8-bit UART *) + (* Explanation: 8 bit asynchronous communication. There's a delay (epsilon) + which needs taking care of. If we're trying to communicate at the same time + an existing communication is occurring, we assert false (else clause of first + if). *) + if status.serial_epsilon_in = None && status.serial_v_in = None then + if status.clock >= time then + (* Waiting for nine bits, multiprocessor communication mode requires nine bits *) + if get_bit status.scon 5 then + assert false (* really: crash! *) + else + { status with serial_epsilon_in = Some (epsilon + time); + serial_v_in = Some (`Eight b) } + else + (* Warning about incomplete case analysis here, but safe as we've already tested for + None. *) + let e = extract status.serial_epsilon_in in + let v = extract status.serial_v_in in + if status.clock >= e then + match v with + `Eight v' -> + { status with sbuf = v'; + serial_v_in = None; + serial_epsilon_in = None; + scon = set_bit status.scon 0 true; + io = cont } + | _ -> assert false (* trying to read in 9 bits instead of 8 *) + else + status + else + assert false + | (true, false) | (true, true) -> + assert false (* only got eight bits on the line when in 9 bit mode *)) + | `SerialBuff (`Nine (b,b')) -> + let sm0 = get_bit status.scon 7 in + let sm1 = get_bit status.scon 6 in + match(sm0, sm1) with + (false, false) | (false, true) -> assert false + | (true, false) | (true, true) -> + (* Modes 2 and 3: 9-bit UART *) + (* Explanation: 9 bit asynchronous communication. There's a delay (epsilon) + which needs taking care of. If we're trying to communicate at the same time + an existing communication is occurring, we assert false (else claus of first + if). *) + if status.serial_epsilon_in = None && status.serial_v_in = None then + if status.clock >= time then + (* waiting for nine bits, multiprocessor communication mode requires nine bits *) + if get_bit status.scon 5 then + assert false (* really: crash! *) + else + { status with serial_epsilon_in = Some (epsilon + time); + serial_v_in = Some (`Nine (b, b')) } + else + (* Warning about incomplete case analysis here, but safe as we've already tested for + None. *) + let e = extract status.serial_epsilon_in in + let v = extract status.serial_v_in in + if status.clock >= e then + match v with + `Nine (v, v') -> + let scon' = set_bit status.scon 0 true in + { status with sbuf = v'; + serial_v_in = None; + serial_epsilon_in = None; + scon = set_bit scon' 2 b; + io = cont } + | _ -> assert false (* trying to read in 8 bits instead of 9 *) + else + status + else + assert false) + in + { status with io = cont }) + | _ -> status +;; + +let serial_port_output status out_cont = + (* Serial port output *) + (let status = { status with serial_epsilon_out = Some (status.clock + status.io_epsilon); + serial_v_out = Some (`Eight status.sbuf); + serial_k_out = Some (snd (out_cont (status.clock + status.io_epsilon) (`SerialBuff (`Eight status.sbuf)))) } in + match status.serial_epsilon_out with + Some s -> + if status.clock >= s then + match status.serial_k_out with + None -> assert false (* correct? *) + | Some k' -> { status with io = k'; + scon = set_bit status.scon 1 true; } + else + status + | _ -> assert false) +;; + +let external_serial_interrupt status esi = + (* Interrupt enabled *) + if esi then + (* If we're already running, then fine (todo: check for *another* interrupt + and add to a queue, or something? *) + if status.t1i_running then + status + else + (* If we should be running, but aren't... *) + if false then + assert false + else + status + else + status +;; + +let external0_interrupt status e0i = + (* Interrupt enabled *) + if e0i then + (* If we're already running, then fine (todo: check for *another* interrupt + and add to a queue, or something? *) + if status.t1i_running then + status + else + (* If we should be running, but aren't... *) + if false then + assert false + else + status + else + status +;; + +let external1_interrupt status e1i = + (* Interrupt enabled *) + if e1i then + (* If we're already running, then fine (todo: check for *another* interrupt + and add to a queue, or something? *) + if status.t1i_running then + status + else + (* If we should be running, but aren't... *) + if false then + assert false + else + status + else + status +;; + +let timer0_interrupt status t0i = + (* Interrupt enabled *) + if t0i then + (* If we're already running, then fine (todo: check for *another* interrupt + and add to a queue, or something? *) + if status.t1i_running then + status + else + (* If we should be running, but aren't... *) + if false then + assert false + else + status + else + status +;; + +let timer1_interrupt status t1i = + (* Interrupt enabled *) + if t1i then + (* If we're already running, then fine (todo: check for *another* interrupt + and add to a queue, or something? *) + if status.t1i_running then + status + else + (* If we should be running, but aren't... *) + if false then + assert false + else + status + else + status +;; + +let interrupts status = + let (ea,_,_,es), (et1,ex1,et0,ex0) = bits_of_byte status.ie in + let (_,_,_,ps), (pt1,px1,pt0,px0) = bits_of_byte status.ip in + (* DPM: are interrupts enabled? *) + if ea then + match (ps,pt1,px1,pt0,px0) with + _ -> assert false + else + status +;; + +let execute1 status = + let instr,pc,ticks = fetch status.code_memory status.pc in + let status = { status with clock = status.clock + ticks; pc = pc } in + let status = + (match instr with + `ADD (`A,d1) -> + let v,c,ac,ov = + add8_with_c (get_arg_8 status false `A) (get_arg_8 status false d1) false + in + set_flags (set_arg_8 status v `A) c (Some ac) ov + | `ADDC (`A,d1) -> + let v,c,ac,ov = + add8_with_c (get_arg_8 status false `A) (get_arg_8 status false d1) (get_cy_flag status) + in + set_flags (set_arg_8 status v `A) c (Some ac) ov + | `SUBB (`A,d1) -> + let v,c,ac,ov = + subb8_with_c (get_arg_8 status false `A) (get_arg_8 status false d1) (get_cy_flag status) + in + set_flags (set_arg_8 status v `A) c (Some ac) ov + | `INC `DPTR -> + let cry, low_order_byte = half_add status.dpl (vect_of_int 1 `Eight) in + let cry, high_order_byte = full_add status.dph (vect_of_int 0 `Eight) cry in + { status with dpl = low_order_byte; dph = high_order_byte } + | `INC ((`A | `REG _ | `DIRECT _ | `INDIRECT _) as d) -> + let b = get_arg_8 status true d in + let cry, res = half_add b (vect_of_int 1 `Eight) in + set_arg_8 status res d + | `DEC d -> + let b = get_arg_8 status true d in + let res,c,ac,ov = subb8_with_c b (vect_of_int 1 `Eight) false in + set_arg_8 status res d + | `MUL (`A,`B) -> + let acc = int_of_vect status.acc in + let b = int_of_vect status.b in + let prod = acc * b in + let ov = prod > 255 in + let l = vect_of_int (prod mod 256) `Eight in + let h = vect_of_int (prod / 256) `Eight in + let status = { status with acc = l ; b = h } in + (* DPM: Carry flag is always cleared. *) + set_flags status false None ov + | `DIV (`A,`B) -> + let acc = int_of_vect status.acc in + let b = int_of_vect status.b in + if b = 0 then + (* CSC: ACC and B undefined! We leave them as they are. *) + set_flags status false None true + else + let q = vect_of_int (acc / b) `Eight in + let r = vect_of_int (acc mod b) `Eight in + let status = { status with acc = q ; b = r } in + set_flags status false None false + | `DA `A -> + let acc_upper_nibble, acc_lower_nibble = from_byte status.acc in + if int_of_vect acc_lower_nibble > 9 or get_ac_flag status = true then + let acc,cy,_,_ = add8_with_c status.acc (vect_of_int 6 `Eight) false in + let acc_upper_nibble, acc_lower_nibble = from_byte acc in + if int_of_vect acc_upper_nibble > 9 or cy = true then + let cry,acc_upper_nibble = half_add acc_upper_nibble (vect_of_int 6 `Four) in + let status = { status with acc = mk_byte acc_upper_nibble acc_lower_nibble } in + set_flags status cry (Some (get_ac_flag status)) (get_ov_flag status) + else + status + else + status + | `ANL (`U1(`A, ag)) -> + let and_val = get_arg_8 status true `A -&- get_arg_8 status true ag in + set_arg_8 status and_val `A + | `ANL (`U2((`DIRECT d), ag)) -> + let and_val = get_arg_8 status true (`DIRECT d) -&- get_arg_8 status true ag in + set_arg_8 status and_val (`DIRECT d) + | `ANL (`U3 (`C, b)) -> + let and_val = get_cy_flag status && get_arg_1 status true b in + set_flags status and_val None (get_ov_flag status) + | `ORL (`U1(`A, ag)) -> + let or_val = get_arg_8 status true `A -|- get_arg_8 status true ag in + set_arg_8 status or_val `A + | `ORL (`U2((`DIRECT d), ag)) -> + let or_val = get_arg_8 status true (`DIRECT d) -|- get_arg_8 status true ag in + set_arg_8 status or_val (`DIRECT d) + | `ORL (`U3 (`C, b)) -> + let or_val = get_cy_flag status || get_arg_1 status true b in + set_flags status or_val None (get_ov_flag status) + | `XRL (`U1(`A, ag)) -> + let xor_val = get_arg_8 status true `A -^- get_arg_8 status true ag in + set_arg_8 status xor_val `A + | `XRL (`U2((`DIRECT d), ag)) -> + let xor_val = get_arg_8 status true (`DIRECT d) -^- get_arg_8 status true ag in + set_arg_8 status xor_val (`DIRECT d) + | `CLR `A -> set_arg_8 status (zero `Eight) `A + | `CLR `C -> set_arg_1 status false `C + | `CLR ((`BIT _) as a) -> set_arg_1 status false a + | `CPL `A -> { status with acc = complement status.acc } + | `CPL `C -> set_arg_1 status (not $ get_arg_1 status true `C) `C + | `CPL ((`BIT _) as b) -> set_arg_1 status (not $ get_arg_1 status true b) b + | `RL `A -> { status with acc = rotate_left status.acc } + | `RLC `A -> + let old_cy = get_cy_flag status in + let n1, n2 = from_byte status.acc in + let (b1,b2,b3,b4),(b5,b6,b7,b8) = from_nibble n1, from_nibble n2 in + let status = set_arg_1 status b1 `C in + { status with acc = mk_byte (mk_nibble b2 b3 b4 b5) (mk_nibble b6 b7 b8 old_cy) } + | `RR `A -> { status with acc = rotate_right status.acc } + | `RRC `A -> + let old_cy = get_cy_flag status in + let n1, n2 = from_byte status.acc in + let (b1,b2,b3,b4),(b5,b6,b7,b8) = from_nibble n1, from_nibble n2 in + let status = set_arg_1 status b8 `C in + { status with acc = mk_byte (mk_nibble old_cy b1 b2 b3) (mk_nibble b4 b5 b6 b7) } + | `SWAP `A -> + let (acc_nibble_upper, acc_nibble_lower) = from_byte status.acc in + { status with acc = mk_byte acc_nibble_lower acc_nibble_upper } + | `MOV(`U1(b1, b2)) -> set_arg_8 status (get_arg_8 status false b2) b1 + | `MOV(`U2(b1, b2)) -> set_arg_8 status (get_arg_8 status false b2) b1 + | `MOV(`U3(b1, b2)) -> set_arg_8 status (get_arg_8 status false b2) b1 + | `MOV(`U4(b1,b2)) -> set_arg_16 status (get_arg_16 status b2) b1 + | `MOV(`U5(b1,b2)) -> set_arg_1 status (get_arg_1 status false b2) b1 + | `MOV(`U6(b1,b2)) -> set_arg_1 status (get_arg_1 status false b2) b1 + | `MOVC (`A, `A_DPTR) -> + let big_acc = mk_word (zero `Eight) status.acc in + let dptr = mk_word status.dph status.dpl in + let cry, addr = half_add dptr big_acc in + let lookup = Physical.WordMap.find addr status.code_memory in + { status with acc = lookup } + | `MOVC (`A, `A_PC) -> + let big_acc = mk_word (zero `Eight) status.acc in + (* DPM: Under specified: does the carry from PC incrementation affect the *) + (* addition of the PC with the DPTR? At the moment, no. *) + let cry,inc_pc = half_add status.pc (vect_of_int 1 `Sixteen) in + let status = { status with pc = inc_pc } in + let cry,addr = half_add inc_pc big_acc in + let lookup = Physical.WordMap.find addr status.code_memory in + { status with acc = lookup } + (* data transfer *) + (* DPM: MOVX currently only implements the *copying* of data! *) + | `MOVX (`U1 (a1, a2)) -> set_arg_8 status (get_arg_8 status false a2) a1 + | `MOVX (`U2 (a1, a2)) -> set_arg_8 status (get_arg_8 status false a2) a1 + | `SETB b -> set_arg_1 status true b + | `PUSH a -> + (* DPM: What happens if we overflow? *) + let cry,new_sp = half_add status.sp (vect_of_int 1 `Eight) in + let status = { status with sp = new_sp } in + write_at_sp status (get_arg_8 status false a) + | `POP (`DIRECT b) -> + let contents = read_at_sp status in + let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in + let status = { status with sp = new_sp } in + let status = set_arg_8 status contents (`DIRECT b) in + status + | `XCH(`A, arg) -> + let old_arg = get_arg_8 status false arg in + let old_acc = status.acc in + let status = set_arg_8 status old_acc arg in + { status with acc = old_arg } + | `XCHD(`A, i) -> + let acc_upper_nibble, acc_lower_nibble = from_byte $ get_arg_8 status false `A in + let ind_upper_nibble, ind_lower_nibble = from_byte $ get_arg_8 status false i in + let new_acc = mk_byte acc_upper_nibble ind_lower_nibble in + let new_reg = mk_byte ind_upper_nibble acc_lower_nibble in + let status = { status with acc = new_acc } in + set_arg_8 status new_reg i + (* program branching *) + | `JC (`REL rel) -> + if get_cy_flag status then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `JNC (`REL rel) -> + if not $ get_cy_flag status then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `JB (b, (`REL rel)) -> + if get_arg_1 status false b then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `JNB (b, (`REL rel)) -> + if not $ get_arg_1 status false b then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `JBC (b, (`REL rel)) -> + let status = set_arg_1 status false b in + if get_arg_1 status false b then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `RET -> + (* DPM: What happens when we underflow? *) + let high_bits = read_at_sp status in + let new_sp,cy,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in + let status = { status with sp = new_sp } in + let low_bits = read_at_sp status in + let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) cy in + let status = { status with sp = new_sp } in + { status with pc = mk_word high_bits low_bits } + | `RETI -> + let high_bits = read_at_sp status in + let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in + let status = { status with sp = new_sp } in + let low_bits = read_at_sp status in + let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in + let status = { status with sp = new_sp } in + { status with pc = mk_word high_bits low_bits } + | `ACALL (`ADDR11 a) -> + let cry, new_sp = half_add status.sp (vect_of_int 1 `Eight) in + let status = { status with sp = new_sp } in + let pc_upper_byte, pc_lower_byte = from_word status.pc in + let status = write_at_sp status pc_lower_byte in + let cry, new_sp = half_add status.sp (vect_of_int 1 `Eight) in + let status = { status with sp = new_sp } in + let status = write_at_sp status pc_upper_byte in + let addr = addr16_of_addr11 status.pc a in + { status with pc = addr } + | `LCALL (`ADDR16 addr) -> + let cry, new_sp = half_add status.sp (vect_of_int 1 `Eight) in + let status = { status with sp = new_sp } in + let pc_upper_byte, pc_lower_byte = from_word status.pc in + let status = write_at_sp status pc_lower_byte in + let cry, new_sp = half_add status.sp (vect_of_int 1 `Eight) in + let status = { status with sp = new_sp } in + let status = write_at_sp status pc_upper_byte in + { status with pc = addr } + | `AJMP (`ADDR11 a) -> + let addr = addr16_of_addr11 status.pc a in + { status with pc = addr } + | `LJMP (`ADDR16 a) -> + { status with pc = a } + | `SJMP (`REL rel) -> + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + | `JMP `IND_DPTR -> + let dptr = mk_word status.dph status.dpl in + let big_acc = mk_word (zero `Eight) status.acc in + let cry, jmp_addr = half_add big_acc dptr in + let cry, new_pc = half_add status.pc jmp_addr in + { status with pc = new_pc } + | `JZ (`REL rel) -> + if status.acc = zero `Eight then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `JNZ (`REL rel) -> + if status.acc <> zero `Eight then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `CJNE ((`U1 (`A, ag)), `REL rel) -> + let new_carry = status.acc < get_arg_8 status false ag in + if get_arg_8 status false ag <> status.acc then + let cry, new_pc = half_add status.pc (sign_extension rel) in + let status = set_flags status new_carry None (get_ov_flag status) in + { status with pc = new_pc; } + else + set_flags status new_carry None (get_ov_flag status) + | `CJNE ((`U2 (ag, `DATA d)), `REL rel) -> + let new_carry = get_arg_8 status false ag < d in + if get_arg_8 status false ag <> d then + let cry, new_pc = half_add status.pc (sign_extension rel) in + let status = { status with pc = new_pc } in + set_flags status new_carry None (get_ov_flag status) + else + set_flags status new_carry None (get_ov_flag status) + | `DJNZ (ag, (`REL rel)) -> + let new_ag,_,_,_ = subb8_with_c (get_arg_8 status true ag) (vect_of_int 1 `Eight) false in + let status = set_arg_8 status new_ag ag in + if new_ag <> zero `Eight then + let cry, new_pc = half_add status.pc (sign_extension rel) in + { status with pc = new_pc } + else + status + | `NOP -> status) in + let status = timers status ticks in + let in_cont, `Out out_cont = status.io in + let status = serial_port_input status in_cont in + let status = serial_port_output status out_cont in + let status = interrupts status in + { status with previous_p1_val = get_bit status.p3 4; + previous_p3_val = get_bit status.p3 5 } +;; + +(* +OLD output routine: + (* Serial port output, part one *) + let status = + (match status.expected_out_time with + `At t when status.clock >= t -> + { status with scon = set_bit status.scon 1 true; expected_out_time = `None } + | _ -> status) in + + (if status.expected_out_time = `Now then + if get_bit status.scon 7 then + let exp_time, new_cont = out_cont status.clock (`SerialBuff (`Nine ((get_bit status.scon 3), status.sbuf))) in + { status with expected_out_time = `At exp_time; io = new_cont } + else + let exp_time, new_cont = out_cont status.clock (`SerialBuff (`Eight status.sbuf)) in + { status with expected_out_time = `At exp_time; io = new_cont } + else + status) in +*) + +let rec execute f s = + let cont = + try f s; true + with Halt -> false + in + if cont then execute f (execute1 s) + else s +;; + + +let load_program p = + let st = load p.ASM.code initialize in + { st with exit_addr = p.ASM.exit_addr ; cost_labels = p.ASM.cost_labels } + +let observe_trace trace_ref st = + let cost_label = + if BitVectors.WordMap.mem st.pc st.cost_labels then + [BitVectors.WordMap.find st.pc st.cost_labels] + else [] in + trace_ref := cost_label @ !trace_ref ; + if st.pc = st.exit_addr (* <=> end of program *) then raise Halt else st + +let result st = + let dpl = st.dpl in + let dpr = st.dph in + let addr i = BitVectors.vect_of_int i `Seven in + let get_ireg i = Physical.Byte7Map.find (addr i) st.low_internal_ram in + let r00 = get_ireg 0 in + let r01 = get_ireg 1 in + let is = [dpl ; dpr ; r00 ; r01] in + let f i = IntValue.Int32.of_int (BitVectors.int_of_vect i) in + IntValue.Int32.merge (List.map f is) + +let interpret debug p = + Printf.printf "*** 8051 interpret ***\n%!" ; + if p.ASM.has_main then + let st = load_program p in + let trace = ref [] in + let callback = observe_trace trace in + let st = execute callback st in + let res = result st in + if debug then + Printf.printf "Result = %s\n%!" (IntValue.Int32.to_string res) ; + (res, List.rev !trace) + else (IntValue.Int32.zero, []) + + +let size_of_instr instr = + let exit_lbl = "exit" in + let p = { ASM.ppreamble = [] ; ASM.pexit_label = exit_lbl ; + ASM.pcode = [instr ; `Label exit_lbl] ; ASM.phas_main = false } in + let p = assembly p in + let status = load_program p in + let addr_zero = BitVectors.vect_of_int 0 `Sixteen in + let (_, size, _) = fetch status.code_memory addr_zero in + BitVectors.int_of_vect size + +let size_of_instrs instrs = + let f res instr = res + (size_of_instr instr) in + List.fold_left f 0 instrs diff --git a/src/ASM/ASMInterpret.mli b/src/ASM/ASMInterpret.mli new file mode 100644 index 0000000..41441a5 --- /dev/null +++ b/src/ASM/ASMInterpret.mli @@ -0,0 +1,132 @@ +open BitVectors;; +open Physical;; + +exception CodeTooLarge + +type time = int;; +type line = [ `P1 of byte + | `P3 of byte + | `SerialBuff of [ `Eight of byte + | `Nine of BitVectors.bit * byte + ] + ];; + +val string_of_line: line -> string;; + +type epsilon = int;; + +(* In: reception time, line of input, new continuation, + Out: transmission time, output line, expected duration until reply, + new continuation. +*) +type continuation = + [`In of time * line * epsilon * continuation] option * + [`Out of (time -> line -> time * continuation) ];; + +type status = + { + (* Memory *) + code_memory: WordMap.map; (* can be reduced *) + low_internal_ram: Byte7Map.map; + high_internal_ram: Byte7Map.map; + external_ram: WordMap.map; + + (* Program counter *) + pc: word; + + (* SFRs *) + sp: byte; + dpl: byte; + dph: byte; + pcon: byte; + tcon: byte; + tmod: byte; + tl0: byte; + tl1: byte; + th0: byte; + th1: byte; + p1: byte; + scon: byte; + sbuf: byte; + ie: byte; + p3: byte; + ip: byte; + psw: byte; + acc: byte; + b: byte; + t2con: byte; (* 8052 only *) + rcap2l: byte; (* 8052 only *) + rcap2h: byte; (* 8052 only *) + tl2: byte; (* 8052 only *) + th2: byte; (* 8052 only *) + + (* Latches for the output lines *) + p1_latch: byte; + p3_latch: byte; + + (* Fields for tracking the state of the processor. *) + + (* IO specific *) + previous_p1_val: bool; + previous_p3_val: bool; + + serial_epsilon_out: epsilon option; + serial_epsilon_in: epsilon option; + + io_epsilon: epsilon; + + serial_v_in: [`Eight of byte | `Nine of (BitVectors.bit * byte) ] option; + serial_v_out: [`Eight of byte | `Nine of (BitVectors.bit * byte) ] option; + + serial_k_out: continuation option; + + io: continuation; + expected_out_time: [ `None | `Now | `At of time ]; + + (* Timer and clock specific *) + clock: time; + timer0: word; + timer1: word; + timer2: word; (* can be missing *) + + esi_running: bool; + t0i_running: bool; + t1i_running: bool; + e0i_running: bool; + e1i_running: bool; + es_running: bool; + + exit_addr : BitVectors.word; + cost_labels : string BitVectors.WordMap.t + } + +val string_of_status: status -> string + + +val assembly: + [< ASM.labelled_instruction] ASM.pretty_program -> ASM.program + +(* + val link: + (ASM.instruction list * symbol_table * cost_map) list -> BitVectors.byte list +*) + +val initialize: status + +val load_code_memory: BitVectors.byte list -> Physical.WordMap.map +val load_mem: Physical.WordMap.map -> status -> status +val load: BitVectors.byte list -> status -> status + +exception Halt (* to be raised to stop execution *) + +(* the callback function is used to observe the execution + trace; it can raise Hold to stop execution. Otherwise + the processor never halts. *) +val execute: (status -> unit) -> status -> status + +val fetch: Physical.WordMap.map -> word -> ASM.instruction * word * int + +val load_program : ASM.program -> status +val interpret : bool -> ASM.program -> AST.trace + +val size_of_instrs : ASM.labelled_instruction list -> int diff --git a/src/ASM/ASMPrinter.ml b/src/ASM/ASMPrinter.ml new file mode 100644 index 0000000..f7071da --- /dev/null +++ b/src/ASM/ASMPrinter.ml @@ -0,0 +1,7 @@ + +(** This module provides a function to print [ASM] programs. *) + +let print_program p = + let code_memory = ASMInterpret.load_code_memory p.ASM.code in + let intel_hex = IntelHex.pack_exported_code_memory 16 65535 code_memory in + IntelHex.string_of_intel_hex_format intel_hex diff --git a/src/ASM/ASMPrinter.mli b/src/ASM/ASMPrinter.mli new file mode 100644 index 0000000..99edc64 --- /dev/null +++ b/src/ASM/ASMPrinter.mli @@ -0,0 +1,4 @@ + +(** This module provides a function to print [ASM] programs. *) + +val print_program : ASM.program -> string diff --git a/src/ASM/BitVectors.ml b/src/ASM/BitVectors.ml new file mode 100644 index 0000000..0abac73 --- /dev/null +++ b/src/ASM/BitVectors.ml @@ -0,0 +1,159 @@ +open Util;; + +type bit = bool +type 'a vect = bit list +type nibble = [`Four] vect +type byte7 = [`Seven] vect +type byte = [`Eight] vect +type word = [`Sixteen] vect +type word11 = [`Eleven] vect + +type sizes = [ `Four | `Seven | `Eight | `Eleven | `Sixteen ] + +let mk_nibble b1 b2 b3 b4 = [b1; b2; b3; b4] +let from_nibble = + function + [b1; b2; b3; b4] -> b1,b2,b3,b4 + | _ -> assert false +let mk_byte n1 n2 = n1 @ n2 +let mk_byte_from_bits ((b1,b2,b3,b4),(b5,b6,b7,b8)) = ([b1;b2;b3;b4;b5;b6;b7;b8] : [`Eight] vect) +let from_byte = + function + b1::b2::b3::b4::r -> [b1;b2;b3;b4],r + | _ -> assert false +let bits_of_byte = + function + [b1;b2;b3;b4;b5;b6;b7;b8] -> (b1,b2,b3,b4),(b5,b6,b7,b8) + | _ -> assert false +let mk_byte7 b1 b2 b3 n1 = b1::b2::b3::n1 +let from_byte7 = + function + b1::b2::b3::r -> b1,b2,b3,r + | _ -> assert false +let mk_word = mk_byte +let from_word = + function + b1::b2::b3::b4::b5::b6::b7::b8::r -> [b1;b2;b3;b4;b5;b6;b7;b8],r + | _ -> assert false +let mk_word11 = mk_byte7 +let from_word11 = from_byte7 + +let get_bit l index = + try + List.nth (List.rev l) index + with (Failure _ | Invalid_argument _) -> assert false + +let set_bit l index new_val = + try + let rec aux index l = + match index, l with + _, [] -> raise (Invalid_argument "") + | 0,_::tl -> new_val::tl + | n,hd::tl -> hd::(aux (n-1) tl) in + List.rev (aux index (List.rev l)) + with Invalid_argument "" -> assert false + +let (-&-) l1 l2 = List.map2 (fun b1 b2 -> b1 & b2) l1 l2 +let (-|-) l1 l2 = List.map2 (fun b1 b2 -> b1 || b2) l1 l2 +let xor b1 b2 = b1 <> b2 +let (-^-) l1 l2 = List.map2 xor l1 l2 +let complement l1 = List.map (not) l1 + +let iter_bits f v = String.concat "" (List.map f v) +let map_bits = List.map +let map2_bits = List.map2 + +let string_of_bit = function false -> "0" | true -> "1" +let string_of_vect l = String.concat "" (List.map string_of_bit l) + +let full_add l r c = List.fold_right2 (fun b1 b2 (c,r) -> b1 & b2 || c & (b1 || b2),xor (xor b1 b2) c::r) l r (c,[]) +let half_add l r = full_add l r false + +let sign_extension = + function + [] -> assert false + | (he::_) as l -> + [he;he;he;he;he;he;he;he] @ l +;; + + +let rec split_last = + function + [] -> assert false + | [he] -> he,[] + | he::tl -> + let l,res = split_last tl in + l,he::res + +let shift_left = + function + [] -> assert false + | _::tl -> tl @ [false] +let shift_right l = false :: snd (split_last l) +let rotate_left = + function + [] -> assert false + | he::tl -> tl @ [he] +let rotate_right l = + let he,tl = split_last l in + he::tl + +(* CSC: can overflow!!! *) +let int_of_vect v = + let rec aux pow v = + match v with + [] -> 0 + | hd::tl -> + if hd = true then + pow + (aux (pow * 2) tl) + else + aux (pow * 2) tl + in + aux 1 (List.rev v) + +let size_lookup = + function + `Four -> 4 + | `Seven -> 7 + | `Eight -> 8 + | `Eleven -> 11 + | `Sixteen -> 16 + +let rec pow v p = + if p = 0 then + 1 + else + v * (pow v (p - 1)) + +let divide_with_remainder x y = (x / y, x mod y) + +let rec aux i = + if i < 0 then + raise (Invalid_argument "Negative index") + else + let (d, r) = divide_with_remainder i 2 in + if (d, r) = (0, 0) then + [] + else if r = 0 then + false :: aux d + else + true :: aux d + +let rec pad i l = if i = 0 then l else false :: (pad (i - 1) l) + +let vect_of_int i size = + let big_list = List.rev (aux i) in + if List.length big_list > size_lookup size then + raise (Invalid_argument "BitVectors.vect_of_int: size not big enough") + else + let diff = size_lookup size - List.length big_list in + pad diff big_list + +let zero size = pad (size_lookup size) [] + +(* CSC: can overflow!!! *) +(* CSC: only works properly with bytes!!! *) +let hex_string_of_vect v = Printf.sprintf "%0 2X" (int_of_vect v);; + +module WordMap = + Map.Make (struct type t = word let compare = compare end);; diff --git a/src/ASM/BitVectors.mli b/src/ASM/BitVectors.mli new file mode 100644 index 0000000..b9925c2 --- /dev/null +++ b/src/ASM/BitVectors.mli @@ -0,0 +1,57 @@ +type bit = bool + +type 'a vect + +type nibble = [`Four] vect +type byte7 = [`Seven] vect +type byte = [`Eight] vect +type word = [`Sixteen] vect +type word11 = [`Eleven] vect + +type sizes = [ `Four | `Seven | `Eight | `Eleven | `Sixteen ] + +val mk_nibble: bit -> bit -> bit -> bit -> nibble +val from_nibble: nibble -> bit * bit * bit * bit +val mk_byte7: bit -> bit -> bit -> nibble -> byte7 +val from_byte7: byte7 -> bit * bit * bit * nibble +val mk_byte: nibble -> nibble -> byte +val mk_byte_from_bits: ((bit * bit * bit * bit) * (bit * bit * bit * bit)) -> byte +val from_byte: byte -> nibble * nibble +val bits_of_byte: byte -> ((bit * bit * bit * bit) * (bit * bit * bit * bit)) +val mk_word: byte -> byte -> word +val from_word: word -> byte * byte +val mk_word11: bit -> bit -> bit -> byte -> word11 +val from_word11: word11 -> bit * bit * bit * byte + +val get_bit: 'a vect -> int -> bit +val set_bit: 'a vect -> int -> bit -> 'a vect + +val int_of_vect: 'a vect -> int +val vect_of_int: int -> ([< sizes] as 'a) -> 'a vect +val string_of_bit: bit -> string +val string_of_vect: 'a vect -> string +val hex_string_of_vect: 'a vect -> string + +val (-&-): 'a vect -> 'a vect -> 'a vect +val (-|-): 'a vect -> 'a vect -> 'a vect +val (-^-): 'a vect -> 'a vect -> 'a vect +val complement: 'a vect -> 'a vect + +val iter_bits: (bit -> string) -> 'a vect -> string +val map_bits: (bit -> bit) -> 'a vect -> 'a vect +val map2_bits: (bit -> bit -> bit) -> 'a vect -> 'a vect -> 'a vect + +val string_of_vect: 'a vect -> string + +val zero: [< `Four | `Seven | `Eight | `Eleven | `Sixteen ] -> [< `Four | `Seven | `Eight | `Eleven | `Sixteen ] vect + +val half_add: 'a vect -> 'a vect -> bit * 'a vect +val full_add: 'a vect -> 'a vect -> bit -> bit * 'a vect +val sign_extension: byte -> word + +val rotate_left : 'a vect -> 'a vect +val rotate_right : 'a vect -> 'a vect +val shift_right : 'a vect -> 'a vect +val shift_left : 'a vect -> 'a vect + +module WordMap: Map.S with type key = word diff --git a/src/ASM/I8051.ml b/src/ASM/I8051.ml new file mode 100644 index 0000000..5174ae1 --- /dev/null +++ b/src/ASM/I8051.ml @@ -0,0 +1,209 @@ + +let int_size = 1 +let ptr_size = 2 +let alignment = None + +type opaccs = + | Mul + | DivuModu + +type op1 = + | Cmpl + | Inc + +type op2 = + | Add + | Addc + | Sub + | And + | Or + | Xor + +let print_opaccs = function + | Mul -> "mul" + | DivuModu -> "divu" + +let print_op1 = function + | Cmpl -> "cmpl" + | Inc -> "inc" + +let print_op2 = function + | Add -> "add" + | Addc -> "addc" + | Sub -> "sub" + | And -> "and" + | Or -> "or" + | Xor -> "xor" + + +module Eval (Val : Value.S) = struct + + let eval_int_mul size i1 i2 = + let module Int = IntValue.Make (struct let size = 2 * size end) in + match Int.break (Int.mul i1 i2) 2 with + | res1 :: res2 :: _ -> (Val.of_int_repr res1, Val.of_int_repr res2) + | _ -> assert false (* should be impossible *) + + let eval_mul v1 v2 = + if Val.is_int v1 && Val.is_int v2 then + eval_int_mul Val.int_size (Val.to_int_repr v1) (Val.to_int_repr v2) + else (Val.undef, Val.undef) + + let opaccs op v1 v2 = match op with + | Mul -> eval_mul v1 v2 + | DivuModu -> (Val.divu v1 v2, Val.modulou v1 v2) + + let op1 = function + | Cmpl -> Val.cmpl + | Inc -> Val.succ + + let op2 carry op2 v1 v2 = match op2 with + | Add -> Val.add_and_of v1 v2 + | Addc -> + let (res1, of1) = Val.add_and_of v1 v2 in + let (res2, of2) = Val.add_and_of res1 carry in + (res2, Val.or_op of1 of2) + | Sub -> + let (res1, uf1) = Val.sub_and_uf v1 v2 in + let (res2, uf2) = Val.sub_and_uf res1 carry in + (res2, Val.or_op uf1 uf2) + | And -> (Val.and_op v1 v2, carry) + | Or -> (Val.or_op v1 v2, carry) + | Xor -> (Val.xor v1 v2, carry) + +end + + +type register = int +let compare_reg = Pervasives.compare +let eq_reg r1 r2 = r1 = r2 + +module OrdReg = struct type t = register let compare = compare_reg end +module RegisterSet = Set.Make (OrdReg) +module RegisterMap = Map.Make (OrdReg) + +let r00 = 0 +let r01 = 1 +let r02 = 2 +let r03 = 3 +let r04 = 4 +let r05 = 5 +let r06 = 6 +let r07 = 7 +let r10 = 8 +let r11 = 9 +let r12 = 10 +let r13 = 11 +let r14 = 12 +let r15 = 13 +let r16 = 14 +let r17 = 15 +let r20 = 16 +let r21 = 17 +let r22 = 18 +let r23 = 19 +let r24 = 20 +let r25 = 21 +let r26 = 22 +let r27 = 23 +let r30 = 24 +let r31 = 25 +let r32 = 26 +let r33 = 27 +let r34 = 28 +let r35 = 29 +let r36 = 30 +let r37 = 31 +let a = 224 +let b = 240 +let dpl = 130 +let dph = 131 +let carry = -1 (* only used for the liveness analysis. *) + +let print_register = function + | 0 -> "R00" + | 1 -> "R01" + | 2 -> "R02" + | 3 -> "R03" + | 4 -> "R04" + | 5 -> "R05" + | 6 -> "R06" + | 7 -> "R07" + | 8 -> "R10" + | 9 -> "R11" + | 10 -> "R12" + | 11 -> "R13" + | 12 -> "R14" + | 13 -> "R15" + | 14 -> "R16" + | 15 -> "R17" + | 16 -> "R20" + | 17 -> "R21" + | 18 -> "R22" + | 19 -> "R23" + | 20 -> "R24" + | 21 -> "R25" + | 22 -> "R26" + | 23 -> "R27" + | 24 -> "R30" + | 25 -> "R31" + | 26 -> "R32" + | 27 -> "R33" + | 28 -> "R34" + | 29 -> "R35" + | 30 -> "R36" + | 31 -> "R37" + | 224 -> "A" + | 240 -> "B" + | 130 -> "DPL" + | 131 -> "DPH" + | _ -> assert false (* impossible *) + +let sst = r10 +let st0 = r02 +let st1 = r03 +let st2 = r04 +let st3 = r05 +let sts = [st0 ; st1 ; st2 ; st3] +let spl = r06 +let sph = r07 +let rets = [dpl ; dph ; r00 ; r01] + +let spl_addr = spl +let spl_init = 255 +let sph_addr = sph +let sph_init = 255 +let isp_addr = 129 +let isp_init = 47 + +let set_of_list rl = List.fold_right RegisterSet.add rl RegisterSet.empty +let list_of_set rs = RegisterSet.fold (fun r l -> r :: l) rs [] + +let registers = + set_of_list [r00 ; r01 ; r02 ; r03 ; r04 ; r05 ; r06 ; r07 ; + r10 ; r11 ; r12 ; r13 ; r14 ; r15 ; r16 ; r17 ; + r20 ; r21 ; r22 ; r23 ; r24 ; r25 ; r26 ; r27 ; + r30 ; r31 ; r32 ; r33 ; r34 ; r35 ; r36 ; r37 ; + a ; b ; dpl ; dph ; spl ; sph ; st0 ; st1 ; sst] + +let forbidden = + set_of_list + [a ; b ; dpl ; dph ; spl ; sph ; st0 ; st1 ; st2 ; st3 ; sst] + +let parameters = + let params = set_of_list [r30 ; r31 ; r32 ; r33 ; r34 ; r35 ; r36 ; r37] in + list_of_set (RegisterSet.diff params forbidden) + +let callee_saved = + RegisterSet.diff (set_of_list [r20 ; r21 ; r22 ; r23 ; r24 ; r25 ; r26 ; r27]) + forbidden +let caller_saved = + RegisterSet.diff (RegisterSet.diff registers callee_saved) forbidden +let allocatable = RegisterSet.diff registers forbidden + +let reg_addr r = `DIRECT (BitVectors.vect_of_int r `Eight) + +(* External RAM size *) +let ext_ram_size = MiscPottier.pow 2 16 +(* Internal RAM size *) +let int_ram_size = MiscPottier.pow 2 8 diff --git a/src/ASM/I8051.mli b/src/ASM/I8051.mli new file mode 100644 index 0000000..420cb8d --- /dev/null +++ b/src/ASM/I8051.mli @@ -0,0 +1,76 @@ + +include Arch.S + +type opaccs = + | Mul + | DivuModu + +type op1 = + | Cmpl + | Inc + +type op2 = + | Add + | Addc + | Sub + | And + | Or + | Xor + +val print_opaccs : opaccs -> string +val print_op1 : op1 -> string +val print_op2 : op2 -> string + +module Eval (Val : Value.S) : sig + val opaccs : opaccs -> Val.t -> Val.t -> + (Val.t (* first result (ACC) *) * + Val.t (* second result (BACC) *)) + val op1 : op1 -> Val.t -> Val.t + val op2 : Val.t (* carry *) -> op2 -> Val.t -> Val.t -> + (Val.t (* returned value *) * Val.t (* new carry value *)) +end + +(* Not supported: signed division, signed modulo, shift operations. *) + +type register +val compare_reg : register -> register -> int +val eq_reg : register -> register -> bool + +module RegisterSet : Set.S with type elt = register +module RegisterMap : Map.S with type key = register + +val a : register +val b : register +val dpl : register +val dph : register +val spl : register +val sph : register +val st0 : register +val st1 : register +val st2 : register +val st3 : register +val sts : register list +val rets : register list +val sst : register +val carry : register (* only used for the liveness analysis *) + +val spl_addr : int +val spl_init : int +val sph_addr : int +val sph_init : int +val isp_addr : int +val isp_init : int + +val registers : RegisterSet.t +val parameters : register list +val callee_saved : RegisterSet.t +val caller_saved : RegisterSet.t +val allocatable : RegisterSet.t +val forbidden : RegisterSet.t + +val print_register : register -> string + +val reg_addr : register -> [> ASM.direct] + +val ext_ram_size : int +val int_ram_size : int diff --git a/src/ASM/IntelHex.ml b/src/ASM/IntelHex.ml new file mode 100644 index 0000000..b71289a --- /dev/null +++ b/src/ASM/IntelHex.ml @@ -0,0 +1,293 @@ +open BitVectors;; +open ASM;; +open Util;; +open Parser;; +open Printf;; + +exception WrongFormat of string + +type intel_hex_entry_type = + Data + | End + | ExtendedSeg + | ExtendedLinear +;; + +type intel_hex_entry = +{ + record_length: byte; + record_addr: word; + record_type: intel_hex_entry_type; + data_field: byte list; + data_checksum: byte +} +;; + +type intel_hex_format = intel_hex_entry list;; + +let hex_digit_of_char = + function + '0' -> 0 | '1' -> 1 | '2' -> 2 + | '3' -> 3 | '4' -> 4 | '5' -> 5 + | '6' -> 6 | '7' -> 7 | '8' -> 8 + | '9' -> 9 | 'A' -> 10 | 'B' -> 11 + | 'C' -> 12 | 'D' -> 13 | 'E' -> 14 + | 'F' -> 15 | 'a' -> 10 | 'b' -> 11 + | 'c' -> 12 | 'd' -> 13 | 'e' -> 14 + | 'f' -> 15 | _ -> assert false + +let intel_hex_entry_type_of_int = + function + 0 -> Data + | 1 -> End + | 2 -> ExtendedSeg + | 4 -> ExtendedLinear + | _ -> assert false +;; + +let int_of_intel_hex_entry_type = + function + Data -> 0 + | End -> 1 + | ExtendedSeg -> 2 + | ExtendedLinear -> 4 +;; + +let prs_nibble = + prs_hex_digit >>= +fun a -> return $ vect_of_int (hex_digit_of_char a) `Four +;; + +let prs_byte = + prs_nibble >>= +fun a -> prs_nibble >>= +fun b -> return $ mk_byte a b +;; + +let prs_word = + prs_byte >>= +fun a -> prs_byte >>= +fun b -> return $ mk_word a b +;; + +let prs_length = prs_byte;; +let prs_data len = prs_exact len prs_byte +let prs_checksum = prs_byte;; +let prs_addr = prs_word;; + +let prs_type = + prs_hex_digit >>= +fun a -> prs_hex_digit >>= +fun b -> + let a_as_hex = hex_digit_of_char a in + let b_as_hex = hex_digit_of_char b in +(*CSC: is next line correct??? *) + let total = a_as_hex + b_as_hex in + return $ intel_hex_entry_type_of_int total + +let add_bytes v = + let r = List.rev v in + let rec aux (cry, bs) = + function + [] -> (cry, bs) + | hd::tl -> + aux (half_add hd bs) tl + in + aux (false, (vect_of_int 0 `Eight)) r + +let calculate_checksum hex_entry = + let ty = (flip vect_of_int $ `Eight) $ int_of_intel_hex_entry_type hex_entry.record_type in + let addr1,addr2 = from_word hex_entry.record_addr in + let _, total = add_bytes (hex_entry.record_length :: addr1 :: addr2 :: ty :: hex_entry.data_field) in + let _,total = half_add (vect_of_int 1 `Eight) $ complement total in + total + +let checksum_valid hex_entry = + let total = calculate_checksum hex_entry in + hex_entry.data_checksum = total + +let prs_intel_hex_record = + prs_char ':' >>= +fun _ -> prs_length >>= +fun b -> prs_addr >>= +fun c -> prs_type >>= +fun d -> prs_data (int_of_vect b) >>= +fun e -> prs_checksum >>= +fun f -> prs_eof >>= +fun _ -> + let entry = + { record_length = b; + record_addr = c; + record_type = d; + data_field = e; + data_checksum = f } + in + if checksum_valid entry then + return entry + else + prs_zero +;; + +let prs_intel_hex_format = + prs_sep_by prs_intel_hex_record (prs_char '\n') +;; + +let intel_hex_format_of_string s = + let chars = char_list_of_string s in + match prs_intel_hex_format chars with + [] -> None + | (prs,_)::_ -> Some prs + +let string_of_intel_hex_entry entry = + let b = Buffer.create 655536 in + let length_string = hex_string_of_vect entry.record_length in + let addr_string = Printf.sprintf "%04X" (int_of_vect entry.record_addr) in + let checksum_string = Printf.sprintf "%02X" (int_of_vect entry.data_checksum) in + let type_string = Printf.sprintf "%02d" (int_of_intel_hex_entry_type entry.record_type) in + List.iter (Buffer.add_string b) + [ + ":"; length_string; addr_string; type_string + ]; + List.iter (fun e -> Buffer.add_string b (hex_string_of_vect e)) entry.data_field; + Buffer.add_string b checksum_string; + Buffer.contents b +;; + +let string_of_intel_hex_format f = + let strs = List.map string_of_intel_hex_entry f in + let rec aux = + function + [] -> "" + | [e] -> e + | hd::tl -> hd ^ "\n" ^ aux tl + in + aux strs + +let intel_hex_of_file path = + let fd = open_in path in + let rec aux () = + match try Some (input_line fd) with End_of_file -> None with + None -> [] + | Some txt -> + let read = prs_intel_hex_record (Parser.chars_of_string txt) in + let read = + match read with + [x,[]] -> x + | _ -> raise (WrongFormat txt) + in + read::aux () + in + aux () +;; + +let rec load_from mem addr = + function + [] -> mem + | he::tl -> + load_from (Physical.WordMap.add addr he mem) (snd (BitVectors.half_add addr (BitVectors.vect_of_int 1 `Sixteen))) tl +;; + +let process_intel_hex = + let rec aux mem = + function + [] -> assert false + | he::tl -> + match he.record_type with + End -> assert (tl = []); mem + | Data -> aux (load_from mem he.record_addr he.data_field) tl + | _ -> assert false + in + aux Physical.WordMap.empty +;; + +(* DPM: this needs some comment: + We aim to extract code memory into segmented lists of bytes, with a maximum + length (chunk_size). The code memory map has a fixed size (max_addressable) + on the 8051. Further, the chunks we extract get segmented when we find an + unitialized zone in the code memory. +*) +let export_code_memory chunk_size max_addressable code_mem = + let rec aux chunk address start_address rbuff lbuff = + if address = max_addressable then + (start_address, List.rev rbuff)::lbuff + else if chunk = 0 then + aux chunk_size address address [] ((start_address, List.rev rbuff)::lbuff) + else + let code = Physical.WordMap.find (vect_of_int address `Sixteen) code_mem in + aux (chunk - 1) (address + 1) start_address (code::rbuff) lbuff + in + List.rev (aux chunk_size 0 0 [] []) +;; + +let clean_exported_code_memory = List.filter (fun x -> snd x <> []) +;; + +let calculate_data_checksum (record_length, record_addr, record_type, data_field) = + let ty = (flip vect_of_int $ `Eight) $ int_of_intel_hex_entry_type record_type in + let addr1,addr2 = from_word record_addr in + let _, total = add_bytes (record_length :: addr1 :: addr2 :: ty :: data_field) in + let _,total = half_add (vect_of_int 0 `Eight) $ complement total in + total +;; + +let process_exported_code_memory = + List.map (fun x -> + let record_length = vect_of_int (List.length (snd x)) `Eight in + let record_addr = vect_of_int (fst x) `Sixteen in + let record_type = Data in + let data_field = snd x in + let temp_record = + { record_length = record_length; + record_addr = record_addr; + record_type = record_type; + data_field = data_field; + data_checksum = zero `Eight + } in + { temp_record with data_checksum = calculate_checksum temp_record }) +;; + +let rec zeros len = + if len = 0 then + [] + else + vect_of_int 0 `Eight :: zeros (len - 1) + +let post_process_exported_code_memory intel_hex = + let reversed = List.rev intel_hex in + let rec aux hex = + match hex with + [] -> [] + | he::tl -> + if he.record_type = End then + aux tl + else if he.record_type = Data then + if he.data_field = zeros (int_of_vect he.record_length) then + aux tl + else + he::(aux tl) + else + tl + in + List.rev (aux reversed) + +let pack_exported_code_memory chunk_size max_addressable code_mem = + let export = export_code_memory chunk_size max_addressable code_mem in + let cleaned = clean_exported_code_memory export in + let processed = process_exported_code_memory cleaned in + let postprocessed = post_process_exported_code_memory processed in + let end_buffer = + [{ record_length = zero `Eight; + record_addr = zero `Sixteen; + record_type = End; + data_field = []; + data_checksum = vect_of_int 255 `Eight + }] in + postprocessed @ end_buffer +;; + +let file_of_intel_hex path fmt = + let str_fmt = string_of_intel_hex_format fmt in + let channel = open_out path in + fprintf channel "%s\n" str_fmt; + close_out channel +;; diff --git a/src/ASM/IntelHex.mli b/src/ASM/IntelHex.mli new file mode 100644 index 0000000..85edb10 --- /dev/null +++ b/src/ASM/IntelHex.mli @@ -0,0 +1,17 @@ +open BitVectors;; +open ASM;; +open Parser;; + +exception WrongFormat of string + +type intel_hex_format + +val string_of_intel_hex_format: intel_hex_format -> string +val prs_intel_hex_format: intel_hex_format parser + +val intel_hex_of_file: string -> intel_hex_format +val file_of_intel_hex: string -> intel_hex_format -> unit +val process_intel_hex: intel_hex_format -> Physical.WordMap.map + +val pack_exported_code_memory: int -> int -> Physical.WordMap.map -> intel_hex_format +val file_of_intel_hex: string -> intel_hex_format -> unit diff --git a/src/ASM/MIPS.ml b/src/ASM/MIPS.ml new file mode 100644 index 0000000..10232a8 --- /dev/null +++ b/src/ASM/MIPS.ml @@ -0,0 +1,214 @@ + +let int_size = 4 +let ptr_size = 4 +let alignment = Some 4 + +let insts = [AST.IOp_notbool] + +(* +(* Adapted from Pottier's PP compiler *) + +(* A machine word is 4 bytes. *) + +let word = + 4l + +(* The MIPS CPU contains 32 general-purpose 32-bit registers + that are numbered 0 to 31. + + Register 0, known as [$0], always contains the hardwired value 0. + + Register 1, known as [$at], is conventionally reserved for use by + the assembler for expanding certain pseudo-instructions into actual + hardware instructions. This means that we cannot use it. + + Registers 2 and 3, known as [$v0] and [$v1], are normally used to + return values from functions. In our compiler, only [$v0] is used + for this purpose. We use [$v1] as a reserved register for spilling + and refer to it as [$st0]. + + Registers 4 to 7, known as [$a0] to [$a3], are used to pass the + first four arguments to functions. Remaining arguments are passed + on the stack. + + Registers 8 to 15, 24 and 25, known as [$t0] to [$t9], are + caller-saved registers. + + Registers 16 to 23, known as [$s0] to [$s7], are callee-saved + registers. + + Registers 26 and 27, known as [$k0] and [$k1], are reserved for use + by the operating system kernel. + + Register 28, known as [$gp] for global pointer, points into the + middle of a 64K block of memory in the heap that holds constants + and global variables. + + Register 29, known as [$sp] for stack pointer, points to the last + location in use on the stack. + + Register 30, known as [$fp] for frame pointer, is used in our + compiler as a reserved register for spilling. We refer to it as + [$st1]. + + Register 31, known as [$ra], contains the return address for the + current function. It is written by the [jal] instruction. *) + +type register = + int + +let equal : register -> register -> bool = (=) + +module RegisterSet = struct + + include Set.Make (struct + type t = register + let compare = (-) + end) + + let disjoint s1 s2 = + is_empty (inter s1 s2) + + let of_list rs = + List.fold_right add rs empty + +end + +module RegisterMap = struct + + include Map.Make (struct + type t = register + let compare = (-) + end) + + let lift f s = + RegisterSet.fold (fun x m -> + add x (f x) m + ) s empty + +end + +(* Naming convention. *) + +let zero = + 0 + +let v0, v1, a0, a1, a2, a3 = + 2, 3, 4, 5, 6, 7 + +let t0, t1, t2, t3, t4, t5, t6, t7, t8, t9 = + 8, 9, 10, 11, 12, 13, 14, 15, 24, 25 + +let s0, s1, s2, s3, s4, s5, s6 = + 16, 17, 18, 19, 20, 21, 22 + +let gp_mips = + 23 (* s7 *) + +let gp_gnu = + 28 + +let sp, fp = + 29, 30 + +let ra = + 31 + +let st0, st1 = + v1, fp + +let print = function + | 0 -> + "zero" + | 1 -> + "at" + | 2 -> + "v0" + | 3 -> + "v1" + | 4 -> + "a0" + | 5 -> + "a1" + | 6 -> + "a2" + | 7 -> + "a3" + | 8 -> + "t0" + | 9 -> + "t1" + | 10 -> + "t2" + | 11 -> + "t3" + | 12 -> + "t4" + | 13 -> + "t5" + | 14 -> + "t6" + | 15 -> + "t7" + | 24 -> + "t8" + | 25 -> + "t9" + | 16 -> + "s0" + | 17 -> + "s1" + | 18 -> + "s2" + | 19 -> + "s3" + | 20 -> + "s4" + | 21 -> + "s5" + | 22 -> + "s6" + | 23 -> + "s7" + | 28 -> + "gp" + | 29 -> + "sp" + | 30 -> + "fp" + | 31 -> + "ra" + | _ -> + assert false + +let print2 r = string_of_int r + +(* Calling convention. *) + +let parameters = + [ a0; a1; a2; a3 ] + +let result = + v0 + +let caller_saved = + RegisterSet.of_list ( + [ v0; a0; a1; a2; a3; t0; t1; t2; t3; t4; t5; t6; t7; t8; t9; ra ] + ) + +let callee_saved = + RegisterSet.of_list ( + [ s0; s1; s2; s3; s4; s5; s6 ] + ) + +let allocatable = + (* The register [$zero] can be viewed as allocatable, but this requires building + ad hoc interference edges -- see [Build]. In TD7, in order to simplify things, + this register is made non-allocatable. *) + RegisterSet.add zero (RegisterSet.union caller_saved callee_saved) + +let registers = + RegisterSet.union allocatable + (RegisterSet.of_list [ gp_mips; gp_gnu; sp; st0; st1 ]) + +*) diff --git a/src/ASM/MIPS.mli b/src/ASM/MIPS.mli new file mode 100644 index 0000000..3823802 --- /dev/null +++ b/src/ASM/MIPS.mli @@ -0,0 +1,105 @@ + +include Arch.S + +(* +(* Adapted from Pottier's PP compiler *) + +(** This module defines the physical registers of the MIPS processor + and their conventional use. *) + +(* This is the size of a machine word in bytes. *) + +val word: int32 + +(* This is the type of hardware registers. *) + +type register + +val equal: register -> register -> bool +(* Names *) +val print: register -> string +(* Number *) +val print2: register -> string + +(* A list of the registers used for passing function parameters. *) + +val parameters: register list + +(* The register used for returning function results. *) + +val result: register + +(* The return address register. It is best thought of as a register + that is used to pass a parameter (namely, the return address). *) + +val ra: register + +(* The zero register always holds the value 0. Although it is a + special register, it is considered allocatable; see module [Zero] + for an explanation. *) + +val zero: register + +(* Sets of hardware registers. *) + +module RegisterSet : sig + include Set.S with type elt = register + val disjoint: t -> t -> bool + val of_list: elt list -> t +end + +(* Maps over hardware registers. *) + +module RegisterMap : sig + + include Map.S with type key = register + + (* [lift f s] turns the set [s] into a map where every element [x] + is mapped to [f x]. *) + + val lift: (key -> 'a) -> RegisterSet.t -> 'a t + +end + +(* A set of all allocatable hardware registers, that is, of all + registers that are available for use by the register allocator -- + as opposed to reserved for some fixed use. *) + +val allocatable: RegisterSet.t + +(* A set of all allocatable ``caller-saved'' hardware registers, that + is, of all allocatable registers that might be overwritten during a + function call. This includes the so-called ``caller-saved temporary + registers'' [$t0-$t9] as well as the registers used to implement + the calling convention, namely [$a0-$a3], [$v0], and [$ra]. *) + +val caller_saved: RegisterSet.t + +(* A set of all allocatable ``callee-saved'' hardware registers, that + is, of all allocatable registers that must be preserved by function + calls. *) + +val callee_saved: RegisterSet.t + +(* Two non-allocatable registers, reserved for transferring spilled + pseudo-registers to and from the stack. *) + +val st0: register +val st1: register + +(* The stack pointer register. *) + +val sp: register + +(* The global pointer register. *) + +val gp_mips: register +val gp_gnu: register + +(* A set of all registers that are used in the code that we generate. + This includes all allocatable registers, plus the four special + registers mentioned above. *) + +val registers: RegisterSet.t + +*) diff --git a/src/ASM/MIPSInterpret.ml b/src/ASM/MIPSInterpret.ml new file mode 100644 index 0000000..174f2b1 --- /dev/null +++ b/src/ASM/MIPSInterpret.ml @@ -0,0 +1,51 @@ + +let error_prefix = "MIPS interpret" +let error s = Error.global_error error_prefix (s ^ "\n") + + +let unop = function + | MIPSOps.UOpAddi i -> Value.add (Value.Val_int i) + | MIPSOps.UOpSlti i -> (fun v -> Value.cmp_lt v (Value.Val_int i)) + | MIPSOps.UOpSltiu i -> (fun v -> Value.cmp_lt_u v (Value.Val_int i)) + | MIPSOps.UOpAndi i -> Value.and_op (Value.Val_int i) + | MIPSOps.UOpOri i -> Value.or_op (Value.Val_int i) + | MIPSOps.UOpXori i -> Value.xor (Value.Val_int i) + | MIPSOps.UOpNeg -> Value.negint + | MIPSOps.UOpNot -> Value.notint + +let binop = function + | MIPSOps.OpAdd -> Value.add + | MIPSOps.OpSub -> Value.sub + | MIPSOps.OpMul -> Value.mul + | MIPSOps.OpDiv -> Value.div + | MIPSOps.OpDivu -> Value.divu + | MIPSOps.OpModu -> Value.modulo + | MIPSOps.OpLt -> Value.cmp_lt + | MIPSOps.OpLtu -> Value.cmp_lt_u + | MIPSOps.OpLe -> Value.cmp_le + | MIPSOps.OpLeu -> Value.cmp_le_u + | MIPSOps.OpGt -> Value.cmp_gt + | MIPSOps.OpGtu -> Value.cmp_gt_u + | MIPSOps.OpGe -> Value.cmp_ge + | MIPSOps.OpGeu -> Value.cmp_ge_u + | MIPSOps.OpEq -> Value.cmp_eq + | MIPSOps.OpNe -> Value.cmp_ne + | MIPSOps.OpSllv -> Value.shl + | MIPSOps.OpSrav -> Value.shr + | MIPSOps.OpSrlv -> Value.shru + | MIPSOps.OpAnd -> Value.and_op + | MIPSOps.OpOr -> Value.or_op + | MIPSOps.OpXor -> Value.xor + +let fun_of_uncon = function + | MIPSOps.UConGez -> Value.cmp_ge + | MIPSOps.UConGtz -> Value.cmp_gt + | MIPSOps.UConLez -> Value.cmp_le + | MIPSOps.UConLtz -> Value.cmp_lt + +let uncon con = (fun_of_uncon con) (Value.Val_int 0l) + + +let bincon = function + | MIPSOps.ConEq -> Value.cmp_eq + | MIPSOps.ConNe -> Value.cmp_ne diff --git a/src/ASM/MIPSInterpret.mli b/src/ASM/MIPSInterpret.mli new file mode 100644 index 0000000..df81c2e --- /dev/null +++ b/src/ASM/MIPSInterpret.mli @@ -0,0 +1,10 @@ +(* Adapted from Pottier's PP compiler *) + +(** This module provides interpretations of the MIPS operators, for + use in building interpreters or in the compiler itself. *) + +val unop: MIPSOps.unop -> (Value.t -> Value.t) +val binop: MIPSOps.binop -> (Value.t -> Value.t -> Value.t) + +val uncon: MIPSOps.uncon -> (Value.t -> Value.t) +val bincon: MIPSOps.bincon -> (Value.t -> Value.t -> Value.t) diff --git a/src/ASM/MIPSOps.mli b/src/ASM/MIPSOps.mli new file mode 100644 index 0000000..b2f66cb --- /dev/null +++ b/src/ASM/MIPSOps.mli @@ -0,0 +1,113 @@ + +(** This module defines the operators and branch conditions of the + MIPS processor. *) + +(* Pasted from Pottier's PP compiler *) + +(* These type definitions document the target processor's operators + and branch conditions. Here, the target processor is the MIPS. *) + +(* The MIPS manual explains that some instructions are actual machine + instructions, while others are pseudo-instructions, which are + expanded away by the assembler. Do we need to be aware of the + distinction? + + Ignoring the distinction is interesting. There are several + processors in the MIPS family, and the distinction between actual + instructions and pseudo-instructions might vary with the + processor. For instance, a future member of the MIPS family might + implement more instructions in hardware than its predecessors. + + On the other hand, ignoring the distinction means that we cannot + use the hardware register [$at], which is reserved by the assembler + for translating some pseudo-instructions into actual instructions. + + Our approach is to follow standard practice and to exploit + pseudo-instructions when desired. This means that we cannot use + register [$at]. *) + +(* Immediate constants, used in the definition of some operators. They + must fit in 16 bits. *) + +type immediate16 = + int32 + +(* Offsets, used as part of addressing modes. They are measured in + bytes and must fit in 16 bits. *) + +type offset = + immediate16 + +(* Unary (integer arithmetic) operators. *) + +type unop = + | UOpAddi of immediate16 + | UOpSlti of immediate16 (* set on less than immediate *) + | UOpSltiu of immediate16 + | UOpAndi of immediate16 + | UOpOri of immediate16 + | UOpXori of immediate16 + | UOpNeg + | UOpNot + +(* Binary (integer arithmetic or integer comparison) operators. Among + the comparison operators, only [OpLt] corresponds to a MIPS binary + comparison instruction, namely [slt]. All others correspond to + pseudo-instructions. They are exploited because they are + convenient. *) + +type binop = + | OpAdd + | OpSub + | OpMul + | OpDiv + | OpDivu + | OpModu + | OpLt + | OpLtu + | OpLe + | OpLeu + | OpGt + | OpGtu + | OpGe + | OpGeu + | OpEq + | OpNe + | OpSllv + | OpSrav + | OpSrlv + | OpAnd + | OpOr + | OpXor + +(* Unary branch conditions. *) + +type uncon = + + (* Greater than or equal to zero. *) + + | UConGez + + (* Greater than zero. *) + + | UConGtz + + (* Less than or equal to zero. *) + + | UConLez + + (* Less than zero. *) + + | UConLtz + +(* Binary branch conditions. *) + +and bincon = + + (* Equal. *) + + | ConEq + + (* Not equal. *) + + | ConNe diff --git a/src/ASM/Parser.ml b/src/ASM/Parser.ml new file mode 100644 index 0000000..738900e --- /dev/null +++ b/src/ASM/Parser.ml @@ -0,0 +1,89 @@ +open Util;; +open BitVectors;; +open ASM;; + +let chars_of_string s = + let len = String.length s in + let rec aux n = + if n < len then + s.[n] :: aux (n + 1) + else + [] + in + aux 0 +;; + +type 'a parser = char list -> ('a * char list) list + +let return x = + fun y -> [(x, y)] + +let (>>=) f g = + fun x -> + let frst = f x in + List.concat $ List.map (fun (a, x') -> (g a) x') frst + +let prs_zero = fun _ -> [] +;; + +let prs_eof = function [] -> [(),[]] | _ -> [];; + +let prs_predicate p = + function + hd::tl -> + if p hd then + [(hd, tl)] + else + [] + | [] -> [] +;; + +let (++) f g = + fun x -> + f x @ g x +;; + +let (+++) f g = + fun x -> + match (f ++ g) x with + [] -> [] + | hd::_ -> [hd] +;; + +let rec prs_many p = + prs_many1 p +++ return [] +and prs_many1 p = + p >>= +fun a -> prs_many p >>= +fun b -> return $ a::b +;; + +let rec prs_exact i p = + if i = 0 then + return [] + else + p >>= +fun a -> prs_exact (i - 1) p >>= +fun b -> return $ a::b + +let rec prs_sep_by p s = + prs_sep_by1 p s +++ return [] +and prs_sep_by1 p s = + p >>= +fun a -> prs_many $ (s >>= fun _ -> p) >>= +fun b -> return $ a::b + + +let prs_char c = prs_predicate (fun x -> x = c) +;; + +let prs_hex_digit = + prs_predicate + (fun x -> + x = '0' || x = '1' || x = '2' || x = '3' || + x = '4' || x = '5' || x = '6' || x = '7' || + x = '8' || x = '9' || x = 'A' || x = 'B' || + x = 'C' || x = 'D' || x = 'E' || x = 'F' || + x = 'a' || x = 'b' || x = 'c' || x = 'd' || + x = 'e' || x = 'f') + diff --git a/src/ASM/Parser.mli b/src/ASM/Parser.mli new file mode 100644 index 0000000..a6a2ac5 --- /dev/null +++ b/src/ASM/Parser.mli @@ -0,0 +1,19 @@ +val chars_of_string: string -> char list + +type 'a parser = char list -> ('a * char list) list + +val return: 'a -> 'a parser +val (>>=): 'a parser -> ('a -> 'b parser) -> 'b parser +val prs_zero: 'a parser +val prs_eof: unit parser +val prs_predicate: (char -> bool) -> char parser;; +val prs_many1: 'a parser -> ('a list) parser;; +val prs_many: 'a parser -> ('a list) parser;; +val prs_exact: int -> 'a parser -> ('a list) parser;; +val prs_sep_by: 'a parser -> 'b parser -> ('a list) parser;; +val prs_sep_by1: 'a parser -> 'b parser -> ('a list) parser;; +val (++): 'a parser -> 'a parser -> 'a parser;; +val (+++): 'a parser -> 'a parser -> 'a parser;; + +val prs_char: char -> char parser;; +val prs_hex_digit: char parser;; diff --git a/src/ASM/Physical.ml b/src/ASM/Physical.ml new file mode 100644 index 0000000..39feafe --- /dev/null +++ b/src/ASM/Physical.ml @@ -0,0 +1,112 @@ +open BitVectors;; + +exception Byte7_conversion + +module type Map = + sig + type key + type map + val empty : map + val find : key -> map -> byte + val add : key -> byte -> map -> map + val fold : (key -> byte -> 'b -> 'b) -> map -> 'b -> 'b + val equal: (byte -> byte -> bool) -> map -> map -> bool + end +;; + +module Byte7Map : Map with type key = byte7 = +struct + include Map.Make (struct type t = byte7 let compare = Pervasives.compare end) + type map = byte t + let find k m = + try + find k m + with Not_found -> zero `Eight + let fold = fold + let equal = equal +end;; + +module WordMap : Map with type key = word = +struct + include Map.Make (struct type t = word let compare = Pervasives.compare end) + type map = byte t + let find k m = + try + find k m + with Not_found -> zero `Eight + let fold = fold + let equal = equal +end;; + +let int_of_bit = + function + false -> 0 + | true -> 1 + +let add8_with_c (b1 : [`Eight] vect) (b2 : [`Eight] vect) (c : bit) = + let n1 = int_of_vect b1 in + let n2 = int_of_vect b2 in + let c = int_of_bit c in + let res = n1 + n2 + c in + let ac = n1 mod 16 + n2 mod 16 + c >= 16 in + let c6 = n1 mod 128 + n2 mod 128 + c >= 128 in + let res,c = res mod 256, res >= 256 in + let ov = c <> c6 in + vect_of_int res `Eight,c,ac,ov +;; + +let add16_with_c (b1 : [`Sixteen] vect) (b2 : [`Sixteen] vect) (c : bit) = + let n1 = int_of_vect b1 in + let n2 = int_of_vect b2 in + let c = int_of_bit c in + let res = n1 + n2 + c in + let ac = n1 mod 256 + n2 mod 256 + c >= 256 in + let c6 = n1 mod 2097152 + n2 mod 2097152 + c >= 2097152 in + let res,c = res mod 4194304, res >= 4194304 in + let ov = c <> c6 in + vect_of_int res `Sixteen,c,ac,ov +;; + +let subb8_with_c (b1 : [`Eight] vect) (b2 : [`Eight] vect) (c : bit) = + let n1 = int_of_vect b1 in + let n2 = int_of_vect b2 in + let c = int_of_bit c in + let res = n1 - n2 - c in + let ac = n1 mod 16 - n2 mod 16 - c < 0 in + let c6 = n1 mod 128 - n2 mod 128 - c < 0 in + let res,c = + if res >= 0 then res,false + else n1 + 256 - n2 - c, true in + let ov = c <> c6 in + (vect_of_int res `Eight,c,ac,ov) +;; + +let dec b = + let res = int_of_vect b - 1 in + if res < 0 then vect_of_int 255 `Eight + else vect_of_int res `Eight +;; + +let inc b = + let res = int_of_vect b + 1 in + if res > 255 then (vect_of_int 0 `Eight : byte) + else (vect_of_int res `Eight : byte) +;; + +let byte7_of_bit b = + [false;false;false;false;false;false;b] +;; + +let byte_of_byte7 = + function + ([b1;b2;b3]::n) -> [false;b1;b2;b3]::n + | _ -> assert false +;; + +let addr16_of_addr11 pc a = + let pc_upper, _ = from_word pc in + let n1, n2 = from_byte pc_upper in + let (b1,b2,b3,b) = from_word11 a in + let (p1,p2,p3,p4),(p5,_,_,_) = from_nibble n1, from_nibble n2 in + mk_word (mk_byte (mk_nibble p1 p2 p3 p4) (mk_nibble p5 b1 b2 b3)) b +;; diff --git a/src/ASM/Physical.mli b/src/ASM/Physical.mli new file mode 100644 index 0000000..2dcccd2 --- /dev/null +++ b/src/ASM/Physical.mli @@ -0,0 +1,31 @@ +open BitVectors;; + +exception Byte7_conversion + +module type Map = + sig + type key + type map + val empty : map + val find : key -> map -> byte + val add : key -> byte -> map -> map + val fold : (key -> byte -> 'b -> 'b) -> map -> 'b -> 'b + val equal: (byte -> byte -> bool) -> map -> map -> bool + end +;; + +module Byte7Map : Map with type key = byte7 +module WordMap : Map with type key = word + +val int_of_bit: bit -> int + +val subb8_with_c: + byte -> byte -> bit -> byte * bit * bit * bit (* -, c, ac, ov *) +val add8_with_c: + byte -> byte -> bit -> byte * bit * bit * bit +val add16_with_c: + word -> word -> bit -> word * bit * bit * bit +val dec: byte -> byte (* with roll-over *) +val inc: byte -> byte (* with roll-over *) + +val addr16_of_addr11: word -> word11 -> word diff --git a/src/ASM/Pretty.ml b/src/ASM/Pretty.ml new file mode 100644 index 0000000..8af5c8a --- /dev/null +++ b/src/ASM/Pretty.ml @@ -0,0 +1,113 @@ +open BitVectors;; +open ASM;; + +let pp_arg = + function + `A -> "A" + | `B -> "B" + | `C -> "C" + | `DPTR -> "DPTR" + | `ADDR11 x -> hex_string_of_vect x + | `ADDR16 x -> hex_string_of_vect x + | `DATA x -> "#0" ^ hex_string_of_vect x ^ "h" + | `DATA16 x -> "#0" ^ hex_string_of_vect x ^ "h" + | `BIT x -> "bit " ^ hex_string_of_vect (x: byte) + | `NBIT x -> "nbit " ^ hex_string_of_vect (x: byte) + | `REG (r1, r2, r3) -> "R" ^ string_of_int (int_of_vect (mk_nibble false r1 r2 r3)) + | `REL x -> hex_string_of_vect x + | `A_DPTR -> "@DPTR" + | `A_PC -> "@PC" + | `DIRECT x -> "0" ^ (hex_string_of_vect (x: byte)) ^ "h" + | `EXT_INDIRECT x -> "ext_indirect " ^ string_of_bool x + | `EXT_IND_DPTR -> "@DPTR" +(* DPM: weird: this seems to be reversed in mcu8051ide: change made. *) + | `INDIRECT x -> if not x then "@R0" else "@R1" + | `IND_DPTR -> "@DPTR" + | `Label s -> s +;; + +let pp_jump = + function + `CJNE (`U1 (a1,a2),a3) -> "cjne " ^ pp_arg a1 ^ ", " ^ pp_arg a2 ^ ", " ^ pp_arg a3 + | `CJNE (`U2 (a1,a2),a3) -> "cjne " ^ pp_arg a1 ^ ", " ^ pp_arg a2 ^ ", " ^ pp_arg a3 + | `DJNZ (a1,a2) -> "djnz " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `JB (a1,a2) -> "jb " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `JBC (a1,a2) -> "jbc " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `JC a1 -> "jc " ^ pp_arg a1 + | `JNB (a1,a2) -> "jnb " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `JNC a1 -> "jnc " ^ pp_arg a1 + | `JNZ a1 -> "jnz " ^ pp_arg a1 + | `JZ a1 -> "jz " ^ pp_arg a1 + +let pp_instruction = + function + `Label l -> l ^ ":" + | `Cost l -> l ^ ":" + | `Jmp j -> "ljmp " ^ j + | `Call j -> "lcall " ^ j + | `WithLabel i -> pp_jump i + | (#jump as i) -> pp_jump i + | `Mov (a1,a2) -> "mov " ^ pp_arg a1 ^ ", " ^ a2 + | `ACALL a1 -> "acall " ^ pp_arg a1 + | `ADD (a1,a2) -> "add " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `ADDC (a1,a2) -> "addc " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `AJMP a1 -> "ajmp " ^ pp_arg a1 + | `ANL (`U1 (a1,a2)) -> "anl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `ANL (`U2 (a1,a2)) -> "anl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `ANL (`U3 (a1,a2)) -> "anl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `CLR a1 -> "clr " ^ pp_arg a1 + | `CPL a1 -> "cpl " ^ pp_arg a1 + | `DA a1 -> "da " ^ pp_arg a1 + | `DEC a1 -> "dec " ^ pp_arg a1 + | `DIV (a1,a2) -> "div AB" + | `INC a1 -> "inc " ^ pp_arg a1 + | `JMP a1 -> "jmp " ^ pp_arg a1 + | `LCALL a1 -> "lcall " ^ pp_arg a1 + | `LJMP a1 -> "ljmp " ^ pp_arg a1 + | `MOV (`U1 (a1,a2)) -> "mov " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOV (`U2 (a1,a2)) -> "mov " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOV (`U3 (a1,a2)) -> "mov " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOV (`U4 (a1,a2)) -> "mov " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOV (`U5 (a1,a2)) -> "mov " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOV (`U6 (a1,a2)) -> "mov " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOVC (a1,a2) -> "movc " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOVX (`U1 (a1,a2)) -> "movx " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MOVX (`U2 (a1,a2)) -> "movx " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `MUL(a1, a2) -> "mul AB" + | `NOP -> "nop" + | `ORL (`U1(a1,a2)) -> "orl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `ORL (`U2(a1,a2)) -> "orl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `ORL (`U3(a1,a2)) -> "orl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `POP a1 -> "pop " ^ pp_arg a1 + | `PUSH a1 -> "push " ^ pp_arg a1 + | `RET -> "ret" + | `RETI -> "reti" + | `RL a1 -> "rl " ^ pp_arg a1 + | `RLC a1 -> "rlc " ^ pp_arg a1 + | `RR a1 -> "rr " ^ pp_arg a1 + | `RRC a1 -> "rrc " ^ pp_arg a1 + | `SETB a1 -> "setb " ^ pp_arg a1 + | `SJMP a1 -> "sjmp " ^ pp_arg a1 + | `SUBB (a1,a2) -> "subb " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `SWAP a1 -> "swap " ^ pp_arg a1 + | `XCH (a1,a2) -> "xch " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `XCHD(a1,a2) -> "xchd " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `XRL(`U1(a1,a2)) -> "xrl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + | `XRL(`U2(a1,a2)) -> "xrl " ^ pp_arg a1 ^ ", " ^ pp_arg a2 + +let print_program p = + let eformat = Eformat.create () in + let printf = Eformat.printf eformat in + let mem = ASMInterpret.load_code_memory p.ASM.code in + let f pc _ = + let (inst, new_pc, cost) = ASMInterpret.fetch mem pc in + printf "% 6X: %- 18s ;; %d %s\n" + (BitVectors.int_of_vect pc) + (pp_instruction inst) + cost + (if BitVectors.WordMap.mem pc p.ASM.cost_labels then + (BitVectors.WordMap.find pc p.ASM.cost_labels) + else "") ; + new_pc in + let _ = List.fold_left f (BitVectors.zero `Sixteen) p.ASM.code in + Eformat.get eformat diff --git a/src/ASM/Pretty.mli b/src/ASM/Pretty.mli new file mode 100644 index 0000000..74a15d5 --- /dev/null +++ b/src/ASM/Pretty.mli @@ -0,0 +1,23 @@ +val pp_arg: + [< `A + | `ADDR11 of 'a BitVectors.vect + | `ADDR16 of 'b BitVectors.vect + | `A_DPTR + | `A_PC + | `B + | `BIT of BitVectors.byte + | `C + | `DATA of 'c BitVectors.vect + | `DATA16 of 'd BitVectors.vect + | `DIRECT of BitVectors.byte + | `DPTR + | `EXT_INDIRECT of bool + | `EXT_IND_DPTR + | `INDIRECT of bool + | `IND_DPTR + | `NBIT of BitVectors.byte + | `REG of BitVectors.bit * BitVectors.bit * BitVectors.bit + | `REL of 'e BitVectors.vect ] -> string +val pp_instruction: [< ASM.labelled_instruction] -> string + +val print_program : ASM.program -> string diff --git a/src/ASM/Util.ml b/src/ASM/Util.ml new file mode 100644 index 0000000..48da8cf --- /dev/null +++ b/src/ASM/Util.ml @@ -0,0 +1,30 @@ +let ($) f x = f x +;; + +let (<*>) f g x = f (g x) +;; + +let flip f a b = f b a +;; + +let fst (a, b) = a +;; + +let snd (a, b) = b +;; + +let rec pad v i l = + match i with + 0 -> l + | n -> v :: (pad v (i - 1) l) +;; + +let char_list_of_string s = + let str_length = String.length s in + let rec aux s l buff = + if l = str_length then + buff + else + aux s (l + 1) ((String.get s l)::buff) + in + List.rev $ aux s 0 [] diff --git a/src/ASM/arch.mli b/src/ASM/arch.mli new file mode 100644 index 0000000..09d56ea --- /dev/null +++ b/src/ASM/arch.mli @@ -0,0 +1,7 @@ + +module type S = +sig + val int_size : int + val ptr_size : int + val alignment : int option +end diff --git a/src/ASM/printOps.ml b/src/ASM/printOps.ml new file mode 100644 index 0000000..971beea --- /dev/null +++ b/src/ASM/printOps.ml @@ -0,0 +1,96 @@ +(* Pasted from Pottier's PP compiler *) + +open MIPSOps +open Printf + +(* Some of the instructions that we emit are in fact pseudo-instructions. *) + +(* We use [addu], [addiu], and [subu] instead of [add], [addi], and + [sub]. The only difference is that the former never generate + overflow exceptions. This is what we desire, since the semantics + of Pseudo-Pascal says nothing about overflow exceptions. Overflow + is silent. *) + +let unop reg f (op, dst, src) = + match op with + | UOpAddi 0l -> + sprintf "move %a, %a" reg dst reg src (* pseudo-instruction *) + | UOpAddi i -> + sprintf "addi %a, %a, %ld" reg dst reg src i + | UOpSlti i -> + sprintf "slti %a, %a, %ld" reg dst reg src i + | UOpSltiu i -> + sprintf "sltiu %a, %a, %ld" reg dst reg src i + | UOpAndi i -> + sprintf "andi %a, %a, %ld" reg dst reg src i + | UOpOri i -> + sprintf "ori %a, %a, %ld" reg dst reg src i + | UOpXori i -> + sprintf "xori %a, %a, %ld" reg dst reg src i + | UOpNeg -> + sprintf "neg %a, %a" reg dst reg src + | UOpNot -> + sprintf "not %a, %a" reg dst reg src + +let binop = function + | OpAdd -> + "add " + | OpSub -> + "sub " + | OpMul -> + "mulo " + | OpDiv -> + "div " (* pseudo-instruction *) + | OpDivu -> + "divu " (* pseudo-instruction *) + | OpModu -> + "remu " (* pseudo-instruction *) + | OpLt -> + "slt " + | OpLtu -> + "sltu " + | OpLe -> + "sle " (* pseudo-instruction *) + | OpLeu -> + "sleu " (* pseudo-instruction *) + | OpGt -> + "sgt " (* pseudo-instruction *) + | OpGtu -> + "sgtu " (* pseudo-instruction *) + | OpGe -> + "sge " (* pseudo-instruction *) + | OpGeu -> + "sgeu " (* pseudo-instruction *) + | OpEq -> + "seq " (* pseudo-instruction *) + | OpNe -> + "sne " (* pseudo-instruction *) + | OpSllv -> + "sllv " + | OpSrav -> + "srav " + | OpSrlv -> + "srlv " + | OpAnd -> + "and " + | OpOr -> + "or " + | OpXor -> + "xor " + +let uncon reg f (cond, src) = + match cond with + | UConGez -> + sprintf "bgez %a" reg src + | UConGtz -> + sprintf "bgtz %a" reg src + | UConLez -> + sprintf "blez %a" reg src + | UConLtz -> + sprintf "bltz %a" reg src + +let bincon = function + | ConEq -> + "beq " + | ConNe -> + "bne " diff --git a/src/ASM/printOps.mli b/src/ASM/printOps.mli new file mode 100644 index 0000000..9190bf2 --- /dev/null +++ b/src/ASM/printOps.mli @@ -0,0 +1,12 @@ + +(** This module provides functions to print the operators of the + MIPS processor. *) + +(* Pasted from Pottier's PP compiler *) + +open PrintPottier + +val unop: 'reg printer -> (MIPSOps.unop * 'reg * 'reg) printer +val binop: MIPSOps.binop -> string +val uncon: 'reg printer -> (MIPSOps.uncon * 'reg) printer +val bincon: MIPSOps.bincon -> string diff --git a/src/ERTL/ERTL.mli b/src/ERTL/ERTL.mli new file mode 100644 index 0000000..026ebb9 --- /dev/null +++ b/src/ERTL/ERTL.mli @@ -0,0 +1,191 @@ + +(** This module defines the abstract syntax tree of [RTL]. *) + +(* Adapted from Pottiers's Pseudo-Pascal pedagogical compiler *) + +(* This is the definition of the abstract syntax for the Explicit + Register Transfer Language (ERTL). + + This language is very much like RTL, except the calling convention + has been made explicit. That is, functions and procedures no longer + accept parameters and return results via a high-level mechanism; + instead, they do so via either hardware registers or stack + slots. + + Functions and procedures no longer magically return to their caller: instead, + a new [St_return] instruction appears, whose semantics is to transfer control + to the address stored in the return address registers. + + Functions and procedures are no longer explicitly distinguished: functions + are simply procedures that happen to write the hardware register. There only + remains a distinction at [St_return] instructions (see below). + + Two new instructions, [St_newframe] and [St_delframe], appear in order to + allocate and release stack frames. They will be translated, in the final + assembly code, to arithmetic on the stack pointer registers. *) + +(* Stack organization. + + The stack is going from top to bottom. Below is a schema of the stack + organization viewed by the function being executed. + + formal parameters (the first parameter is at the top) + spilled variables (the first spilled variable is a the top) + local variables (the first local variable is at the bottom) + stack pointer -> +*) + +type registers = Register.t list + +type statement = + + (* The empty statement. *) + | St_skip of Label.t + + (* Comment. *) + | St_comment of string * Label.t + + (* Emit a cost label. *) + | St_cost of CostLabel.t * Label.t + + (* Assign the content of a hardware register to a pseudo register. Parameters + are the destination pseudo register, the source hardware register, and the + label of the next statement. *) + | St_get_hdw of Register.t * I8051.register * Label.t + + (* Assign the content of a pseudo register to a hardware register. Parameters + are the destination hardware register, the source pseudo register, and the + label of the next statement. *) + | St_set_hdw of I8051.register * Register.t * Label.t + + (* Assign the content of a hardware register to a hardware + register. Parameters are the destination register, the source register, and + the label of the next statement. Only used to save the return value before + the epilogue and restore it right before leaving the function. *) + | St_hdw_to_hdw of I8051.register * I8051.register * Label.t + + (* Allocate required space on the stack for the function. Parameter is the + label of the next statement. *) + | St_newframe of Label.t + + (* Deallocate required space on the stack for the function. Parameter is the + label of the next statement. *) + | St_delframe of Label.t + + (* Assign the frame size to a register. Parameters are the destination + register, and the label of the next statement. *) + | St_framesize of Register.t * Label.t + + (* Pop a value from the IRAM to a register. Parameter are the destination + register, and the label of the next statement. *) + | St_pop of Register.t * Label.t + + (* Push a value from a register to the IRAM. Parameter are the source + register, and the label of the next statement. *) + | St_push of Register.t * Label.t + + (* Assign the most significant bits of the address of a symbol to a + register. Parameters are the destination register, the symbol and the label + of the next statement. *) + | St_addrH of Register.t * AST.ident * Label.t + + (* Assign the least significant bits of the address of a symbol to a + register. Parameters are the destination register, the symbol and the label + of the next statement. *) + | St_addrL of Register.t * AST.ident * Label.t + + (* Assign an integer constant to a register. Parameters are the destination + register, the integer and the label of the next statement. *) + | St_int of Register.t * int * Label.t + + (* Move the content of a register to another. Parameters are the destination + register, the source register, and the label of the next statement. *) + | St_move of Register.t * Register.t * Label.t + + (* Apply a binary operation that will later be translated in an operation on + the accumulators, keeping only the result in ACC. Parameters are the + operation, the destination register, the source registers, and the label of + the next statement. *) + | St_opaccsA of I8051.opaccs * Register.t * Register.t * Register.t * Label.t + + (* Apply a binary operation that will later be translated in an operation on + the accumulators, keeping only the result in BACC. Parameters are the + operation, the destination register, the source registers, and the label of + the next statement. *) + | St_opaccsB of I8051.opaccs * Register.t * Register.t * Register.t * Label.t + + (* Apply an unary operation. Parameters are the operation, the destination + register, the source register, and the label of the next statement. *) + | St_op1 of I8051.op1 * Register.t * Register.t * Label.t + + (* Apply a binary operation. Parameters are the operation, the destination + register, the source registers, and the label of the next statement. *) + | St_op2 of I8051.op2 * Register.t * Register.t * Register.t * Label.t + + (* Set the carry flag to zero. Parameter is the label of the next + statement. *) + | St_clear_carry of Label.t + + (* Set the carry flag to 1. Parameter is the label of the next statement. *) + | St_set_carry of Label.t + + (* Load from external memory. Parameters are the destination register, the + address registers (low bytes first), and the label of the next + statement. *) + | St_load of Register.t * Register.t * Register.t * Label.t + + (* Store to external memory. Parameters are the address registers (low bytes + first), the source register, and the label of the next statement. *) + | St_store of Register.t * Register.t * Register.t * Label.t + + (* Call to a function given its name. Parameters are the name of the function, + the number of arguments of the function, and the label of the next + statement. *) + | St_call_id of AST.ident * int * Label.t + + (* Call to a function given its address. Parameters are the registers holding + the address of the function, the number of arguments of the function, and + the label of the next statement. *) + | St_call_ptr of Register.t * Register.t * int * Label.t + +(* + (* Tail call to a function given its name. Parameters are the name of the + function, and the number of arguments of the function. *) + | St_tailcall_id of AST.ident * int + + (* Tail call to a function given its address. Parameters are registers holding + the address of the function, and the arguments of the function. *) + | St_tailcall_ptr of registers * register list +*) + + (* Branch. Parameters are the register holding the value for the branching, + the label to go to when the value is not 0, and the label to go to when the + value is 0. *) + | St_cond of Register.t * Label.t * Label.t + + (* Transfer control to the address stored in the return address registers. *) + | St_return of registers + +type graph = statement Label.Map.t + +type internal_function = + { f_luniverse : Label.Gen.universe ; + f_runiverse : Register.universe ; + f_params : int ; + f_locals : Register.Set.t ; + f_stacksize : int ; + f_graph : graph ; + f_entry : Label.t ; + f_exit : Label.t } + +type function_def = + | F_int of internal_function + | F_ext of AST.external_function + +(* A program is a list of global variables and their reserved space, a list of + function names and their definition, and the name of the main function. *) + +type program = + { vars : (AST.ident * int (* size *)) list ; + functs : (AST.ident * function_def) list ; + main : AST.ident option } diff --git a/src/ERTL/ERTLInterpret.ml b/src/ERTL/ERTLInterpret.ml new file mode 100644 index 0000000..6caa400 --- /dev/null +++ b/src/ERTL/ERTLInterpret.ml @@ -0,0 +1,509 @@ + +(** This module provides an interpreter for the ERTL language. *) + + +let error_prefix = "ERTL interpret" +let error s = Error.global_error error_prefix s + + +module Mem = Driver.ERTLMemory +module Val = Mem.Value +let chunk = Driver.ERTLMemory.int_size +module Eval = I8051.Eval (Val) + + +(* Memory *) + +type memory = ERTL.function_def Mem.memory + +(* Local environments. They associate a value to the pseudo-registers of the + function being executed. *) + +type local_env = Val.t Register.Map.t + +(* Hardware registers environments. They associate a value to each hardware + register. *) + +type hdw_reg_env = Val.t I8051.RegisterMap.t + +(* Call frames. The execution state has a call stack, each element of the stack + being composed of the local environment to resume the execution of the + caller. *) + +type stack_frame = local_env + +(* Execution states. *) + +type state = + { st_frs : stack_frame list ; + pc : Val.address ; + isp : Val.address ; + exit : Val.address ; + lenv : local_env ; + carry : Val.t ; + renv : hdw_reg_env ; + mem : memory ; + trace : CostLabel.t list } + + +(* Helpers *) + +let add_st_frs st frame = { st with st_frs = frame :: st.st_frs } +let pop_st_frs st = match st.st_frs with + | [] -> error "Empty stack frames." + | lenv :: st_frs -> { st with st_frs = st_frs ; lenv = lenv } +let change_pc st pc = { st with pc = pc } +let change_isp st isp = { st with isp = isp } +let change_exit st exit = { st with exit = exit } +let change_lenv st lenv = { st with lenv = lenv } +let change_carry st carry = { st with carry = carry } +let change_renv st renv = { st with renv = renv } +let change_mem st mem = { st with mem = mem } +let change_trace st trace = { st with trace = trace } +let add_trace st cost_lbl = change_trace st (cost_lbl :: st.trace) + +let empty_state = + { st_frs = [] ; + pc = Val.null ; + isp = Val.null ; + exit = Val.null ; + lenv = Register.Map.empty ; + carry = Val.undef ; + renv = I8051.RegisterMap.empty ; + mem = Mem.empty ; + trace = [] } + + +(* Each label of each function is associated an address. The base of this + address is the base of the function in memory. Inside a function, offsets are + bijectively associated to labels. *) + +module Labels_Offsets = Bijection.Make (Label) (Val.Offset) + +let labels_offsets_internal int_fun = + let f lbl _ (lbls_offs, i) = + (Labels_Offsets.add1 lbl i lbls_offs, Val.Offset.succ i) in + Label.Map.fold f int_fun.ERTL.f_graph + +(* [labels_offsets p] builds a bijection between the labels found in the + functions of [p] and some memory addresses. *) + +let labels_offsets p = + let f (lbls_offs, i) (_, def) = match def with + | ERTL.F_int int_fun -> labels_offsets_internal int_fun (lbls_offs, i) + | _ -> (lbls_offs, i) in + fst (List.fold_left f (Labels_Offsets.empty, Val.Offset.zero) p.ERTL.functs) + +let fun_def_of_ptr mem ptr = match Mem.find_fun_def mem ptr with + | ERTL.F_int def -> def + | _ -> error "Trying to fetch the definition of an external function." + +let fetch_stmt lbls_offs st = + let msg = + Printf.sprintf "%s does not point to a statement." + (Val.string_of_address st.pc) in + if Val.is_mem_address st.pc then + let off = Val.offset_of_address st.pc in + let def = fun_def_of_ptr st.mem st.pc in + let lbl = Labels_Offsets.find2 off lbls_offs in + Label.Map.find lbl def.ERTL.f_graph + else error msg + +let entry_pc lbls_offs ptr def = + let off = Labels_Offsets.find1 def.ERTL.f_entry lbls_offs in + Val.change_address_offset ptr off + +let init_fun_call lbls_offs st ptr def = + let f r lenv = Register.Map.add r Val.undef lenv in + let lenv = Register.Set.fold f def.ERTL.f_locals Register.Map.empty in + let pc = entry_pc lbls_offs ptr def in + change_lenv (change_pc st pc) lenv + +let next_pc lbls_offs st lbl = + let off = Labels_Offsets.find1 lbl lbls_offs in + change_pc st (Val.change_address_offset st.pc off) + +let framesize st = + if Val.is_mem_address st.pc then + let def = fun_def_of_ptr st.mem st.pc in + def.ERTL.f_stacksize + else error "No function at the given address." + +type register = Hdw of I8051.register | Psd of Register.t + +let add_reg r v st = match r with + | Hdw r -> + let renv = I8051.RegisterMap.add r v st.renv in + change_renv st renv + | Psd r -> + let lenv = Register.Map.add r v st.lenv in + change_lenv st lenv + +let get_reg r st = match r with + | Hdw r -> + if I8051.RegisterMap.mem r st.renv then I8051.RegisterMap.find r st.renv + else error ("Unknown hardware register " ^ (I8051.print_register r) ^ ".") + | Psd r -> + if Register.Map.mem r st.lenv then Register.Map.find r st.lenv + else error ("Unknown local register " ^ (Register.print r) ^ ".") + +let push st v = + let mem = Mem.store st.mem chunk st.isp v in + let isp = Val.add_address st.isp (Val.Offset.of_int chunk) in + change_mem (change_isp st isp) mem + +let pop st = + let isp = Val.add_address st.isp (Val.Offset.of_int (-chunk)) in + let st = change_isp st isp in + let v = Mem.load st.mem chunk st.isp in + (st, v) + +let get_ra st = + let (st, pch) = pop st in + let (st, pcl) = pop st in + [pcl ; pch] + +let save_ra lbls_offs st lbl = + let ra = + Val.change_address_offset st.pc (Labels_Offsets.find1 lbl lbls_offs) in + let st = push st (List.nth ra 0) in + let st = push st (List.nth ra 1) in + st + +let save_frame st = add_st_frs st st.lenv + +let label_of_pointer lbls_offs ptr = +(* + Printf.printf "Retrieving label of %s\n%!" (Val.to_string ptr) ; +*) + let off = Val.offset_of_address ptr in + Labels_Offsets.find2 off lbls_offs + +let pointer_of_label lbls_offs ptr lbl = + Val.change_address_offset ptr (Labels_Offsets.find1 lbl lbls_offs) + +let get_sp st = + List.map (fun r -> get_reg (Hdw r) st) [I8051.spl ; I8051.sph] + +let set_sp vs st = + let spl = List.nth vs 0 in + let sph = List.nth vs 1 in + let st = add_reg (Hdw I8051.spl) spl st in + let st = add_reg (Hdw I8051.sph) sph st in + st + +let make_addr st r1 r2 = List.map (fun r -> get_reg (Psd r) st) [r1 ; r2] + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external mem f args = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> (mem', vs) + | (mem', InterpretExternal.A addr) -> (mem', addr) + +let fetch_external_args f st = + let size = Mem.size_of_quantity (Primitive.args_byte_size f) in + let params = MiscPottier.prefix size I8051.parameters in + List.map (fun r -> get_reg (Hdw r) st) params + +let set_result st vs = + let f st (r, v) = add_reg (Hdw r) v st in + List.fold_left f st (MiscPottier.combine I8051.rets vs) + +let interpret_external_call st f next_pc = + let args = fetch_external_args f st in + let (mem, vs) = interpret_external st.mem f args in + let st = change_mem st mem in + let st = set_result st vs in + change_pc st next_pc + +let interpret_call lbls_offs st ptr ra = + (* let ptr = Mem.find_global st.mem f in *) + match Mem.find_fun_def st.mem ptr with + | ERTL.F_int def -> + let st = save_ra lbls_offs st ra in + let st = save_frame st in + init_fun_call lbls_offs st ptr def + | ERTL.F_ext def -> + let next_pc = + Val.change_address_offset st.pc (Labels_Offsets.find1 ra lbls_offs) in + interpret_external_call st def.AST.ef_tag next_pc + +let interpret_return lbls_offs st = + let st = pop_st_frs st in + let (st, pch) = pop st in + let (st, pcl) = pop st in + let pc = [pcl ; pch] in + change_pc st pc + + +(* Interpret statements. *) + +let interpret_stmt lbls_offs st stmt = + let next_pc = next_pc lbls_offs in + match stmt with + + | ERTL.St_skip lbl -> + next_pc st lbl + + | ERTL.St_comment (s, lbl) -> +(* + Printf.printf "*** %s ***\n\n%!" s ; +*) + next_pc st lbl + + | ERTL.St_cost (cost_lbl, lbl) -> + let st = add_trace st cost_lbl in + next_pc st lbl + + | ERTL.St_get_hdw (destr, srcr, lbl) -> + let st = add_reg (Psd destr) (get_reg (Hdw srcr) st) st in + next_pc st lbl + + | ERTL.St_set_hdw (destr, srcr, lbl) -> + let st = add_reg (Hdw destr) (get_reg (Psd srcr) st) st in + next_pc st lbl + + | ERTL.St_hdw_to_hdw (destr, srcr, lbl) -> + let st = add_reg (Hdw destr) (get_reg (Hdw srcr) st) st in + next_pc st lbl + + | ERTL.St_newframe lbl -> + let size = framesize st in + let sp = get_sp st in + let new_sp = Val.add_address sp (Val.Offset.of_int (-size)) in + let st = set_sp new_sp st in + next_pc st lbl + + | ERTL.St_delframe lbl -> + let size = framesize st in + let sp = get_sp st in + let new_sp = Val.add_address sp (Val.Offset.of_int size) in + let st = set_sp new_sp st in + next_pc st lbl + + | ERTL.St_framesize (destr, lbl) -> + let size = framesize st in + let st = add_reg (Psd destr) (Val.of_int size) st in + next_pc st lbl + + | ERTL.St_pop (destr, lbl) -> + let (st, v) = pop st in + let st = add_reg (Psd destr) v st in + next_pc st lbl + + | ERTL.St_push (srcr, lbl) -> + let v = get_reg (Psd srcr) st in + let st = push st v in + next_pc st lbl + + | ERTL.St_addrH (r, x, lbl) -> + let vs = Mem.find_global st.mem x in + let st = add_reg (Psd r) (List.nth vs 1) st in + next_pc st lbl + + | ERTL.St_addrL (r, x, lbl) -> + let vs = Mem.find_global st.mem x in + let st = add_reg (Psd r) (List.nth vs 0) st in + next_pc st lbl + + | ERTL.St_int (r, i, lbl) -> + let st = add_reg (Psd r) (Val.of_int i) st in + next_pc st lbl + + | ERTL.St_move (destr, srcr, lbl) -> + let st = add_reg (Psd destr) (get_reg (Psd srcr) st) st in + next_pc st lbl + + | ERTL.St_opaccsA (opaccs, destr, srcr1, srcr2, lbl) -> + let (v, _) = + Eval.opaccs opaccs + (get_reg (Psd srcr1) st) + (get_reg (Psd srcr2) st) in + let st = add_reg (Psd destr) v st in + next_pc st lbl + + | ERTL.St_opaccsB (opaccs, destr, srcr1, srcr2, lbl) -> + let (_, v) = + Eval.opaccs opaccs + (get_reg (Psd srcr1) st) + (get_reg (Psd srcr2) st) in + let st = add_reg (Psd destr) v st in + next_pc st lbl + + | ERTL.St_op1 (op1, destr, srcr, lbl) -> + let v = Eval.op1 op1 (get_reg (Psd srcr) st) in + let st = add_reg (Psd destr) v st in + next_pc st lbl + + | ERTL.St_op2 (op2, destr, srcr1, srcr2, lbl) -> + let (v, carry) = + Eval.op2 st.carry op2 + (get_reg (Psd srcr1) st) + (get_reg (Psd srcr2) st) in + let st = change_carry st carry in + let st = add_reg (Psd destr) v st in + next_pc st lbl + + | ERTL.St_clear_carry lbl -> + let st = change_carry st Val.zero in + next_pc st lbl + + | ERTL.St_set_carry lbl -> + let st = change_carry st (Val.of_int 1) in + next_pc st lbl + + | ERTL.St_load (destr, addr1, addr2, lbl) -> + let addr = make_addr st addr1 addr2 in + let v = Mem.load st.mem chunk addr in + let st = add_reg (Psd destr) v st in + next_pc st lbl + + | ERTL.St_store (addr1, addr2, srcr, lbl) -> + let addr = make_addr st addr1 addr2 in + let mem = Mem.store st.mem chunk addr (get_reg (Psd srcr) st) in + let st = change_mem st mem in + next_pc st lbl + + | ERTL.St_call_id (f, _, lbl) -> + interpret_call lbls_offs st (Mem.find_global st.mem f) lbl + + | ERTL.St_call_ptr (f1, f2, _, lbl) -> + interpret_call lbls_offs st (make_addr st f1 f2) lbl + + | ERTL.St_cond (srcr, lbl_true, lbl_false) -> + let v = get_reg (Psd srcr) st in + let lbl = + if Val.is_true v then lbl_true + else + if Val.is_false v then lbl_false + else error "Undecidable branchment." in + next_pc st lbl + + | ERTL.St_return _ -> + interpret_return lbls_offs st + + +let print_lenv lenv = + let f r v = + if not (Val.eq v Val.undef) then + Printf.printf "\n%s = %s%!" (Register.print r) (Val.to_string v) in + Register.Map.iter f lenv + +let print_renv renv = + let f r v = + if not (Val.eq v Val.undef) then + Printf.printf "\n%s = %s%!" (I8051.print_register r) (Val.to_string v) in + I8051.RegisterMap.iter f renv + +let current_label lbls_offs st = + Labels_Offsets.find2 (Val.offset_of_address st.pc) lbls_offs + +let print_state lbls_offs st = + Printf.printf "PC: %s (%s)\n%!" + (Val.string_of_address st.pc) (current_label lbls_offs st) ; + Printf.printf "SP: %s\n%!" (Val.string_of_address (get_sp st)) ; + Printf.printf "ISP: %s%!" (Val.string_of_address st.isp) ; + Printf.printf "Carry: %s%!" (Val.to_string st.carry) ; + print_lenv st.lenv ; + print_renv st.renv ; + Mem.print st.mem ; + Printf.printf "\n%!" + +let compute_result st ret_regs = + let vs = List.map (fun r -> get_reg (Psd r) st) ret_regs in + let f res v = res && (Val.is_int v) in + let is_int vs = (List.length vs > 0) && (List.fold_left f true vs) in + if is_int vs then + let chunks = + List.map (fun v -> IntValue.Int32.cast (Val.to_int_repr v)) vs in + IntValue.Int32.merge chunks + else IntValue.Int32.zero + +let rec iter_small_step debug lbls_offs st = + let print_and_return_result (res, cost_labels) = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state lbls_offs st ; + match fetch_stmt lbls_offs st with + | ERTL.St_return ret_regs when Val.eq_address (get_ra st) st.exit -> + print_and_return_result (compute_result st ret_regs, List.rev st.trace) + | stmt -> + let st' = interpret_stmt lbls_offs st stmt in + iter_small_step debug lbls_offs st' + + +let add_global_vars = + List.fold_left + (fun mem (id, size) -> Mem.add_var mem id (AST.SQ (AST.QInt size)) None) + +let add_fun_defs = + List.fold_left (fun mem (f_id, f_def) -> Mem.add_fun_def mem f_id f_def) + +let init_prog (st : state) (p : ERTL.program) : state = + let mem = add_global_vars (add_fun_defs st.mem p.ERTL.functs) p.ERTL.vars in + change_mem st mem + +let init_sp st = + let (mem, sp) = Mem.alloc st.mem I8051.ext_ram_size in + let sp = + Val.change_address_offset sp (Val.Offset.of_int I8051.ext_ram_size) in + let st = change_mem st mem in + (st, sp) + +let init_isp st = + let (mem, isp) = Mem.alloc st.mem I8051.int_ram_size in + let st = change_mem (change_isp st isp) mem in + let (mem, exit) = Mem.alloc st.mem 1 in + let st = change_exit st exit in + let st = push st (List.nth exit 0) in + let st = push st (List.nth exit 1) in + st + +let init_renv st sp = + let f r renv = I8051.RegisterMap.add r Val.undef renv in + let renv = I8051.RegisterSet.fold f I8051.registers I8051.RegisterMap.empty in + let spl = List.nth sp 0 in + let sph = List.nth sp 1 in + let renv = I8051.RegisterMap.add I8051.sph sph renv in + let renv = I8051.RegisterMap.add I8051.spl spl renv in + change_renv st renv + +let init_main_call lbls_offs st main = + let ptr = Mem.find_global st.mem main in + match Mem.find_fun_def st.mem ptr with + | ERTL.F_int def -> + init_fun_call lbls_offs st ptr def + | _ -> error ("Cannot execute the main (\"" ^ main ^ "\"): it is external.") + + +(* Before interpreting, the environment is initialized: + - Build a bijection between the labels in the program and some values (taken + amongst the offsets). + - Add function definitions to the memory and reserve space for the globals. + - Allocate memory to emulate the external stack and initialize the external + stack pointer. + - Allocate memory to emulate the internal stack and initialize the internal + stack pointer. + - Initialiaze the physical register environment. All are set to 0, except for + the stack pointer registers that take the high and low bits of the external + stack pointer. + - Initialize a call to the main (set the current program counter to the + beginning of the function). + - Initialize the carry flag to 0. *) + +let interpret debug p = + Printf.printf "*** ERTL interpret ***\n%!" ; + match p.ERTL.main with + | None -> (IntValue.Int32.zero, []) + | Some main -> + let lbls_offs = labels_offsets p in + let st = empty_state in + let st = init_prog st p in + let (st, sp) = init_sp st in + let st = init_isp st in + let st = init_renv st sp in + let st = init_main_call lbls_offs st main in + let st = change_carry st Val.zero in + iter_small_step debug lbls_offs st diff --git a/src/ERTL/ERTLInterpret.mli b/src/ERTL/ERTLInterpret.mli new file mode 100644 index 0000000..a1fd123 --- /dev/null +++ b/src/ERTL/ERTLInterpret.mli @@ -0,0 +1,4 @@ + +(** This module provides an interpreter for the [ERTL] language. *) + +val interpret : bool -> ERTL.program -> AST.trace diff --git a/src/ERTL/ERTLPrinter.ml b/src/ERTL/ERTLPrinter.ml new file mode 100644 index 0000000..8232a4c --- /dev/null +++ b/src/ERTL/ERTLPrinter.ml @@ -0,0 +1,191 @@ + +(** This module provides a function to print [ERTL] programs. *) + + +let n_spaces n = String.make n ' ' + + +let print_global n (x, size) = + Printf.sprintf "%s\"%s\" [%d]" (n_spaces n) x size + +let print_globals eformat n globs = + Eformat.printf eformat "%sglobals:\n" (n_spaces n) ; + List.iter + (fun g -> Eformat.printf eformat "%s\n" (print_global (n+2) g)) globs + + +let reg_set_to_list rs = + let f r l = l @ [r] in + Register.Set.fold f rs [] + +let print_reg_list first last sep f rl = + Printf.sprintf "%s%s%s" + first (MiscPottier.string_of_list sep f rl) last + +let print_ptr rl = print_reg_list "[" "]" " ; " Register.print rl + +let print_args rl = print_reg_list "(" ")" ", " Register.print rl + +let print_return rl = print_reg_list "[" "]" " ; " Register.print rl + +let print_params rl = print_reg_list "(" ")" ", " Register.print rl + +let print_locals rs = + let rl = reg_set_to_list rs in + Printf.sprintf "%s" (print_reg_list "" "" ", " Register.print rl) + +let print_result rl = print_reg_list "[" "]" " ; " Register.print rl + + +let print_statement = function + | ERTL.St_skip lbl -> "--> " ^ lbl + | ERTL.St_comment (s, lbl) -> + Printf.sprintf "*** %s *** --> %s" s lbl + | ERTL.St_cost (cost_lbl, lbl) -> + Printf.sprintf "emit %s --> %s" cost_lbl lbl + | ERTL.St_get_hdw (r1, r2, lbl) -> + Printf.sprintf "move %s, %s --> %s" + (Register.print r1) (I8051.print_register r2) lbl + | ERTL.St_set_hdw (r1, r2, lbl) -> + Printf.sprintf "move %s, %s --> %s" + (I8051.print_register r1) (Register.print r2) lbl + | ERTL.St_hdw_to_hdw (r1, r2, lbl) -> + Printf.sprintf "move %s, %s --> %s" + (I8051.print_register r1) (I8051.print_register r2) lbl + | ERTL.St_newframe lbl -> + Printf.sprintf "newframe --> %s" lbl + | ERTL.St_delframe lbl -> + Printf.sprintf "delframe --> %s" lbl + | ERTL.St_framesize (r, lbl) -> + Printf.sprintf "imm %s, FRAMESIZE --> %s" (Register.print r) lbl + | ERTL.St_pop (r, lbl) -> + Printf.sprintf "pop %s --> %s" (Register.print r) lbl + | ERTL.St_push (r, lbl) -> + Printf.sprintf "push %s --> %s" (Register.print r) lbl + | ERTL.St_addrH (dstr, id, lbl) -> + Printf.sprintf "addrH %s, %s --> %s" (Register.print dstr) id lbl + | ERTL.St_addrL (dstr, id, lbl) -> + Printf.sprintf "addrL %s, %s --> %s" (Register.print dstr) id lbl + | ERTL.St_int (dstr, i, lbl) -> + Printf.sprintf "imm %s, %d --> %s" (Register.print dstr) i lbl + | ERTL.St_move (dstr, srcr, lbl) -> + Printf.sprintf "move %s, %s --> %s" + (Register.print dstr) (Register.print srcr) lbl + | ERTL.St_opaccsA (opaccs, dstr, srcr1, srcr2, lbl) -> + Printf.sprintf "%sA %s, %s, %s --> %s" + (I8051.print_opaccs opaccs) + (Register.print dstr) + (Register.print srcr1) + (Register.print srcr2) + lbl + | ERTL.St_opaccsB (opaccs, dstr, srcr1, srcr2, lbl) -> + Printf.sprintf "%sB %s, %s, %s --> %s" + (I8051.print_opaccs opaccs) + (Register.print dstr) + (Register.print srcr1) + (Register.print srcr2) + lbl + | ERTL.St_op1 (op1, dstr, srcr, lbl) -> + Printf.sprintf "%s %s, %s --> %s" + (I8051.print_op1 op1) + (Register.print dstr) + (Register.print srcr) + lbl + | ERTL.St_op2 (op2, dstr, srcr1, srcr2, lbl) -> + Printf.sprintf "%s %s, %s, %s --> %s" + (I8051.print_op2 op2) + (Register.print dstr) + (Register.print srcr1) + (Register.print srcr2) + lbl + | ERTL.St_clear_carry lbl -> + Printf.sprintf "clear CARRY --> %s" lbl + | ERTL.St_set_carry lbl -> + Printf.sprintf "set CARRY --> %s" lbl + | ERTL.St_load (dstr, addr1, addr2, lbl) -> + Printf.sprintf "load %s, (%s, %s) --> %s" + (Register.print dstr) + (Register.print addr1) + (Register.print addr2) + lbl + | ERTL.St_store (addr1, addr2, srcr, lbl) -> + Printf.sprintf "store (%s, %s), %s --> %s" + (Register.print addr1) + (Register.print addr2) + (Register.print srcr) + lbl + | ERTL.St_call_id (f, nb_args, lbl) -> + Printf.sprintf "call \"%s\", %d --> %s" f nb_args lbl + | ERTL.St_call_ptr (f1, f2, nb_args, lbl) -> + Printf.sprintf "call_ptr [%s ; %s], %d --> %s" + (Register.print f1) + (Register.print f2) + nb_args + lbl +(* + | ERTL.St_tailcall_id (f, nb_args) -> + Printf.sprintf "tailcall \"%s\", %d" + f + nb_args + | ERTL.St_tailcall_ptr (f, args) -> + Printf.sprintf "tailcall_ptr %s, %s" + (print_ptr f) + (print_args args) +*) + | ERTL.St_cond (srcr, lbl_true, lbl_false) -> + Printf.sprintf "branch %s <> 0 --> %s, %s" + (Register.print srcr) lbl_true lbl_false + | ERTL.St_return ret_regs -> + Printf.sprintf "return %s" (print_return ret_regs) + + +let print_graph eformat n c = + let f lbl stmt = + Eformat.printf eformat "%s%s: %s\n" + (n_spaces n) + lbl + (print_statement stmt) in + Label.Map.iter f c + + +let print_internal_decl eformat n f def = + Eformat.printf eformat + "%s\"%s\" %d\n%slocals: %s\n%sstacksize: %d\n%sentry: %s\n%sexit: %s\n\n" + (n_spaces n) + f + def.ERTL.f_params + (n_spaces (n+2)) + (print_locals def.ERTL.f_locals) + (n_spaces (n+2)) + def.ERTL.f_stacksize + (n_spaces (n+2)) + def.ERTL.f_entry + (n_spaces (n+2)) + def.ERTL.f_exit ; + print_graph eformat (n+2) def.ERTL.f_graph + + +let print_external_decl eformat n f def = + Eformat.printf eformat "%sextern \"%s\": %s\n" + (n_spaces n) + f + (Primitive.print_sig def.AST.ef_sig) + + +let print_fun_decl eformat n (f, def) = match def with + | ERTL.F_int def -> print_internal_decl eformat n f def + | ERTL.F_ext def -> print_external_decl eformat n f def + +let print_fun_decls eformat n functs = + List.iter + (fun f -> print_fun_decl eformat n f ; Eformat.printf eformat "\n\n") + functs + + +let print_program p = + let eformat = Eformat.create () in + Eformat.printf eformat "program:\n\n\n" ; + print_globals eformat 2 p.ERTL.vars ; + Eformat.printf eformat "\n\n" ; + print_fun_decls eformat 2 p.ERTL.functs ; + Eformat.get eformat diff --git a/src/ERTL/ERTLPrinter.mli b/src/ERTL/ERTLPrinter.mli new file mode 100644 index 0000000..7b56efd --- /dev/null +++ b/src/ERTL/ERTLPrinter.mli @@ -0,0 +1,4 @@ + +(** This module provides a function to print [ERTL] programs. *) + +val print_program : ERTL.program -> string diff --git a/src/ERTL/ERTLToLTL.ml b/src/ERTL/ERTLToLTL.ml new file mode 100644 index 0000000..9b287f2 --- /dev/null +++ b/src/ERTL/ERTLToLTL.ml @@ -0,0 +1,135 @@ + +(* This module provides a translation of ERTL programs to LTL + programs. *) + +(* Adapted from Pottier's PP compiler *) + +let translate_internal f (int_fun : ERTL.internal_function) + : LTL.internal_function = + + (* Allocate a reference that will hold the control flow + graph. Define a function that generates a statement at a fresh + label. *) + + let graph = ref Label.Map.empty in + + let fresh_label () = Label.Gen.fresh int_fun.ERTL.f_luniverse in + + let add_graph lbl stmt = graph := Label.Map.add lbl stmt !graph in + + let generate stmt = + let l = fresh_label () in + add_graph l stmt ; + l in + + (* Build an interference graph for this function, and color + it. Define a function that allows consulting the coloring. *) + + let module G = struct + let liveafter, graph = Build.build int_fun + let uses = Uses.examine_internal int_fun + let verbose = false + let () = + if verbose then + Printf.printf "Starting hardware register allocation for %s.\n" f + end in + + let module C = Coloring.Color (G) in + + let lookup r = + Interference.Vertex.Map.find (Interference.lookup G.graph r) C.coloring + in + + (* Restrict the interference graph to concern spilled vertices only, + and color it again, this time using stack slots as colors. *) + + let module H = struct + let graph = Interference.droph (Interference.restrict G.graph (fun v -> + match Interference.Vertex.Map.find v C.coloring with + | Coloring.Spill -> + true + | Coloring.Color _ -> + false + )) + let verbose = false + let () = + if verbose then + Printf.printf "Starting stack slot allocation for %s.\n" f + end in + + let module S = Spill.Color (H) in + + (* Define a new function that consults both colorings at once. *) + + let lookup r = + match lookup r with + | Coloring.Spill -> + ERTLToLTLI.Spill (Interference.Vertex.Map.find (Interference.lookup H.graph r) S.coloring) + | Coloring.Color color -> + ERTLToLTLI.Color color + in + + (* We are now ready to instantiate the functor that deals with the + translation of instructions. The reason why we make this a + separate functor is purely pedagogical. Smaller modules are + easier to understand. *) + + (* We add the additional stack size required for spilled register to the stack + size previously required for the function: this is the final stack size + required for the locals. *) + + let locals = S.locals + int_fun.ERTL.f_stacksize in + + (* The full stack size is then the size of the locals in the stack plus the + size of the formal parameters of the function. *) + + let stacksize = int_fun.ERTL.f_params + locals in + + let module I = ERTLToLTLI.Make (struct + let lookup = lookup + let generate = generate + let fresh_label = fresh_label + let add_graph = add_graph + let locals = locals + let stacksize = stacksize + end) in + + (* Translate the instructions in the existing control flow graph. + Pure instructions whose destination pseudo-register is dead are + eliminated on the fly. *) + + let () = + Label.Map.iter (fun label stmt -> + let stmt = + match Liveness.eliminable (G.liveafter label) stmt with + | Some successor -> + LTL.St_skip successor + | None -> + I.translate_statement stmt + in + graph := Label.Map.add label stmt !graph + ) int_fun.ERTL.f_graph + in + + AnnotStackSize.add_stack_size f stacksize; + (* Build a [LTL] function. *) + + { + LTL.f_luniverse = int_fun.ERTL.f_luniverse; + LTL.f_stacksize = stacksize ; + LTL.f_entry = int_fun.ERTL.f_entry; + LTL.f_exit = int_fun.ERTL.f_exit; + LTL.f_graph = !graph + } + + +let translate_funct (name, def) = + let def' = match def with + | ERTL.F_int def -> LTL.F_int (translate_internal name def) + | ERTL.F_ext def -> LTL.F_ext def in + (name, def') + +let translate (p : ERTL.program) : LTL.program = + { LTL.vars = p.ERTL.vars; + LTL.functs = List.map translate_funct p.ERTL.functs ; + LTL.main = p.ERTL.main } diff --git a/src/ERTL/ERTLToLTL.mli b/src/ERTL/ERTLToLTL.mli new file mode 100644 index 0000000..a6fbf27 --- /dev/null +++ b/src/ERTL/ERTLToLTL.mli @@ -0,0 +1,12 @@ + +(** This module is the external part of the translation of [ERTL] + programs into [LTL] programs. *) + +(** The translation consists in the following operations: + - Build an interference graph and color it. This process relies an a + liveness analysis and allows to associate a physical location to each + pseudo-register. + - Do the actual translation by removing the statements whose written + register is dead (using the results of the liveness analysis). *) + +val translate : ERTL.program -> LTL.program diff --git a/src/ERTL/ERTLToLTLI.ml b/src/ERTL/ERTLToLTLI.ml new file mode 100644 index 0000000..bea2c1d --- /dev/null +++ b/src/ERTL/ERTLToLTLI.ml @@ -0,0 +1,305 @@ +(* Pasted from Pottier's PP compiler *) + +(* This module translates [ERTL] statements into [LTL] statements. It is + parameterized over a module [Env], whose signature appears below, which + provides support for mapping pseudo-registers to stack slots or hardware + registers and for generating instructions (which requires allocating fresh + control flow graph labels). *) + +type decision = + | Spill of AST.immediate + | Color of I8051.register + +module Make (Env : sig + + val lookup: Register.t -> decision + + (* [generate stmt] returns a fresh statement label, which it associates with + [stmt] in the control flow graph. *) + + val generate: LTL.statement -> Label.t + + val fresh_label: unit -> Label.t + + val add_graph: Label.t -> LTL.statement -> unit + + val locals: int + + val stacksize: int + +end) = struct + + open Env + open I8051 + + let adjust off = locals - (off + I8051.int_size) + + let get_stack r off l = + let off = adjust off in + let l = generate (LTL.St_from_acc (r, l)) in + let l = generate (LTL.St_load l) in + let l = generate (LTL.St_from_acc (I8051.dph, l)) in + let l = generate (LTL.St_op2 (I8051.Addc, I8051.sph, l)) in + let l = generate (LTL.St_int (I8051.a, 0, l)) in + let l = generate (LTL.St_from_acc (I8051.dpl, l)) in + let l = generate (LTL.St_op2 (I8051.Add, I8051.spl, l)) in + LTL.St_int (I8051.a, off, l) + + let set_stack off r l = + let off = adjust off in + let l = generate (LTL.St_store l) in + let l = generate (LTL.St_to_acc (r, l)) in + let l = generate (LTL.St_from_acc (I8051.dph, l)) in + let l = generate (LTL.St_op2 (I8051.Addc, I8051.sph, l)) in + let l = generate (LTL.St_int (I8051.a, 0, l)) in + let l = generate (LTL.St_from_acc (I8051.dpl, l)) in + let l = generate (LTL.St_op2 (I8051.Add, I8051.spl, l)) in + LTL.St_int (I8051.a, off, l) + + + let write (r : Register.t) (l : Label.t) : (I8051.register * Label.t) = + match lookup r with + + | Color hwr -> + (* Pseudo-register [r] has been mapped to hardware register + [hwr]. Just write into [hwr] and branch to [l]. *) + (hwr, l) + + | Spill off -> + (* Pseudo-register [r] has been mapped to offset [off] in the local zone + of the stack. Then, write into [sst] (never allocated) and transfer + control to an instruction that copies [sst] in the designated + location of the stack before branching to [l]. *) + (I8051.sst, generate (set_stack off I8051.sst l)) + + + let read (r : Register.t) (stmt : I8051.register -> LTL.statement) = + match lookup r with + | Color hwr -> + (* Pseudo-register [r] has been mapped to hardware register [hwr]. Just + generate statement [stmt] with a reference to register [hwr]. *) + generate (stmt hwr) + + | Spill off -> + (* Pseudo-register [r] has been mapped to offset [off] in the local zone + of the stack. Issue a statement that copies the designated area in + the stack into the temporary unallocatable hardware register [sst], + then generate statement [stmt] with a reference to register + [sst]. *) + let temphwr = I8051.sst in + let l = generate (stmt temphwr) in + generate (get_stack temphwr off l) + + + let move (dest : decision) (src : decision) l = + match dest, src with + + (* Both pseudo-registers are translated to hardware registers. Issue move + statements, or no statement at all if both pseudo-registers reside in + the same hardware register. *) + | Color desthwr, Color sourcehwr when I8051.eq_reg desthwr sourcehwr -> + LTL.St_skip l + | Color desthwr, Color sourcehwr -> + let l = generate (LTL.St_from_acc (desthwr, l)) in + LTL.St_to_acc (sourcehwr, l) + + (* One pseudo-register is translated to a hardware register, while the + other is spilled. Issue a single stack access instruction. *) + | Color desthwr, Spill off -> get_stack desthwr off l + | Spill off, Color sourcehwr -> set_stack off sourcehwr l + + (* Both pseudo-registers are spilled. Combine the previous two cases. Of + course, if the two pseudo-registers have been spilled into the same + stack slot, there is nothing to do. *) + | Spill off1, Spill off2 when off1 = off2 -> + LTL.St_skip l + | Spill off1, Spill off2 -> + let temphwr = I8051.sst in + let l = generate (set_stack off1 temphwr l) in + get_stack temphwr off2 l + + + let newframe l = + if stacksize = 0 then LTL.St_skip l + else + let l = generate (LTL.St_from_acc (I8051.sph, l)) in + let l = generate (LTL.St_op2 (I8051.Sub, I8051.dph, l)) in + let l = generate (LTL.St_int (I8051.dph, 0, l)) in + let l = generate (LTL.St_to_acc (I8051.sph, l)) in + let l = generate (LTL.St_from_acc (I8051.spl, l)) in + let l = generate (LTL.St_op2 (I8051.Sub, I8051.dpl, l)) in + let l = generate (LTL.St_clear_carry l) in + let l = generate (LTL.St_int (I8051.dpl, stacksize, l)) in + LTL.St_to_acc (I8051.spl, l) + + let delframe l = + if stacksize = 0 then LTL.St_skip l + else + let l = generate (LTL.St_from_acc (I8051.sph, l)) in + let l = generate (LTL.St_op2 (I8051.Addc, I8051.sph, l)) in + let l = generate (LTL.St_int (I8051.a, 0, l)) in + let l = generate (LTL.St_from_acc (I8051.spl, l)) in + let l = generate (LTL.St_op2 (I8051.Add, I8051.spl, l)) in + LTL.St_int (I8051.a, stacksize, l) + + + (* ------------------------------------------------------------------------ *) + + (* [translate_statement] turns a [ERTL] statement into a [LTL] statement, or + sequence of statements, that transfers control to the same label(s). + + Existing statement labels are preserved, that is, the labels in the new + control flow graph form a superset of the labels in the existing control + flow graph. *) + + let translate_statement (stmt : ERTL.statement) : LTL.statement = + match stmt with + + | ERTL.St_skip l -> + LTL.St_skip l + + | ERTL.St_comment (s, l) -> + LTL.St_comment (s, l) + + | ERTL.St_cost (cost_lbl, l) -> + LTL.St_cost (cost_lbl, l) + + | ERTL.St_get_hdw (destr, sourcehwr, l) -> + move (lookup destr) (Color sourcehwr) l + + | ERTL.St_set_hdw (desthwr, sourcer, l) -> + move (Color desthwr) (lookup sourcer) l + + | ERTL.St_hdw_to_hdw (r1, r2, l) -> + let l = generate (LTL.St_from_acc (r1, l)) in + LTL.St_to_acc (r2, l) + + | ERTL.St_newframe l -> + newframe l + + | ERTL.St_delframe l -> + delframe l + + | ERTL.St_framesize (r, l) -> + let (hdw, l) = write r l in + LTL.St_int (hdw, stacksize, l) + + | ERTL.St_pop (r, l) -> + let (hdw, l) = write r l in + let l = generate (LTL.St_from_acc (hdw, l)) in + LTL.St_pop l + + | ERTL.St_push (r, l) -> + let l = generate (LTL.St_push l) in + let l = read r (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_addrH (r, x, l) -> + let (hdw, l) = write r l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_to_acc (I8051.dph, l)) in + LTL.St_addr (x, l) + + | ERTL.St_addrL (r, x, l) -> + let (hdw, l) = write r l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_to_acc (I8051.dpl, l)) in + LTL.St_addr (x, l) + + | ERTL.St_int (r, i, l) -> + let (hdw, l) = write r l in + LTL.St_int (hdw, i, l) + + | ERTL.St_move (r1, r2, l) -> + move (lookup r1) (lookup r2) l + + | ERTL.St_opaccsA (opaccs, destr, srcr1, srcr2, l) -> + let (hdw, l) = write destr l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_opaccs (opaccs, l)) in + let l = read srcr1 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.b, l)) in + let l = read srcr2 (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_opaccsB (opaccs, destr, srcr1, srcr2, l) -> + let (hdw, l) = write destr l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_to_acc (I8051.b, l)) in + let l = generate (LTL.St_opaccs (opaccs, l)) in + let l = read srcr1 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.b, l)) in + let l = read srcr2 (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_op1 (op1, destr, srcr, l) -> + let (hdw, l) = write destr l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_op1 (op1, l)) in + let l = read srcr (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_op2 (op2, destr, srcr1, srcr2, l) -> + let (hdw, l) = write destr l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_op2 (op2, I8051.b, l)) in + let l = read srcr1 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.b, l)) in + let l = read srcr2 (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_clear_carry l -> + LTL.St_clear_carry l + + | ERTL.St_set_carry l -> + LTL.St_set_carry l + + | ERTL.St_load (destr, addr1, addr2, l) -> + let (hdw, l) = write destr l in + let l = generate (LTL.St_from_acc (hdw, l)) in + let l = generate (LTL.St_load l) in + let l = generate (LTL.St_from_acc (I8051.dph, l)) in + let l = generate (LTL.St_to_acc (I8051.st0, l)) in + let l = generate (LTL.St_from_acc (I8051.dpl, l)) in + let l = read addr1 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.st0, l)) in + let l = read addr2 (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_store (addr1, addr2, srcr, l) -> + let l = generate (LTL.St_store l) in + let l = generate (LTL.St_to_acc (I8051.st1, l)) in + let l = generate (LTL.St_from_acc (I8051.dph, l)) in + let l = generate (LTL.St_to_acc (I8051.st0, l)) in + let l = generate (LTL.St_from_acc (I8051.dpl, l)) in + let l = read addr1 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.st0, l)) in + let l = read addr2 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.st1, l)) in + let l = read srcr (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_call_id (f, _, l) -> + LTL.St_call_id (f, l) + + | ERTL.St_call_ptr (f1, f2, _, l) -> + let l = generate (LTL.St_call_ptr l) in + let l = generate (LTL.St_from_acc (I8051.dph, l)) in + let l = generate (LTL.St_to_acc (I8051.st0, l)) in + let l = generate (LTL.St_from_acc (I8051.dpl, l)) in + let l = read f1 (fun hdw -> LTL.St_to_acc (hdw, l)) in + let l = generate (LTL.St_from_acc (I8051.st0, l)) in + let l = read f2 (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_cond (srcr, lbl_true, lbl_false) -> + let l = generate (LTL.St_condacc (lbl_true, lbl_false)) in + let l = read srcr (fun hdw -> LTL.St_to_acc (hdw, l)) in + LTL.St_skip l + + | ERTL.St_return _ -> + LTL.St_return + +(* ------------------------------------------------------------------------- *) + +end diff --git a/src/ERTL/ERTLToLTLI.mli b/src/ERTL/ERTLToLTLI.mli new file mode 100644 index 0000000..70ecefd --- /dev/null +++ b/src/ERTL/ERTLToLTLI.mli @@ -0,0 +1,46 @@ + +(** This module is the central part of the translation of [ERTL] + programs into [LTL] programs. *) + +(* Pasted from Pottier's PP compiler *) + +(* This module translates [ERTL] statements into [LTL] statements. It is + parameterized over a module [Env], whose signature appears below, which + provides support for mapping pseudo-registers to stack slots or hardware + registers and for generating instructions (which requires allocating fresh + control flow graph labels). *) + +type decision = + | Spill of AST.immediate + | Color of I8051.register + +module Make (Env : sig + + val lookup: Register.t -> decision + + (* [generate instruction] returns a fresh instruction label, which + it associates with [instruction] in the control flow graph. *) + + val generate: LTL.statement -> Label.t + + val fresh_label: unit -> Label.t + + val add_graph: Label.t -> LTL.statement -> unit + + val locals: int + + val stacksize: int + + end) : sig + + (* [translate_statement] turns a [ERTL] statement into a [LTL] statement, or + sequence of statements, that transfers control to the same label(s). + + Existing statement labels are preserved, that is, the labels in + the new control flow graph form a superset of the labels in the + existing control flow graph. *) + + val translate_statement: ERTL.statement -> LTL.statement + +end + diff --git a/src/ERTL/build.ml b/src/ERTL/build.ml new file mode 100644 index 0000000..a75188e --- /dev/null +++ b/src/ERTL/build.ml @@ -0,0 +1,131 @@ +(* Pasted from Pottier's PP compiler *) + +open ERTL +open Interference + +let build (int_fun : internal_function) = + + (* Perform liveness analysis. *) + + let liveafter = Liveness.analyze int_fun in + + (* Create an interference graph whose vertices are the procedure's + pseudo-registers. This graph initially has no edges. *) + + let graph = create int_fun.f_locals in + + (* Every pseudo register interferes with special forbidden registers. *) + + let graph = mkiph graph int_fun.f_locals I8051.forbidden in + + (* Iterate over all statements in the control flow graph and populate the + interference graph with interference and preference edges. *) + + let graph = + Label.Map.fold (fun label stmt graph -> + let live = liveafter label in + match Liveness.eliminable live stmt with + + | Some _ -> + + (* This statement is eliminable and should be ignored. Eliminable + statements have not been eliminated yet, because we are still + in between ERTL and LTL. They *will* be eliminated soon, though, + so there is no reason to take them into account while building + the interference graph. *) + + graph + + | None -> + + (* Create interference edges. The general rule is, every + pseudo-register or hardware register that is defined (written) by + a statement interferes with every pseudo-register or hardware + register (other than itself) that is live immediately after the + statement executes. + + An exception to the general rule can be made for move + statements. In a move statement, we do not need the source + and destination pseudo-registers to be assigned distinct hardware + registers, since they contain the same value -- in fact, we would + like them to be assigned the same hardware register. So, for a + move statement, we let the register that is defined (written) + interfere with every pseudo-register, other than itself *and + other than the source pseudo-register*, that is live immediately + after the statement executes. This optimization is explained in + Chapter 10 of Appel's book (p. 221). + + This special case is only a hack that works in many cases. There + are cases where it doesn't suffice. For instance, if two + successive move statements have the same source [r0], then + their destinations [r1] and [r2] *will* be considered as + interfering, even though it would in fact be correct and + desirable to map both of them to the same hardware register. A + more general solution would be to perform a static analysis that + determines, for every program point, which pseudo-registers + definitely hold the same value, and to exploit this information + to build fewer interference edges. *) + + let defined = Liveness.defined stmt in + let exceptions = + match stmt with + | St_move (_, sourcer, _) + | St_set_hdw (_, sourcer, _) -> + Liveness.L.psingleton sourcer + | St_get_hdw (_, sourcehwr, _) -> + Liveness.L.hsingleton sourcehwr + | _ -> + Liveness.L.bottom + in + let graph = + mki graph (Liveness.L.diff live exceptions) defined + in + +(* + (* Two registers written at the same time are interfering (they + obviously should not be associated the same address). + Only happens with St_addr. *) + + let graph = + match stmt with + | St_addr (r1, r2, _, _) -> + mki graph (Liveness.L.psingleton r1) (Liveness.L.psingleton r2) + | _ -> + graph + in +*) + + (* Create preference edges between pseudo-registers. Two registers + should preferably be assigned the same color when they are + related by a move statement, so that the move statement can + be eliminated. *) + + let graph = + match stmt with + | St_move (r1, r2, _) -> + mkppp graph r1 r2 + | St_get_hdw (r, hwr, _) + | St_set_hdw (hwr, r, _) -> + mkpph graph r hwr + | _ -> + graph + in + (* + + (* Add interference edges between the hardware register [$zero] + and every pseudo-register that the statement renders + nonzeroable. See [Zero] for an explanation. *) + + let graph = + mkiph graph (Zero.nonzeroable i) (MIPS.RegisterSet.singleton MIPS.zero) + in + *) + graph + + ) int_fun.f_graph graph + in + + (* Done. *) + + liveafter, graph + diff --git a/src/ERTL/build.mli b/src/ERTL/build.mli new file mode 100644 index 0000000..c4a6d92 --- /dev/null +++ b/src/ERTL/build.mli @@ -0,0 +1,9 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module builds an interference graph for an [ERTL] function. + This is done by running a liveness analysis and exploiting its + result. [build] returns both the result of the liveness analysis + and the interference graph. *) + +val build: ERTL.internal_function -> Liveness.valuation * Interference.graph + diff --git a/src/ERTL/liveness.ml b/src/ERTL/liveness.ml new file mode 100644 index 0000000..e01ffba --- /dev/null +++ b/src/ERTL/liveness.ml @@ -0,0 +1,329 @@ +(* Pasted from Pottier's PP compiler *) + +open ERTL + +(* In the following, a ``variable'' means a pseudo-register or an + allocatable hardware register. *) + +(* These functions allow turning an [ERTL] control flow graph into an + explicit graph, that is, making successor edges explicit. This is + useful in itself and facilitates the computation of predecessor + edges. *) + +let statement_successors (stmt : statement) = + match stmt with + | St_return _ -> + Label.Set.empty + | St_skip l + | St_comment (_, l) + | St_cost (_, l) + | St_set_hdw (_, _, l) + | St_get_hdw (_, _, l) + | St_hdw_to_hdw (_, _, l) + | St_newframe l + | St_delframe l + | St_framesize (_, l) + | St_push (_, l) + | St_pop (_, l) + | St_addrH (_, _, l) + | St_addrL (_, _, l) + | St_int (_, _, l) + | St_move (_, _, l) + | St_opaccsA (_, _, _, _, l) + | St_opaccsB (_, _, _, _, l) + | St_op1 (_, _, _, l) + | St_op2 (_, _, _, _, l) + | St_clear_carry l + | St_set_carry l + | St_load (_, _, _, l) + | St_store (_, _, _, l) + | St_call_id (_, _, l) + | St_call_ptr (_, _, _, l) -> + Label.Set.singleton l + | St_cond (_, l1, l2) -> + Label.Set.add l1 (Label.Set.singleton l2) + +(* The analysis uses the lattice of sets of variables. The lattice's + join operation is pointwise set union, which reflects the fact that + a variable is deemed live at a program point if and only if it is + live at any of the successors of that program point. *) + +module L = struct + + (* A set of variable is represented as a pair of a set of + pseudo-registers and a set of hardware registers. *) + + type t = + Register.Set.t * I8051.RegisterSet.t + + type property = + t + + let bottom = + Register.Set.empty, I8051.RegisterSet.empty + + let psingleton r = + Register.Set.singleton r, I8051.RegisterSet.empty + + let hsingleton hwr = + Register.Set.empty, I8051.RegisterSet.singleton hwr + + let join (rset1, hwrset1) (rset2, hwrset2) = + (Register.Set.union rset1 rset2, I8051.RegisterSet.union hwrset1 hwrset2) + + let diff (rset1, hwrset1) (rset2, hwrset2) = + (Register.Set.diff rset1 rset2, I8051.RegisterSet.diff hwrset1 hwrset2) + + let equal (rset1, hwrset1) (rset2, hwrset2) = + Register.Set.equal rset1 rset2 && I8051.RegisterSet.equal hwrset1 hwrset2 + + let is_maximal _ = + false + +end + +module Label_ImperativeMap = struct + + type key = + Label.Map.key + + type 'data t = + 'data Label.Map.t ref + + let create () = + ref Label.Map.empty + + let clear t = + t := Label.Map.empty + + let add k d t = + t := Label.Map.add k d !t + + let find k t = + Label.Map.find k !t + + let iter f t = + Label.Map.iter f !t + +end + +module F = Fix.Make (Label_ImperativeMap) (L) + +(* These are the sets of variables defined at (written by) a statement. *) + +let defined (stmt : statement) : L.t = + match stmt with + | St_skip _ + | St_comment _ + | St_cost _ + | St_push _ + | St_store _ + | St_cond _ + | St_return _ -> + L.bottom + | St_clear_carry _ + | St_set_carry _ -> + Register.Set.empty, I8051.RegisterSet.singleton I8051.carry + | St_op2 (I8051.Add, r, _, _, _) + | St_op2 (I8051.Addc, r, _, _, _) + | St_op2 (I8051.Sub, r, _, _, _) -> + L.join (L.hsingleton I8051.carry) (L.psingleton r) + | St_op1 (I8051.Inc, r, _, _) + | St_get_hdw (r, _, _) + | St_framesize (r, _) + | St_pop (r, _) + | St_int (r, _, _) + | St_addrH (r, _, _) + | St_addrL (r, _, _) + | St_move (r, _, _) + | St_opaccsA (_, r, _, _, _) + | St_opaccsB (_, r, _, _, _) + | St_op1 (_, r, _, _) + | St_op2 (_, r, _, _, _) + | St_load (r, _, _, _) -> + L.psingleton r + | St_set_hdw (r, _, _) + | St_hdw_to_hdw (r, _, _) -> + L.hsingleton r + | St_call_id _ | St_call_ptr _ -> + (* Potentially destroys all caller-save hardware registers. *) + Register.Set.empty, I8051.caller_saved + | St_newframe _ + | St_delframe _ -> + L.join (L.hsingleton I8051.spl) (L.hsingleton I8051.sph) + +let set_of_list rl = + List.fold_right I8051.RegisterSet.add rl I8051.RegisterSet.empty + +(* This is the set of variables used at (read by) a statement. *) + +let set_of_list = + let f set r = I8051.RegisterSet.add r set in + List.fold_left f I8051.RegisterSet.empty + +let ret_regs = set_of_list I8051.rets + +let used (stmt : statement) : L.t = + match stmt with + | St_skip _ + | St_comment _ + | St_cost _ + | St_framesize _ + | St_pop _ + | St_addrH _ + | St_addrL _ + | St_int _ + | St_clear_carry _ + | St_set_carry _ -> + L.bottom + | St_call_id (_, nparams, _) -> + (* Reads the hardware registers that are used to pass parameters. *) + Register.Set.empty, + set_of_list (MiscPottier.prefix nparams I8051.parameters) + | St_call_ptr (r1, r2, nparams, _) -> + (* Reads the hardware registers that are used to pass parameters. *) + Register.Set.of_list [r1 ; r2], + set_of_list (MiscPottier.prefix nparams I8051.parameters) + | St_get_hdw (_, r, _) + | St_hdw_to_hdw (_, r, _) -> + L.hsingleton r + | St_set_hdw (_, r, _) + | St_push (r, _) + | St_move (_, r, _) + | St_op1 (_, _, r, _) + | St_cond (r, _, _) -> + L.psingleton r + | St_op2 (I8051.Addc, _, r1, r2, _) -> + L.join (L.join (L.psingleton r1) (L.psingleton r2)) + (L.hsingleton I8051.carry) + | St_opaccsA (_, _, r1, r2, _) + | St_opaccsB (_, _, r1, r2, _) + | St_op2 (_, _, r1, r2, _) + | St_load (_, r1, r2, _) -> + L.join (L.psingleton r1) (L.psingleton r2) + | St_store (r1, r2, r3, _) -> + L.join (L.join (L.psingleton r1) (L.psingleton r2)) (L.psingleton r3) + | St_newframe _ + | St_delframe _ -> + L.join (L.hsingleton I8051.spl) (L.hsingleton I8051.sph) + | St_return _ -> + Register.Set.empty, I8051.RegisterSet.union I8051.callee_saved ret_regs + +(* A statement is considered pure if it has no side effect, that is, if + its only effect is to write a value to its destination variable. + + A pure statement whose destination is dead after the statement will + be eliminated during the translation of [ERTL] to [LTL]. This is done by + replacing the statement with an [St_skip] statement. + + [eliminable liveafter stmt] returns [Some l], where [l] is [stmt]'s single + successor, if statement [stmt] is eliminable. Otherwise, it returns + [None]. The parameter [liveafter] is the set of variables that are live + after the statement. *) + +let eliminable ((pliveafter, hliveafter) : L.t) (stmt : statement) = + match stmt with + | St_skip _ + | St_comment _ + | St_cost _ + | St_newframe _ + | St_delframe _ + | St_pop _ + | St_push _ + | St_clear_carry _ + | St_set_carry _ + | St_store _ + | St_call_id _ + | St_call_ptr _ + | St_cond _ + | St_return _ -> + None + | St_get_hdw (r, _, l) + | St_framesize (r, l) + | St_int (r, _, l) + | St_addrH (r, _, l) + | St_addrL (r, _, l) + | St_move (r, _, l) + | St_opaccsA (_, r, _, _, l) + | St_opaccsB (_, r, _, _, l) + | St_op1 (_, r, _, l) + | St_op2 (_, r, _, _, l) + | St_load (r, _, _, l) -> + if (Register.Set.mem r pliveafter) || + (I8051.RegisterSet.mem I8051.carry hliveafter) then None else Some l + | St_set_hdw (r, _, l) + | St_hdw_to_hdw (r, _, l) -> + if I8051.RegisterSet.mem r hliveafter then None else Some l + +(* This is the abstract semantics of instructions. It defines the + variables that are live before the instruction in terms of + those that are live after the instruction. *) + +(* The standard definition is: a variable is considered live + before the instruction if either (1) it is used by the instruction, + or (2) it is live after the instruction and not defined by the + instruction. + + As an exception to this rule, if the instruction is eliminable, + then a variable is considered live before the instruction + if and only if it is live after the instruction. This anticipates + on the instruction's elimination. + + This exception means that the source variables of a pure + instruction need not be considered live if the instruction's result + is unused. This allows a sequence of pure instructions whose end + result is dead to be considered entirely dead. + + It is a simple, but not entirely trivial, exercise to check that + this transfer function is monotone. *) + +let statement_semantics (stmt : statement) (liveafter : L.t) : L.t = + match eliminable liveafter stmt with + | None -> + L.join (L.diff liveafter (defined stmt)) (used stmt) + | Some _ -> + liveafter + +(* A valuation is a function that maps a program point (a control flow + graph label) to the set of variables that are live after that + point. *) + +type valuation = + Label.t -> L.t + +(* This is how we turn an [ERTL] procedure into a liveness analysis + problem and solve it. *) + +let analyze (int_fun : internal_function) : valuation = + + (* Formulate the problem. Construct a system (recursive) equations + that describe the live variables before and after each + instruction. *) + + (* The following two functions, [livebefore] and [liveafter], + define these equations. Both use an oracle, a valuation -- + also called [liveafter] -- which is supposed to tell us + which variables are live after each label. *) + + (* The live variables before an instruction are computed, using the + instruction's semantics, in terms of the live variables after the + instruction -- which are given by the oracle. *) + + let livebefore label (liveafter : valuation) : L.t = + let stmt : statement = Label.Map.find label int_fun.f_graph in + statement_semantics stmt (liveafter label) + in + + (* The live variables after an instruction are the union of the live + variables before each of the instruction's successors. *) + + let liveafter label (liveafter : valuation) : L.t = + let stmt : statement = Label.Map.find label int_fun.f_graph in + Label.Set.fold (fun successor accu -> + L.join (livebefore successor liveafter) accu + ) (statement_successors stmt) L.bottom + in + + (* Compute the least fixed point of these recursive equations. *) + + F.lfp liveafter diff --git a/src/ERTL/liveness.mli b/src/ERTL/liveness.mli new file mode 100644 index 0000000..f2a7046 --- /dev/null +++ b/src/ERTL/liveness.mli @@ -0,0 +1,51 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module performs liveness analysis over the control flow graph + of a single [ERTL] procedure. *) + +(* In the following, a ``variable'' means a pseudo-register or an + allocatable hardware register. *) + +(* We collect liveness information about variables. We are not interested in + collecting information about non-allocatable hardware registers such as the + stack pointer registers, etc. so they are considered never defined and never + used as far as [ERTL] is concerned. *) + +open ERTL + +(* This is the lattice of sets of variables. *) + +module L : sig + type t = Register.Set.t * I8051.RegisterSet.t + val bottom: t + val join: t -> t -> t + val equal: t -> t -> bool + val diff: t -> t -> t + val psingleton: Register.t -> t + val hsingleton: I8051.register -> t +end + +(* [defined i] is the set of variables defined at (written by) + statement [i]. *) + +val defined: statement -> L.t + +(* A valuation is a function that maps a program point (a control flow + graph label) to the set of variables that are live after that + point. *) + +type valuation = + Label.t -> L.t + +(* [analyze int_fun] analyzes the function [int_fun] and returns a valuation. *) + +val analyze: internal_function -> valuation + +(* Pure instructions whose destination pseudo-register is dead after the + instruction will be eliminated during the translation of [ERTL] to [LTL]. + [eliminable liveafter i] returns [Some successor], where [successor] is + [i]'s single successor, if instruction [i] is eliminable. Otherwise, it + returns [None]. *) + +val eliminable: L.t -> statement -> Label.t option + diff --git a/src/ERTL/spill.ml b/src/ERTL/spill.ml new file mode 100644 index 0000000..7e89afd --- /dev/null +++ b/src/ERTL/spill.ml @@ -0,0 +1,153 @@ +(* Pasted from Pottier's PP compiler *) + +open Interference +(* open Integer *) +open Printf + +(* ------------------------------------------------------------------------- *) +(* Colorings. *) + +(* This module performs graph coloring with an unlimited number of + colors and aggressive coalescing. It is used for assigning stack + slots to the pseudo-registers that have been spilled by register + allocation. *) + +(* A coloring is a partial function of graph vertices to stack + slots. Vertices that are not in the domain of the coloring are + waiting for a decision to be made. *) + +type decision = + AST.immediate + +type coloring = + decision Vertex.Map.t + +(* ------------------------------------------------------------------------- *) +(* Here is the coloring algorithm. *) + +module Color (G : sig + + val graph: graph + val verbose: bool + +end) = struct + + module SlotSet = + Set.Make(struct type t = int let compare = Pervasives.compare end) + + (* [forbidden_slots graph coloring v] is the set of stack slots that + cannot be assigned to [v] considering the (partial) coloring + [coloring]. This takes into account [v]'s possible interferences + with other spilled vertices. *) + + let add_slot coloring r slots = + SlotSet.add (Vertex.Map.find r coloring) slots + + let forbidden_slots graph coloring v = + Vertex.Set.fold (add_slot coloring) (ipp graph v) SlotSet.empty + + (* [allocate_slot forbidden] returns a stack slot that is not a + member of the set [forbidden]. Unlike hardware registers, stack + slots are infinitely many, so it is always possible to allocate a + new one. The reference [locals] holds the space that must be + reserved on the stack for locals. *) + + let locals = + ref 0 + + let allocate_slot forbidden = + let rec loop slot = + if SlotSet.mem slot forbidden then + loop (slot + I8051.int_size) + else + slot + in + let slot = loop 0 in + locals := max (slot + I8051.int_size) !locals; + slot + + (* Allocation is in two phases, implemented by [coalescing] and + [simplification]. Each of these functions produces a coloring of its + graph argument. *) + + (* [simplification] expects a graph that does not contain any preference + edges. It picks a vertex [v], removes it, colors the remaining graph, + then colors [v] using a color that is still available. Such a color must + exist, since there is an unlimited number of colors. *) + + (* Following Appel, [v] is chosen with lowest degree: this will make this + vertex easier to color and might (?) help use fewer colors. *) + + let rec simplification graph : coloring = + + match lowest graph with + | Some (v, _) -> + + if G.verbose then + printf "SPILL: Picking vertex: %s.\n" (print_vertex graph v); + + (* Remove [v] from the graph and color what remains. *) + + let coloring = simplification (Interference.remove graph v) in + + (* Choose a color for [v]. *) + + let decision = + allocate_slot (forbidden_slots graph coloring v) + in + + if G.verbose then + printf "SPILL: Decision concerning %s: offset %d.\n" (print_vertex graph v) decision; + + (* Record our decision and return. *) + + Vertex.Map.add v decision coloring + + | None -> + + (* The graph is empty. Return an empty coloring. *) + + Vertex.Map.empty + + (* [coalescing] looks for a preference edge, that is, for two vertices + [x] and [y] such that [x] and [y] are move-related. In that case, + [x] and [y] cannot interfere, because the [Interference] module + does not allow two vertices to be related by both an interference + edge and a preference edge. If [coalescing] finds such an edge, it + coalesces [x] and [y] and continues coalescing. Otherwise, it + invokes the next phase, [simplification]. + + This is aggressive coalescing: we coalesce all preference edges, + without fear of creating high-degree nodes. This is good because + a move between two pseudo-registers that have been spilled in + distinct stack slots is very expensive: one load followed by one + store. *) + + let rec coalescing graph : coloring = + + match pppick graph (fun _ -> true) with + | Some (x, y) -> + + if G.verbose then + printf "SPILL: Coalescing %s and %s.\n" (print_vertex graph x) (print_vertex graph y); + + let graph = Interference.coalesce graph x y in + let coloring = coalescing graph in + Vertex.Map.add x (Vertex.Map.find y coloring) coloring + + | None -> + + simplification graph + + (* Run the algorithm. [coalescing] runs first and calls [simplification] + when it is done. *) + + let coloring = + coalescing G.graph + + (* Report how much stack space was used. *) + + let locals = + !locals + +end diff --git a/src/ERTL/spill.mli b/src/ERTL/spill.mli new file mode 100644 index 0000000..1e1fe00 --- /dev/null +++ b/src/ERTL/spill.mli @@ -0,0 +1,36 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module performs graph coloring with an unlimited number of + colors and aggressive coalescing. It is used for assigning stack + slots to the pseudo-registers that have been spilled by register + allocation. *) + +(* A coloring is a partial function of graph vertices to stack + slots. Vertices that are not in the domain of the coloring are + waiting for a decision to be made. *) + +type decision = + AST.immediate + +type coloring = + decision Interference.Vertex.Map.t + +(* Here is the coloring algorithm. Out of an interference graph, it + produces a coloring and reports how many colors (stack slots) were + required. The graph is expected to contain interference and + preferences edges between vertices only -- no hardware registers + are involved. If the [verbose] flag is set, the algorithm prints + information messages to the standard output channel. *) + +module Color (G : sig + + val graph: Interference.graph + val verbose: bool + +end) : sig + + val coloring: coloring + val locals: int + +end + diff --git a/src/ERTL/uses.ml b/src/ERTL/uses.ml new file mode 100644 index 0000000..938e9c9 --- /dev/null +++ b/src/ERTL/uses.ml @@ -0,0 +1,56 @@ +(* Pasted from Pottier's PP compiler *) + +(* This module offers functions that count how many times each + pseudo-register is used within a piece of [ERTL] code. This + is used in [Coloring] to drive the spilling heuristics. *) + +open ERTL + +let lookup uses r = + try + Register.Map.find r uses + with Not_found -> + 0 + +let count r uses = Register.Map.add r (lookup uses r + 1) uses + +let examine_statement _ stmt uses = + match stmt with + | St_skip _ + | St_comment _ + | St_cost _ + | St_hdw_to_hdw _ + | St_newframe _ + | St_delframe _ + | St_clear_carry _ + | St_set_carry _ + | St_call_id _ + | St_return _ -> + uses + | St_get_hdw (r, _, _) + | St_set_hdw (_, r, _) + | St_framesize (r, _) + | St_pop (r, _) + | St_push (r, _) + | St_int (r, _, _) + | St_addrH (r, _, _) + | St_addrL (r, _, _) + | St_cond (r, _, _) -> + count r uses + | St_move (r1, r2, _) + | St_op1 (_, r1, r2, _) + | St_call_ptr (r1, r2, _, _) -> + count r1 (count r2 uses) + | St_opaccsA (_, r1, r2, r3, _) + | St_opaccsB (_, r1, r2, r3, _) + | St_op2 (_, r1, r2, r3, _) + | St_load (r1, r2, r3, _) + | St_store (r1, r2, r3, _) -> + count r1 (count r2 (count r3 uses)) + +let examine_internal int_fun = + let uses = + Label.Map.fold examine_statement int_fun.f_graph Register.Map.empty + in + lookup uses + diff --git a/src/ERTL/uses.mli b/src/ERTL/uses.mli new file mode 100644 index 0000000..5e86531 --- /dev/null +++ b/src/ERTL/uses.mli @@ -0,0 +1,12 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module offers functions that count how many times each + pseudo-register is used within a piece of [ERTL] code. This is used + in [Coloring] to drive the spilling heuristics. *) + +(* [examine_procedure int_fun] counts how many times each pseudo-register + is used within procedure [int_fun]. It returns a function that maps + pseudo-registers to integer use counts. *) + +val examine_internal: ERTL.internal_function -> (Register.t -> int) + diff --git a/src/LIN/LIN.mli b/src/LIN/LIN.mli new file mode 100644 index 0000000..685e180 --- /dev/null +++ b/src/LIN/LIN.mli @@ -0,0 +1,91 @@ + +(** This module defines the abstract syntax tree of [LIN]. *) + +(** Compared to LTL where functions were graphs, the functions of a LIN program + are sequential instructions. *) + +type statement = + + (* Unconditional branch. *) + | St_goto of Label.t + + (* Label a statement. *) + | St_label of Label.t + + (* Comment. *) + | St_comment of string + + (* Emit a cost label. *) + | St_cost of CostLabel.t + + (* Assign an integer constant to a register. Parameters are the destination + register, and the integer. *) + | St_int of I8051.register * int + + (* Pop a value from the IRAM to the accumulator. *) + | St_pop + + (* Push a value from the accumulator to the IRAM. *) + | St_push + + (* Assign the address of a symbol to DPTR. Parameter is the symbol. *) + | St_addr of AST.ident + + (* Move the content of the accumulator to a register. Parameters is the + destination register. *) + | St_from_acc of I8051.register + + (* Move the content of a register to the accumulator. Parameters is the source + register. *) + | St_to_acc of I8051.register + + (* Apply an operation on the accumulators. Parameter is the operation. *) + | St_opaccs of I8051.opaccs + + (* Apply an unary operation on the A accumulator. Parameter is the + operation. *) + | St_op1 of I8051.op1 + + (* Apply a binary operation on the A accumulator. Parameters are the + operation, and the other source register. *) + | St_op2 of I8051.op2 * I8051.register + + (* Set the carry flag to zero. *) + | St_clear_carry + + (* Set the carry flag to 1. *) + | St_set_carry + + (* Load from external memory (address in DPTR) to the accumulator. *) + | St_load + + (* Store to external memory (address in DPTR) from the accumulator. *) + | St_store + + (* Call to a function given its name. Parameter is the name of the + function. *) + | St_call_id of AST.ident + + (* Call to a function given its address in DPTR. *) + | St_call_ptr + + (* Branch on A accumulator. Parameter is the label to go to when the A + accumulator is not 0. *) + | St_condacc of Label.t + + (* Transfer control to the address stored in the return address registers. *) + | St_return + +type internal_function = statement list + +type function_def = + | F_int of internal_function + | F_ext of AST.external_function + +(* A program is a list of global variables and their reserved space, a list of + function names and their definition, and the name of the main function. *) + +type program = + { vars : (AST.ident * int (* size *)) list ; + functs : (AST.ident * function_def) list ; + main : AST.ident option } diff --git a/src/LIN/LINInterpret.ml b/src/LIN/LINInterpret.ml new file mode 100644 index 0000000..cc870ed --- /dev/null +++ b/src/LIN/LINInterpret.ml @@ -0,0 +1,381 @@ + +(** This module provides an interpreter for the LIN language. *) + + +let error_prefix = "LIN interpret" +let error s = Error.global_error error_prefix s + + +module Mem = Driver.LINMemory +module Val = Mem.Value +let chunk = Driver.LINMemory.int_size +module Eval = I8051.Eval (Val) + + +(* Memory *) + +type memory = LIN.function_def Mem.memory + +(* Hardware registers environments. They associate a value to each hardware + register. *) + +type hdw_reg_env = Val.t I8051.RegisterMap.t + +(* Execution states. *) + +type state = + { pc : Val.address ; + isp : Val.address ; + exit : Val.address ; + carry : Val.t ; + renv : hdw_reg_env ; + mem : memory ; + trace : CostLabel.t list } + + +(* Helpers *) + +let change_pc st pc = { st with pc = pc } +let change_isp st isp = { st with isp = isp } +let change_exit st exit = { st with exit = exit } +let change_carry st carry = { st with carry = carry } +let change_renv st renv = { st with renv = renv } +let change_mem st mem = { st with mem = mem } +let change_trace st trace = { st with trace = trace } +let add_trace st cost_lbl = change_trace st (cost_lbl :: st.trace) + +let empty_state = + { pc = Val.null ; + isp = Val.null ; + exit = Val.null ; + carry = Val.undef ; + renv = I8051.RegisterMap.empty ; + mem = Mem.empty ; + trace = [] } + + +let int_fun_of_ptr mem ptr = match Mem.find_fun_def mem ptr with + | LIN.F_int def -> def + | _ -> error "Trying to fetch the definition of an external function." + +let current_int_fun st = int_fun_of_ptr st.mem st.pc + +let fetch_stmt st = + let msg = + Printf.sprintf "%s does not point to a statement." + (Val.string_of_address st.pc) in + if Val.is_mem_address st.pc then + let off = Val.offset_of_address st.pc in + let def = int_fun_of_ptr st.mem st.pc in + List.nth def (Val.Offset.to_int off) + else error msg + +let init_fun_call st ptr = + change_pc st (Val.change_address_offset ptr Val.Offset.zero) + +let next_pc st = + change_pc st (Val.add_address st.pc Val.Offset.one) + +let add_reg r v st = + let renv = I8051.RegisterMap.add r v st.renv in + change_renv st renv + +let get_reg r st = + if I8051.RegisterMap.mem r st.renv then I8051.RegisterMap.find r st.renv + else error ("Unknown hardware register " ^ (I8051.print_register r) ^ ".") + +let push st v = + let mem = Mem.store st.mem chunk st.isp v in + let isp = Val.add_address st.isp (Val.Offset.of_int chunk) in + change_mem (change_isp st isp) mem + +let pop st = + let isp = Val.add_address st.isp (Val.Offset.of_int (-chunk)) in + let st = change_isp st isp in + let v = Mem.load st.mem chunk st.isp in + (st, v) + +let save_ra st = + let ra = Val.add_address st.pc Val.Offset.one in + let st = push st (List.nth ra 0) in + let st = push st (List.nth ra 1) in + st + +let find_label lbl = + let rec aux i = function + | [] -> error (Printf.sprintf "Unknown label %s." lbl) + | LIN.St_label lbl' :: _ when lbl' = lbl -> i + | _ :: code -> aux (i+1) code + in + aux 0 + +let pointer_of_label st lbl = + let code = current_int_fun st in + let off = find_label lbl code in + Val.change_address_offset st.pc (Val.Offset.of_int off) + +let goto st lbl = + change_pc st (pointer_of_label st lbl) + +let return_pc st = + let (st, pch) = pop st in + let (st, pcl) = pop st in + (st, [pcl ; pch]) + +let dptr st = List.map (fun r -> get_reg r st) [I8051.dpl ; I8051.dph] + + +(* State pretty-printing *) + +let print_renv renv = + let f r v = + if not (Val.eq v Val.undef) then + Printf.printf "\n%s = %s%!" (I8051.print_register r) (Val.to_string v) in + I8051.RegisterMap.iter f renv + +let print_state st = + Printf.printf "PC: %s\n%!" (Val.string_of_address st.pc) ; + Printf.printf "SP: %s\n%!" + (Val.string_of_address [get_reg I8051.spl st ; get_reg I8051.sph st]) ; + Printf.printf "ISP: %s%!" (Val.string_of_address st.isp) ; + print_renv st.renv ; + Printf.printf "\nC = %s%!" (Val.to_string st.carry) ; + Mem.print st.mem ; + Printf.printf "\n%!" + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external mem f args = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> (mem', vs) + | (mem', InterpretExternal.A addr) -> (mem', addr) + +let fetch_external_args f st = + let size = Mem.size_of_quantity (Primitive.args_byte_size f) in + let params = MiscPottier.prefix size I8051.parameters in + List.map (fun r -> get_reg r st) params + +let set_result st vs = + let f st (r, v) = add_reg r v st in + List.fold_left f st (MiscPottier.combine I8051.rets vs) + +let interpret_external_call st f = + let args = fetch_external_args f st in + let (mem, vs) = interpret_external st.mem f args in + let st = change_mem st mem in + set_result st vs + +let interpret_call st ptr = + match Mem.find_fun_def st.mem ptr with + | LIN.F_int def -> + let st = save_ra st in + init_fun_call st ptr + | LIN.F_ext def -> + let st = next_pc st in + interpret_external_call st def.AST.ef_tag + +let interpret_return st = + let (st, pc) = return_pc st in + change_pc st pc + +let interpret_stmt st stmt = + match stmt with + + | LIN.St_goto lbl -> + goto st lbl + + | LIN.St_label _ -> + next_pc st + + | LIN.St_comment s -> +(* + Printf.printf "*** %s ***\n\n%!" s ; +*) + next_pc st + + | LIN.St_cost cost_lbl -> + let st = add_trace st cost_lbl in + next_pc st + + | LIN.St_int (r, i) -> + let st = add_reg r (Val.of_int i) st in + next_pc st + + | LIN.St_pop -> + let (st, v) = pop st in + let st = add_reg I8051.a v st in + next_pc st + + | LIN.St_push -> + let v = get_reg I8051.a st in + let st = push st v in + next_pc st + + | LIN.St_addr x -> + let vs = Mem.find_global st.mem x in + let st = add_reg I8051.dpl (List.nth vs 0) st in + let st = add_reg I8051.dph (List.nth vs 1) st in + next_pc st + + | LIN.St_from_acc destr -> + let st = add_reg destr (get_reg I8051.a st) st in + next_pc st + + | LIN.St_to_acc srcr -> + let st = add_reg I8051.a (get_reg srcr st) st in + next_pc st + + | LIN.St_opaccs opaccs -> + let (a, b) = + Eval.opaccs opaccs + (get_reg I8051.a st) + (get_reg I8051.b st) in + let st = add_reg I8051.a a st in + let st = add_reg I8051.b b st in + next_pc st + + | LIN.St_op1 op1 -> + let v = Eval.op1 op1 (get_reg I8051.a st) in + let st = add_reg I8051.a v st in + next_pc st + + | LIN.St_op2 (op2, srcr) -> + let (v, carry) = + Eval.op2 st.carry op2 + (get_reg I8051.a st) + (get_reg srcr st) in + let st = change_carry st carry in + let st = add_reg I8051.a v st in + next_pc st + + | LIN.St_clear_carry -> + let st = change_carry st Val.zero in + next_pc st + + | LIN.St_set_carry -> + let st = change_carry st (Val.of_int 1) in + next_pc st + + | LIN.St_load -> + let addr = dptr st in + let v = Mem.load st.mem chunk addr in + let st = add_reg I8051.a v st in + next_pc st + + | LIN.St_store -> + let addr = dptr st in + let mem = Mem.store st.mem chunk addr (get_reg I8051.a st) in + let st = change_mem st mem in + next_pc st + + | LIN.St_call_id f -> + interpret_call st (Mem.find_global st.mem f) + + | LIN.St_call_ptr -> + interpret_call st (dptr st) + + | LIN.St_condacc lbl_true -> + let v = get_reg I8051.a st in + if Val.is_true v then goto st lbl_true + else + if Val.is_false v then next_pc st + else error "Undecidable branchment." + + | LIN.St_return -> + interpret_return st + + +let compute_result st = + let vs = List.map (fun r -> get_reg r st) I8051.rets in + let f res v = res && (Val.is_int v) in + let is_int vs = (List.length vs > 0) && (List.fold_left f true vs) in + if is_int vs then + let chunks = + List.map (fun v -> IntValue.Int32.cast (Val.to_int_repr v)) vs in + IntValue.Int32.merge chunks + else IntValue.Int32.zero + +let rec iter_small_step debug st = + let print_and_return_result (res, cost_labels) = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state st ; + match fetch_stmt st with + | LIN.St_return when Val.eq_address (snd (return_pc st)) st.exit -> + print_and_return_result (compute_result st, List.rev st.trace) + | stmt -> + let st' = interpret_stmt st stmt in + iter_small_step debug st' + + +let add_global_vars = + List.fold_left + (fun mem (id, size) -> Mem.add_var mem id (AST.SQ (AST.QInt size)) None) + +let add_fun_defs = + List.fold_left (fun mem (f_id, f_def) -> Mem.add_fun_def mem f_id f_def) + +let init_prog (st : state) (p : LIN.program) : state = + let mem = add_global_vars (add_fun_defs st.mem p.LIN.functs) p.LIN.vars in + change_mem st mem + +let init_sp st = + let (mem, sp) = Mem.alloc st.mem I8051.ext_ram_size in + let sp = + Val.change_address_offset sp (Val.Offset.of_int I8051.ext_ram_size) in + let st = change_mem st mem in + (st, sp) + +let init_isp st = + let (mem, isp) = Mem.alloc st.mem I8051.int_ram_size in + let st = change_mem (change_isp st isp) mem in + let (mem, exit) = Mem.alloc st.mem 1 in + let st = change_exit st exit in + let st = push st (List.nth exit 0) in + let st = push st (List.nth exit 1) in + st + +let init_renv st sp = + let f r st = add_reg r Val.undef st in + let st = I8051.RegisterSet.fold f I8051.registers st in + let spl = List.nth sp 0 in + let sph = List.nth sp 1 in + let st = add_reg I8051.spl spl st in + let st = add_reg I8051.sph sph st in + st + +let init_main_call st main = + let ptr = Mem.find_global st.mem main in + match Mem.find_fun_def st.mem ptr with + | LIN.F_int def -> + init_fun_call st ptr + | _ -> error ("Cannot execute the main (\"" ^ main ^ "\"): it is external.") + + +(* Before interpreting, the environment is initialized: + - Add function definitions to the memory and reserve space for the globals. + - Allocate memory to emulate the external stack and initialize the external + stack pointer. + - Allocate memory to emulate the internal stack and initialize the internal + stack pointer. + - Initialiaze the physical register environment. All are set to 0, except for + the stack pointer registers that take the high and low bits of the external + stack pointer. + - Initialize a call to the main (set the current program counter to the + beginning of the function). + - Initialize the carry flag to 0. *) + +let interpret debug p = + Printf.printf "*** LIN interpret ***\n%!" ; + match p.LIN.main with + | None -> (IntValue.Int32.zero, []) + | Some main -> + let st = empty_state in + let st = init_prog st p in + let (st, sp) = init_sp st in + let st = init_isp st in + let st = init_renv st sp in + let st = init_main_call st main in + let st = change_carry st Val.zero in + iter_small_step debug st diff --git a/src/LIN/LINInterpret.mli b/src/LIN/LINInterpret.mli new file mode 100644 index 0000000..4faa205 --- /dev/null +++ b/src/LIN/LINInterpret.mli @@ -0,0 +1,5 @@ + +(** This module provides a function to interpret a [LIN] program and + return the trace of cost labels encountered. *) + +val interpret: bool -> LIN.program -> AST.trace diff --git a/src/LIN/LINPrinter.ml b/src/LIN/LINPrinter.ml new file mode 100644 index 0000000..abd4aec --- /dev/null +++ b/src/LIN/LINPrinter.ml @@ -0,0 +1,96 @@ + +(** This module provides a function to print [LIN] programs. *) + + +let n_spaces n = String.make n ' ' + + +let print_global n (x, size) = + Printf.sprintf "%s\"%s\" [%d]" (n_spaces n) x size + +let print_globals eformat n globs = + Eformat.printf eformat "%sglobals:\n" (n_spaces n) ; + List.iter + (fun g -> Eformat.printf eformat "%s\n" (print_global (n+2) g)) globs + + +let print_reg = I8051.print_register + +let print_a = print_reg I8051.a + + +let print_statement = function + | LIN.St_goto lbl -> "goto " ^ lbl + | LIN.St_label lbl -> lbl ^ ":" + | LIN.St_comment s -> + Printf.sprintf "*** %s ***" s + | LIN.St_cost cost_lbl -> + Printf.sprintf "emit %s" cost_lbl + | LIN.St_int (dstr, i) -> + Printf.sprintf "imm %s, %d" (print_reg dstr) i + | LIN.St_pop -> + Printf.sprintf "pop %s" print_a + | LIN.St_push -> + Printf.sprintf "push %s" print_a + | LIN.St_addr id -> + Printf.sprintf "addr DPTR, %s" id + | LIN.St_from_acc dstr -> + Printf.sprintf "move %s, %s" (print_reg dstr) print_a + | LIN.St_to_acc srcr -> + Printf.sprintf "move %s, %s" print_a (print_reg srcr) + | LIN.St_opaccs opaccs -> + Printf.sprintf "%s %s, %s" + (I8051.print_opaccs opaccs) print_a (print_reg I8051.b) + | LIN.St_op1 op1 -> + Printf.sprintf "%s %s" (I8051.print_op1 op1) print_a + | LIN.St_op2 (op2, srcr) -> + Printf.sprintf "%s %s, %s" + (I8051.print_op2 op2) print_a (print_reg srcr) + | LIN.St_clear_carry -> "clear CARRY" + | LIN.St_set_carry -> "set CARRY" + | LIN.St_load -> + Printf.sprintf "movex %s, @DPTR" print_a + | LIN.St_store -> + Printf.sprintf "movex @DPTR, %s" print_a + | LIN.St_call_id f -> Printf.sprintf "call \"%s\"" f + | LIN.St_call_ptr -> + Printf.sprintf "call_ptr DPTR" + | LIN.St_condacc lbl_true -> + Printf.sprintf "branch %s <> 0, %s" print_a lbl_true + | LIN.St_return -> "return" + + +let print_code eformat n c = + let f stmt = + Eformat.printf eformat "\n%s%s" (n_spaces n) (print_statement stmt) in + List.iter f c + + +let print_internal_decl eformat n f def = + Eformat.printf eformat "%s\"%s\"\n\n" (n_spaces n) f ; + print_code eformat (n+2) def + + +let print_external_decl eformat n f def = + Eformat.printf eformat "%sextern \"%s\": %s\n" + (n_spaces n) + f + (Primitive.print_sig def.AST.ef_sig) + + +let print_fun_decl eformat n (f, def) = match def with + | LIN.F_int def -> print_internal_decl eformat n f def + | LIN.F_ext def -> print_external_decl eformat n f def + +let print_fun_decls eformat n functs = + List.iter + (fun f -> print_fun_decl eformat n f ; Eformat.printf eformat "\n\n") functs + + +let print_program p = + let eformat = Eformat.create () in + Eformat.printf eformat "program:\n\n\n" ; + print_globals eformat 2 p.LIN.vars ; + Eformat.printf eformat "\n\n" ; + print_fun_decls eformat 2 p.LIN.functs ; + Eformat.get eformat diff --git a/src/LIN/LINPrinter.mli b/src/LIN/LINPrinter.mli new file mode 100644 index 0000000..7e1f192 --- /dev/null +++ b/src/LIN/LINPrinter.mli @@ -0,0 +1,4 @@ + +(** This module provides a function to print [LIN] programs. *) + +val print_program: LIN.program -> string diff --git a/src/LIN/LINToASM.ml b/src/LIN/LINToASM.ml new file mode 100644 index 0000000..e3fabb7 --- /dev/null +++ b/src/LIN/LINToASM.ml @@ -0,0 +1,192 @@ + +(** This module translates a [LIN] program into a [ASM] program. *) + + +let error_prefix = "LIN to ASM" +let error s = Error.global_error error_prefix s + + +(* Translation environment *) + +type env = + { externals : AST.ident list ; + exit_lbl : Label.t ; + fresh : unit -> string } + +let make_env externals exit_lbl fresh = + { externals = externals ; + exit_lbl = exit_lbl ; + fresh = fresh } + + +(* Fetch the labels found in a LIN program. *) + +let statement_labels = function + | LIN.St_goto lbl + | LIN.St_label lbl + | LIN.St_cost lbl + | LIN.St_condacc lbl -> Label.Set.singleton lbl + | _ -> Label.Set.empty + +let funct_labels (_, fun_def) = match fun_def with + | LIN.F_int stmts -> + let f labels stmt = Label.Set.union labels (statement_labels stmt) in + List.fold_left f Label.Set.empty stmts + | _ -> Label.Set.empty + +let prog_labels p = + let f labels funct = Label.Set.union labels (funct_labels funct) in + List.fold_left f Label.Set.empty p.LIN.functs + + +let size_of_vect_size = function + | `Four -> 4 + | `Seven -> 7 + | `Eight -> 8 + | `Eleven -> 11 + | `Sixteen -> 16 + +let vect_of_int i size = + let i' = + if i < 0 then (MiscPottier.pow 2 (size_of_vect_size size)) + i else i in + try BitVectors.vect_of_int i' size + with Invalid_argument _ (* "BitVectors.vect_of_int: size not big enough" *) -> + error + (Printf.sprintf "integer %d is too big to convert using %d bits. Maybe the stack frame of a function is too big." + i (size_of_vect_size size)) + +let byte_of_int i = vect_of_int i `Eight +let data_of_int i = `DATA (byte_of_int i) +let data16_of_int i = `DATA16 (vect_of_int i `Sixteen) +let acc_addr = I8051.reg_addr I8051.a +let dpl_addr = I8051.reg_addr I8051.dpl +let dph_addr = I8051.reg_addr I8051.dph +let st0_addr = I8051.reg_addr I8051.st0 +let st1_addr = I8051.reg_addr I8051.st1 + + +let translate_statement env = function + | LIN.St_goto lbl -> [`Jmp lbl] + | LIN.St_label lbl -> [`Label lbl] + | LIN.St_comment _ -> [] + | LIN.St_cost lbl -> + (* TODO: hack! Need to make the difference between cost labels and regular + labels. *) + [`Cost lbl ; `NOP] + | LIN.St_int (r, i) -> + [`MOV (`U3 (I8051.reg_addr r, data_of_int i))] + | LIN.St_pop -> + [`POP acc_addr] + | LIN.St_push -> + [`PUSH acc_addr] + | LIN.St_addr x when List.mem x env.externals -> + (* HACK! for Lustre support: externals appears in the code but are not + used. *) + [`MOV (`U4 (`DPTR, data16_of_int 0))] + (* error ("Primitive or external " ^ x ^ " is not supported.") *) + | LIN.St_addr x -> + [`Mov (`DPTR, x)] + | LIN.St_from_acc r -> + [`MOV (`U3 (I8051.reg_addr r, `A))] + | LIN.St_to_acc r -> + [`MOV (`U1 (`A, I8051.reg_addr r))] + | LIN.St_opaccs I8051.Mul -> + [`MUL (`A, `B)] + | LIN.St_opaccs I8051.DivuModu -> + [`DIV (`A, `B)] + | LIN.St_op1 I8051.Cmpl -> + [`CPL `A] + | LIN.St_op1 I8051.Inc -> + [`INC `A] + | LIN.St_op2 (I8051.Add, r) -> + [`ADD (`A, I8051.reg_addr r)] + | LIN.St_op2 (I8051.Addc, r) -> + [`ADDC (`A, I8051.reg_addr r)] + | LIN.St_op2 (I8051.Sub, r) -> + [`SUBB (`A, I8051.reg_addr r)] + | LIN.St_op2 (I8051.And, r) -> + [`ANL (`U1 (`A, I8051.reg_addr r))] + | LIN.St_op2 (I8051.Or, r) -> + [`ORL (`U1 (`A, I8051.reg_addr r))] + | LIN.St_op2 (I8051.Xor, r) -> + [`XRL (`U1 (`A, I8051.reg_addr r))] + | LIN.St_clear_carry -> + [`CLR `C] + | LIN.St_set_carry -> + [`SETB `C] + | LIN.St_load -> + [`MOVX (`U1 (`A, `EXT_IND_DPTR))] + | LIN.St_store -> + [`MOVX (`U2 (`EXT_IND_DPTR, `A))] + | LIN.St_call_id x when List.mem x env.externals -> + (* HACK! for Lustre support: externals appears in the code but are not + used. *) + [] + (* error ("Primitive or external " ^ x ^ " is not supported.") *) + | LIN.St_call_id f -> + [`Call f] + | LIN.St_call_ptr -> + let lbl = env.fresh () in + [`MOV (`U3 (st0_addr, dpl_addr)) ; (* save DPL *) + `MOV (`U3 (st1_addr, dph_addr)) ; (* save DPH *) + `Mov (`DPTR, lbl) ; (* DPTR <- return address *) + `PUSH dpl_addr ; (* push DPL *) + `PUSH dph_addr ; (* push DPH *) + `MOV (`U3 (dpl_addr, st0_addr)) ; (* restore DPL *) + `MOV (`U3 (dph_addr, st1_addr)) ; (* restore DPH *) + `MOV (`U1 (`A, data_of_int 0)) ; (* A <- 0 *) + `JMP `IND_DPTR ; (* jump to A+DPTR *) + `Label lbl] (* return address *) + | LIN.St_condacc lbl -> + [`WithLabel (`JNZ (`Label lbl))] + | LIN.St_return -> + [`RET] + +let translate_code env code = + List.flatten (List.map (translate_statement env) code) + + +let translate_fun_def env (id, def) = + let code = match def with + | LIN.F_int code -> translate_code env code + | LIN.F_ext ext -> [`NOP] in + ((`Label id) :: code) + +let translate_functs env main functs = + let preamble = match main with + | None -> [] + | Some main -> + [`MOV (`U3 (`DIRECT (byte_of_int I8051.isp_addr), + data_of_int I8051.isp_init)) ; + `MOV (`U3 (`DIRECT (byte_of_int I8051.spl_addr), + data_of_int I8051.spl_init)) ; + `MOV (`U3 (`DIRECT (byte_of_int I8051.sph_addr), + data_of_int I8051.sph_init)) ; + `Call main ; + `Label env.exit_lbl ; `Jmp env.exit_lbl] in + preamble @ (List.flatten (List.map (translate_fun_def env) functs)) + + +let init_env p = + let f_externals (id, def) = match def with LIN.F_ext _ -> [id] | _ -> [] in + let externals = + List.fold_left (fun res def -> res @ (f_externals def)) [] p.LIN.functs in + let prog_lbls = prog_labels p in + let exit_lbl = Label.Gen.fresh_prefix prog_lbls "_exit" in + let fresh = Label.make_fresh prog_lbls "_call_ret" in + make_env externals exit_lbl fresh + + +(* Translating programs. + + Global variables are associated an offset from the base of the external + memory. *) + +let translate p = + let env = init_env p in + let p = + { ASM.ppreamble = p.LIN.vars ; + ASM.pexit_label = env.exit_lbl ; + ASM.pcode = translate_functs env p.LIN.main p.LIN.functs ; + ASM.phas_main = p.LIN.main <> None } in + ASMInterpret.assembly p diff --git a/src/LIN/LINToASM.mli b/src/LIN/LINToASM.mli new file mode 100644 index 0000000..a7f88d7 --- /dev/null +++ b/src/LIN/LINToASM.mli @@ -0,0 +1,16 @@ + +(** This module translates a [LIN] program into a [ASM] program. *) + +(** Very few work here: + + The globals are associated an offset from the bottom of the memory and + depending on there size. + + The instruction that loads the address of a global into a register + actually loads the offset associated to the global. + + In 8051, a program is supposed to run forever. A preamble that contains + two instructions is added: the first calls the main, and the second + infinitely jumps to itself once the main has returned. *) + +val translate : LIN.program -> ASM.program diff --git a/src/LTL/LTL.mli b/src/LTL/LTL.mli new file mode 100644 index 0000000..dafa303 --- /dev/null +++ b/src/LTL/LTL.mli @@ -0,0 +1,108 @@ + +(** This module defines the abstract syntax tree of [LTL]. *) + +(** The main difference with ERTL is that only physical registers are present in + LTL (no more pseudo-registers). Pseudo-registers are associated either a + physical register or a location on the stack. This is done by a coloring + algorithm. Actually, this coloring algorithm relies on the result of a + liveness analysis that will also allow to remove dead code. *) + +type statement = + + (* The empty statement. *) + | St_skip of Label.t + + (* Comment. *) + | St_comment of string * Label.t + + (* Emit a cost label. *) + | St_cost of CostLabel.t * Label.t + + (* Assign an integer constant to a register. Parameters are the destination + register, the integer and the label of the next statement. *) + | St_int of I8051.register * int * Label.t + + (* Pop a value from the IRAM to the accumulator. Parameter is the label of the + next statement. *) + | St_pop of Label.t + + (* Push a value from the accumulator to the IRAM. Parameter is the label of + the next statement. *) + | St_push of Label.t + + (* Assign the address of a symbol to a DPTR. Parameters are the symbol, and + the label of the next statement. *) + | St_addr of AST.ident * Label.t + + (* Move the content of the accumulator to a register. Parameters are the + destination register, and the label of the next statement. *) + | St_from_acc of I8051.register * Label.t + + (* Move the content of a register to the accumulator. Parameters are the + source register, and the label of the next statement. *) + | St_to_acc of I8051.register * Label.t + + (* Apply an operation on the accumulators. Parameters are the operation, and + the label of the next statement. *) + | St_opaccs of I8051.opaccs * Label.t + + (* Apply an unary operation on the A accumulator. Parameters are the + operation, and the label of the next statement. *) + | St_op1 of I8051.op1 * Label.t + + (* Apply a binary operation on the A accumulator. Parameters are the + operation, the other source register, and the label of the next + statement. *) + | St_op2 of I8051.op2 * I8051.register * Label.t + + (* Set the carry flag to zero. Parameter is the label of the next + statement. *) + | St_clear_carry of Label.t + + (* Set the carry flag to 1. Parameter is the label of the next statement. *) + | St_set_carry of Label.t + + (* Load from external memory (address in DPTR) to the accumulator. Parameter + is the label of the next statement. *) + | St_load of Label.t + + (* Store to external memory (address in DPTR) from the accumulator. Parameter + is the label of the next statement. *) + | St_store of Label.t + + (* Call to a function given its name. Parameters are the name of the function, + and the label of the next statement. *) + | St_call_id of AST.ident * Label.t + + (* Call to a function given its address in DPTR. Parameter is the label of the + next statement. *) + | St_call_ptr of Label.t + + (* Branch on A accumulator. Parameters are the label to go to when the A + accumulator is not 0, and the label to go to when the A accumulator is + 0. *) + | St_condacc of Label.t * Label.t + + (* Transfer control to the address stored in the return address registers. *) + | St_return + +type graph = statement Label.Map.t + +type internal_function = + { f_luniverse : Label.Gen.universe ; + f_stacksize : int ; + f_graph : graph ; + f_entry : Label.t ; + f_exit : Label.t } + +type function_def = + | F_int of internal_function + | F_ext of AST.external_function + +(* A program is a list of global variables and their reserved space, a list of + function names and their definition, and the name of the main function. *) + +type program = + { vars : (AST.ident * int (* size *)) list ; + functs : (AST.ident * function_def) list ; + main : AST.ident option } diff --git a/src/LTL/LTLInterpret.ml b/src/LTL/LTLInterpret.ml new file mode 100644 index 0000000..7f45f9b --- /dev/null +++ b/src/LTL/LTLInterpret.ml @@ -0,0 +1,418 @@ + +(** This module provides an interpreter for the LTL language. *) + + +let error_prefix = "LTL interpret" +let error s = Error.global_error error_prefix s + + +module Mem = Driver.LTLMemory +module Val = Mem.Value +let chunk = Driver.LTLMemory.int_size +module Eval = I8051.Eval (Val) + + +(* Memory *) + +type memory = LTL.function_def Mem.memory + +(* Hardware registers environments. They associate a value to the each hardware + register. *) + +type hdw_reg_env = Val.t I8051.RegisterMap.t + +(* Execution states. *) + +type state = + { pc : Val.address ; + isp : Val.address ; + exit : Val.address ; + carry : Val.t ; + renv : hdw_reg_env ; + mem : memory ; + trace : CostLabel.t list } + + +(* Helpers *) + +let change_pc st pc = { st with pc = pc } +let change_isp st isp = { st with isp = isp } +let change_exit st exit = { st with exit = exit } +let change_carry st carry = { st with carry = carry } +let change_renv st renv = { st with renv = renv } +let change_mem st mem = { st with mem = mem } +let change_trace st trace = { st with trace = trace } +let add_trace st cost_lbl = change_trace st (cost_lbl :: st.trace) + +let empty_state = + { pc = Val.null ; + isp = Val.null ; + exit = Val.null ; + carry = Val.undef ; + renv = I8051.RegisterMap.empty ; + mem = Mem.empty ; + trace = [] } + + +(* Each label of each function is associated a pointer. The base of this pointer + is the base of the function in memory. Inside a function, offsets are + bijectively associated to labels. *) + +module Labels_Offsets = Bijection.Make (Label) (Val.Offset) + +let labels_offsets_internal int_fun = + let f lbl _ (lbls_offs, i) = + (Labels_Offsets.add1 lbl i lbls_offs, Val.Offset.succ i) in + Label.Map.fold f int_fun.LTL.f_graph + +(* [labels_offsets p] builds a bijection between the labels found in the + functions of [p] and some offsets. *) + +let labels_offsets p = + let f (lbls_offs, i) (_, def) = match def with + | LTL.F_int int_fun -> labels_offsets_internal int_fun (lbls_offs, i) + | _ -> (lbls_offs, i) in + fst (List.fold_left f (Labels_Offsets.empty, Val.Offset.zero) p.LTL.functs) + +let fun_def_of_ptr mem ptr = match Mem.find_fun_def mem ptr with + | LTL.F_int def -> def + | _ -> error "Trying to fetch the definition of an external function." + +let fetch_stmt lbls_offs st = + let msg = + Printf.sprintf "%s does not point to a statement." + (Val.string_of_address st.pc) in + if Val.is_mem_address st.pc then + let off = Val.offset_of_address st.pc in + let def = fun_def_of_ptr st.mem st.pc in + let lbl = Labels_Offsets.find2 off lbls_offs in + Label.Map.find lbl def.LTL.f_graph + else error msg + +let entry_pc lbls_offs ptr def = + Val.change_address_offset ptr (Labels_Offsets.find1 def.LTL.f_entry lbls_offs) + +let init_fun_call lbls_offs st ptr def = + let pc = entry_pc lbls_offs ptr def in + change_pc st pc + +let next_pc lbls_offs st lbl = + let off = Labels_Offsets.find1 lbl lbls_offs in + change_pc st (Val.change_address_offset st.pc off) + +let framesize st = + if Val.is_mem_address st.pc then + let def = fun_def_of_ptr st.mem st.pc in + def.LTL.f_stacksize + else error "Trying to load the stack size of an external function." + +let add_reg r v st = + let renv = I8051.RegisterMap.add r v st.renv in + change_renv st renv + +let get_reg r st = + if I8051.RegisterMap.mem r st.renv then I8051.RegisterMap.find r st.renv + else error ("Unknown hardware register " ^ (I8051.print_register r) ^ ".") + +let push st v = + let mem = Mem.store st.mem chunk st.isp v in + let isp = Val.add_address st.isp (Val.Offset.of_int chunk) in + change_mem (change_isp st isp) mem + +let pop st = + let isp = Val.add_address st.isp (Val.Offset.of_int (-chunk)) in + let st = change_isp st isp in + let v = Mem.load st.mem chunk st.isp in + (st, v) + +let save_ra lbls_offs st lbl = + let ra = + Val.change_address_offset st.pc (Labels_Offsets.find1 lbl lbls_offs) in + let st = push st (List.nth ra 0) in + let st = push st (List.nth ra 1) in + st + +let label_of_pointer lbls_offs ptr = +(* + Printf.printf "Retrieving label of %s\n%!" (Val.to_string ptr) ; +*) + let off = Val.offset_of_address ptr in + Labels_Offsets.find2 off lbls_offs + +let pointer_of_label lbls_offs ptr lbl = + Val.change_address_offset ptr (Labels_Offsets.find1 lbl lbls_offs) + +let return_pc st = + let (st, pch) = pop st in + let (st, pcl) = pop st in + (st, [pcl ; pch]) + +let dptr st = List.map (fun r -> get_reg r st) [I8051.dpl ; I8051.dph] + + +(* State pretty-printing *) + +let current_label lbls_offs st = + Labels_Offsets.find2 (Val.offset_of_address st.pc) lbls_offs + +let print_renv renv = + let f r v = + if not (Val.eq v Val.undef) then + Printf.printf "\n%s = %s%!" (I8051.print_register r) (Val.to_string v) in + I8051.RegisterMap.iter f renv + +let print_state lbls_offs st = + Printf.printf "PC: %s (%s)\n%!" + (Val.string_of_address st.pc) (current_label lbls_offs st) ; + Printf.printf "SP: %s\n%!" + (Val.string_of_address [get_reg I8051.spl st ; get_reg I8051.sph st]) ; + Printf.printf "ISP: %s%!" (Val.string_of_address st.isp) ; + print_renv st.renv ; + Printf.printf "\nC = %s%!" (Val.to_string st.carry) ; + Mem.print st.mem ; + Printf.printf "\n%!" + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external mem f args = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> (mem', vs) + | (mem', InterpretExternal.A addr) -> (mem', addr) + +let fetch_external_args f st = + let size = Mem.size_of_quantity (Primitive.args_byte_size f) in + let params = MiscPottier.prefix size I8051.parameters in + List.map (fun r -> get_reg r st) params + +let set_result st vs = + let f st (r, v) = add_reg r v st in + List.fold_left f st (MiscPottier.combine I8051.rets vs) + +let interpret_external_call st f next_pc = + let args = fetch_external_args f st in + let (mem, vs) = interpret_external st.mem f args in + let st = change_mem st mem in + let st = set_result st vs in + change_pc st next_pc + +let interpret_call lbls_offs st ptr ra = + match Mem.find_fun_def st.mem ptr with + | LTL.F_int def -> + let st = save_ra lbls_offs st ra in + init_fun_call lbls_offs st ptr def + | LTL.F_ext def -> + let next_pc = + Val.change_address_offset st.pc (Labels_Offsets.find1 ra lbls_offs) in + interpret_external_call st def.AST.ef_tag next_pc + +let interpret_return lbls_offs st = + let (st, pc) = return_pc st in + change_pc st pc + + +(* Interpret statements. *) + +let interpret_stmt lbls_offs st stmt = + let next_pc = next_pc lbls_offs in + match stmt with + + | LTL.St_skip lbl -> + next_pc st lbl + + | LTL.St_comment (s, lbl) -> +(* + Printf.printf "*** %s ***\n\n%!" s ; +*) + next_pc st lbl + + | LTL.St_cost (cost_lbl, lbl) -> + let st = add_trace st cost_lbl in + next_pc st lbl + + | LTL.St_int (r, i, lbl) -> + let st = add_reg r (Val.of_int i) st in + next_pc st lbl + + | LTL.St_pop lbl -> + let (st, v) = pop st in + let st = add_reg I8051.a v st in + next_pc st lbl + + | LTL.St_push lbl -> + let v = get_reg I8051.a st in + let st = push st v in + next_pc st lbl + + | LTL.St_addr (x, lbl) -> + let vs = Mem.find_global st.mem x in + let st = add_reg I8051.dpl (List.nth vs 0) st in + let st = add_reg I8051.dph (List.nth vs 1) st in + next_pc st lbl + + | LTL.St_from_acc (destr, lbl) -> + let st = add_reg destr (get_reg (I8051.a) st) st in + next_pc st lbl + + | LTL.St_to_acc (srcr, lbl) -> + let st = add_reg I8051.a (get_reg srcr st) st in + next_pc st lbl + + | LTL.St_opaccs (opaccs, lbl) -> + let (a, b) = + Eval.opaccs opaccs + (get_reg I8051.a st) + (get_reg I8051.b st) in + let st = add_reg I8051.a a st in + let st = add_reg I8051.b b st in + next_pc st lbl + + | LTL.St_op1 (op1, lbl) -> + let v = Eval.op1 op1 (get_reg I8051.a st) in + let st = add_reg I8051.a v st in + next_pc st lbl + + | LTL.St_op2 (op2, srcr, lbl) -> + let (v, carry) = + Eval.op2 st.carry op2 + (get_reg I8051.a st) + (get_reg srcr st) in + let st = change_carry st carry in + let st = add_reg I8051.a v st in + next_pc st lbl + + | LTL.St_clear_carry lbl -> + let st = change_carry st Val.zero in + next_pc st lbl + + | LTL.St_set_carry lbl -> + let st = change_carry st (Val.of_int 1) in + next_pc st lbl + + | LTL.St_load lbl -> + let addr = dptr st in + let v = Mem.load st.mem chunk addr in + let st = add_reg I8051.a v st in + next_pc st lbl + + | LTL.St_store lbl -> + let addr = dptr st in + let mem = Mem.store st.mem chunk addr (get_reg I8051.a st) in + let st = change_mem st mem in + next_pc st lbl + + | LTL.St_call_id (f, lbl) -> + interpret_call lbls_offs st (Mem.find_global st.mem f) lbl + + | LTL.St_call_ptr lbl -> + interpret_call lbls_offs st (dptr st) lbl + + | LTL.St_condacc (lbl_true, lbl_false) -> + let v = get_reg I8051.a st in + let lbl = + if Val.is_true v then lbl_true + else + if Val.is_false v then lbl_false + else error "Undecidable branchment." in + next_pc st lbl + + | LTL.St_return -> + interpret_return lbls_offs st + + +let compute_result st = + let vs = List.map (fun r -> get_reg r st) I8051.rets in + let f res v = res && (Val.is_int v) in + let is_int vs = (List.length vs > 0) && (List.fold_left f true vs) in + if is_int vs then + let chunks = + List.map (fun v -> IntValue.Int32.cast (Val.to_int_repr v)) vs in + IntValue.Int32.merge chunks + else IntValue.Int32.zero + +let rec iter_small_step debug lbls_offs st = + let print_and_return_result (res, cost_labels) = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state lbls_offs st ; + match fetch_stmt lbls_offs st with + | LTL.St_return when Val.eq_address (snd (return_pc st)) st.exit -> + print_and_return_result (compute_result st, List.rev st.trace) + | stmt -> + let st' = interpret_stmt lbls_offs st stmt in + iter_small_step debug lbls_offs st' + + +let add_global_vars = + List.fold_left + (fun mem (id, size) -> Mem.add_var mem id (AST.SQ (AST.QInt size)) None) + +let add_fun_defs = + List.fold_left (fun mem (f_id, f_def) -> Mem.add_fun_def mem f_id f_def) + +let init_prog (st : state) (p : LTL.program) : state = + let mem = add_global_vars (add_fun_defs st.mem p.LTL.functs) p.LTL.vars in + change_mem st mem + +let init_sp st = + let (mem, sp) = Mem.alloc st.mem I8051.ext_ram_size in + let sp = + Val.change_address_offset sp (Val.Offset.of_int I8051.ext_ram_size) in + let st = change_mem st mem in + (st, sp) + +let init_isp st = + let (mem, isp) = Mem.alloc st.mem I8051.int_ram_size in + let st = change_mem (change_isp st isp) mem in + let (mem, exit) = Mem.alloc st.mem 1 in + let st = change_exit st exit in + let st = push st (List.nth exit 0) in + let st = push st (List.nth exit 1) in + st + +let init_renv st sp = + let f r st = add_reg r Val.undef st in + let st = I8051.RegisterSet.fold f I8051.registers st in + let spl = List.nth sp 0 in + let sph = List.nth sp 1 in + let st = add_reg I8051.spl spl st in + let st = add_reg I8051.sph sph st in + st + +let init_main_call lbls_offs st main = + let ptr = Mem.find_global st.mem main in + match Mem.find_fun_def st.mem ptr with + | LTL.F_int def -> + init_fun_call lbls_offs st ptr def + | _ -> error ("Cannot execute the main (\"" ^ main ^ "\"): it is external.") + + +(* Before interpreting, the environment is initialized: + - Build a bijection between the labels in the program and some values (taken + amongst the offsets). + - Add function definitions to the memory and reserve space for the globals. + - Allocate memory to emulate the external stack and initialize the external + stack pointer. + - Allocate memory to emulate the internal stack and initialize the internal + stack pointer. + - Initialiaze the physical register environment. All are set to 0, except for + the stack pointer registers that take the high and low bits of the external + stack pointer. + - Initialize a call to the main (set the current program counter to the + beginning of the function). + - Initialize the carry flag to 0. *) + +let interpret debug p = + Printf.printf "*** LTL interpret ***\n%!" ; + match p.LTL.main with + | None -> (IntValue.Int8.zero, []) + | Some main -> + let lbls_offs = labels_offsets p in + let st = empty_state in + let st = init_prog st p in + let (st, sp) = init_sp st in + let st = init_isp st in + let st = init_renv st sp in + let st = init_main_call lbls_offs st main in + let st = change_carry st Val.zero in + iter_small_step debug lbls_offs st diff --git a/src/LTL/LTLInterpret.mli b/src/LTL/LTLInterpret.mli new file mode 100644 index 0000000..7a50a62 --- /dev/null +++ b/src/LTL/LTLInterpret.mli @@ -0,0 +1,5 @@ + +(** This module provides a function to interpret a [LTL] program and + return the trace of cost labels encountered. *) + +val interpret: bool -> LTL.program -> AST.trace diff --git a/src/LTL/LTLPrinter.ml b/src/LTL/LTLPrinter.ml new file mode 100644 index 0000000..2c7d6b2 --- /dev/null +++ b/src/LTL/LTLPrinter.ml @@ -0,0 +1,110 @@ + +(** This module provides a function to print [LTL] programs. *) + + +let n_spaces n = String.make n ' ' + + +let print_global n (x, size) = + Printf.sprintf "%s\"%s\" [%d]" (n_spaces n) x size + +let print_globals eformat n globs = + Eformat.printf eformat "%sglobals:\n" (n_spaces n) ; + List.iter + (fun g -> Eformat.printf eformat "%s\n" (print_global (n+2) g)) globs + + +let print_reg = I8051.print_register + +let print_a = print_reg I8051.a + + +let print_statement = function + | LTL.St_skip lbl -> "--> " ^ lbl + | LTL.St_comment (s, lbl) -> + Printf.sprintf "*** %s *** --> %s" s lbl + | LTL.St_cost (cost_lbl, lbl) -> + Printf.sprintf "emit %s --> %s" cost_lbl lbl + | LTL.St_int (dstr, i, lbl) -> + Printf.sprintf "imm %s, %d --> %s" (print_reg dstr) i lbl + | LTL.St_pop lbl -> + Printf.sprintf "pop %s --> %s" print_a lbl + | LTL.St_push lbl -> + Printf.sprintf "push %s --> %s" print_a lbl + | LTL.St_addr (id, lbl) -> + Printf.sprintf "addr DPTR, %s --> %s" id lbl + | LTL.St_from_acc (dstr, lbl) -> + Printf.sprintf "move %s, %s --> %s" (print_reg dstr) print_a lbl + | LTL.St_to_acc (srcr, lbl) -> + Printf.sprintf "move %s, %s --> %s" print_a (print_reg srcr) lbl + | LTL.St_opaccs (opaccs, lbl) -> + Printf.sprintf "%s %s, %s --> %s" + (I8051.print_opaccs opaccs) print_a (print_reg I8051.b) lbl + | LTL.St_op1 (op1, lbl) -> + Printf.sprintf "%s %s --> %s" (I8051.print_op1 op1) print_a lbl + | LTL.St_op2 (op2, srcr, lbl) -> + Printf.sprintf "%s %s, %s --> %s" + (I8051.print_op2 op2) print_a (print_reg srcr) lbl + | LTL.St_clear_carry lbl -> + Printf.sprintf "clear CARRY --> %s" lbl + | LTL.St_set_carry lbl -> + Printf.sprintf "set CARRY --> %s" lbl + | LTL.St_load lbl -> + Printf.sprintf "movex %s, @DPTR --> %s" print_a lbl + | LTL.St_store lbl -> + Printf.sprintf "movex @DPTR, %s --> %s" print_a lbl + | LTL.St_call_id (f, lbl) -> Printf.sprintf "call \"%s\" --> %s" f lbl + | LTL.St_call_ptr lbl -> + Printf.sprintf "call_ptr DPTR --> %s" lbl + | LTL.St_condacc (lbl_true, lbl_false) -> + Printf.sprintf "branch %s <> 0 --> %s, %s" print_a lbl_true lbl_false + | LTL.St_return -> Printf.sprintf "return" + + +let print_graph eformat n c = + let f lbl stmt = + Eformat.printf eformat "%s%s: %s\n" + (n_spaces n) + lbl + (print_statement stmt) in + Label.Map.iter f c + + +let print_internal_decl eformat n f def = + Eformat.printf eformat + "%s\"%s\"\n%sstacksize: %d\n%sentry: %s\n%sexit: %s\n\n" + (n_spaces n) + f + (n_spaces (n+2)) + def.LTL.f_stacksize + (n_spaces (n+2)) + def.LTL.f_entry + (n_spaces (n+2)) + def.LTL.f_exit ; + print_graph eformat (n+2) def.LTL.f_graph + + +let print_external_decl eformat n f def = + Eformat.printf eformat "%sextern \"%s\": %s\n" + (n_spaces n) + f + (Primitive.print_sig def.AST.ef_sig) + + +let print_fun_decl eformat n (f, def) = match def with + | LTL.F_int def -> print_internal_decl eformat n f def + | LTL.F_ext def -> print_external_decl eformat n f def + +let print_fun_decls eformat n functs = + List.iter + (fun f -> print_fun_decl eformat n f ; Eformat.printf eformat "\n\n") + functs + + +let print_program p = + let eformat = Eformat.create () in + Eformat.printf eformat "program:\n\n\n" ; + print_globals eformat 2 p.LTL.vars ; + Eformat.printf eformat "\n\n" ; + print_fun_decls eformat 2 p.LTL.functs ; + Eformat.get eformat diff --git a/src/LTL/LTLPrinter.mli b/src/LTL/LTLPrinter.mli new file mode 100644 index 0000000..82794d1 --- /dev/null +++ b/src/LTL/LTLPrinter.mli @@ -0,0 +1,6 @@ + + +(** This module provides a function to print [LTL] programs. *) + +val print_program : LTL.program -> string + diff --git a/src/LTL/LTLToLIN.ml b/src/LTL/LTLToLIN.ml new file mode 100644 index 0000000..07ca892 --- /dev/null +++ b/src/LTL/LTLToLIN.ml @@ -0,0 +1,133 @@ +(* This module provides a translation of LTL programs to LIN programs. *) + +(* Adapted from Pottier's PP compiler *) + +(* ------------------------------------------------------------------------- *) + +(* [translate_statement] translates an [LTL] statement into a [LIN] + statement. *) + +let translate_statement = function + + (* Because [Branch.compress] has been called before, no [St_skip] + statement can be reached. *) + + | LTL.St_skip lbl -> + LIN.St_goto lbl + + (* Sequential statements. *) + + | LTL.St_comment (s, _) -> + LIN.St_comment s + | LTL.St_cost (lbl, _) -> + LIN.St_cost lbl + | LTL.St_int (r, i, _) -> + LIN.St_int (r, i) + | LTL.St_addr (x, _) -> + LIN.St_addr x + | LTL.St_pop _ -> + LIN.St_pop + | LTL.St_push _ -> + LIN.St_push + | LTL.St_clear_carry _ -> + LIN.St_clear_carry + | LTL.St_set_carry _ -> + LIN.St_set_carry + | LTL.St_from_acc (r, _) -> + LIN.St_from_acc (r) + | LTL.St_to_acc (r, _) -> + LIN.St_to_acc r + | LTL.St_opaccs (opaccs, _) -> + LIN.St_opaccs opaccs + | LTL.St_op1 (op1, _) -> + LIN.St_op1 op1 + | LTL.St_op2 (op2, r, _) -> + LIN.St_op2 (op2, r) + | LTL.St_load _ -> + LIN.St_load + | LTL.St_store _ -> + LIN.St_store + | LTL.St_call_id (f, _) -> + LIN.St_call_id f + | LTL.St_call_ptr _ -> + LIN.St_call_ptr + + (* Conditional branch statement. In [LIN], control implicitly + falls through to the second successor, so only the first + successor is explicitly mentioned in the statement. *) + + | LTL.St_condacc (lbl_true, _) -> + LIN.St_condacc lbl_true + + (* Statement without a successor. *) + + | LTL.St_return -> + LIN.St_return + +(* ------------------------------------------------------------------------- *) + +(* [translate entry graph] turns an [LTL] control flow graph into + a [LIN] sequence of statements. *) + +let translate_graph entry graph = + + (* Keep track of the labels that have been visited (initially none), of the + labels that must exist within the [LIN] code (initially only the graph's + entry point) and of the list of [LIN] statements that are being + generated (initially empty). Statements are held in the list in reverse + order, for efficiency. The list is reversed once generation is over. *) + + let visited, required, statements = + ref Label.Set.empty, ref (Label.Set.singleton entry), ref [] + in + + (* Instantiate the functor. *) + + let module V = LTLToLINI.Visit (struct + let fetch label = + Label.Map.find label graph + let translate_statement = + translate_statement + let generate statement = + statements := statement :: !statements + let require label = + required := Label.Set.add label !required + let mark label = + visited := Label.Set.add label !visited + let marked label = + Label.Set.mem label !visited + end) in + + (* Traverse the control flow graph. *) + + V.visit entry; + + (* Now, get rid of the labels that do not need to exist. Also, + reverse the list to re-establish the correct order. *) + + List.filter (function + | LIN.St_label l -> + Label.Set.mem l !required + | _ -> + true + ) (List.rev !statements) + +(* ------------------------------------------------------------------------- *) + +(* Extend the translation to procedures and programs. *) + +let translate_internal int_fun = + (* Compress the graph to eliminate gotos (St_skip) statements. *) + let entry, graph = Branch.compress int_fun.LTL.f_entry int_fun.LTL.f_graph in + translate_graph entry graph + +let translate_funct (name, def) = + let def' = match def with + | LTL.F_int def -> LIN.F_int (translate_internal def) + | LTL.F_ext def -> LIN.F_ext def in + (name, def') + +let translate (p : LTL.program) : LIN.program = + { LIN.vars = p.LTL.vars; + LIN.functs = List.map translate_funct p.LTL.functs ; + LIN.main = p.LTL.main } diff --git a/src/LTL/LTLToLIN.mli b/src/LTL/LTLToLIN.mli new file mode 100644 index 0000000..c3b8e9b --- /dev/null +++ b/src/LTL/LTLToLIN.mli @@ -0,0 +1,9 @@ + +(** This module is the external part of the translation of [LTL] + programs into [LIN] programs. *) + +(** The translation mainly consists in compressing the graph (remove all gotos + statements) and then transform the graph structure in a sequence of + statements. *) + +val translate : LTL.program -> LIN.program diff --git a/src/LTL/LTLToLINI.ml b/src/LTL/LTLToLINI.ml new file mode 100644 index 0000000..07bc56d --- /dev/null +++ b/src/LTL/LTLToLINI.ml @@ -0,0 +1,172 @@ +(* Adapted from Pottier's PP compiler *) + +open MIPSOps + +(* ------------------------------------------------------------------------- *) + +(* The functor [Visit] implements the core of the translation of + [LTL] to [LIN]. *) + +module Visit (S : sig + + (* [fetch l] is the statement found at label [l] in the source + program. *) + + val fetch: Label.t -> LTL.statement + + (* [translate_statement stmt] translates the [LTL] statement [stmt] to + a [LIN] statement. [LTL] statements that have one explicit + successor are turned into [LIN] statements with an implicit + successor. [LTL] statements that have two explicit successors + are turned into [LIN] statements where the first successor is + explicit and the second successor is implicit. *) + + val translate_statement: LTL.statement -> LIN.statement + + (* [generate stmt] generates statement [stmt]. Statements are + generated sequentially. *) + + val generate: LIN.statement -> unit + + (* [require l] records the fact that the label [l] should explicitly + exist in the [LIN] program. It must be used whenever a [LIN] + branch statement is issued. *) + + val require: Label.t -> unit + + (* [mark l] marks the label [l]. [marked l] tells whether [l] is + marked. *) + + val mark: Label.t -> unit + val marked: Label.t -> bool + +end) = struct + + open S + + let rec visit l = + + if marked l then begin + + (* Label [l] has been visited before. This implies that an [St_label l] + statement has been issued already. We must now generate an + [St_goto] statement that transfers control to this place. Because + [l] is the target of a branch statement, we require it to exist + in the [LIN] code. *) + + require l; + generate (LIN.St_goto l) + + end + else begin + + (* Label [l] has never been visited before. First, record that it + now has been visited, so as to avoid looping. *) + + mark l; + + (* Then, generate an [St_label l] statement. This statement + will be useless if [l] turns out not to be the target of a + branch: this is taken care of later. *) + + generate (LIN.St_label l); + + (* Fetch the statement found at label [l] in the source program. *) + + let statement = fetch l in + + (* As an optional optimization, check if this is a conditional branch + whose implicit successor has been visited before and whose explicit + successor has not. In that case, if we did nothing special, we would + produce a conditional branch immediately followed with an + unconditional one, like this: + + bgtz $t1, find24 + j find42 + find24: + ... + + This can be avoided simply by reversing the condition: + + blez $t1, find42 + ... + + *) + + (* But in fact, there is only a unique conditional branch statement in + LTL for the 8051, so this is optimization is not used. *) + + (* Translate the statement. *) + + generate (translate_statement statement); + + (* Note that [translate_statement] never produces an [St_goto] + statement. As a result, the code above never generates an [St_label] + statement immediately followed with an [St_goto] statement. This + proves that we never generate a (conditional or unconditional) branch + towards an [St_goto] statement. *) + + (* There now remains to visit the statement's successors. *) + + match statement with + + (* Sequential statements. There is only one successor, with implicit + fallthrough. *) + + | LTL.St_skip l + | LTL.St_comment (_, l) + | LTL.St_cost (_, l) + | LTL.St_int (_, _, l) + | LTL.St_pop l + | LTL.St_push l + | LTL.St_addr (_, l) + | LTL.St_from_acc (_, l) + | LTL.St_to_acc (_, l) + | LTL.St_opaccs (_, l) + | LTL.St_op1 (_, l) + | LTL.St_op2 (_, _, l) + | LTL.St_clear_carry l + | LTL.St_set_carry l + | LTL.St_load l + | LTL.St_store l + | LTL.St_call_id (_, l) + | LTL.St_call_ptr l -> + + visit l + + (* Conditional branch statement. The label that is reached by + falling through in [LIN] is [l2], which means that it must be + translated first, so that its statements are contiguous with the + [LIN] branch statement. The label [l1], on the other hand, + becomes the target of a jump, so it is required to exist in the + [LIN] code. + + Code for [l1] is generated, if necessary, after we are done dealing + with [l2]. If [l1] has already been visited at this point, no code + needs be produced, so the second call to visit is made only if [l1] + has not been visited yet. *) + + | LTL.St_condacc (l1, l2) -> + + visit l2; + require l1; + if not (marked l1) then + visit l1 + + (* Statement without a successor. *) + + (* We would prefer to duplicate, rather than share, these + statements. Indeed, it is inefficient to generate a jump towards + one of these statements. Unfortunately, it is not easy to achieve + this, for two reasons. First, frame deletion is in the way. Second, + and worse, we must not generate duplicate labels. Maybe I will find + a fix in the future. *) + + | LTL.St_return -> + + () + + end + +end + diff --git a/src/LTL/LTLToLINI.mli b/src/LTL/LTLToLINI.mli new file mode 100644 index 0000000..48fa782 --- /dev/null +++ b/src/LTL/LTLToLINI.mli @@ -0,0 +1,57 @@ + +(** This module is the central part of the translation of [LTL] + programs into [LIN] programs. *) + +(* Adapted from Pottier's PP compiler *) + +(* The functor [Visit] implements the core of the translation of + [LTL] to [LIN]. *) + +module Visit (S : sig + + (* [fetch l] is the statement found at label [l] in the source + program. *) + + val fetch: Label.t -> LTL.statement + + (* [translate_statement stmt] translates the [LTL] statement [stmt] to + a [LIN] statement. [LTL] statements that have one explicit + successor are turned into [LIN] statements with an implicit + successor. [LTL] statements that have two explicit successors + are turned into [LIN] statements where the first successor is + explicit and the second successor is implicit. *) + + val translate_statement: LTL.statement -> LIN.statement + + (* [generate stmt] generates statement [stmt]. Statements are + generated sequentially. *) + + val generate: LIN.statement -> unit + + (* [require l] records the fact that the label [l] should explicitly + exist in the [LIN] program. It must be used whenever a [LIN] + branch statement is issued. *) + + val require: Label.t -> unit + + (* [mark l] marks the label [l]. [marked l] tells whether [l] is + marked. *) + + val mark: Label.t -> unit + val marked: Label.t -> bool + +end) : sig + + (* [visit] implements a depth-first traversal of the control flow graph, + generating statements as new nodes are being discovered. + + If label [l] has already been discovered, then [visit l] issues + an [St_goto] statement towards [l]. If [l] has not been + discovered yet, [visit l] marks [l] as discovered, issues an + [St_label] statement, translates the statement found at [l] in + the source program, and visits its successors. *) + + val visit: Label.t -> unit + +end + diff --git a/src/LTL/branch.ml b/src/LTL/branch.ml new file mode 100644 index 0000000..a76a96b --- /dev/null +++ b/src/LTL/branch.ml @@ -0,0 +1,88 @@ +(* Pasted from Pottier's PP compiler *) + +open LTL + +let compress entry graph = + + (* Build a table that maps every graph label to a distinct ``point'' + in the sense of [UnionFind]. *) + + let points = + Label.Map.mapi (fun label _ -> + UnionFind.fresh label + ) graph + in + + let lookup label = + try + Label.Map.find label points + with Not_found -> + assert false + in + + (* For every [St_skip] statement, make the source label an alias for + the target label, unless the former is already an alias for the + latter (which means that the graph contains a cycle of [St_skip] + statements). *) + + Label.Map.iter (fun src stmt -> + let source = lookup src in + match stmt with + | St_skip trgt -> + let target = lookup trgt in + if UnionFind.equivalent source target then + assert false (* can happen if the program contains an empty infinite loop, but let's ignore that *) + else + UnionFind.union source target + | _ -> + () + ) graph; + + (* Transform the graph by replacing every label with its representative. *) + + let rep label = + UnionFind.find (lookup label) + in + + rep entry, Label.Map.map (function + | LTL.St_skip l -> + LTL.St_skip (rep l) (* statement will be unreachable *) + | LTL.St_comment (s, l) -> + LTL.St_comment (s, rep l) + | LTL.St_cost (lbl, l) -> + LTL.St_cost (lbl, rep l) + | LTL.St_int (r, i, l) -> + LTL.St_int (r, i, rep l) + | LTL.St_addr (x, l) -> + LTL.St_addr (x, rep l) + | LTL.St_pop l -> + LTL.St_pop (rep l) + | LTL.St_push l -> + LTL.St_push (rep l) + | LTL.St_clear_carry l -> + LTL.St_clear_carry (rep l) + | LTL.St_set_carry l -> + LTL.St_set_carry (rep l) + | LTL.St_from_acc (r, l) -> + LTL.St_from_acc (r, rep l) + | LTL.St_to_acc (r, l) -> + LTL.St_to_acc (r, rep l) + | LTL.St_opaccs (opaccs, l) -> + LTL.St_opaccs (opaccs, rep l) + | LTL.St_op1 (op1, l) -> + LTL.St_op1 (op1, rep l) + | LTL.St_op2 (op2, r, l) -> + LTL.St_op2 (op2, r, rep l) + | LTL.St_load l -> + LTL.St_load (rep l) + | LTL.St_store l -> + LTL.St_store (rep l) + | LTL.St_call_id (f, l) -> + LTL.St_call_id (f, rep l) + | LTL.St_call_ptr l -> + LTL.St_call_ptr (rep l) + | LTL.St_condacc (lbl_true, lbl_false) -> + LTL.St_condacc (rep lbl_true, rep lbl_false) + | LTL.St_return -> + LTL.St_return + ) graph diff --git a/src/LTL/branch.mli b/src/LTL/branch.mli new file mode 100644 index 0000000..9038b19 --- /dev/null +++ b/src/LTL/branch.mli @@ -0,0 +1,14 @@ + +(** This module optimizes [LTL] code by suppressing all empty + statements. *) + +(* Pasted from Pottier's PP compiler *) + +(* This module optimizes [LTL] code by suppressing all [St_skip] statements. In + short, every statement whose successor is a [St_skip] statement is modified + so that its successor is the successor of the [St_skip] statement, and this + is repeated until no reachable [St_skip] statements remain. Unreachable + [St_skip] statements remain in the graph, but will be implicitly eliminated + in the translation of [LTL] to [LIN]. *) + +val compress: Label.t -> LTL.graph -> (Label.t * LTL.graph) diff --git a/src/RTL/RTL.mli b/src/RTL/RTL.mli new file mode 100644 index 0000000..e6689ba --- /dev/null +++ b/src/RTL/RTL.mli @@ -0,0 +1,120 @@ + +(** This module defines the abstract syntax tree of [RTL]. *) + +(* The main differences between RTLabs and RTL is instruction selection. + + Also, since addresses in 8051 are two words long, the instructions involving + addresses use two registers to represent them. *) + +type registers = Register.t list + +type statement = + + (* The empty statement. *) + | St_skip of Label.t + + (* Emit a cost label. *) + | St_cost of CostLabel.t * Label.t + + (* Assign the address of a symbol to registers. Parameters are the destination + registers (low bytes first), the symbol and the label of the next + statement. *) + | St_addr of Register.t * Register.t * AST.ident * Label.t + + (* Assign the stack pointer to registers. Parameters are the destination + registers (low bytes first), and the label of the next statement. *) + | St_stackaddr of Register.t * Register.t * Label.t + + (* Assign an integer constant to a register. Parameters are the destination + register, the integer and the label of the next statement. *) + | St_int of Register.t * int * Label.t + + (* Move the content of a register to another. Parameters are the destination + register, the source register, and the label of the next statement. *) + | St_move of Register.t * Register.t * Label.t + + (* Apply a binary operation that will later be translated in an operation on + the accumulators. Parameters are the operation, the destination registers + (ACC first, BACC second), the source registers, and the label of the next + statement. *) + | St_opaccs of I8051.opaccs * Register.t * Register.t * + Register.t * Register.t * Label.t + + (* Apply an unary operation. Parameters are the operation, the destination + register, the source register, and the label of the next statement. *) + | St_op1 of I8051.op1 * Register.t * Register.t * Label.t + + (* Apply a binary operation. Parameters are the operation, the destination + register, the source registers, and the label of the next statement. *) + | St_op2 of I8051.op2 * Register.t * Register.t * Register.t * Label.t + + (* Set the carry flag to zero. Parameter is the label of the next + statement. *) + | St_clear_carry of Label.t + + (* Set the carry flag to 1. Parameter is the label of the next statement. *) + | St_set_carry of Label.t + + (* Load from external memory. Parameters are the destination register, the + address registers (low bytes first), and the label of the next + statement. *) + | St_load of Register.t * Register.t * Register.t * Label.t + + (* Store to external memory. Parameters are the address registers (low bytes + first), the source register, and the label of the next statement. *) + | St_store of Register.t * Register.t * Register.t * Label.t + + (* Call to a function given its name. Parameters are the name of the function, + the arguments of the function, the destination registers, and the label of + the next statement. *) + | St_call_id of AST.ident * Register.t list * registers * Label.t + + (* Call to a function given its address. Parameters are the registers holding + the address of the function (low bytes first), the arguments of the + function, the destination registers, and the label of the next + statement. *) + | St_call_ptr of Register.t * Register.t * Register.t list * registers * + Label.t + + (* Tail call to a function given its name. Parameters are the name of the + function, and the arguments of the function. *) + | St_tailcall_id of AST.ident * Register.t list + + (* Tail call to a function given its address. Parameters are the registers + holding the address of the function (low bytes first), and the arguments of + the function. *) + | St_tailcall_ptr of Register.t * Register.t * Register.t list + + (* Branch. Parameters are the register holding the value for the branching, + the label to go to when the value is not 0, and the label to go to when the + value is 0. *) + | St_cond of Register.t * Label.t * Label.t + + (* Return the value of some registers (low bytes first). *) + | St_return of registers + + +type graph = statement Label.Map.t + +type internal_function = + { f_luniverse : Label.Gen.universe ; + f_runiverse : Register.universe ; + f_result : Register.t list (* low byte first *) ; + f_params : Register.t list ; + f_locals : Register.Set.t ; + f_stacksize : int ; + f_graph : graph ; + f_entry : Label.t ; + f_exit : Label.t } + +type function_def = + | F_int of internal_function + | F_ext of AST.external_function + +(* A program is a list of global variables and their reserved space, a list of + function names and their definition, and the name of the main function. *) + +type program = + { vars : (AST.ident * int (* size *)) list ; + functs : (AST.ident * function_def) list ; + main : AST.ident option } diff --git a/src/RTL/RTLInterpret.ml b/src/RTL/RTLInterpret.ml new file mode 100644 index 0000000..705a9a6 --- /dev/null +++ b/src/RTL/RTLInterpret.ml @@ -0,0 +1,324 @@ + +(** This module provides an interpreter for the RTL language. *) + + +let error_prefix = "RTL interpret" +let error s = Error.global_error error_prefix s + + +module Mem = Driver.RTLMemory +module Val = Mem.Value +let chunk = Driver.RTLMemory.int_size +module Eval = I8051.Eval (Val) + + +type memory = RTL.function_def Mem.memory + + +(* Local environments. They associate a value to the registers of the function + being executed. *) + +type local_env = Val.t Register.Map.t + +(* Call frames. The execution state has a call stack, each element of the stack + being composed of the return registers to store the result of the callee, the + graph, the node, the local environment and the value of the carry to resume + the execution of the caller. *) + +type stack_frame = + { ret_regs : Register.t list ; + graph : RTL.graph ; + pc : Label.t ; + sp : Val.address ; + lenv : local_env ; + carry : Val.t } + +(* Execution states. There are three possible states : + - The constructor [State] represents a state when executing a function + - The constructor [CallState] represents a state when calling a function + - The constructor [ReturnState] represents a state when leaving a function *) + +type state = + | State of stack_frame list * RTL.graph * Label.t * Val.address (* sp *) * + local_env * Val.t (* carry *) * memory * CostLabel.t list + | CallState of stack_frame list * RTL.function_def * + Val.t list (* args *) * memory * CostLabel.t list + | ReturnState of stack_frame list * Val.t list (* return values *) * + memory * CostLabel.t list + +let string_of_local_env lenv = + let f x v s = + s ^ + (if Val.eq v Val.undef then "" + else (Register.print x) ^ " = " ^ (Val.to_string v) ^ " ") in + Register.Map.fold f lenv "" + +let string_of_args args = + let f s v = s ^ " " ^ (Val.to_string v) in + List.fold_left f "" args + +let print_state = function + | State (_, _, lbl, sp, lenv, carry, mem, _) -> + Printf.printf "Stack pointer: %s\n\nCarry: %s\n\nLocal environment:\n%s\n\nMemory:%s\nRegular state: %s\n\n%!" + (Val.string_of_address sp) + (Val.to_string carry) + (string_of_local_env lenv) + (Mem.to_string mem) + lbl + | CallState (_, _, args, mem, _) -> + Printf.printf "Memory:%s\nCall state: %s\n\n%!" + (Mem.to_string mem) + (string_of_args args) + | ReturnState (_, vs, mem, _) -> + Printf.printf "Memory:%s\nReturn state: %s\n\n%!" + (Mem.to_string mem) + (string_of_args vs) + + +let find_function mem f = + let addr = Mem.find_global mem f in + Mem.find_fun_def mem addr + +let get_local_value (lenv : local_env) (r : Register.t) : Val.t = + if Register.Map.mem r lenv then Register.Map.find r lenv + else error ("Unknown local register \"" ^ (Register.print r) ^ "\".") +let get_arg_values lenv args = List.map (get_local_value lenv) args + +let get_local_addr lenv f1 f2 = + List.map (get_local_value lenv) [f1 ; f2] + + +let adds rs vs lenv = + let f lenv r v = Register.Map.add r v lenv in + List.fold_left2 f lenv rs vs + + +(* Assign a value to some destinations registers. *) + +let assign_state sfrs graph lbl sp lenv carry mem trace destrs vs = + let lenv = adds destrs vs lenv in + State (sfrs, graph, lbl, sp, lenv, carry, mem, trace) + +(* Branch on a value. *) + +let branch_state sfrs graph lbl_true lbl_false sp lenv carry mem trace v = + let next_lbl = + if Val.is_true v then lbl_true + else + if Val.is_false v then lbl_false + else error "Undefined conditional value." in + State (sfrs, graph, next_lbl, sp, lenv, carry, mem, trace) + + +(* Interpret statements. *) + +let interpret_statement + (sfrs : stack_frame list) + (graph : RTL.graph) + (sp : Val.address) + (lenv : local_env) + (carry : Val.t) + (mem : memory) + (stmt : RTL.statement) + (trace : CostLabel.t list) : + state = match stmt with + + | RTL.St_skip lbl -> + State (sfrs, graph, lbl, sp, lenv, carry, mem, trace) + + | RTL.St_cost (cost_lbl, lbl) -> + State (sfrs, graph, lbl, sp, lenv, carry, mem, cost_lbl :: trace) + + | RTL.St_addr (r1, r2, x, lbl) -> + assign_state sfrs graph lbl sp lenv carry mem trace [r1 ; r2] + (Mem.find_global mem x) + + | RTL.St_stackaddr (r1, r2, lbl) -> + assign_state sfrs graph lbl sp lenv carry mem trace [r1 ; r2] sp + + | RTL.St_int (r, i, lbl) -> + assign_state sfrs graph lbl sp lenv carry mem trace [r] [Val.of_int i] + + | RTL.St_move (destr, srcr, lbl) -> + assign_state sfrs graph lbl sp lenv carry mem trace [destr] + [get_local_value lenv srcr] + + | RTL.St_opaccs (opaccs, destr1, destr2, srcr1, srcr2, lbl) -> + let (v1, v2) = + Eval.opaccs opaccs + (get_local_value lenv srcr1) + (get_local_value lenv srcr2) in + assign_state sfrs graph lbl sp lenv carry mem trace + [destr1 ; destr2] [v1 ; v2] + + | RTL.St_op1 (op1, destr, srcr, lbl) -> + let v = Eval.op1 op1 (get_local_value lenv srcr) in + assign_state sfrs graph lbl sp lenv carry mem trace [destr] [v] + + | RTL.St_op2 (op2, destr, srcr1, srcr2, lbl) -> + let (v, carry) = + Eval.op2 carry op2 + (get_local_value lenv srcr1) + (get_local_value lenv srcr2) in + assign_state sfrs graph lbl sp lenv carry mem trace [destr] [v] + + | RTL.St_clear_carry lbl -> + State (sfrs, graph, lbl, sp, lenv, Val.zero, mem, trace) + + | RTL.St_set_carry lbl -> + State (sfrs, graph, lbl, sp, lenv, Val.of_int 1, mem, trace) + + | RTL.St_load (destr, addr1, addr2, lbl) -> + let addr = get_local_addr lenv addr1 addr2 in + let v = Mem.load mem chunk addr in + assign_state sfrs graph lbl sp lenv carry mem trace [destr] [v] + + | RTL.St_store (addr1, addr2, srcr, lbl) -> + let addr = get_local_addr lenv addr1 addr2 in + let mem = Mem.store mem chunk addr (get_local_value lenv srcr) in + State (sfrs, graph, lbl, sp, lenv, carry, mem, trace) + + | RTL.St_call_id (f, args, ret_regs, lbl) -> + let f_def = find_function mem f in + let args = get_arg_values lenv args in + let sf = + { ret_regs = ret_regs ; graph = graph ; pc = lbl ; + sp = sp ; lenv = lenv ; carry = carry } + in + CallState (sf :: sfrs, f_def, args, mem, trace) + + | RTL.St_call_ptr (f1, f2, args, ret_regs, lbl) -> + let addr = get_local_addr lenv f1 f2 in + let f_def = Mem.find_fun_def mem addr in + let args = get_arg_values lenv args in + let sf = { ret_regs = ret_regs ; graph = graph ; pc = lbl ; + sp = sp ; lenv = lenv ; carry = carry } in + CallState (sf :: sfrs, f_def, args, mem, trace) + + | RTL.St_tailcall_id (f, args) -> + let f_def = find_function mem f in + let args = get_arg_values lenv args in + let mem = Mem.free mem sp in + CallState (sfrs, f_def, args, mem, trace) + + | RTL.St_tailcall_ptr (f1, f2, args) -> + let addr = get_local_addr lenv f1 f2 in + let f_def = Mem.find_fun_def mem addr in + let args = get_arg_values lenv args in + let mem = Mem.free mem sp in + CallState (sfrs, f_def, args, mem, trace) + + | RTL.St_cond (srcr, lbl_true, lbl_false) -> + let v = get_local_value lenv srcr in + branch_state sfrs graph lbl_true lbl_false sp lenv carry mem trace v + + | RTL.St_return rl -> + let vl = List.map (get_local_value lenv) rl in + let mem = Mem.free mem sp in + ReturnState (sfrs, vl, mem, trace) + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external mem f args = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> (mem', vs) + | (mem', InterpretExternal.A addr) -> (mem', addr) + +let init_locals + (locals : Register.Set.t) + (params : Register.t list) + (args : Val.t list) : + local_env = + let f r lenv = Register.Map.add r Val.undef lenv in + let lenv = Register.Set.fold f locals Register.Map.empty in + let f lenv r v = Register.Map.add r v lenv in + List.fold_left2 f lenv params args + +let state_after_call + (sfrs : stack_frame list) + (f_def : RTL.function_def) + (args : Val.t list) + (mem : memory) + (trace : CostLabel.t list) : + state = + match f_def with + | RTL.F_int def -> + let (mem', sp) = Mem.alloc mem def.RTL.f_stacksize in + State (sfrs, def.RTL.f_graph, def.RTL.f_entry, sp, + init_locals def.RTL.f_locals def.RTL.f_params args, + Val.undef, mem', trace) + | RTL.F_ext def -> + let (mem', vs) = interpret_external mem def.AST.ef_tag args in + ReturnState (sfrs, vs, mem', trace) + +let state_after_return + (sf : stack_frame) + (sfrs : stack_frame list) + (ret_vals : Val.t list) + (mem : memory) + (trace : CostLabel.t list) : + state = + let f i lenv r = Register.Map.add r (List.nth ret_vals i) lenv in + let lenv = MiscPottier.foldi f sf.lenv sf.ret_regs in + State (sfrs, sf.graph, sf.pc, sf.sp, lenv, sf.carry, mem, trace) + + +let small_step (st : state) : state = match st with + | State (sfrs, graph, pc, sp, lenv, carry, mem, trace) -> + let stmt = Label.Map.find pc graph in + interpret_statement sfrs graph sp lenv carry mem stmt trace + | CallState (sfrs, f_def, args, mem, trace) -> + state_after_call sfrs f_def args mem trace + | ReturnState ([], ret_vals, mem, trace) -> + assert false (* End of execution; handled in iter_small_step. *) + | ReturnState (sf :: sfrs, ret_vals, mem, trace) -> + state_after_return sf sfrs ret_vals mem trace + + +let compute_result vs = + let f res v = res && (Val.is_int v) in + let is_int vs = (List.length vs > 0) && (List.fold_left f true vs) in + if is_int vs then + let chunks = + List.map (fun v -> IntValue.Int32.cast (Val.to_int_repr v)) vs in + IntValue.Int32.merge chunks + else IntValue.Int32.zero + +let rec iter_small_step debug st = + let print_and_return_result (res, cost_labels) = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state st ; + match small_step st with + | ReturnState ([], vs, mem, trace) -> + print_and_return_result (compute_result vs, List.rev trace) + | st' -> iter_small_step debug st' + + +let add_global_vars = + List.fold_left + (fun mem (id, size) -> Mem.add_var mem id (AST.SQ (AST.QInt size)) None) + +let add_fun_defs = + List.fold_left (fun mem (f_id, f_def) -> Mem.add_fun_def mem f_id f_def) + + +(* The memory is initialized by loading the code into it, and by reserving space + for the global variables. *) + +let init_mem (p : RTL.program) : memory = + add_global_vars (add_fun_defs Mem.empty p.RTL.functs) p.RTL.vars + + +(* Interpret the program only if it has a main. *) + +let interpret debug p = + Printf.printf "*** RTL interpret ***\n%!" ; + match p.RTL.main with + | None -> (IntValue.Int32.zero, []) + | Some main -> + let mem = init_mem p in + let main_def = find_function mem main in + let st = CallState ([], main_def, [], mem, []) in + iter_small_step debug st diff --git a/src/RTL/RTLInterpret.mli b/src/RTL/RTLInterpret.mli new file mode 100644 index 0000000..eb2a263 --- /dev/null +++ b/src/RTL/RTLInterpret.mli @@ -0,0 +1,5 @@ + +(** This module provides a function to interpret a [RTL] program + and return the trace of cost labels encountered. *) + +val interpret : bool -> RTL.program -> AST.trace diff --git a/src/RTL/RTLPrinter.ml b/src/RTL/RTLPrinter.ml new file mode 100644 index 0000000..21484c3 --- /dev/null +++ b/src/RTL/RTLPrinter.ml @@ -0,0 +1,171 @@ + +(** This module provides a function to print [RTL] programs. *) + + +let n_spaces n = String.make n ' ' + + +let print_global n (x, size) = + Printf.sprintf "%s\"%s\" [%d]" (n_spaces n) x size + +let print_globals eformat n globs = + Eformat.printf eformat "%sglobals:\n" (n_spaces n) ; + List.iter + (fun g -> Eformat.printf eformat "%s\n" (print_global (n+2) g)) globs + +let print_reg = Register.print + +let reg_set_to_list rs = + let e = ref [] in + Register.Set.iter (fun r -> e := r :: !e) rs; + List.rev !e + +let print_reg_list first last sep f rl = + Printf.sprintf "%s%s%s" + first (MiscPottier.string_of_list sep f rl) last + +let print_ptr rl = print_reg_list "[" "]" " ; " print_reg rl + +let print_args rl = print_reg_list "(" ")" ", " print_reg rl + +let print_return rl = print_reg_list "[" "]" " ; " print_reg rl + +let print_params rl = print_reg_list "(" ")" ", " Register.print rl + +let print_locals rs = + let rl = reg_set_to_list rs in + Printf.sprintf "%s" (print_reg_list "" "" ", " Register.print rl) + +let print_result rl = print_reg_list "[" "]" " ; " Register.print rl + + +let print_statement = function + | RTL.St_skip lbl -> "--> " ^ lbl + | RTL.St_cost (cost_lbl, lbl) -> + Printf.sprintf "emit %s --> %s" cost_lbl lbl + | RTL.St_addr (dstr1, dstr2, id, lbl) -> + Printf.sprintf "imm (%s, %s), %s --> %s" + (print_reg dstr1) (print_reg dstr2) id lbl + | RTL.St_stackaddr (dstr1, dstr2, lbl) -> + Printf.sprintf "imm (%s, %s), STACK --> %s" + (print_reg dstr1) (print_reg dstr2) lbl + | RTL.St_int (dstr, i, lbl) -> + Printf.sprintf "imm %s, %d --> %s" (print_reg dstr) i lbl + | RTL.St_move (dstr, srcr, lbl) -> + Printf.sprintf "move %s, %s --> %s" + (print_reg dstr) (print_reg srcr) lbl + | RTL.St_opaccs (opaccs, dstr1, dstr2, srcr1, srcr2, lbl) -> + Printf.sprintf "%s (%s, %s) %s, %s --> %s" + (I8051.print_opaccs opaccs) + (print_reg dstr1) + (print_reg dstr2) + (print_reg srcr1) + (print_reg srcr2) + lbl + | RTL.St_op1 (op1, dstr, srcr, lbl) -> + Printf.sprintf "%s %s, %s --> %s" + (I8051.print_op1 op1) (print_reg dstr) (print_reg srcr) lbl + | RTL.St_op2 (op2, dstr, srcr1, srcr2, lbl) -> + Printf.sprintf "%s %s, %s, %s --> %s" + (I8051.print_op2 op2) + (print_reg dstr) + (print_reg srcr1) + (print_reg srcr2) + lbl + | RTL.St_clear_carry lbl -> + Printf.sprintf "clear CARRY --> %s" lbl + | RTL.St_set_carry lbl -> + Printf.sprintf "set CARRY --> %s" lbl + | RTL.St_load (dstr, addr1, addr2, lbl) -> + Printf.sprintf "load %s, (%s, %s) --> %s" + (print_reg dstr) + (print_reg addr1) + (print_reg addr2) + lbl + | RTL.St_store (addr1, addr2, srcr, lbl) -> + Printf.sprintf "store (%s, %s), %s --> %s" + (print_reg addr1) + (print_reg addr2) + (print_reg srcr) + lbl + | RTL.St_call_id (f, args, dstrs, lbl) -> + Printf.sprintf "call \"%s\", %s, %s --> %s" + f + (print_args args) + (print_return dstrs) + lbl + | RTL.St_call_ptr (f1, f2, args, dstrs, lbl) -> + Printf.sprintf "call_ptr [%s ; %s], %s, %s --> %s" + (print_reg f1) + (print_reg f2) + (print_args args) + (print_return dstrs) + lbl + | RTL.St_tailcall_id (f, args) -> + Printf.sprintf "tailcall \"%s\", %s" + f + (print_args args) + | RTL.St_tailcall_ptr (f1, f2, args) -> + Printf.sprintf "tailcall_ptr [%s ; %s], %s" + (print_reg f1) + (print_reg f2) + (print_args args) + | RTL.St_cond (srcr, lbl_true, lbl_false) -> + Printf.sprintf "branch %s <> 0 --> %s, %s" + (print_reg srcr) lbl_true lbl_false + | RTL.St_return regs -> + Printf.sprintf "return %s" (print_return regs) + + +let print_graph eformat n c = + let f lbl stmt = + Eformat.printf eformat "%s%s: %s\n" + (n_spaces n) + lbl + (print_statement stmt) in + Label.Map.iter f c + + +let print_internal_decl eformat n f def = + Eformat.printf eformat + "%s\"%s\"%s\n%slocals: %s\n%sresult: %s\n%sstacksize: %d\n%sentry: %s\n%sexit: %s\n\n" + (n_spaces n) + f + (print_params def.RTL.f_params) + (n_spaces (n+2)) + (print_locals def.RTL.f_locals) + (n_spaces (n+2)) + (print_result def.RTL.f_result) + (n_spaces (n+2)) + def.RTL.f_stacksize + (n_spaces (n+2)) + def.RTL.f_entry + (n_spaces (n+2)) + def.RTL.f_exit ; + print_graph eformat (n+2) def.RTL.f_graph + + +let print_external_decl eformat n f def = + Eformat.printf eformat "%sextern \"%s\": %s\n" + (n_spaces n) + f + (Primitive.print_sig def.AST.ef_sig) + + +let print_fun_decl eformat n (f, def) = match def with + | RTL.F_int def -> print_internal_decl eformat n f def + | RTL.F_ext def -> print_external_decl eformat n f def + +let print_fun_decls eformat n functs = + List.iter + (fun f -> print_fun_decl eformat n f ; Eformat.printf eformat "\n\n") + functs + + +let print_program p = + let eformat = Eformat.create () in + Eformat.printf eformat "program:\n\n\n" ; + print_globals eformat 2 p.RTL.vars ; + Eformat.printf eformat "\n\n" ; + print_fun_decls eformat 2 p.RTL.functs ; + Eformat.get eformat diff --git a/src/RTL/RTLPrinter.mli b/src/RTL/RTLPrinter.mli new file mode 100644 index 0000000..dbcfff8 --- /dev/null +++ b/src/RTL/RTLPrinter.mli @@ -0,0 +1,4 @@ + +(** This module provides a function to print [RTL] programs. *) + +val print_program : RTL.program -> string diff --git a/src/RTL/RTLToERTL.ml b/src/RTL/RTLToERTL.ml new file mode 100644 index 0000000..0589176 --- /dev/null +++ b/src/RTL/RTLToERTL.ml @@ -0,0 +1,500 @@ + +(** This module provides a translation of [RTL] programs to [ERTL] + programs. *) + + +let error_prefix = "RTL to ERTL" +let error = Error.global_error error_prefix + + +(* Helper functions *) + +let change_exit_label lbl def = + { def with ERTL.f_exit = lbl } + +let add_graph lbl stmt def = + { def with ERTL.f_graph = Label.Map.add lbl stmt def.ERTL.f_graph } + +let fresh_label def = Label.Gen.fresh def.ERTL.f_luniverse + +let change_label lbl = function + | ERTL.St_skip _ -> ERTL.St_skip lbl + | ERTL.St_comment (s, _) -> ERTL.St_comment (s, lbl) + | ERTL.St_cost (cost_lbl, _) -> ERTL.St_cost (cost_lbl, lbl) + | ERTL.St_get_hdw (r1, r2, _) -> ERTL.St_get_hdw (r1, r2, lbl) + | ERTL.St_set_hdw (r1, r2, _) -> ERTL.St_set_hdw (r1, r2, lbl) + | ERTL.St_hdw_to_hdw (r1, r2, _) -> ERTL.St_hdw_to_hdw (r1, r2, lbl) + | ERTL.St_newframe _ -> ERTL.St_newframe lbl + | ERTL.St_delframe _ -> ERTL.St_delframe lbl + | ERTL.St_framesize (r, _) -> ERTL.St_framesize (r, lbl) + | ERTL.St_pop (r, _) -> ERTL.St_pop (r, lbl) + | ERTL.St_push (r, _) -> ERTL.St_push (r, lbl) + | ERTL.St_addrH (r, id, _) -> ERTL.St_addrH (r, id, lbl) + | ERTL.St_addrL (r, id, _) -> ERTL.St_addrL (r, id, lbl) + | ERTL.St_int (r, i, _) -> ERTL.St_int (r, i, lbl) + | ERTL.St_move (r1, r2, _) -> ERTL.St_move (r1, r2, lbl) + | ERTL.St_opaccsA (opaccs, dstr, srcr1, srcr2, _) -> + ERTL.St_opaccsA (opaccs, dstr, srcr1, srcr2, lbl) + | ERTL.St_opaccsB (opaccs, dstr, srcr1, srcr2, _) -> + ERTL.St_opaccsB (opaccs, dstr, srcr1, srcr2, lbl) + | ERTL.St_op1 (op1, dstr, srcr, _) -> ERTL.St_op1 (op1, dstr, srcr, lbl) + | ERTL.St_op2 (op2, dstr, srcr1, srcr2, _) -> + ERTL.St_op2 (op2, dstr, srcr1, srcr2, lbl) + | ERTL.St_clear_carry _ -> ERTL.St_clear_carry lbl + | ERTL.St_set_carry _ -> ERTL.St_set_carry lbl + | ERTL.St_load (dstrs, addr1, addr2, _) -> + ERTL.St_load (dstrs, addr1, addr2, lbl) + | ERTL.St_store (addr1, addr2, srcrs, _) -> + ERTL.St_store (addr1, addr2, srcrs, lbl) + | ERTL.St_call_id (f, nb_args, _) -> ERTL.St_call_id (f, nb_args, lbl) + | ERTL.St_call_ptr (f1, f2, nb_args, _) -> + ERTL.St_call_ptr (f1, f2, nb_args, lbl) + | ERTL.St_cond _ as inst -> inst + | ERTL.St_return _ as inst -> inst + +(* Process a list of function that adds a list of instructions to a graph, from + one label to another, and by creating fresh labels inbetween. *) + +let rec add_translates translate_list start_lbl dest_lbl def = + match translate_list with + | [] -> add_graph start_lbl (ERTL.St_skip dest_lbl) def + | [trans] -> trans start_lbl dest_lbl def + | trans :: translate_list -> + let tmp_lbl = fresh_label def in + let def = trans start_lbl tmp_lbl def in + add_translates translate_list tmp_lbl dest_lbl def + +(* Add a sequence of instruction in a graph, from one label to another, by creating + fresh labels inbetween. *) + +(* FIXME: Clean this up by factorizing with the previous function. *) +let rec adds_graph stmt_list start_lbl dest_lbl def = + match stmt_list with + | [] -> add_graph start_lbl (ERTL.St_skip dest_lbl) def + | [stmt] -> + add_graph start_lbl (change_label dest_lbl stmt) def + | stmt :: stmt_list -> + let tmp_lbl = fresh_label def in + let stmt = change_label tmp_lbl stmt in + let def = add_graph start_lbl stmt def in + adds_graph stmt_list tmp_lbl dest_lbl def + +let fresh_reg def = + let r = Register.fresh def.ERTL.f_runiverse in + let locals = Register.Set.add r def.ERTL.f_locals in + ({ def with ERTL.f_locals = locals }, r) + +let rec fresh_regs def n = + if n = 0 then (def, []) + else + let (def, res) = fresh_regs def (n-1) in + let (def, r) = fresh_reg def in + (def, r :: res) + + +(* Translation *) + +let save_hdws l = + let f (destr, srcr) start_lbl = + adds_graph [ERTL.St_get_hdw (destr, srcr, start_lbl)] start_lbl in + List.map f l + +let restore_hdws l = + let f (destr, srcr) start_lbl = + adds_graph [ERTL.St_set_hdw (destr, srcr, start_lbl)] start_lbl in + List.map f (List.map (fun (x, y) -> (y, x)) l) + +let get_params_hdw params = + if List.length params = 0 then + [fun start_lbl -> adds_graph [ERTL.St_skip start_lbl] start_lbl] + else + let l = MiscPottier.combine params I8051.parameters in + save_hdws l + +let get_param_stack off destr start_lbl dest_lbl def = + let (def, addr1) = fresh_reg def in + let (def, addr2) = fresh_reg def in + let (def, tmpr) = fresh_reg def in + adds_graph + [ERTL.St_framesize (addr1, start_lbl) ; + ERTL.St_int (tmpr, off+I8051.int_size, start_lbl) ; + ERTL.St_op2 (I8051.Sub, addr1, addr1, tmpr, start_lbl) ; + ERTL.St_get_hdw (tmpr, I8051.spl, start_lbl) ; + ERTL.St_op2 (I8051.Add, addr1, addr1, tmpr, start_lbl) ; + ERTL.St_int (addr2, 0, start_lbl) ; + ERTL.St_get_hdw (tmpr, I8051.sph, start_lbl) ; + ERTL.St_op2 (I8051.Addc, addr2, addr2, tmpr, start_lbl) ; + ERTL.St_load (destr, addr1, addr2, start_lbl)] + start_lbl dest_lbl def + +let get_params_stack params = + if List.length params = 0 then + [fun start_lbl -> adds_graph [ERTL.St_skip start_lbl] start_lbl] + else + let f i r = get_param_stack i r in + MiscPottier.mapi f params + +(* Parameters are taken from the physical parameter registers first. If there + are not enough such of these, then the remaining parameters are taken from + the stack. *) + +let get_params params = + let n = min (List.length params) (List.length I8051.parameters) in + let (hdw_params, stack_params) = MiscPottier.split params n in + (get_params_hdw hdw_params) @ (get_params_stack stack_params) + +let add_prologue params sral srah sregs def = + let start_lbl = def.ERTL.f_entry in + let tmp_lbl = fresh_label def in + let last_stmt = Label.Map.find start_lbl def.ERTL.f_graph in + let def = + add_translates + ([adds_graph [ERTL.St_comment ("Prologue", start_lbl)]] @ + (* new frame *) + (adds_graph [ERTL.St_comment ("New frame", start_lbl) ; + ERTL.St_newframe start_lbl]) :: + (* save the return address *) + (adds_graph [ERTL.St_comment ("Save return address", start_lbl) ; + ERTL.St_pop (sral, start_lbl) ; + ERTL.St_pop (srah, start_lbl)]) :: + (* save callee-saved registers *) + [adds_graph [ERTL.St_comment ("Save callee-saved registers", + start_lbl)]] @ + (save_hdws sregs) @ + (* fetch parameters *) + [adds_graph [ERTL.St_comment ("Fetch parameters", start_lbl)]] @ + (get_params params) @ + [adds_graph [ERTL.St_comment ("End Prologue", start_lbl)]]) + start_lbl tmp_lbl def in + add_graph tmp_lbl last_stmt def + + +(* Save the result of a function in a place that cannot be written, even after + register allocation. This way, the cleaning sequence of returning from a + function will not interfere with the result value, that can be restored right + before jumping out of the function. *) + +(* L'existence de cette fonction résulte du choix d'utiliser DPTR à la fois + pour effectuer l'arithmétique de pointeur sur la pile et le retour des + fonctions. On aurait probablement pu faire un autre choix. *) +let save_return ret_regs start_lbl dest_lbl def = + let (def, tmpr) = fresh_reg def in + (* Sépare les registres utiles pour le stockage effectif des valeurs + des registres de retour de ceux qui ne seront pas utilisés, et + donc mis à zéro. *) + let ((common1, rest1), (common2, rest2)) = + (* I8051.sts are registers that are reserved in order to store the + result of functions. *) + MiscPottier.reduce I8051.sts ret_regs + in + assert (rest2 = []); (* parce qu'on suppose que la valeur de retour + tient dans l'ensemble des registres réservés + pour la stocker. *) + + (* Met a zero les registres utilisés pour le retour car la valeur + de retour pourrait être plus petite que la capacité totale de + stockage des registres physiques de retour conventionnels. *) + + (* FIXME: Nicolas pense qu'en vérité cette mise à zéro ne sert à + rien car plus tard (cf. FIXME plus loin dans la fonction + fetch_result), ces registres à zéro ne seront pas considérés. *) + let init_tmpr = ERTL.St_int (tmpr, 0, start_lbl) in + + (* Sauvegarde temporairement la valeur des registres de retour + dans des registres frais car ces registres de retour peuvent + être utilisés pour faire de l'arithmétique de pointeurs sur + le pointeur de pile lors du dépilement. *) + let f_save st r = ERTL.St_set_hdw (st, r, start_lbl) in + let saves = List.map2 f_save common1 common2 in + (* Le reste est mis à zéro. *) + let f_default st = ERTL.St_set_hdw (st, tmpr, start_lbl) in + let defaults = List.map f_default rest1 in + adds_graph (init_tmpr :: saves @ defaults) start_lbl dest_lbl def + +(* Après avoir travaillé sur la pile, on sait que l'on peut sans danger + copier le contenu sauvegardé dans les registres temporaires vers + les registres de retour. *) +let assign_result start_lbl = + let ((common1, rest1), (common2, rest2)) = MiscPottier.reduce I8051.rets I8051.sts in + assert (rest1 = [] && rest2 = []); + (* parce qu'on suppose que |I8051.rets| = |I8051.sts|. *) + let f ret st = ERTL.St_hdw_to_hdw (ret, st, start_lbl) in + let insts = List.map2 f common1 common2 in + adds_graph insts start_lbl + +let add_epilogue ret_regs sral srah sregs def = + let start_lbl = def.ERTL.f_exit in + let tmp_lbl = fresh_label def in + let last_stmt = Label.Map.find start_lbl def.ERTL.f_graph in + let def = + add_translates + ([adds_graph [ERTL.St_comment ("Epilogue", start_lbl)]] @ + (* save return value *) + [save_return ret_regs] @ + (* restore callee-saved registers *) + [adds_graph [ERTL.St_comment ("Restore callee-saved registers", + start_lbl)]] @ + (restore_hdws sregs) @ + (* restore the return address *) + [adds_graph [ERTL.St_comment ("Restore return address", start_lbl) ; + ERTL.St_push (srah, start_lbl) ; + ERTL.St_push (sral, start_lbl)]] @ + (* delete frame *) + [adds_graph [ERTL.St_comment ("Delete frame", start_lbl) ; + ERTL.St_delframe start_lbl]] @ + (* assign the result to actual return registers *) + [adds_graph [ERTL.St_comment ("Set result", start_lbl)]] @ + [assign_result] @ + [adds_graph [ERTL.St_comment ("End Epilogue", start_lbl)]]) + start_lbl tmp_lbl def in + let def = add_graph tmp_lbl last_stmt def in + change_exit_label tmp_lbl def + + +let allocate_regs saved def = + let f r (def, sregs) = + let (def, r') = fresh_reg def in + (def, (r', r) :: sregs) in + I8051.RegisterSet.fold f saved (def, []) + +let add_pro_and_epilogue params ret_regs def = + (* Allocate registers to hold the return address. *) + let (def, sra) = fresh_regs def 2 in + let sral = List.nth sra 0 in + let srah = List.nth sra 1 in + (* Allocate registers to save callee-saved registers. *) + let (def, sregs) = allocate_regs I8051.callee_saved def in + (* Add a prologue and a epilogue. *) + let def = add_prologue params sral srah sregs def in + let def = add_epilogue ret_regs sral srah sregs def in + def + + +let set_params_hdw params = + if List.length params = 0 then + [fun start_lbl -> adds_graph [ERTL.St_skip start_lbl] start_lbl] + else + let l = MiscPottier.combine params I8051.parameters in + restore_hdws l + +let set_param_stack off srcr start_lbl dest_lbl def = + let (def, addr1) = fresh_reg def in + let (def, addr2) = fresh_reg def in + let (def, tmpr) = fresh_reg def in + adds_graph + [ERTL.St_int (addr1, off+I8051.int_size, start_lbl) ; + ERTL.St_get_hdw (tmpr, I8051.spl, start_lbl) ; + ERTL.St_clear_carry start_lbl ; + ERTL.St_op2 (I8051.Sub, addr1, tmpr, addr1, start_lbl) ; + ERTL.St_get_hdw (tmpr, I8051.sph, start_lbl) ; + ERTL.St_int (addr2, 0, start_lbl) ; + ERTL.St_op2 (I8051.Sub, addr2, tmpr, addr2, start_lbl) ; + ERTL.St_store (addr1, addr2, srcr, start_lbl)] + start_lbl dest_lbl def + +let set_params_stack params = + if List.length params = 0 then + [fun start_lbl -> adds_graph [ERTL.St_skip start_lbl] start_lbl] + else + let f i r = set_param_stack i r in + MiscPottier.mapi f params + +(* Parameters are put in the physical parameter registers first. If there are + not enough such of these, then the remaining parameters are passed on the + stack. *) + +let set_params params = + let n = min (List.length params) (List.length I8051.parameters) in + let (hdw_params, stack_params) = MiscPottier.split params n in + (set_params_hdw hdw_params) @ (set_params_stack stack_params) + +(* Fetching the result depends on the type of the function, or say, the number + of registers that are waiting for a value. Temporary non allocatable + registers are used. Indeed, moving directly from DPL to a pseudo-register may + cause a bug: DPL might be used to compute the address of the + pseudo-register. *) + +let fetch_result ret_regs start_lbl = + let ((common1, rest1), (common2, rest2)) = MiscPottier.reduce I8051.sts I8051.rets in + assert (rest1 = [] && rest2 = []); + let f_save st ret = ERTL.St_hdw_to_hdw (st, ret, start_lbl) in + let saves = List.map2 f_save common1 common2 in + let ((common1, rest1), (common2, rest2)) = MiscPottier.reduce ret_regs I8051.sts in + (* FIXME: [rest2] est ignoré mais ce n'est pas grave car ils ne + contiennent pas des données significatives. Du coup, il n'était + probablement pas nécessaire de les mettre à zéro. *) + let f_restore r st = ERTL.St_get_hdw (r, st, start_lbl) in + let restores = List.map2 f_restore common1 common2 in + adds_graph (saves @ restores) start_lbl + +(* When calling a function, we need to set its parameters in specific locations: + the physical parameter registers as much as possible, and then the stack + below. When the called function returns, we put the result where the calling + function expect it to be. *) +let translate_call stmt args ret_regs start_lbl dest_lbl def = + let nb_args = List.length args in + add_translates + ([adds_graph [ERTL.St_comment ("Starting a call", start_lbl)] ; + adds_graph [ERTL.St_comment ("Setting up parameters", start_lbl)]] @ + set_params args @ + [adds_graph [stmt nb_args] ; + adds_graph [ERTL.St_comment ("Fetching result", start_lbl)] ; + fetch_result ret_regs ; + adds_graph [ERTL.St_comment ("End of call sequence", start_lbl)]]) + start_lbl dest_lbl def + +let translate_stmt lbl stmt def = match stmt with + | RTL.St_skip lbl' -> + add_graph lbl (ERTL.St_skip lbl') def + + | RTL.St_cost (cost_lbl, lbl') -> + add_graph lbl (ERTL.St_cost (cost_lbl, lbl')) def + + | RTL.St_addr (r1, r2, x, lbl') -> + adds_graph + [ERTL.St_addrL (r1, x, lbl) ; ERTL.St_addrH (r2, x, lbl) ;] + lbl lbl' def + + | RTL.St_stackaddr (r1, r2, lbl') -> + adds_graph + [ERTL.St_get_hdw (r1, I8051.spl, lbl) ; + ERTL.St_get_hdw (r2, I8051.sph, lbl)] + lbl lbl' def + + | RTL.St_int (r, i, lbl') -> + add_graph lbl (ERTL.St_int (r, i, lbl')) def + + | RTL.St_move (r1, r2, lbl') -> + add_graph lbl (ERTL.St_move (r1, r2, lbl')) def + + | RTL.St_opaccs (op, destr1, destr2, srcr1, srcr2, lbl') -> + adds_graph [ERTL.St_opaccsA (op, destr1, srcr1, srcr2, lbl) ; + ERTL.St_opaccsB (op, destr2, srcr1, srcr2, lbl) ;] + lbl lbl' def + + | RTL.St_op1 (op1, destr, srcr, lbl') -> + add_graph lbl (ERTL.St_op1 (op1, destr, srcr, lbl')) def + + | RTL.St_op2 (op2, destr, srcr1, srcr2, lbl') -> + add_graph lbl (ERTL.St_op2 (op2, destr, srcr1, srcr2, lbl')) def + + | RTL.St_clear_carry lbl' -> + add_graph lbl (ERTL.St_clear_carry lbl') def + + | RTL.St_set_carry lbl' -> + add_graph lbl (ERTL.St_set_carry lbl') def + + | RTL.St_load (destr, addr1, addr2, lbl') -> + add_graph lbl (ERTL.St_load (destr, addr1, addr2, lbl')) def + + | RTL.St_store (addr1, addr2, srcr, lbl') -> + add_graph lbl (ERTL.St_store (addr1, addr2, srcr, lbl')) def + + | RTL.St_call_id (f, args, ret_regs, lbl') -> + let stmt nb_args = ERTL.St_call_id (f, nb_args, lbl) in + translate_call stmt args ret_regs lbl lbl' def + + | RTL.St_call_ptr (f1, f2, args, ret_regs, lbl') -> + let stmt nb_args = ERTL.St_call_ptr (f1, f2, nb_args, lbl) in + translate_call stmt args ret_regs lbl lbl' def + + | RTL.St_cond (srcr, lbl_true, lbl_false) -> + add_graph lbl (ERTL.St_cond (srcr, lbl_true, lbl_false)) def + + | RTL.St_return ret_regs -> + add_graph lbl (ERTL.St_return ret_regs) def + + | RTL.St_tailcall_id _ | RTL.St_tailcall_ptr _ -> + assert false + (* Impossible: the RTL program is supposed to be simplified: + no tailcalls. *) + +let translate_internal def = + let nb_params = List.length (def.RTL.f_params) in + (* The stack size is augmented by the number of parameters that cannot fit + into physical registers. *) + let added_stacksize = max 0 (nb_params - (List.length I8051.parameters)) in + let def' = + { ERTL.f_luniverse = def.RTL.f_luniverse ; + ERTL.f_runiverse = def.RTL.f_runiverse ; + ERTL.f_params = nb_params ; + (* ERTL does not know about parameter registers. We need to add them to + the locals. *) + ERTL.f_locals = Register.Set.union def.RTL.f_locals + (Register.Set.of_list def.RTL.f_params) ; + ERTL.f_stacksize = def.RTL.f_stacksize + added_stacksize ; + ERTL.f_graph = Label.Map.empty ; + ERTL.f_entry = def.RTL.f_entry ; + ERTL.f_exit = def.RTL.f_exit } in + let def' = Label.Map.fold translate_stmt def.RTL.f_graph def' in + let def' = add_pro_and_epilogue def.RTL.f_params def.RTL.f_result def' in + def' + + +let translate_funct (id, def) = + let def' = match def with + | RTL.F_int def -> ERTL.F_int (translate_internal def) + | RTL.F_ext def -> ERTL.F_ext def + in + (id, def') + + +(* Move the first cost label of each function at the beginning of the + function. Indeed, the instructions for calling conventions (stack allocation + for example) are added at the very beginning of the function, thus before the + first cost label. *) + +let generate stmt def = + let entry = Label.Gen.fresh def.ERTL.f_luniverse in + { def with + ERTL.f_graph = Label.Map.add entry stmt def.ERTL.f_graph; + ERTL.f_entry = entry + } + +let find_and_remove_first_cost_label def = + let rec aux lbl = match Label.Map.find lbl def.ERTL.f_graph with + | ERTL.St_cost (cost_label, next_lbl) -> + let graph = Label.Map.add lbl (ERTL.St_skip next_lbl) def.ERTL.f_graph in + (cost_label, { def with ERTL.f_graph = graph }) + | ERTL.St_skip lbl | ERTL.St_comment (_, lbl) | ERTL.St_get_hdw (_, _, lbl) + | ERTL.St_set_hdw (_, _, lbl) | ERTL.St_hdw_to_hdw (_, _, lbl) + | ERTL.St_pop (_, lbl) | ERTL.St_push (_, lbl) | ERTL.St_addrH (_, _, lbl) + | ERTL.St_addrL (_, _, lbl) | ERTL.St_int (_, _, lbl) + | ERTL.St_move (_, _, lbl) | ERTL.St_opaccsA (_, _, _, _, lbl) + | ERTL.St_opaccsB (_, _, _, _, lbl) + | ERTL.St_op1 (_, _, _, lbl) | ERTL.St_op2 (_, _, _, _, lbl) + | ERTL.St_clear_carry lbl | ERTL.St_set_carry lbl + | ERTL.St_load (_, _, _, lbl) + | ERTL.St_store (_, _, _, lbl) | ERTL.St_call_id (_, _, lbl) + | ERTL.St_call_ptr (_, _, _, lbl) + | ERTL.St_newframe lbl | ERTL.St_delframe lbl | ERTL.St_framesize (_, lbl) + -> + aux lbl + | ERTL.St_cond _ | ERTL.St_return _ -> + (* No cost label found (no labelling performed). Indeed, the first cost + label must after some linear instructions. *) + assert false + in + aux def.ERTL.f_entry + +let move_first_cost_label_up_internal def = + let (cost_label, def) = find_and_remove_first_cost_label def in + generate (ERTL.St_cost (cost_label, def.ERTL.f_entry)) def + +let move_first_cost_label_up (id, def) = + let def' = match def with + | ERTL.F_int int_fun -> + ERTL.F_int (move_first_cost_label_up_internal int_fun) + | _ -> def + in + (id, def') + +let translate p = + (* We simplify tail calls as regular calls for now. *) + let p = RTLtailcall.simplify p in + (* The tranformation on each RTL function: create an ERTL function and move + its first cost label at the very beginning. *) + let f funct = move_first_cost_label_up (translate_funct funct) in + { ERTL.vars = p.RTL.vars ; + ERTL.functs = List.map f p.RTL.functs ; + ERTL.main = p.RTL.main } diff --git a/src/RTL/RTLToERTL.mli b/src/RTL/RTLToERTL.mli new file mode 100644 index 0000000..fe0a12c --- /dev/null +++ b/src/RTL/RTLToERTL.mli @@ -0,0 +1,26 @@ + +(** This module provides a translation of [RTL] programs to [ERTL] programs. *) + +(** The work consists in expliciting the calling convention. + + Function call instructions will be expanded so has to explicitely pass + arguments on dedicated physical registers, and then on specific places in + the stack if there are not enough registers. + + We add a prologue at the beginning of each function that does the following + things: + - Allocate enough space on the stack for the function to execute. + - Save the return address. + - Save callee-saved registers. + - Fetch parameters from physical registers and potentially from the stack. + + Also, we add an epilogue which pretty much reverses the effects of the + prologue: + - Save the return value in physical registers that can only be used for + this. + - Restore callee-saved register. + - Restore the return address. + - Free the allocated space on the stack. + - Assign the return value to the physical return registers. *) + +val translate : RTL.program -> ERTL.program diff --git a/src/RTL/RTLtailcall.ml b/src/RTL/RTLtailcall.ml new file mode 100644 index 0000000..bc05573 --- /dev/null +++ b/src/RTL/RTLtailcall.ml @@ -0,0 +1,25 @@ + +(** Temporary issue backdoor: tranform tail calls into regular calls *) + +let simplify_stmt exit lbl stmt graph = match stmt with + | RTL.St_tailcall_id (f, args) -> + Label.Map.add lbl (RTL.St_call_id (f, args, [], exit)) graph + | RTL.St_tailcall_ptr (f1, f2, args) -> + Label.Map.add lbl (RTL.St_call_ptr (f1, f2, args, [], exit)) graph + | _ -> graph + +let simplify_graph exit graph = + Label.Map.fold (simplify_stmt exit) graph graph + +let simplify_internal def = + { def with RTL.f_graph = simplify_graph def.RTL.f_exit def.RTL.f_graph } + +let simplify_funct (id, def) = + let def' = match def with + | RTL.F_int def -> RTL.F_int (simplify_internal def) + | RTL.F_ext def -> RTL.F_ext def + in + (id, def') + +let simplify p = + { p with RTL.functs = List.map simplify_funct p.RTL.functs } diff --git a/src/RTL/RTLtailcall.mli b/src/RTL/RTLtailcall.mli new file mode 100644 index 0000000..3985ec5 --- /dev/null +++ b/src/RTL/RTLtailcall.mli @@ -0,0 +1,4 @@ + +(** Temporary issue backdoor: tranform tail calls into regular calls *) + +val simplify : RTL.program -> RTL.program diff --git a/src/RTLabs/RTLabs.mli b/src/RTLabs/RTLabs.mli new file mode 100644 index 0000000..ef978fb --- /dev/null +++ b/src/RTLabs/RTLabs.mli @@ -0,0 +1,113 @@ + +(** This module defines the abstract syntax tree of [RTLabs]. *) + +(* A program in RTLabs associates to each function of the program a + Control Flow Graph. Pseudo-registers are used to represent the + variables. The operations and instructions of the language are + those of Cminor. + + RTLabs is the last language of the frontend. It is intended to + ease retargetting. *) + + +(* A function in RTLabs is a mapping from labels to + statements. Statements explicitely mention their successors. *) + +type statement = + + (* The empty statement. *) + | St_skip of Label.t + + (* Emit a cost label. *) + | St_cost of CostLabel.t * Label.t + + (* Assign a constant to registers. Parameters are the destination register, + the constant and the label of the next statement. *) + | St_cst of Register.t * AST.cst * Label.t + + (* Application of an unary operation. Parameters are the operation, the + destination register, the argument register and the label of the next + statement. *) + | St_op1 of AST.op1 * Register.t * Register.t * Label.t + + (* Application of a binary operation. Parameters are the operation, the + destination register, the two argument registers and the label of the next + statement. *) + | St_op2 of AST.op2 * Register.t * Register.t * Register.t * Label.t + + (* Memory load. Parameters are the size in bytes of what to load, the + register containing the address, the destination register and the label + of the next statement. *) + | St_load of AST.quantity * Register.t * Register.t * Label.t + + (* Memory store. Parameters are the size in bytes of what to store, the + register containing the address, the source register and the label of the + next statement. *) + | St_store of AST.quantity * Register.t * Register.t * Label.t + + (* Call to a function given its name. Parameters are the name of the + function, the arguments of the function, the destination + register, the signature of the function and the label of the next + statement. *) + | St_call_id of AST.ident * Register.t list * Register.t option * + AST.signature * Label.t + + (* Call to a function given its address. Parameters are the register + holding the address of the function, the arguments of the + function, the destination register, the signature of the function + and the label of the next statement. This statement with an + [St_op] before can represent a [St_call_id]. However, we + differenciate the two to allow translation to a formalism with no + function pointer. *) + | St_call_ptr of Register.t * Register.t list * Register.t option * + AST.signature * Label.t + + (* Tail call to a function given its name. Parameters are the name of the + function, the arguments of the function, the signature of the function and + the label of the next statement. *) + | St_tailcall_id of AST.ident * Register.t list * AST.signature + + (* Tail call to a function given its address. Parameters are a register + holding the address of the function, the arguments of the function, the + signature of the function and the label of the next statement. Same remark + as for the [St_call_ptr]. *) + | St_tailcall_ptr of Register.t * Register.t list * AST.signature + + (* Branch. Parameters are the register holding the value to branch on, the + label to go to when the value evaluates to true (not 0), and the label + to go to when the value evaluates to false (0). *) + | St_cond of Register.t * Label.t * Label.t + + (* Jump statement. Parameters are a register and a list of + labels. The execution will go to the [n]th label of the list of + labels, where [n] is the natural value held in the register. *) + | St_jumptable of Register.t * Label.t list + + (* Return statement. *) + | St_return of Register.t option + + +type graph = statement Label.Map.t + +type internal_function = + { f_luniverse : Label.Gen.universe ; + f_runiverse : Register.universe ; + f_result : (Register.t * AST.sig_type) option ; + f_params : (Register.t * AST.sig_type) list ; + f_locals : (Register.t * AST.sig_type) list ; + f_stacksize : AST.abstract_size ; + f_graph : graph ; + f_entry : Label.t ; + f_exit : Label.t } + +type function_def = + | F_int of internal_function + | F_ext of AST.external_function + +(* A program is a list of global variables and their reserved space, a list of + function names and their definition, and the name of the main function. *) + +type program = + { vars : (AST.ident * AST.abstract_size * AST.data list option) list ; + functs : (AST.ident * function_def) list ; + main : AST.ident option } diff --git a/src/RTLabs/RTLabsInterpret.ml b/src/RTLabs/RTLabsInterpret.ml new file mode 100644 index 0000000..528c395 --- /dev/null +++ b/src/RTLabs/RTLabsInterpret.ml @@ -0,0 +1,326 @@ + +(** This module provides an interpreter for the RTLabs language. *) + + +let error_prefix = "RTLabs interpret" +let error s = Error.global_error error_prefix s + + +module Mem = Driver.RTLabsMemory +module Val = Mem.Value + +let error_float () = error "float not supported" + + +type memory = RTLabs.function_def Mem.memory + + +(* Local environments. They associate a value and a type to the registers of the + function being executed. *) + +type local_env = (Val.t * AST.sig_type) Register.Map.t + +(* Call frames. The execution state has a call stack, each element of the stack + being composed of the return registers to store the result of the callee, the + graph, the stack pointer, the node, the local environment and the typing + environments to resume the execution of the caller. *) + +type stack_frame = + { ret_reg : Register.t option ; + graph : RTLabs.graph ; + sp : Val.address ; + pc : Label.t ; + lenv : local_env } + +(* Execution states. There are three possible states : + - The constructor [State] represents a state when executing a function + - The constructor [CallState] represents a state when calling a function + - The constructor [ReturnState] represents a state when leaving a function *) + +type state = + | State of stack_frame list * RTLabs.graph * Val.address (* stack pointer *) * + Label.t * local_env * memory * CostLabel.t list + | CallState of stack_frame list * RTLabs.function_def * + Val.t list (* args *) * memory * CostLabel.t list + | ReturnState of stack_frame list * Val.t (* return value *) * + memory * CostLabel.t list + +let string_of_local_env lenv = + let f x (v, _) s = + s ^ + (if Val.eq v Val.undef then "" + else (Register.print x) ^ " = " ^ (Val.to_string v) ^ " ") in + Register.Map.fold f lenv "" + +let string_of_args args = + let f s v = s ^ " " ^ (Val.to_string v) in + List.fold_left f "" args + +let print_state = function + | State (_, _, sp, lbl, lenv, mem, _) -> + Printf.printf "Stack pointer: %s\n\nLocal environment:\n%s\n\nMemory:%s\nRegular state: %s\n\n%!" + (Val.string_of_address sp) + (string_of_local_env lenv) + (Mem.to_string mem) + lbl + | CallState (_, _, args, mem, _) -> + Printf.printf "Memory:%s\nCall state: %s\n\n%!" + (Mem.to_string mem) + (string_of_args args) + | ReturnState (_, v, mem, _) -> + Printf.printf "Memory:%s\nReturn state: %s\n\n%!" + (Mem.to_string mem) + (Val.to_string v) + + +let find_function mem f = + let addr = Mem.find_global mem f in + Mem.find_fun_def mem addr + +let get_local_env f lenv r = + if Register.Map.mem r lenv then f (Register.Map.find r lenv) + else error ("Unknown local register \"" ^ (Register.print r) ^ "\".") + +let get_value = get_local_env fst +let get_args lenv args = List.map (get_value lenv) args + +let get_type = get_local_env snd + +let update_local r v lenv = + let f (_, t) = Register.Map.add r (v, t) lenv in + get_local_env f lenv r + +let update_locals rs vs lenv = + let f lenv r v = update_local r v lenv in + List.fold_left2 f lenv rs vs + +let value_of_address = List.hd +let address_of_value v = [v] + + +module Eval = CminorInterpret.Eval_op (Mem) + +let concrete_stacksize = Eval.concrete_stacksize + + +(* Assign a value to some destinations registers. *) + +let assign_state sfrs graph sp lbl lenv mem trace destr v = + let lenv = update_local destr v lenv in + State (sfrs, graph, sp, lbl, lenv, mem, trace) + +(* Branch on a value. *) + +let branch_state sfrs graph sp lbl_true lbl_false lenv mem trace v = + let next_lbl = + if Val.is_true v then lbl_true + else + if Val.is_false v then lbl_false + else error "Undefined conditional value." in + State (sfrs, graph, sp, next_lbl, lenv, mem, trace) + + +(* Interpret statements. *) + +let interpret_statement + (sfrs : stack_frame list) + (graph : RTLabs.graph) + (sp : Val.address) + (lenv : local_env) + (mem : memory) + (stmt : RTLabs.statement) + (trace : CostLabel.t list) : + state = match stmt with + + | RTLabs.St_skip lbl -> + State (sfrs, graph, sp, lbl, lenv, mem, trace) + + | RTLabs.St_cost (cost_lbl, lbl) -> + State (sfrs, graph, sp, lbl, lenv, mem, cost_lbl :: trace) + + | RTLabs.St_cst (destr, cst, lbl) -> + let v = Eval.cst mem sp (get_type lenv destr) cst in + assign_state sfrs graph sp lbl lenv mem trace destr v + + | RTLabs.St_op1 (op1, destr, srcr, lbl) -> + let v = + Eval.op1 (get_type lenv destr) (get_type lenv srcr) op1 + (get_value lenv srcr) in + assign_state sfrs graph sp lbl lenv mem trace destr v + + | RTLabs.St_op2 (op2, destr, srcr1, srcr2, lbl) -> + let v = + Eval.op2 + (get_type lenv destr) (get_type lenv srcr1) (get_type lenv srcr2) + op2 + (get_value lenv srcr1) + (get_value lenv srcr2) in + assign_state sfrs graph sp lbl lenv mem trace destr v + + | RTLabs.St_load (q, addr, destr, lbl) -> + let addr = address_of_value (get_value lenv addr) in + let v = Mem.loadq mem q addr in + assign_state sfrs graph sp lbl lenv mem trace destr v + + | RTLabs.St_store (q, addr, srcr, lbl) -> + let addr = address_of_value (get_value lenv addr) in + let v = get_value lenv srcr in + let mem = Mem.storeq mem q addr v in + State (sfrs, graph, sp, lbl, lenv, mem, trace) + + | RTLabs.St_call_id (f, args, destr, sg, lbl) -> + let f_def = find_function mem f in + let args = get_args lenv args in + (* Save the stack frame. *) + let sf = + { ret_reg = destr ; graph = graph ; sp = sp ; pc = lbl ; lenv = lenv } + in + CallState (sf :: sfrs, f_def, args, mem, trace) + + | RTLabs.St_call_ptr (r, args, destr, sg, lbl) -> + let addr = get_value lenv r in + let f_def = Mem.find_fun_def mem (address_of_value addr) in + let args = get_args lenv args in + (* Save the stack frame. *) + let sf = + { ret_reg = destr ; graph = graph ; sp = sp ; pc = lbl ; lenv = lenv } + in + CallState (sf :: sfrs, f_def, args, mem, trace) + + | RTLabs.St_tailcall_id (f, args, sg) -> + let f_def = find_function mem f in + let args = get_args lenv args in + (* No need to save the stack frame. But free the stack. *) + let mem = Mem.free mem sp in + CallState (sfrs, f_def, args, mem, trace) + + | RTLabs.St_tailcall_ptr (r, args, sg) -> + let addr = get_value lenv r in + let f_def = Mem.find_fun_def mem (address_of_value addr) in + let args = get_args lenv args in + (* No need to save the stack frame. But free the stack. *) + let mem = Mem.free mem sp in + CallState (sfrs, f_def, args, mem, trace) + + | RTLabs.St_cond (srcr, lbl_true, lbl_false) -> + let v = get_value lenv srcr in + branch_state sfrs graph sp lbl_true lbl_false lenv mem trace v + + | RTLabs.St_jumptable (r, table) -> + assert false (* TODO: jumptable *) + + | RTLabs.St_return None -> + let mem = Mem.free mem sp in + ReturnState (sfrs, Val.undef, mem, trace) + + | RTLabs.St_return (Some r) -> + let v = get_value lenv r in + let mem = Mem.free mem sp in + ReturnState (sfrs, v, mem, trace) + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external mem f args = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> + let v = if List.length vs = 0 then Val.undef else List.hd vs in + (mem', v) + | (mem', InterpretExternal.A addr) -> (mem', value_of_address addr) + + +let init_locals + (locals : (Register.t * AST.sig_type) list) + (params : (Register.t * AST.sig_type) list) + (args : Val.t list) : + local_env = + let f_param lenv (r, t) v = Register.Map.add r (v, t) lenv in + let f_local lenv (r, t) = Register.Map.add r (Val.undef, t) lenv in + let lenv = List.fold_left2 f_param Register.Map.empty params args in + List.fold_left f_local lenv locals + +let state_after_call + (sfrs : stack_frame list) + (f_def : RTLabs.function_def) + (args : Val.t list) + (mem : memory) + (trace : CostLabel.t list) : + state = + match f_def with + | RTLabs.F_int def -> + let (mem', sp) = + Mem.alloc mem (concrete_stacksize def.RTLabs.f_stacksize) in + let lenv = init_locals def.RTLabs.f_locals def.RTLabs.f_params args in + State (sfrs, def.RTLabs.f_graph, sp, def.RTLabs.f_entry, lenv, mem', + trace) + | RTLabs.F_ext def -> + let (mem', v) = interpret_external mem def.AST.ef_tag args in + ReturnState (sfrs, v, mem', trace) + + +let state_after_return + (sf : stack_frame) + (sfrs : stack_frame list) + (ret_val : Val.t) + (mem : memory) + (trace : CostLabel.t list) : + state = + let lenv = match sf.ret_reg with + | None -> sf.lenv + | Some ret_reg -> update_local ret_reg ret_val sf.lenv in + State (sfrs, sf.graph, sf.sp, sf.pc, lenv, mem, trace) + + +let small_step (st : state) : state = match st with + | State (sfrs, graph, sp, pc, lenv, mem, trace) -> + let stmt = Label.Map.find pc graph in + interpret_statement sfrs graph sp lenv mem stmt trace + | CallState (sfrs, f_def, args, mem, trace) -> + state_after_call sfrs f_def args mem trace + | ReturnState ([], ret_val, mem, trace) -> + assert false (* End of execution; handled in iter_small_step. *) + | ReturnState (sf :: sfrs, ret_val, mem, trace) -> + state_after_return sf sfrs ret_val mem trace + + +let compute_result v = + if Val.is_int v then IntValue.Int32.cast (Val.to_int_repr v) + else IntValue.Int32.zero + +let rec iter_small_step debug st = + let print_and_return_result (res, cost_labels) = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state st ; + match small_step st with + | ReturnState ([], v, mem, trace) -> + print_and_return_result (compute_result v, List.rev trace) + | st' -> iter_small_step debug st' + + +let add_global_vars = + List.fold_left + (fun mem (id, size, inits_opt) -> Mem.add_var mem id size inits_opt) + +let add_fun_defs = + List.fold_left (fun mem (f_id, f_def) -> Mem.add_fun_def mem f_id f_def) + + +(* The memory is initialized by loading the code into it, and by reserving space + for the global variables. *) + +let init_mem (p : RTLabs.program) : memory = + add_global_vars (add_fun_defs Mem.empty p.RTLabs.functs) p.RTLabs.vars + + +(* Interpret the program only if it has a main. *) + +let interpret debug p = + Printf.printf "*** RTLabs interpret ***\n%!" ; + match p.RTLabs.main with + | None -> (IntValue.Int32.zero, []) + | Some main -> + let mem = init_mem p in + let main_def = find_function mem main in + let st = CallState ([], main_def, [], mem, []) in + iter_small_step debug st diff --git a/src/RTLabs/RTLabsInterpret.mli b/src/RTLabs/RTLabsInterpret.mli new file mode 100644 index 0000000..833186e --- /dev/null +++ b/src/RTLabs/RTLabsInterpret.mli @@ -0,0 +1,5 @@ + +(** This module provides a function to interpret a [RTLabs] program + and return the trace of cost labels encountered. *) + +val interpret : bool -> RTLabs.program -> AST.trace diff --git a/src/RTLabs/RTLabsPrinter.ml b/src/RTLabs/RTLabsPrinter.ml new file mode 100644 index 0000000..f6d6c49 --- /dev/null +++ b/src/RTLabs/RTLabsPrinter.ml @@ -0,0 +1,301 @@ + +let n_spaces n = String.make n ' ' + + +let rec print_size = function + | AST.SQ q -> Memory.string_of_quantity q + | AST.SProd l -> "struct {" ^ (print_size_list l) ^ "}" + | AST.SSum l -> "union {" ^ (print_size_list l) ^ "}" + | AST.SArray (i, se) -> + (print_size se) ^ "[" ^ (string_of_int i) ^ "]" +and print_size_list l = + MiscPottier.string_of_list ", " print_size l + +let print_global_size = print_size + +let print_data = function +(* + | Data_reserve n -> Printf.sprintf "[%d]" n +*) + | AST.Data_int8 i -> Printf.sprintf "(int8) %d" i + | AST.Data_int16 i -> Printf.sprintf "(int16) %d" i + | AST.Data_int32 i -> Printf.sprintf "%d" i + | AST.Data_float32 f -> Printf.sprintf "%f" f + | AST.Data_float64 f -> Printf.sprintf "(float64) %f" f + +let print_datas init = + let rec aux = function + | [] -> "" + | [data] -> print_data data + | data :: datas -> Printf.sprintf "%s, %s" (print_data data) (aux datas) + in + Printf.sprintf "{%s}" (aux init) + +let print_datas_opt = function + | None -> "" + | Some init -> " = " ^ (print_datas init) + +let print_global n (id, size, init_opt) = + Printf.sprintf "%s\"%s\" : %s%s;\n" + (n_spaces n) id (print_global_size size) (print_datas_opt init_opt) + +let print_globals eformat n = + List.iter (fun v -> Eformat.printf eformat "%s" (print_global n v)) + + +let print_reg = Register.print + +let print_oreg = function + | None -> "_" + | Some r -> print_reg r + +let print_decl (r, t) = + (Primitive.print_type t) ^ " " ^ (Register.print r) + +let rec print_args args = + Printf.sprintf "[%s]" (MiscPottier.string_of_list ", " print_reg args) + +let print_result = function + | None -> "_" + | Some (r, t) -> (Primitive.print_type t) ^ " " ^ (Register.print r) + +let print_params r = + Printf.sprintf "(%s)" (MiscPottier.string_of_list ", " print_decl r) + +let print_locals r = + Printf.sprintf "%s" (MiscPottier.string_of_list ", " print_decl r) + + +let print_cmp = function + | AST.Cmp_eq -> "eq" + | AST.Cmp_ne -> "ne" + | AST.Cmp_gt -> "gt" + | AST.Cmp_ge -> "ge" + | AST.Cmp_lt -> "lt" + | AST.Cmp_le -> "le" + +let rec print_size = function + | AST.SQ q -> Memory.string_of_quantity q + | AST.SProd l -> "struct {" ^ (print_size_list l) ^ "}" + | AST.SSum l -> "union {" ^ (print_size_list l) ^ "}" + | AST.SArray (i, se) -> + (print_size se) ^ "[" ^ (string_of_int i) ^ "]" +and print_size_list l = + MiscPottier.string_of_list ", " print_size l + +let print_stacksize = print_size + +let print_offset (size, depth) = + (print_size size) ^ ", " ^ (string_of_int depth) + +let print_sizeof = print_size + +let print_cst = function + | AST.Cst_int i -> Printf.sprintf "imm_int %d" i + | AST.Cst_float f -> Printf.sprintf "imm_float %f" f + | AST.Cst_addrsymbol id -> Printf.sprintf "imm_addr \"%s\"" id + | AST.Cst_stack -> "imm_addr STACK" + | AST.Cst_offset off -> Printf.sprintf "imm_offset { %s }" (print_offset off) + | AST.Cst_sizeof t -> "imm_sizeof (" ^ (print_size t) ^ ")" + +let string_of_signedness = function + | AST.Signed -> "s" + | AST.Unsigned -> "u" + +let string_of_int_type (size, sign) = + Printf.sprintf "%d%s" size (string_of_signedness sign) + +let print_op1 = function + | AST.Op_cast (int_type, dest_size) -> + Printf.sprintf "int%sto%d" (string_of_int_type int_type) dest_size + | AST.Op_negint -> "negint" + | AST.Op_notbool -> "notbool" + | AST.Op_notint -> "notint" + | AST.Op_id -> "id" + | AST.Op_ptrofint -> "ptrofint" + | AST.Op_intofptr -> "intofptr" + +let print_op2 = function + | AST.Op_add -> "add" + | AST.Op_sub -> "sub" + | AST.Op_mul -> "mul" + | AST.Op_div -> "div" + | AST.Op_divu -> "/u" + | AST.Op_mod -> "mod" + | AST.Op_modu -> "modu" + | AST.Op_and -> "and" + | AST.Op_or -> "or" + | AST.Op_xor -> "xor" + | AST.Op_shl -> "shl" + | AST.Op_shr -> "shr" + | AST.Op_shru -> "shru" + | AST.Op_cmp cmp -> print_cmp cmp + | AST.Op_addp -> "addp" + | AST.Op_subp -> "subp" + | AST.Op_subpp -> "subpp" + | AST.Op_cmpp cmp -> (print_cmp cmp) ^ "p" + | AST.Op_cmpu cmp -> (print_cmp cmp) ^ "u" + + +(* +let print_addressing = function + | RTLabs.Aindexed off -> Printf.sprintf "{ %s }" (print_offset off) + | RTLabs.Aindexed2 -> "add" + | RTLabs.Aglobal (id, off) -> + Printf.sprintf "{ %s }(\"%s\")" (print_offset off) id + | RTLabs.Abased (id, off) -> + Printf.sprintf "add, { %s }(\"%s\")" (print_offset off) id + | RTLabs.Ainstack off -> Printf.sprintf "{ %s }(STACK)" (print_offset off) +*) + + +let rec print_table = function + | [] -> "" + | [lbl] -> lbl + | lbl :: tbl -> lbl ^ ", " ^ (print_table tbl) + + +let print_statement = function + | RTLabs.St_skip lbl -> "--> " ^ lbl + | RTLabs.St_cost (cost_lbl, lbl) -> + Printf.sprintf "emit %s --> %s" cost_lbl lbl + | RTLabs.St_cst (destr, cst, lbl) -> + Printf.sprintf "imm %s, %s --> %s" + (print_reg destr) + (print_cst cst) + lbl + | RTLabs.St_op1 (op1, destr, srcr, lbl) -> + Printf.sprintf "%s %s, %s --> %s" + (print_op1 op1) + (print_reg destr) + (print_reg srcr) + lbl + | RTLabs.St_op2 (op2, destr, srcr1, srcr2, lbl) -> + Printf.sprintf "%s %s, %s, %s --> %s" + (print_op2 op2) + (print_reg destr) + (print_reg srcr1) + (print_reg srcr2) + lbl + | RTLabs.St_load (q, addr, destr, lbl) -> + Printf.sprintf "load %s, %s, %s --> %s" + (Memory.string_of_quantity q) + (print_reg addr) + (print_reg destr) + lbl + | RTLabs.St_store (q, addr, srcr, lbl) -> + Printf.sprintf "store %s, %s, %s --> %s" + (Memory.string_of_quantity q) + (print_reg addr) + (print_reg srcr) + lbl + | RTLabs.St_call_id (f, args, res, sg, lbl) -> + Printf.sprintf "call \"%s\", %s, %s: %s --> %s" + f + (print_args args) + (print_oreg res) + (Primitive.print_sig sg) + lbl + | RTLabs.St_call_ptr (f, args, res, sg, lbl) -> + Printf.sprintf "call_ptr %s, %s, %s: %s --> %s" + (print_reg f) + (print_args args) + (print_oreg res) + (Primitive.print_sig sg) + lbl + | RTLabs.St_tailcall_id (f, args, sg) -> + Printf.sprintf "tailcall \"%s\", %s: %s" + f + (print_args args) + (Primitive.print_sig sg) + | RTLabs.St_tailcall_ptr (f, args, sg) -> + Printf.sprintf "tailcall_ptr \"%s\", %s: %s" + (print_reg f) + (print_args args) + (Primitive.print_sig sg) + | RTLabs.St_cond (r, lbl_true, lbl_false) -> + Printf.sprintf "%s? --> %s, %s" + (print_reg r) + lbl_true + lbl_false +(* + | RTLabs.St_condcst (cst, t, lbl_true, lbl_false) -> + Printf.sprintf "(%s) %s --> %s, %s" + (Primitive.print_type t) + (print_cst cst) + lbl_true + lbl_false + | RTLabs.St_cond1 (op1, srcr, lbl_true, lbl_false) -> + Printf.sprintf "%s %s --> %s, %s" + (print_op1 op1) + (print_reg srcr) + lbl_true + lbl_false + | RTLabs.St_cond2 (op2, srcr1, srcr2, lbl_true, lbl_false) -> + Printf.sprintf "%s %s, %s --> %s, %s" + (print_op2 op2) + (print_reg srcr1) + (print_reg srcr2) + lbl_true + lbl_false +*) + | RTLabs.St_jumptable (r, tbl) -> + Printf.sprintf "j_tbl %s --> %s" + (print_reg r) + (print_table tbl) + | RTLabs.St_return None -> Printf.sprintf "return" + | RTLabs.St_return (Some r) -> Printf.sprintf "return %s" (print_reg r) + + +let print_graph eformat n c = + let f lbl stmt = + Eformat.printf eformat "%s%s: %s\n" + (n_spaces n) + lbl + (print_statement stmt) in + Label.Map.iter f c + + +let print_internal_decl eformat n f def = + Eformat.printf eformat + "%s\"%s\"%s\n%slocals: %s\n%sresult: %s\n%sstacksize: %s\n%sentry: %s\n%sexit: %s\n\n" + (n_spaces n) + f + (print_params def.RTLabs.f_params) + (n_spaces (n+2)) + (print_locals def.RTLabs.f_locals) + (n_spaces (n+2)) + (print_result def.RTLabs.f_result) + (n_spaces (n+2)) + (print_stacksize def.RTLabs.f_stacksize) + (n_spaces (n+2)) + def.RTLabs.f_entry + (n_spaces (n+2)) + def.RTLabs.f_exit ; + print_graph eformat (n+2) def.RTLabs.f_graph + + +let print_external_decl eformat n f def = + Eformat.printf eformat "%sextern \"%s\": %s\n" + (n_spaces n) + f + (Primitive.print_sig def.AST.ef_sig) + + +let print_fun_decl eformat n (f, def) = match def with + | RTLabs.F_int def -> print_internal_decl eformat n f def + | RTLabs.F_ext def -> print_external_decl eformat n f def + +let print_fun_decls eformat n functs = + List.iter + (fun f -> print_fun_decl eformat n f ; Eformat.printf eformat "\n\n") + functs + + +let print_program p = + let eformat = Eformat.create () in + Eformat.printf eformat "program:\n\n\n" ; + print_globals eformat 2 p.RTLabs.vars ; + Eformat.printf eformat "\n\n" ; + print_fun_decls eformat 2 p.RTLabs.functs ; + Eformat.get eformat diff --git a/src/RTLabs/RTLabsPrinter.mli b/src/RTLabs/RTLabsPrinter.mli new file mode 100644 index 0000000..a131d09 --- /dev/null +++ b/src/RTLabs/RTLabsPrinter.mli @@ -0,0 +1,6 @@ + +(** This module provides a function to print [RTLabs] programs. *) + +val print_statement : RTLabs.statement -> string + +val print_program : RTLabs.program -> string diff --git a/src/RTLabs/RTLabsToRTL.ml b/src/RTLabs/RTLabsToRTL.ml new file mode 100644 index 0000000..13a0aae --- /dev/null +++ b/src/RTLabs/RTLabsToRTL.ml @@ -0,0 +1,967 @@ + +(** This module provides a translation of [RTLabs] programs to [RTL] + programs. *) + + +let error_prefix = "RTLabs to RTL" +let error = Error.global_error error_prefix + +let error_int () = error "int16 and int32 not supported." +let error_float () = error "float not supported." +let error_shift () = error "Shift operations not supported." + + +let change_entry def f_entry = { def with RTL.f_entry } + +let add_graph lbl stmt def = + { def with RTL.f_graph = Label.Map.add lbl stmt def.RTL.f_graph } + +let fresh_label def = Label.Gen.fresh def.RTL.f_luniverse + +let fresh_reg def = + let r = Register.fresh def.RTL.f_runiverse in + let locals = Register.Set.add r def.RTL.f_locals in + ({ def with RTL.f_locals = locals }, r) + +let rec fresh_regs def n = + if n = 0 then (def, []) + else + let (def, res) = fresh_regs def (n-1) in + let (def, r) = fresh_reg def in + (def, r :: res) + +let addr_regs regs = match regs with + | r1 :: r2 :: _ -> (r1, r2) + | _ -> error "registers are not an address." + +let rec register_freshes runiverse n = + if n <= 0 then [] + else (Register.fresh runiverse) :: (register_freshes runiverse (n-1)) + +let choose_rest rest1 rest2 = match rest1, rest2 with + | [], _ -> rest2 + | _, [] -> rest1 + | _ -> assert false (* do not use on these arguments *) + +let complete_regs def srcrs1 srcrs2 = + let nb_added = (List.length srcrs1) - (List.length srcrs2) in + let (def, added_regs) = fresh_regs def nb_added in + if nb_added > 0 then (srcrs1, srcrs2 @ added_regs, added_regs) + else (srcrs1 @ added_regs, srcrs2, added_regs) + + +let size_of_sig_type = function + | AST.Sig_int (i, _) -> i / Driver.TargetArch.int_size + | AST.Sig_float _ -> error_float () + | AST.Sig_offset -> Driver.TargetArch.int_size + | AST.Sig_ptr -> Driver.TargetArch.ptr_size + +let concrete_size = Driver.RTLMemory.concrete_size + +let concrete_offset = Driver.RTLMemory.concrete_offset + + +(* Local environments *) + +type local_env = Register.t list Register.Map.t + +let mem_local_env = Register.Map.mem +let add_local_env = Register.Map.add +let find_local_env = Register.Map.find + +let initialize_local_env runiverse registers result = + let registers = + registers @ (match result with None -> [] | Some (r, t) -> [(r, t)]) in + let f lenv (r, t) = + let rs = register_freshes runiverse (size_of_sig_type t) in + add_local_env r rs lenv in + List.fold_left f Register.Map.empty registers + +let map_list_local_env lenv regs = + let f res r = res @ (find_local_env r lenv) in + List.fold_left f [] regs + +let make_addr = function + | r1 :: r2 :: _ -> (r1, r2) + | _ -> assert false (* do not use on these arguments *) + +let find_and_addr r lenv = make_addr (find_local_env r lenv) + +let rtl_args regs_list lenv = + List.flatten (List.map (fun r -> find_local_env r lenv) regs_list) + + +let change_label lbl = function + | RTL.St_skip _ -> RTL.St_skip lbl + | RTL.St_cost (cost_lbl, _) -> RTL.St_cost (cost_lbl, lbl) + | RTL.St_addr (r1, r2, id, _) -> RTL.St_addr (r1, r2, id, lbl) + | RTL.St_stackaddr (r1, r2, _) -> RTL.St_stackaddr (r1, r2, lbl) + | RTL.St_int (r, i, _) -> RTL.St_int (r, i, lbl) + | RTL.St_move (r1, r2, _) -> RTL.St_move (r1, r2, lbl) + | RTL.St_opaccs (opaccs, dstr1, dstr2, srcr1, srcr2, _) -> + RTL.St_opaccs (opaccs, dstr1, dstr2, srcr1, srcr2, lbl) + | RTL.St_op1 (op1, dstr, srcr, _) -> RTL.St_op1 (op1, dstr, srcr, lbl) + | RTL.St_op2 (op2, dstr, srcr1, srcr2, _) -> + RTL.St_op2 (op2, dstr, srcr1, srcr2, lbl) + | RTL.St_clear_carry _ -> RTL.St_clear_carry lbl + | RTL.St_set_carry _ -> RTL.St_set_carry lbl + | RTL.St_load (dstrs, addr1, addr2, _) -> + RTL.St_load (dstrs, addr1, addr2, lbl) + | RTL.St_store (addr1, addr2, srcrs, _) -> + RTL.St_store (addr1, addr2, srcrs, lbl) + | RTL.St_call_id (f, args, retrs, _) -> RTL.St_call_id (f, args, retrs, lbl) + | RTL.St_call_ptr (f1, f2, args, retrs, _) -> + RTL.St_call_ptr (f1, f2, args, retrs, lbl) + | RTL.St_tailcall_id (f, args) -> RTL.St_tailcall_id (f, args) + | RTL.St_tailcall_ptr (f1, f2, args) -> RTL.St_tailcall_ptr (f1, f2, args) + | RTL.St_cond _ as inst -> inst + | RTL.St_return regs -> RTL.St_return regs + +(* Add a list of instruction in a graph, from one label to another, by creating + fresh labels inbetween. *) + +let rec adds_graph stmt_list start_lbl dest_lbl def = match stmt_list with + | [] -> + add_graph start_lbl (RTL.St_skip dest_lbl) def + | [stmt] -> + add_graph start_lbl (change_label dest_lbl stmt) def + | stmt :: stmt_list -> + let tmp_lbl = fresh_label def in + let stmt = change_label tmp_lbl stmt in + let def = add_graph start_lbl stmt def in + adds_graph stmt_list tmp_lbl dest_lbl def + +let generates_graph stmt_list def = + let start_lbl = fresh_label def in + let dest_lbl = def.RTL.f_entry in + change_entry (adds_graph stmt_list start_lbl dest_lbl def) start_lbl + +(* Process a list of function that adds a list of instructions to a graph, from + one label to another, and by creating fresh labels inbetween. *) + +let rec add_translates translate_list start_lbl dest_lbl def = + match translate_list with + | [] -> + add_graph start_lbl (RTL.St_skip dest_lbl) def + | [trans] -> + trans start_lbl dest_lbl def + | trans :: translate_list -> + let tmp_lbl = fresh_label def in + let def = trans start_lbl tmp_lbl def in + add_translates translate_list tmp_lbl dest_lbl def + + +let rec translate_cst cst destrs start_lbl dest_lbl def = match cst with + + | AST.Cst_int _ when destrs = [] -> + add_graph start_lbl (RTL.St_skip dest_lbl) def + + | AST.Cst_int i -> + let size = List.length destrs in + let module M = IntValue.Make (struct let size = size end) in + let is = List.map M.to_int (M.break (M.of_int i) size) in + let f r i = RTL.St_int (r, i, dest_lbl) in + let l = List.map2 f destrs is in + adds_graph l start_lbl dest_lbl def + + | AST.Cst_float _ -> error_float () + + | AST.Cst_addrsymbol id -> + let (r1, r2) = make_addr destrs in + add_graph start_lbl (RTL.St_addr (r1, r2, id, dest_lbl)) def + + | AST.Cst_stack -> + let (r1, r2) = make_addr destrs in + add_graph start_lbl (RTL.St_stackaddr (r1, r2, dest_lbl)) def + + | AST.Cst_offset off -> + let i = concrete_offset off in + translate_cst (AST.Cst_int i) destrs start_lbl dest_lbl def + + | AST.Cst_sizeof size -> + let i = concrete_size size in + translate_cst (AST.Cst_int i) destrs start_lbl dest_lbl def + + +(** Adds zeros if destination is bigger than source, or truncates if source is + bigger than destination. *) + +let translate_move destrs srcrs start_lbl = + let ((common1, rest1), (common2, rest2)) = MiscPottier.reduce destrs srcrs in + let f_common destr srcr = RTL.St_move (destr, srcr, start_lbl) in + let translates1 = adds_graph (List.map2 f_common common1 common2) in + let translates2 = translate_cst (AST.Cst_int 0) rest1 in + add_translates [translates1 ; translates2] start_lbl + +let translate_cast_unsigned destrs start_lbl dest_lbl def = + let (def, tmp_zero) = fresh_reg def in + let zeros = MiscPottier.make tmp_zero (List.length destrs) in + add_translates + [adds_graph [RTL.St_int (tmp_zero, 0, start_lbl)] ; + translate_move destrs zeros] + start_lbl dest_lbl def + +(** [srcr] will be copied in the first register of [destrs]. The remaining + registers of [destrs] needs to be set either to zeros or to ones, depending + on the most significant bit of [srcr]. Since 8051 is a 8 bits architecture, + we fetch the most significant bit with [src & 10000000]. Let [tmpr] be the + result. Then we build zeros or ones with [tmpr * 11111111]. *) + +let translate_cast_signed destrs srcr start_lbl dest_lbl def = + let (def, tmp_128) = fresh_reg def in + let (def, tmp_255) = fresh_reg def in + let (def, tmpr) = fresh_reg def in + let (def, dummy) = fresh_reg def in + let insts = + [RTL.St_int (tmp_128, 128, start_lbl) ; + RTL.St_op2 (I8051.And, tmpr, tmp_128, srcr, start_lbl) ; + RTL.St_opaccs (I8051.DivuModu, tmpr, dummy, tmpr, tmp_128, start_lbl) ; + RTL.St_int (tmp_255, 255, start_lbl) ; + RTL.St_opaccs (I8051.Mul, tmpr, dummy, tmpr, tmp_255, start_lbl)] in + let srcrs = MiscPottier.make tmpr (List.length destrs) in + add_translates [adds_graph insts ; translate_move destrs srcrs] + start_lbl dest_lbl def + +(** Depending on [src_sign], perform either a signed or an unsigned cast. For + the signed case, we need the most significant bit of the source. *) + +let translate_cast src_size src_sign dest_size destrs srcrs = + if List.length srcrs = 0 then adds_graph [] + else + if dest_size < src_size then translate_move destrs srcrs + else + let ((common1, rest1), (common2, rest2)) = + MiscPottier.reduce destrs srcrs in + (* dest_size >= src_size, so there will be no rest2 *) + assert (rest2 = []) ; + let insts_common = translate_move common1 common2 in + let sign_reg = MiscPottier.last srcrs in + let insts_sign = match src_sign with + | AST.Unsigned -> translate_cast_unsigned rest1 + | AST.Signed -> translate_cast_signed rest1 sign_reg in + add_translates [insts_common ; insts_sign] + + +(** [-x] is [~x] (the complement of [x]), and then propagating the carry if some + register of the result is greater or equal to 128 (10000000 in binary). *) + +(** FIXME Nicolas: why is this correct? *) + +let translate_negint destrs srcrs start_lbl dest_lbl def = + assert (List.length destrs = List.length srcrs) ; + let (def, tmpr) = fresh_reg def in + let f_cmpl destr srcr = RTL.St_op1 (I8051.Cmpl, destr, srcr, start_lbl) in + let insts_cmpl = List.map2 f_cmpl destrs srcrs in + let insts_init = + [RTL.St_set_carry start_lbl ; + RTL.St_int (tmpr, 0, start_lbl)] in + let f_add destr = RTL.St_op2 (I8051.Addc, destr, destr, tmpr, start_lbl) in + let insts_add = List.map f_add destrs in + adds_graph (insts_cmpl @ insts_init @ insts_add) + start_lbl dest_lbl def + + +(** In order to know if a register is different from 0 or not, we can simply + substract it from 0 and fetch the carry bit: it is 0 if the register + contains 0, and 1 otherwise. By doing a | on the result of + the previous operation on every source register and starting with 0, the + result is either 0 if all the source registers contained 0, and 1 + otherwise. Let [tmp_res] be this number; then, the result of [notbool] is + simply [tmp_res ^ 1]. *) + +let translate_notbool destrs srcrs start_lbl dest_lbl def = match destrs with + | [] -> add_graph start_lbl (RTL.St_skip dest_lbl) def + | destr :: destrs -> + (* [destr] will be set to either 0 or 1 (depending on [srcrs]), the + remaining destination registers [destrs] will be set to 0. *) + let (def, tmpr) = fresh_reg def in + let (def, tmp_srcrs) = fresh_regs def (List.length srcrs) in + let save_srcrs = translate_move tmp_srcrs srcrs in + let prologue = translate_cst (AST.Cst_int 0) (destr :: destrs) in + let f tmp_srcr = + [RTL.St_clear_carry start_lbl ; + RTL.St_int (tmpr, 0, start_lbl) ; + RTL.St_op2 (I8051.Sub, tmpr, tmpr, tmp_srcr, start_lbl) ; + RTL.St_int (tmpr, 0, start_lbl) ; + RTL.St_op2 (I8051.Addc, tmpr, tmpr, tmpr, start_lbl) ; + RTL.St_op2 (I8051.Or, destr, destr, tmpr, start_lbl)] in + let insts = List.flatten (List.map f tmp_srcrs) in + let epilogue = + [RTL.St_int (tmpr, 1, start_lbl) ; + RTL.St_op2 (I8051.Xor, destr, destr, tmpr, start_lbl)] in + add_translates + [save_srcrs ; prologue ; adds_graph insts ; adds_graph epilogue] + start_lbl dest_lbl def + + +let translate_op1 op1 destrs srcrs start_lbl dest_lbl def = match op1 with + + | AST.Op_cast ((src_size, src_sign), dest_size) -> + translate_cast src_size src_sign dest_size destrs srcrs start_lbl dest_lbl + def + + | AST.Op_negint -> + translate_negint destrs srcrs start_lbl dest_lbl def + + | AST.Op_notbool -> + translate_notbool destrs srcrs start_lbl dest_lbl def + + | AST.Op_notint -> + let f destr srcr = RTL.St_op1 (I8051.Cmpl, destr, srcr, start_lbl) in + let l = List.map2 f destrs srcrs in + adds_graph l start_lbl dest_lbl def + + | AST.Op_ptrofint | AST.Op_intofptr | AST.Op_id -> + translate_move destrs srcrs start_lbl dest_lbl def + + +(** Apply a binary operation. The sources and destination registers may not have + the same size. When they do not, zero registers will be considered if + needed. Considers given a temporary register [tmpr] that plays the role of + the zero register. The destination registers can be one of the sources + registers. *) + +let translate_op_ tmpr op destrs srcrs1 srcrs2 start_lbl dest_lbl def = + (* The next few instructions allows to decompose the sources and destination + registers in sub-lists of the same size, and creating the remainings at + the same time. *) + let ((srcrs1_common, srcrs1_rest), (srcrs2_common, srcrs2_rest)) = + MiscPottier.reduce srcrs1 srcrs2 in + let srcrs_rest = choose_rest srcrs1_rest srcrs2_rest in + let ((destrs_common, destrs_rest), _) = + MiscPottier.reduce destrs srcrs1_common in + (* srcrs1_common and srcrs2_common have the same size, which is exactly the + one of the shortest list between srcrs1 and srcrs2. destrs_common and + destrs_rest are either destrs and empty if destrs is bigger than + srcrs1_common (and thus srcrs2_common), or destrs_common has the size of + srcrs1_common (and srcrs2_common) and destrs_rest is the remainings of + destrs. *) + let ((destrs_cted, destrs_rest), (srcrs_cted, _)) = + MiscPottier.reduce destrs_rest srcrs_rest in + (* destrs_cted is either empty or is the remainings of destrs that has the + same size of the remainings between the srcrs1 and srcrs2 when removed the + number of elements of the size of the shortest one. destrs_rest are the + remainings, if any. *) + let insts_init = + [RTL.St_clear_carry start_lbl ; + RTL.St_int (tmpr, 0, start_lbl)] in + let f_op destr srcr1 srcr2 = + RTL.St_op2 (op, destr, srcr1, srcr2, start_lbl) in + let insts_op = + MiscPottier.map3 f_op destrs_common srcrs1_common srcrs2_common in + let f_op_cted destr srcr = + RTL.St_op2 (op, destr, srcr, tmpr, start_lbl) in + let insts_op_cted = List.map2 f_op_cted destrs_cted srcrs_cted in + let f_rest destr = + RTL.St_op2 (op, destr, tmpr, tmpr, start_lbl) in + let insts_rest = List.map f_rest destrs_rest in + adds_graph (insts_init @ insts_op @ insts_op_cted @ insts_rest) + start_lbl dest_lbl def + +(** Same as [translate_op], but creates the zero register. *) + +let translate_op op destrs srcrs1 srcrs2 start_lbl dest_lbl def = + let (def, tmpr) = fresh_reg def in + translate_op_ tmpr op destrs srcrs1 srcrs2 start_lbl dest_lbl def + + +(** Multiply a list of registers (list significant bits first) by a + register. The multiplication in 8051 of two registers is two registers: the + least and most significant bits of the result. When pultiplying a list of + registers with one register, we need to propagate the most significant bits + of an operation to the next one for addition. Example: + + (i1 i2) * j = res11 (res12 + res21) + + where (res11, res12) = i1 * j and (res21, res22) = i2 * j. The result is + truncated by just forgetting about res22. *) + +(* [dummy] is used to discard the most significant bits *) + +let rec translate_mul1 dummy tmpr destrs srcrs1 srcr2 start_lbl = + match destrs, srcrs1 with + | [], _ -> adds_graph [RTL.St_skip start_lbl] start_lbl + | [destr], [] -> + (* if there are no source register left, and only one destination + register, simply add the carry bit of a potential previous addition *) + adds_graph [RTL.St_int (tmpr, 0, start_lbl) ; + RTL.St_op2 (I8051.Addc, destr, destr, tmpr, start_lbl)] + start_lbl + | destr1 :: destr2 :: _, [] -> + (* if there are no source register left, but at least two destination + registers, adding the carry of the potential previous addition + may lead to another carry that needs to be propagated *) + add_translates + [adds_graph [RTL.St_int (tmpr, 0, start_lbl) ; + RTL.St_op2 (I8051.Addc, destr1, destr1, tmpr, start_lbl) ; + RTL.St_op2 (I8051.Addc, destr2, tmpr, tmpr, start_lbl)]] + start_lbl + | [destr], srcr1 :: _ -> + (* if there are at least one source register, but only one destination + register, discard the most significant bits of the multiplication *) + adds_graph + [RTL.St_opaccs (I8051.Mul, tmpr, dummy, srcr2, srcr1, start_lbl) ; + RTL.St_op2 (I8051.Addc, destr, destr, tmpr, start_lbl)] + start_lbl + | destr1 :: destr2 :: destrs, srcr1 :: srcrs1 -> + (* if there are at least one source register, and at least two destination + registers, the first destination register should hold the most + significant bits of the previous atomic multiplication. We need to add + to it the least significant bits of the current operation, and store + the most significant bits in the next destination register for the next + multiplication. *) + add_translates + [adds_graph + [RTL.St_opaccs + (I8051.Mul, tmpr, destr2, srcr2, srcr1, start_lbl) ; + RTL.St_op2 (I8051.Addc, destr1, destr1, tmpr, start_lbl)] ; + translate_mul1 dummy tmpr (destr2 :: destrs) srcrs1 srcr2] + start_lbl + +(** Multiply the ith register of some source registers. The registers up to the + ith of the result should be set to 0, and the multiplication really starts + at the next one. The result of this operation is then added to the current + result of the full multiplication. *) + +let translate_muli + dummy tmpr destrs tmp_destrs srcrs1 dummy_lbl i translates srcr2i = + let (tmp_destrs1, tmp_destrs2) = MiscPottier.split tmp_destrs i in + translates @ + (match tmp_destrs2 with + | [] -> [] + | tmp_destr2 :: tmp_destrs2 -> + [adds_graph [RTL.St_clear_carry dummy_lbl] ; + translate_cst (AST.Cst_int 0) [tmpr] ; + translate_cst (AST.Cst_int 0) tmp_destrs ; + translate_mul1 dummy tmpr (tmp_destr2 :: tmp_destrs2) srcrs1 srcr2i ; + translate_cst (AST.Cst_int 0) tmp_destrs1 ; + adds_graph [RTL.St_clear_carry dummy_lbl] ; + translate_op I8051.Addc destrs destrs tmp_destrs]) + +(** Multiplication, school-style: + + i1n ... i11 * j1m ... j11 = + i1n ... i11 * j11 + + i1n ... i12 0 * j12 + + i1n ... i13 0 0 * j13 + + ... *) + +let translate_mul destrs srcrs1 srcrs2 start_lbl dest_lbl def = + (* dummy will be used to discard some unused results *) + let (def, dummy) = fresh_reg def in + let (def, tmpr) = fresh_reg def in + (* One line of the multiplication is stored in tmp_destrs. The result of the + full multiplication is accumulated in destrs. *) + let (def, tmp_destrs) = fresh_regs def (List.length destrs) in + (* Source registers are copied into fresh source registers to avoid + overwriting if one of them is also the destination registers. *) + let (def, fresh_srcrs1) = fresh_regs def (List.length srcrs1) in + let (def, fresh_srcrs2) = fresh_regs def (List.length srcrs2) in + let insts_init = + [translate_move fresh_srcrs1 srcrs1 ; + translate_move fresh_srcrs2 srcrs2 ; + translate_cst (AST.Cst_int 0) destrs] in + let f = translate_muli dummy tmpr destrs tmp_destrs fresh_srcrs1 start_lbl in + let insts_mul = MiscPottier.foldi f [] fresh_srcrs2 in + add_translates (insts_init @ insts_mul) start_lbl dest_lbl def + + +(** The 8051 performs division and modulo in a single operation. Depending on + the one we need (boolean [order]), we discard the other. *) + +let translate_divumodu8 order destrs srcr1 srcr2 start_lbl dest_lbl def = + match destrs with + | [] -> add_graph start_lbl (RTL.St_skip dest_lbl) def + | destr :: destrs -> + let (def, dummy) = fresh_reg def in + let (destr1, destr2) = if order then (destr, dummy) else (dummy, destr) in + let inst_div = + adds_graph [RTL.St_opaccs (I8051.DivuModu, destr1, destr2, + srcr1, srcr2, start_lbl)] in + let insts_rest = translate_cst (AST.Cst_int 0) destrs in + add_translates [inst_div ; insts_rest] start_lbl dest_lbl def + + +(** Only the first register of [destrs] will be used, the others will be set to + 0. We compare in order the registers of both source registers and accumulate + the results in the first register of [destrs], with a | and initially set to + 0. Two registers are equal if and only if substracting one with the other + and substracting the other with the one both lead to no carry. If one of the + source registers is bigger than the other, we compare the remainings with + 0. We first copy the source registers into fresh ones, in case the + destination registers share some source registers. Example: + + srcr11 ... srcr1n != srcr21 ... srcr2m = + carry(srcr11 - srcr21) | carry (srcr21 - srcr11) | + carry(srcr12 - srcr22) | carry (srcr22 - srcr12) | + ... *) + +let translate_ne destrs srcrs1 srcrs2 start_lbl dest_lbl def = + match destrs with + | [] -> add_graph start_lbl (RTL.St_skip dest_lbl) def + | destr :: destrs -> + let (def, dummy) = fresh_reg def in + let (def, tmp_zero) = fresh_reg def in + let (def, tmp_srcrs1) = fresh_regs def (List.length srcrs1) in + let save_srcrs1 = translate_move tmp_srcrs1 srcrs1 in + let (def, tmp_srcrs2) = fresh_regs def (List.length srcrs2) in + let save_srcrs2 = translate_move tmp_srcrs2 srcrs2 in + let ((common1, rest1), (common2, rest2)) = + MiscPottier.reduce tmp_srcrs1 tmp_srcrs2 in + let rest = choose_rest rest1 rest2 in + let inits = + [RTL.St_int (destr, 0, start_lbl) ; + RTL.St_int (tmp_zero, 0, start_lbl)] in + let f tmp_srcr1 tmp_srcr2 = + [RTL.St_clear_carry start_lbl ; + RTL.St_op2 (I8051.Sub, dummy, tmp_srcr1, tmp_srcr2, start_lbl) ; + RTL.St_op2 (I8051.Or, destr, destr, tmp_zero, start_lbl) ; + RTL.St_op2 (I8051.Sub, dummy, tmp_srcr2, tmp_srcr1, start_lbl) ; + RTL.St_op2 (I8051.Or, destr, destr, tmp_zero, start_lbl)] in + let insts_common = List.flatten (List.map2 f common1 common2) in + let insts_rest = List.flatten (List.map (f tmp_zero) rest) in + let insts = inits @ insts_common @ insts_rest in + let epilogue = translate_cst (AST.Cst_int 0) destrs in + add_translates [save_srcrs1 ; save_srcrs2 ; adds_graph insts ; epilogue] + start_lbl dest_lbl def + + +(** Are two given registers equal? We substract the one with the other, and then + the other with the one. They are equal if and only if both carry are 0, + i.e., a bitwise 'or' on the carries is 1 if and only if they are + different. We simply do a bitwise xor with this result and 1 to have our + answer: + + r1 == r2 = (carry(r1 - r2) | carry(r2 - r1)) ^ 1 *) + +let translate_eq_reg + tmp_zero tmp_one tmpr1 tmpr2 destr dummy_lbl (srcr1, srcr2) = + [RTL.St_clear_carry dummy_lbl ; + RTL.St_op2 (I8051.Sub, tmpr1, srcr1, srcr2, dummy_lbl) ; + RTL.St_op2 (I8051.Addc, tmpr1, tmp_zero, tmp_zero, dummy_lbl) ; + RTL.St_clear_carry dummy_lbl ; + RTL.St_op2 (I8051.Sub, tmpr2, srcr2, srcr1, dummy_lbl) ; + RTL.St_op2 (I8051.Addc, tmpr2, tmp_zero, tmp_zero, dummy_lbl) ; + RTL.St_op2 (I8051.Or, tmpr1, tmpr1, tmpr2, dummy_lbl) ; + RTL.St_op2 (I8051.Xor, tmpr1, tmpr1, tmp_one, dummy_lbl) ; + RTL.St_op2 (I8051.And, destr, destr, tmpr1, dummy_lbl)] + +let translate_eq_list tmp_zero tmp_one tmpr1 tmpr2 destr leq dummy_lbl = + let f = translate_eq_reg tmp_zero tmp_one tmpr1 tmpr2 destr dummy_lbl in + (RTL.St_int (destr, 1, dummy_lbl)) :: (List.flatten (List.map f leq)) + +(** Translation of unsigned LT: we proceed by successively comparing the source + registers most significant bits first (if one of the two source lists is + smaller than the other, we complete it with zeros). At each step, a register + ([tmpr3]) holds 1 if the previous registers are all equal, and 0 + otherwise. The result of the comparison is 1 if there is a step where all + the previous registers are equal and the first current register is lower + than the second (which is checked by substracting the second to the first + and fetching the carry). *) + +let translate_atom + tmp_zero tmp_one tmpr1 tmpr2 tmpr3 destr dummy_lbl leq srcr1 srcr2 = + (translate_eq_list tmp_zero tmp_one tmpr1 tmpr2 tmpr3 leq dummy_lbl) @ + [RTL.St_clear_carry dummy_lbl ; + RTL.St_op2 (I8051.Sub, tmpr1, srcr1, srcr2, dummy_lbl) ; + RTL.St_op2 (I8051.Addc, tmpr1, tmp_zero, tmp_zero, dummy_lbl) ; + RTL.St_op2 (I8051.And, tmpr3, tmpr3, tmpr1, dummy_lbl) ; + RTL.St_op2 (I8051.Or, destr, destr, tmpr3, dummy_lbl)] + +let translate_lt_main tmp_zero tmp_one tmpr1 tmpr2 tmpr3 destr dummy_lbl + srcrs1 srcrs2 = + let f (insts, leq) srcr1 srcr2 = + let added_insts = + translate_atom tmp_zero tmp_one tmpr1 tmpr2 tmpr3 destr dummy_lbl leq + srcr1 srcr2 in + (insts @ added_insts, leq @ [(srcr1, srcr2)]) in + fst (List.fold_left2 f ([], []) srcrs1 srcrs2) + +let translate_lt destrs srcrs1 srcrs2 start_lbl dest_lbl def = + match destrs with + | [] -> add_graph start_lbl (RTL.St_skip dest_lbl) def + | _ -> + let (def, tmp_destrs) = fresh_regs def (List.length destrs) in + let tmp_destr = List.hd tmp_destrs in + let (def, tmp_zero) = fresh_reg def in + let (def, tmp_one) = fresh_reg def in + let (def, tmpr1) = fresh_reg def in + let (def, tmpr2) = fresh_reg def in + let (def, tmpr3) = fresh_reg def in + let (srcrs1, srcrs2, added) = complete_regs def srcrs1 srcrs2 in + let srcrs1 = List.rev srcrs1 in + let srcrs2 = List.rev srcrs2 in + let insts_init = + [translate_cst (AST.Cst_int 0) tmp_destrs ; + translate_cst (AST.Cst_int 0) added ; + adds_graph [RTL.St_int (tmp_zero, 0, start_lbl) ; + RTL.St_int (tmp_one, 1, start_lbl)]] in + let insts_main = + translate_lt_main tmp_zero tmp_one tmpr1 tmpr2 tmpr3 tmp_destr start_lbl + srcrs1 srcrs2 in + let insts_main = [adds_graph insts_main] in + let insts_exit = [translate_move destrs tmp_destrs] in + add_translates (insts_init @ insts_main @ insts_exit ) + start_lbl dest_lbl def + + +(** Translation of signed LT: exactly unsigned LT when the signed bit is + changed: positive numbers become greater than the half bound as unsigned, + negative numbers become between 0 and the half bound as unsigned. The sign + bit is changed with a bitwise xor between the register holding the bit sign + (the most significant register, i.e. the last register in the list of + registers) and 10000000. *) + +let add_128_to_last tmp_128 rs start_lbl = match rs with + | [] -> adds_graph [] start_lbl + | _ -> + let r = MiscPottier.last rs in + adds_graph [RTL.St_op2 (I8051.Xor, r, r, tmp_128, start_lbl)] start_lbl + +let translate_lts destrs srcrs1 srcrs2 start_lbl dest_lbl def = + let (def, tmp_srcrs1) = fresh_regs def (List.length srcrs1) in + let (def, tmp_srcrs2) = fresh_regs def (List.length srcrs2) in + let (def, tmp_128) = fresh_reg def in + add_translates + [translate_move tmp_srcrs1 srcrs1 ; + translate_move tmp_srcrs2 srcrs2 ; + adds_graph [RTL.St_int (tmp_128, 128, start_lbl)] ; + add_128_to_last tmp_128 tmp_srcrs1 ; + add_128_to_last tmp_128 tmp_srcrs2 ; + translate_lt destrs tmp_srcrs1 tmp_srcrs2] + start_lbl dest_lbl def + + +let rec translate_op2 op2 destrs srcrs1 srcrs2 start_lbl dest_lbl def = + match op2 with + + | AST.Op_add | AST.Op_addp -> + translate_op I8051.Addc destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_sub | AST.Op_subp | AST.Op_subpp -> + translate_op I8051.Sub destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_mul -> + translate_mul destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_divu when List.length srcrs1 = 1 && List.length srcrs2 = 1 -> + translate_divumodu8 true destrs (List.hd srcrs1) (List.hd srcrs2) + start_lbl dest_lbl def + + | AST.Op_modu when List.length srcrs1 = 1 && List.length srcrs2 = 1 -> + translate_divumodu8 false destrs (List.hd srcrs1) (List.hd srcrs2) + start_lbl dest_lbl def + + | AST.Op_and -> + translate_op I8051.And destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_or -> + translate_op I8051.Or destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_xor -> + translate_op I8051.Xor destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_cmp AST.Cmp_eq + | AST.Op_cmpu AST.Cmp_eq + | AST.Op_cmpp AST.Cmp_eq -> + add_translates + [translate_op2 (AST.Op_cmpu AST.Cmp_ne) destrs srcrs1 srcrs2 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_cmp AST.Cmp_ne + | AST.Op_cmpu AST.Cmp_ne + | AST.Op_cmpp AST.Cmp_ne -> + translate_ne destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_cmp AST.Cmp_lt -> + translate_lts destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_cmpu AST.Cmp_lt | AST.Op_cmpp AST.Cmp_lt -> + translate_lt destrs srcrs1 srcrs2 start_lbl dest_lbl def + + | AST.Op_cmp AST.Cmp_le -> + add_translates + [translate_op2 (AST.Op_cmp AST.Cmp_lt) destrs srcrs2 srcrs1 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_cmpu AST.Cmp_le -> + add_translates + [translate_op2 (AST.Op_cmpu AST.Cmp_lt) destrs srcrs2 srcrs1 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_cmpp AST.Cmp_le -> + add_translates + [translate_op2 (AST.Op_cmpp AST.Cmp_lt) destrs srcrs2 srcrs1 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_cmp AST.Cmp_gt -> + translate_op2 (AST.Op_cmp AST.Cmp_lt) + destrs srcrs2 srcrs1 start_lbl dest_lbl def + + | AST.Op_cmpu AST.Cmp_gt -> + translate_op2 (AST.Op_cmpu AST.Cmp_lt) + destrs srcrs2 srcrs1 start_lbl dest_lbl def + + | AST.Op_cmpp AST.Cmp_gt -> + translate_op2 (AST.Op_cmpp AST.Cmp_lt) + destrs srcrs2 srcrs1 start_lbl dest_lbl def + + | AST.Op_cmp AST.Cmp_ge -> + add_translates + [translate_op2 (AST.Op_cmp AST.Cmp_lt) destrs srcrs1 srcrs2 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_cmpu AST.Cmp_ge -> + add_translates + [translate_op2 (AST.Op_cmpu AST.Cmp_lt) destrs srcrs1 srcrs2 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_cmpp AST.Cmp_ge -> + add_translates + [translate_op2 (AST.Op_cmpp AST.Cmp_lt) destrs srcrs1 srcrs2 ; + translate_op1 AST.Op_notbool destrs destrs] + start_lbl dest_lbl def + + | AST.Op_div | AST.Op_divu | AST.Op_modu | AST.Op_mod | AST.Op_shl + | AST.Op_shr | AST.Op_shru -> + (* Unsupported, should have been replaced by a runtime function. *) + assert false + + +(** The RTL.St_cond construction is based on a single register. We accumulate + with a bitwise or the value of the source registers. In the end, the result + is 0 if and only if all registers contained 0. *) + +let translate_cond srcrs start_lbl lbl_true lbl_false def = + let (def, tmpr) = fresh_reg def in + let tmp_lbl = fresh_label def in + let init = RTL.St_int (tmpr, 0, start_lbl) in + let f srcr = RTL.St_op2 (I8051.Or, tmpr, tmpr, srcr, start_lbl) in + let def = adds_graph (init :: (List.map f srcrs)) start_lbl tmp_lbl def in + add_graph tmp_lbl (RTL.St_cond (tmpr, lbl_true, lbl_false)) def + + +(** Loading or storing may ask to load or store several memory cells. We + consider the base address shifted by successive offsets until every data has + been loaded or stored. *) + +let translate_load addr destrs start_lbl dest_lbl def = + let (def, save_addr) = fresh_regs def (List.length addr) in + let (def, tmp_addr) = fresh_regs def (List.length addr) in + let (tmp_addr1, tmp_addr2) = make_addr tmp_addr in + let (def, tmpr) = fresh_reg def in + let insts_save_addr = translate_move save_addr addr in + let f (translates, off) r = + let translates = + translates @ + [adds_graph [RTL.St_int (tmpr, off, start_lbl)] ; + translate_op2 AST.Op_addp tmp_addr save_addr [tmpr] ; + adds_graph [RTL.St_load (r, tmp_addr1, tmp_addr2, dest_lbl)]] in + (translates, off + Driver.TargetArch.int_size) in + let (translates, _) = List.fold_left f ([], 0) destrs in + add_translates (insts_save_addr :: translates) start_lbl dest_lbl def + + +let translate_store addr srcrs start_lbl dest_lbl def = + let (def, tmp_addr) = fresh_regs def (List.length addr) in + let (tmp_addr1, tmp_addr2) = make_addr tmp_addr in + let (def, tmpr) = fresh_reg def in + let f (translates, off) srcr = + let translates = + translates @ + [adds_graph [RTL.St_int (tmpr, off, start_lbl)] ; + translate_op2 AST.Op_addp tmp_addr addr [tmpr] ; + adds_graph [RTL.St_store (tmp_addr1, tmp_addr2, srcr, dest_lbl)]] in + (translates, off + Driver.TargetArch.int_size) in + let (translates, _) = List.fold_left f ([], 0) srcrs in + add_translates translates start_lbl dest_lbl def + + +let translate_stmt lenv lbl stmt def = match stmt with + + | RTLabs.St_skip lbl' -> + add_graph lbl (RTL.St_skip lbl') def + + | RTLabs.St_cost (cost_lbl, lbl') -> + add_graph lbl (RTL.St_cost (cost_lbl, lbl')) def + + | RTLabs.St_cst (destr, cst, lbl') -> + translate_cst cst (find_local_env destr lenv) lbl lbl' def + + | RTLabs.St_op1 (op1, destr, srcr, lbl') -> + translate_op1 op1 (find_local_env destr lenv) (find_local_env srcr lenv) + lbl lbl' def + + | RTLabs.St_op2 (op2, destr, srcr1, srcr2, lbl') -> + translate_op2 op2 (find_local_env destr lenv) + (find_local_env srcr1 lenv) (find_local_env srcr2 lenv) lbl lbl' def + + | RTLabs.St_load (_, addr, destr, lbl') -> + translate_load (find_local_env addr lenv) (find_local_env destr lenv) + lbl lbl' def + + | RTLabs.St_store (_, addr, srcr, lbl') -> + translate_store (find_local_env addr lenv) (find_local_env srcr lenv) + lbl lbl' def + + | RTLabs.St_call_id (f, args, None, _, lbl') -> + add_graph lbl (RTL.St_call_id (f, rtl_args args lenv, [], lbl')) def + + | RTLabs.St_call_id (f, args, Some retr, _, lbl') -> + add_graph lbl (RTL.St_call_id (f, rtl_args args lenv, + find_local_env retr lenv, lbl')) def + + | RTLabs.St_call_ptr (f, args, None, _, lbl') -> + let (f1, f2) = find_and_addr f lenv in + add_graph lbl (RTL.St_call_ptr (f1, f2, rtl_args args lenv, [], lbl')) def + + | RTLabs.St_call_ptr (f, args, Some retr, _, lbl') -> + let (f1, f2) = find_and_addr f lenv in + add_graph lbl + (RTL.St_call_ptr + (f1, f2, rtl_args args lenv, find_local_env retr lenv, lbl')) def + + | RTLabs.St_tailcall_id (f, args, _) -> + add_graph lbl (RTL.St_tailcall_id (f, rtl_args args lenv)) def + + | RTLabs.St_tailcall_ptr (f, args, _) -> + let (f1, f2) = find_and_addr f lenv in + add_graph lbl (RTL.St_tailcall_ptr (f1, f2, rtl_args args lenv)) def + + | RTLabs.St_cond (r, lbl_true, lbl_false) -> + translate_cond (find_local_env r lenv) lbl lbl_true lbl_false def + + | RTLabs.St_jumptable _ -> + error "Jump tables not supported yet." + + | RTLabs.St_return None -> + add_graph lbl (RTL.St_return []) def + + | RTLabs.St_return (Some r) -> + add_graph lbl (RTL.St_return (find_local_env r lenv)) def + + +let translate_internal def = + let runiverse = def.RTLabs.f_runiverse in + let lenv = + initialize_local_env runiverse + (def.RTLabs.f_params @ def.RTLabs.f_locals) def.RTLabs.f_result in + let set_of_list l = List.fold_right Register.Set.add l Register.Set.empty in + let params = map_list_local_env lenv (List.map fst def.RTLabs.f_params) in + let locals = map_list_local_env lenv (List.map fst def.RTLabs.f_locals) in + let locals = set_of_list locals in + let result = match def.RTLabs.f_result with + | None -> [] + | Some (r, _) -> find_local_env r lenv in + let res = + { RTL.f_luniverse = def.RTLabs.f_luniverse ; + RTL.f_runiverse = runiverse ; + RTL.f_result = result ; + RTL.f_params = params ; + RTL.f_locals = locals ; + RTL.f_stacksize = concrete_size def.RTLabs.f_stacksize ; + RTL.f_graph = Label.Map.empty ; + RTL.f_entry = def.RTLabs.f_entry ; + RTL.f_exit = def.RTLabs.f_exit } in + Label.Map.fold (translate_stmt lenv) def.RTLabs.f_graph res + + +let translate_fun_def = function + | RTLabs.F_int def -> RTL.F_int (translate_internal def) + | RTLabs.F_ext def -> RTL.F_ext def + + +(* Add global initializations *) + +let sum_offsets = + let f res off = res + (concrete_offset off) in + List.fold_left f 0 + +let assign_data addr1 addr2 addr1' addr2' off_r data_r tmpr def (offset, data) = + if offset < 256 then + let def = + generates_graph + [RTL.St_store (addr1', addr2', data_r, Label.dummy)] def in + let start_lbl = fresh_label def in + let dest_lbl = def.RTL.f_entry in + let def = + translate_op_ tmpr I8051.Addc + [addr1' ; addr2'] [addr1 ; addr2] [off_r] start_lbl dest_lbl def in + let def = change_entry def start_lbl in + generates_graph + [RTL.St_int (off_r, offset, Label.dummy) ; + RTL.St_int (data_r, data, Label.dummy)] def + else error ("offset too big to fit in a register when initializing globals.") + +let assign_datas + addr1 addr2 addr1' addr2' off_r data_r tmpr x def (offsets, data) = + let base_offset = sum_offsets offsets in + let (data, quantity) = match data with + | AST.Data_int8 i -> (i, 1) + | AST.Data_int16 i -> (i, 2) + | AST.Data_int32 i -> (i, 4) + | AST.Data_float32 f | AST.Data_float64 f -> error_float () in + let data = IntValue.Int32.of_int data in + let datas = IntValue.Int32.break data quantity in + let datas = List.map IntValue.Int8.to_int datas in + let added_offs = MiscPottier.make 0 (List.length datas) in + let offs = MiscPottier.mapi (fun i _ -> base_offset + i) added_offs in + assert (List.length offs = List.length datas) ; + let offs_datas = List.combine offs datas in + let def = + List.fold_left (assign_data addr1 addr2 addr1' addr2' off_r data_r tmpr) + def offs_datas in + generates_graph [RTL.St_addr (addr1, addr2, x, Label.dummy)] def + +let add_global_initializations_def globals def = + let (def, addr1, addr2, addr1', addr2', off_r, data_r, tmpr) = + match fresh_regs def 7 with + | (def, [addr1 ; addr2 ; addr1' ; addr2' ; off_r ; data_r ; tmpr]) -> + (def, addr1, addr2, addr1', addr2', off_r, data_r, tmpr) + | _ -> + (* should be impossible: [fresh_regs _ 7] returns 7 regs *) + assert false in + let f def (x, size, datas_opt) = match datas_opt with + | None -> def + | Some datas -> + let offsets = Memory.all_offsets size in + if List.length offsets <> List.length datas then + error "bad global initialization style." + else + let offs_datas = List.combine offsets datas in + List.fold_left + (assign_datas addr1 addr2 addr1' addr2' off_r data_r tmpr x) + def offs_datas in + List.fold_left f def globals + +let add_global_initializations_funct globals = function + | RTL.F_int def -> + let def = add_global_initializations_def globals def in + RTL.F_int def + | def -> def + +(* [add_global_initializations p] moves the initializations of the globals of + [p] to the beginning of the main function, if any. *) + +let add_global_initializations globals main functs = match main with + | None -> functs + | Some main -> + let main_def = List.assoc main functs in + let main_def = add_global_initializations_funct globals main_def in + MiscPottier.update_list_assoc main main_def functs + + +let translate p = + let f_global (id, size, _) = (id, concrete_size size) in + let f_funct (id, fun_def) = (id, translate_fun_def fun_def) in + let functs = List.map f_funct p.RTLabs.functs in + let functs = add_global_initializations p.RTLabs.vars p.RTLabs.main functs in + { RTL.vars = List.map f_global p.RTLabs.vars ; + RTL.functs = functs ; + RTL.main = p.RTLabs.main } diff --git a/src/RTLabs/RTLabsToRTL.mli b/src/RTLabs/RTLabsToRTL.mli new file mode 100644 index 0000000..f432ec3 --- /dev/null +++ b/src/RTLabs/RTLabsToRTL.mli @@ -0,0 +1,8 @@ + +(** This module provides a translation of [RTLabs] programs to [RTL] + programs. *) + +(** Most of the work consists in the instruction selection. We target the 8051 + processor, which has addresses coded on two machine words. *) + +val translate : RTLabs.program -> RTL.program diff --git a/src/acc.ml b/src/acc.ml new file mode 100644 index 0000000..52989d1 --- /dev/null +++ b/src/acc.ml @@ -0,0 +1,180 @@ +open Options +open Misc.Timed + +(** Parse the command line. *) +let input_files = + if not (Options.is_web_mode ()) then + OptionsParsing.results () + else + [] + +(** For each input file of the source language: + + 1. Parse. + + 2. Add runtime functions. + + 3. Labelize. + + 4. Compile to the target language. + (And keep track of annotations if required). + + 5. Annotate the input program with collected costs. + + 6. Save the annotated input program. + + Optionnally, we can interpret the intermediate programs + if {!Options.interpretation_requested}. +*) +let process ?(step=fun step over -> ()) source = + (** Set source and target languages. *) + let src_language = Options.get_source_language () in + let tgt_language = Options.get_target_language () in + + let next_step = + let nb_step = 10 in + let c = ref 0 in + fun () -> incr c; step !c nb_step + in + + (** These variables are related to the lustre mode of the compiler. *) + let is_lustre_file = Options.is_lustre_file () in + let remove_lustre_externals = Options.is_remove_lustre_externals () in + + (** Parse. *) + let input_ast = + profile "Parsing" + (Languages.parse ~is_lustre_file ~remove_lustre_externals src_language) + source + in + + next_step (); + + (** Embed the runtime functions in the abstract syntax tree. *) + let input_ast = Languages.add_runtime input_ast in + + (** Labelling pass. *) + let input_ast = + profile "Labelling" + Languages.labelize input_ast + in + + next_step (); + + (** Compilation. *) + let target_asts = + (** If debugging is enabled, the compilation function returns all + the intermediate programs. *) + profile "Compilation" + (Languages.compile + (Options.is_debug_enabled ()) + src_language tgt_language) + input_ast + in + + next_step (); + + let final_ast, intermediate_asts = Misc.ListExt.cut_last target_asts in + + (** Instrument the source file with cost annotations. *) + let (annotated_input_ast, cost_id, cost_incr, extern_cost_variables) = + profile "Annotation" + (Languages.annotate input_ast) + final_ast + in + + (** Instrument the source file with cost annotations. *) + let (annotated_input_ast, stack_id, stack_max_id, + stack_incr, extern_stack_variables) = + profile "Annotation Stack" + Languages.annotate_stack_size cost_incr annotated_input_ast + in + + next_step (); + + (** Combine the output asts. *) + let output = (target_asts, annotated_input_ast) in + + (** Finally save these output if we are not in a web mode. *) + let _ = + if not (Options.is_web_mode ()) then + let filename = match source with `Filename f -> f | _ -> assert false in + let (exact_output, output_filename) = match Options.get_output_files () with + | None -> (false, filename) + | Some filename' -> (true, filename') in + let save ?(suffix="") ast = + Languages.save + (Options.is_asm_pretty ()) exact_output output_filename suffix ast + in + begin + save final_ast; + save ~suffix:"-instrumented" annotated_input_ast; + Languages.save_cost exact_output output_filename cost_id cost_incr + extern_cost_variables; + Languages.save_stack + exact_output output_filename + stack_id stack_max_id stack_incr extern_stack_variables; + if Options.is_debug_enabled () then + List.iter save intermediate_asts; + end; + + (** Interpret all the intermediate ASTs if requested. *) + if Options.interpretations_requested () then + begin + Printf.printf "Interpret\n%!" ; + let asts = target_asts in + let debug = Options.is_debug_enabled () in + let label_traces = List.map (Languages.interpret debug) asts in + Misc.IOExt.eprintf "Checking execution traces...%!"; + Checker.same_traces (List.combine asts label_traces); + Misc.IOExt.eprintf "OK.\n%!"; + end; + + (** Interpret the final AST if requested. *) + if Options.interpretation_requested () then + ignore (Languages.interpret (Options.is_debug_enabled ()) final_ast) + in + (** Return the output ASTs. *) + output + +let lustre_test (filename : string) = + let lustre_test = match Options.get_lustre_test () with + | None -> assert false (* do not use on this argument *) + | Some lustre_test -> lustre_test in + let lustre_test_cases = Options.get_lustre_test_cases () in + let lustre_test_cycles = Options.get_lustre_test_cycles () in + let lustre_test_min_int = Options.get_lustre_test_min_int () in + let lustre_test_max_int = Options.get_lustre_test_max_int () in + let src_language = Languages.Clight in + let tgt_language = Languages.Clight in + let input_ast = Languages.parse src_language (`Filename filename) in + let input_ast = + Languages.add_lustre_main lustre_test lustre_test_cases lustre_test_cycles + lustre_test_min_int lustre_test_max_int input_ast in + let (exact_output, output_filename) = match Options.get_output_files () with + | None -> (false, filename) + | Some filename' -> (true, filename') + in + let save ast = + Languages.save + (Options.is_asm_pretty ()) exact_output output_filename "" ast in + let target_asts = + Languages.compile false src_language tgt_language input_ast + in + let final_ast, _ = Misc.ListExt.cut_last target_asts in + save input_ast ; + save final_ast + +let _ = + Misc.Timed.set_profiling_flag (Options.is_debug_enabled () || Options.is_web_mode ()); + if not (Options.is_web_mode ()) then + begin + set_now (fun () -> 0.); (* Unix.gettimeofday () *. 1000.); *) + if Options.is_dev_test_enabled () then + Dev_test.do_dev_test input_files + else + if Options.get_lustre_test () <> None then + List.iter lustre_test input_files + else + ignore (List.map process (List.map (fun f -> `Filename f) input_files)) + end diff --git a/src/acc.mli b/src/acc.mli new file mode 100644 index 0000000..097d1fb --- /dev/null +++ b/src/acc.mli @@ -0,0 +1,9 @@ +(** This module realizes the compiler as a command line program + if {!Options.web_mode} is disabled. Otherwise, the compiler can + be used as an API. + + @author Yann Regis-Gianas +*) + +val process : ?step:(int -> int -> unit) -> Languages.source -> Languages.ast list * Languages.ast + diff --git a/src/accweb.ml b/src/accweb.ml new file mode 100644 index 0000000..9932b57 --- /dev/null +++ b/src/accweb.ml @@ -0,0 +1,53 @@ +(* let installation_path = "http://www.pps.jussieu.fr/~yrg/cerco" *) + +let installation_path = + "http://0.0.0.0:8000" + +let inputs = [ +(* For the moment: + Webify.Direct ("Scratch", + (fun () -> "/* Type your source code here in C. */")); +*) + Webify.Url (installation_path ^ "/cerco_input.xml") +] + +let processor step (title, contents) = + let to_output title a = + let lang = Languages.to_string (Languages.language_of_ast a) in + ("[" + ^ title + ^ lang + ^ "]", + (Misc.Timed.profile (Printf.sprintf "Print %s" lang) Languages.print a)) + in + let terminal title s = ("[" ^ title ^ "]", s) in + let (intermediate_asts, annotated_ast) = + Acc.process ~step (`Source (title, contents)) + in + let intermediate_asts = + snd (Misc.ListExt.cut_last intermediate_asts) + in + let pasts = + to_output "Annotated " annotated_ast + :: List.map (to_output "") intermediate_asts + in + let (out, err) = Misc.IOExt.get_buffers () in + let terminals = [ + terminal "Standard output" out; + terminal "Standard error" err + ] + in + pasts @ terminals + +let now () : float = + let date = jsnew Js.date_now () in + Js.to_float (date##getTime ()) + +let _ = + Options.set_web_mode (); + Misc.Timed.set_profiling_flag true; + Misc.Timed.set_now now; + Misc.IOExt.set_buffered_mode (); + Webify.from_function inputs processor + + diff --git a/src/annotStackSize.ml b/src/annotStackSize.ml new file mode 100644 index 0000000..97b2a30 --- /dev/null +++ b/src/annotStackSize.ml @@ -0,0 +1,197 @@ + + +let error_prefix = "Clight Stack Size Annotator" +let error = Error.global_error error_prefix + + +let stack_id_prefix = "__stack_size" +let stack_max_id_prefix = "__stack_size_max" +let stack_incr_prefix = "__stack_size_incr" + + +let fun_stack_size = Hashtbl.create 10 + +let add_stack_size s i = + Hashtbl.add fun_stack_size s i + +let get_stack_size s = + try + Hashtbl.find fun_stack_size s + with Not_found -> + Printf.eprintf + "get_stack_size: the function %s has not a stack size associated\n%!" + s; + exit 1 + +(* Instrumentation *) + +let int_typ = Clight.Tint (Clight.I32, AST.Signed) + +let const_int i = Clight.Expr (Clight.Econst_int i, int_typ) + +(* Instrument a statement. *) + +let rec instrument_body stack_incr stack_size stmt = match stmt with + | Clight.Sskip | Clight.Sbreak | Clight.Scontinue + | Clight.Sgoto _ -> + stmt + | Clight.Sassign (e1, e2) -> Clight.Sassign (e1, e2) + | Clight.Scall (eopt, f, args) -> stmt + | Clight.Ssequence (s1, s2) -> + Clight.Ssequence (instrument_body stack_incr stack_size s1, + instrument_body stack_incr stack_size s2) + | Clight.Sifthenelse (e, s1, s2) -> + let s1' = instrument_body stack_incr stack_size s1 in + let s2' = instrument_body stack_incr stack_size s2 in + Clight.Sifthenelse (e, s1', s2') + | Clight.Swhile (e, s) -> + let s' = instrument_body stack_incr stack_size s in + Clight.Swhile (e, s') + | Clight.Sdowhile (e, s) -> + let s' = instrument_body stack_incr stack_size s in + Clight.Sdowhile (e, s') + | Clight.Sfor (s1, e, s2, s3) -> + let s1' = instrument_body stack_incr stack_size s1 in + let s2' = instrument_body stack_incr stack_size s2 in + let s3' = instrument_body stack_incr stack_size s3 in + Clight.Sfor (s1', e, s2', s3') + | Clight.Sreturn _ -> + let fun_typ = Clight.Tfunction ([int_typ], Clight.Tvoid) in + let f = Clight.Expr (Clight.Evar stack_incr, fun_typ) in + let ss = Clight.Expr (Clight.Econst_int stack_size, int_typ) in + let args = [Clight.Expr (Clight.Eunop(Clight.Oneg,ss),int_typ)] in + Clight.Ssequence (Clight.Scall (None, f, args), stmt) + | Clight.Sswitch (e, ls) -> + let ls' = instrument_ls stack_incr stack_size ls in + Clight.Sswitch (e, ls') + | Clight.Slabel (lbl, s) -> + let s' = instrument_body stack_incr stack_size s in + Clight.Slabel (lbl, s') + | Clight.Scost (lbl, s) -> + (* Keep the cost label in the code. *) + let s' = instrument_body stack_incr stack_size s in + Clight.Scost (lbl, s') + (* + instrument_body stack_incr s + *) +and instrument_ls stack_incr stack_size = function + | Clight.LSdefault s -> + let s' = instrument_body stack_incr stack_size s in + Clight.LSdefault s' + | Clight.LScase (i, s, ls) -> + let s' = instrument_body stack_incr stack_size s in + let ls' = instrument_ls stack_incr stack_size ls in + Clight.LScase (i, s', ls') + +(* Instrument a function. *) + +let instrument_funct stack_incr (id, def) = + let def = match def with + | Clight.Internal def -> + let stack_size = get_stack_size id in + let body = instrument_body stack_incr + stack_size def.Clight.fn_body in + let body = + let fun_typ = Clight.Tfunction ([int_typ], Clight.Tvoid) in + let f = Clight.Expr (Clight.Evar stack_incr, fun_typ) in + let args = [Clight.Expr (Clight.Econst_int stack_size, int_typ)] in + Clight.Ssequence (Clight.Scall (None, f, args), body) in + Clight.Internal { def with Clight.fn_body = body } + | Clight.External _ -> def + in + (id, def) + +(* This is the declaration of the cost variable. *) + +let add_stack_decl stack_id = + let init = [Clight.Init_int32 0] in + ((stack_id, init), int_typ) + +(* This is the definition of the increment cost function. *) + +let stack_incr_def stack_id_max stack_id stack_incr = + let int_var x = Clight.Expr (Clight.Evar x, int_typ) in + let param = "incr" in + let cost = int_var stack_id in + let cost_max = int_var stack_id_max in + let increment = int_var param in + let stack_increment = + Clight.Expr (Clight.Ebinop (Clight.Oadd, cost, increment), int_typ) in + let stmt1 = Clight.Sassign (cost, stack_increment) in + let stack_max = + Clight.Expr ( + Clight.Econdition( + Clight.Expr (Clight.Ebinop (Clight.Olt, cost_max, cost), int_typ), + cost,cost_max), int_typ) in + let stmt2 = Clight.Sassign (cost_max, stack_max) in + let cfun = + { Clight.fn_return = Clight.Tvoid ; + Clight.fn_params = [(param, int_typ)] ; + Clight.fn_vars = [] ; + Clight.fn_body = Clight.Ssequence(stmt1,stmt2) } in + (stack_incr, Clight.Internal cfun) + +(* Create a fresh uninitialized cost variable for each external function. This + will be used by the Cost plug-in of the Frama-C platform. *) + +let extern_stack_variables make_unique functs = + let prefix = "_stack_of_" in + let f (decls, map) (_, def) = match def with + | Clight.Internal _ -> (decls, map) + | Clight.External (id, _, _) -> + let new_var = make_unique (prefix ^ id) in + (decls @ [add_stack_decl new_var], StringTools.Map.add id new_var map) in + List.fold_left f ([], StringTools.Map.empty) functs + +let save_tmp tmp_file s = + let cout = open_out tmp_file in + output_string cout s ; + flush cout ; + close_out cout + +(** [instrument prog stack_map] instruments the program [prog]. First a fresh + global variable --- the so-called cost variable --- is added to the program. + Then, each cost label in the program is replaced by an increment of the cost + variable, following the mapping [stack_map]. The function also returns the + name of the cost variable and the name of the cost increment function. *) + +let instrument cost_incr p = + + (* Create a fresh 'cost' variable. *) + let names = ClightAnnotator.names p in + let make_unique = StringTools.make_unique names in + let stack_id = make_unique stack_id_prefix in + let stack_max_id = make_unique stack_max_id_prefix in + let stack_decl = add_stack_decl stack_id in + let stack_max_decl = add_stack_decl stack_max_id in + + (* Create a fresh uninitialized global variable for each extern function. *) + let (extern_stack_decls, extern_stack_variables) = + extern_stack_variables make_unique p.Clight.prog_funct in + + (* Define an increment function for the cost variable. *) + let stack_incr = + StringTools.Gen.fresh_prefix (StringTools.Set.add stack_id names) + stack_incr_prefix in + let stack_incr_def = stack_incr_def stack_max_id stack_id stack_incr in + + (* Instrument each function *) + let prog_funct = + List.map (fun ((id,_) as a) -> + if id = cost_incr then a else instrument_funct stack_incr a) + p.Clight.prog_funct in + + (* Glue all this together. *) + let prog_vars = stack_decl :: stack_max_decl + :: extern_stack_decls @ p.Clight.prog_vars in + let prog_funct = stack_incr_def :: prog_funct in + let p' = + { p with Clight.prog_vars = prog_vars ; Clight.prog_funct = prog_funct } in + + (* Save the resulted program. Then re-parse it. + Indeed, the instrumentation may add side-effects in expressions, which is + not Clight compliant. Re-parsing the result with CIL will remove these + side-effects in expressions to obtain a Clight program. *) + let output = ClightPrinter.print_program p' in + let res = ClightParser.process (`Source ("annotated", output)) in + (res, stack_id, stack_max_id, stack_incr, extern_stack_variables) diff --git a/src/checker.ml b/src/checker.ml new file mode 100644 index 0000000..6677da1 --- /dev/null +++ b/src/checker.ml @@ -0,0 +1,31 @@ +let same_traces (traces : ((Languages.ast * AST.trace) list)) = + let compare_trace trace1 trace2 = + let occs_trace1 = Misc.ListExt.multi_set_of_list trace1 + and occs_trace2 = Misc.ListExt.multi_set_of_list trace2 in + Misc.ListExt.assoc_diff occs_trace1 occs_trace2 + in + let check_trace (_, (_, trace1)) (_, (_, trace2)) = + compare_trace trace1 trace2 = [] + in + let print_trace lang1 lang2 ds = + let string_of_value = function + | None -> "is not present" + | Some v -> Printf.sprintf "appears %d times" v + in + let sentence (k, (v1, v2)) = + Printf.sprintf " Label %s %s in language `%s' \ + whereas it %s in language `%s'." + k (string_of_value v1) lang1 (string_of_value v2) lang2 + in + String.concat "\n" (List.map sentence ds) + in + match Misc.ListExt.transitive_forall2 check_trace traces with + | None -> () + | Some ((ast1, (res1, trace1)), (ast2, (res2, trace2))) -> + let lang1 = Languages.to_string (Languages.language_of_ast ast1) + and lang2 = Languages.to_string (Languages.language_of_ast ast2) in + let diff = compare_trace trace1 trace2 in + Error.global_error "during trace comparison" + (Printf.sprintf + "The traces of two intermediate programs differ:\n%s" + (print_trace lang1 lang2 diff)) diff --git a/src/checker.mli b/src/checker.mli new file mode 100644 index 0000000..85ff2d7 --- /dev/null +++ b/src/checker.mli @@ -0,0 +1,5 @@ +(** This module offers functions for dynamic verification of invariants. *) + +(** [same_traces ts] checks that the collected execution traces are + identical (modulo permutation). *) +val same_traces : (Languages.ast * AST.trace) list -> unit diff --git a/src/clight/clight.mli b/src/clight/clight.mli new file mode 100644 index 0000000..54dd7d8 --- /dev/null +++ b/src/clight/clight.mli @@ -0,0 +1,193 @@ +(** This module defines the abstract syntax tree of [Clight]. + + This is a (quasi-)direct translation of the Coq definition that + can be found in the CompCert development. *) + +open AST + +(** ** Types *) + +type intsize = I8 | I16 | I32 + +type floatsize = F32 | F64 + +(** The syntax of type expressions. Some points to note: + - Array types [Tarray n] carry the size [n] of the array. + Arrays with unknown sizes are represented by pointer types. + - Function types [Tfunction targs tres] specify the number and types + of the function arguments (list [targs]), and the type of the + function result ([tres]). Variadic functions and old-style unprototyped + functions are not supported. + - In C, struct and union types are named and compared by name. + This enables the definition of recursive struct types such as + {[ + struct s1 { int n; struct * s1 next; }; + ]} + Note that recursion within types must go through a pointer type. + For instance, the following is not allowed in C. + {[ + struct s2 { int n; struct s2 next; }; + ]} + In Clight, struct and union types [Tstruct id fields] and + [Tunion id fields] are compared by structure: the [fields] + argument gives the names and types of the members. The AST_common.identifier + [id] is a local name which can be used in conjuction with the + [Tcomp_ptr] constructor to express recursive types. [Tcomp_ptr id] + stands for a pointer type to the nearest enclosing [Tstruct] + or [Tunion] type named [id]. For instance. the structure [s1] + defined above in C is expressed by + {[ + Tstruct "s1" (Fcons "n" (Tint I32 Signed) + (Fcons "next" (Tcomp_ptr "s1") + Fnil)) + ]} + Note that the incorrect structure [s2] above cannot be expressed at + all, since [Tcomp_ptr] lets us refer to a pointer to an enclosing + structure or union, but not to the structure or union directly. + *) + +type ctype = + | Tvoid (**r the [void] type *) + | Tint of intsize*signedness (**r integer types *) + | Tfloat of floatsize (**r floating-point types *) + | Tpointer of ctype (**r pointer types ([*ty]) *) + | Tarray of ctype*int (**r array types ([ty[len]]) *) + | Tfunction of ctype list*ctype (**r function types *) + | Tstruct of ident*(ident*ctype) list + (**r struct types *) + | Tunion of ident*(ident*ctype) list + (**r union types *) + | Tcomp_ptr of ident (**r pointer to named struct or union *) + +(** ** Expressions *) + +(** Arithmetic and logical operators. *) + +type unary_operation = + | Onotbool (**r boolean negation ([!] in C) *) + | Onotint (**r integer complement ([~] in C) *) + | Oneg (**r opposite (unary [-]) *) + +type binary_operation = + | Oadd (**r addition (binary [+]) *) + | Osub (**r subtraction (binary [-]) *) + | Omul (**r multiplication (binary [*]) *) + | Odiv (**r division ([/]) *) + | Omod (**r remainder ([%]) *) + | Oand (**r bitwise and ([&]) *) + | Oor (**r bitwise or ([|]) *) + | Oxor (**r bitwise xor ([^]) *) + | Oshl (**r left shift ([<<]) *) + | Oshr (**r right shift ([>>]) *) + | Oeq (**r comparison ([==]) *) + | One (**r comparison ([!=]) *) + | Olt (**r comparison ([<]) *) + | Ogt (**r comparison ([>]) *) + | Ole (**r comparison ([<=]) *) + | Oge (**r comparison ([>=]) *) + +(** Clight expressions are a large subset of those of C. + The main omissions are string literals and assignment operators + ([=], [+=], [++], etc). In Clight, assignment is a statement, + not an expression. + + All expressions are annotated with their types. An expression + (type [expr]) is therefore a pair of a type and an expression + description (type [expr_descr]). + *) + +type expr = + | Expr of expr_descr*ctype + + and expr_descr = + | Econst_int of int (**r integer literal *) + | Econst_float of float (**r float literal *) + | Evar of ident (**r variable *) + | Ederef of expr (**r pointer dereference (unary [*]) *) + | Eaddrof of expr (**r address-of operator ([&]) *) + | Eunop of unary_operation*expr (**r unary operation *) + | Ebinop of binary_operation*expr*expr (**r binary operation *) + | Ecast of ctype*expr (**r type cast ([(ty) e]) *) + | Econdition of expr*expr*expr (**r conditional ([e1 ? e2 : e3]) *) + | Eandbool of expr*expr (**r sequential and ([&&]) *) + | Eorbool of expr*expr (**r sequential or ([||]) *) + | Esizeof of ctype (**r size of a type *) + | Efield of expr*ident (**r access to a member of a struct or union *) + + (** The following constructors are used by the annotation process only. *) + + | Ecost of CostLabel.t*expr (**r cost label. *) + | Ecall of ident * expr * expr + + +(** ** Statements *) + +(** Clight statements include all C statements. + Only structured forms of [switch] are supported; moreover, + the [default] case must occur last. Blocks and block-scoped declarations + are not supported. *) + +type label = Label.t + +type statement = + | Sskip (**r do nothing *) + | Sassign of expr*expr (**r assignment [lvalue = rvalue] *) + | Scall of expr option*expr*expr list (**r function call *) + | Ssequence of statement*statement (**r sequence *) + | Sifthenelse of expr*statement*statement (**r conditional *) + | Swhile of expr*statement (**r [while] loop *) + | Sdowhile of expr*statement (**r [do] loop *) + | Sfor of statement*expr*statement*statement (**r [for] loop *) + | Sbreak (**r [break] statement *) + | Scontinue (**r [continue] statement *) + | Sreturn of expr option (**r [return] statement *) + | Sswitch of expr*labeled_statements (**r [switch] statement *) + | Slabel of label*statement + | Sgoto of label + | Scost of CostLabel.t * statement + +and labeled_statements = (**r cases of a [switch] *) + | LSdefault of statement + | LScase of int*statement*labeled_statements + +(** ** Functions *) + +(** A function definition is composed of its return type ([fn_return]), + the names and types of its parameters ([fn_params]), the names + and types of its local variables ([fn_vars]), and the body of the + function (a statement, [fn_body]). *) + +type cfunction = { + fn_return : ctype ; + fn_params : (ident*ctype) list ; + fn_vars : (ident * ctype) list ; + fn_body : statement +} + +(** Functions can either be defined ([Internal]) or declared as + external functions ([External]). *) + +type fundef = + | Internal of cfunction + | External of ident*ctype list*ctype + +(** ** Programs *) + +(** A program is a collection of named functions, plus a collection + of named global variables, carrying their types and optional initialization + data. See module [AST] for more details. *) + +type init_data = + | Init_int8 of int + | Init_int16 of int + | Init_int32 of int + | Init_float32 of float + | Init_float64 of float + | Init_space of int + | Init_addrof of ident*int (**r address of symbol + offset *) + +type program = { + prog_funct: (ident * fundef) list ; + prog_main: ident option; + prog_vars: ((ident * init_data list) * ctype) list +} diff --git a/src/clight/clight32ToClight8.ml b/src/clight/clight32ToClight8.ml new file mode 100644 index 0000000..491ba74 --- /dev/null +++ b/src/clight/clight32ToClight8.ml @@ -0,0 +1,675 @@ + +(** This module performs a transformation of a [Clight] program with potentially + 32 and 16 bits integers to an equivalent [Clight] program that only uses 8 + bits integers. + + The main changes are: defining two types that represent 32 and 16 bits + integers with a structure of 8 bits integers, making the substitution, + replacing primitive integer operations on 32 and 16 bits integers with new + functions emulating them on the new types, and finally defining a global + variable for each 32 and 16 bits integer constant, which is then replaced by + its associated variable. *) + + +let error_prefix = "Clight32 to Clight8" +let error s = Error.global_error error_prefix s + + +let cint32s = Clight.Tint (Clight.I32, AST.Signed) +let cint32u = Clight.Tint (Clight.I32, AST.Unsigned) +let cint8s = Clight.Tint (Clight.I8, AST.Signed) +let cint8u = Clight.Tint (Clight.I8, AST.Unsigned) + + +(* Change the main so that it returns a 8 bits integer. Indeed, 32 bits integers + will be replaced by structures, and returning a structure from the main is + not Clight compliant. *) + +let main_ret_type = function + | Clight.Tint (_, AST.Signed) -> cint8s + | Clight.Tint (_, AST.Unsigned) -> cint8u + | _ -> error "The main should return an integer which is not the case." + +let f_ctype ctype _ = ctype +let f_expr e _ _ = e +let f_expr_descr ed _ _ = ed + +let f_stmt ret_type stmt sub_exprs_res sub_stmts_res = + match stmt, sub_exprs_res with + | Clight.Sreturn (Some _), e :: _ -> + let e' = Clight.Expr (Clight.Ecast (ret_type, e), ret_type) in + Clight.Sreturn (Some e') + | _ -> ClightFold.statement_fill_subs stmt sub_exprs_res sub_stmts_res + +let body_returns ret_type = + ClightFold.statement f_ctype f_expr f_expr_descr (f_stmt ret_type) + +let fundef_returns_char = function + | Clight.Internal cfun -> + let ret_type = main_ret_type cfun.Clight.fn_return in + let body = body_returns ret_type cfun.Clight.fn_body in + Clight.Internal {cfun with Clight.fn_return = ret_type ; + Clight.fn_body = body } + | Clight.External _ as fundef -> fundef + +let main_returns_char p = match p.Clight.prog_main with + | None -> p + | Some main -> + let main_def = List.assoc main p.Clight.prog_funct in + let main_def = fundef_returns_char main_def in + let prog_funct = + MiscPottier.update_list_assoc main main_def p.Clight.prog_funct in + { p with Clight.prog_funct = prog_funct } + + +(* Replacement *) + +let seq = + List.fold_left + (fun stmt1 stmt2 -> Clight.Ssequence (stmt1, stmt2)) + Clight.Sskip + +let is_complex = function + | Clight.Tstruct _ | Clight.Tunion _ -> true + | _ -> false + +let is_subst_complex type_substitutions res_type = + if List.mem_assoc res_type type_substitutions then + is_complex (List.assoc res_type type_substitutions) + else false + +let addrof_with_type e ctype = + let ctype = Clight.Tpointer ctype in + (Clight.Expr (Clight.Eaddrof e, ctype), ctype) + +let address_if_subst_complex type_substitutions = + let f l (e, ctype) = + let arg_and_type = + if is_subst_complex type_substitutions ctype then addrof_with_type e ctype + else (e, ctype) in + l @ [arg_and_type] in + List.fold_left f [] + +let make_call_struct tmpe res_type f_var args args_types = + let (res_e, res_type) = addrof_with_type tmpe res_type in + let f_type = Clight.Tfunction (res_type :: args_types, Clight.Tvoid) in + let f = Clight.Expr (f_var, f_type) in + Clight.Scall (None, f, res_e :: args) + +let make_call_wo_struct tmpe res_type f_var args args_types = + let f_type = Clight.Tfunction (args_types, res_type) in + let f = Clight.Expr (f_var, f_type) in + Clight.Scall (Some tmpe, f, args) + +let make_call type_substitutions tmp f_id args_with_types res_type = + let tmpe = Clight.Expr (Clight.Evar tmp, res_type) in + let args_with_types = + address_if_subst_complex type_substitutions args_with_types in + let (args, args_types) = List.split args_with_types in + let f_var = Clight.Evar f_id in + let call = + if is_subst_complex type_substitutions res_type then make_call_struct + else make_call_wo_struct in + (tmpe, call tmpe res_type f_var args args_types) + +let call fresh replaced type_substitutions replacement_assoc + args added_stmt added_tmps ret_type = + let tmp = fresh () in + let replacement_fun_name = List.assoc replaced replacement_assoc in + let (tmpe, call) = + make_call type_substitutions tmp replacement_fun_name args ret_type in + let stmt = seq (added_stmt @ [call]) in + (tmpe, stmt, added_tmps @ [(tmp, ret_type)]) + +let replace_ident replacement_assoc x t = + let new_name = match t with + | Clight.Tfunction _ + when List.mem_assoc (Runtime.Fun x) replacement_assoc -> + let replacement_fun_name = List.assoc (Runtime.Fun x) replacement_assoc in + replacement_fun_name + | _ -> x in + (Clight.Expr (Clight.Evar new_name, t), Clight.Sskip, []) + +let replace_expression fresh type_substitutions replacement_assoc e = + + let rec aux (Clight.Expr (ed, t) as e) = + let expr ed = Clight.Expr (ed, t) in + match ed with + + | Clight.Econst_int _ | Clight.Econst_float _ | Clight.Esizeof _ -> + (e, Clight.Sskip, []) + + | Clight.Evar x -> replace_ident replacement_assoc x t + + | Clight.Ederef e' -> + let (e', stmt, tmps) = aux e' in + (expr (Clight.Ederef e'), stmt, tmps) + + | Clight.Eaddrof e' -> + let (e', stmt, tmps) = aux e' in + (expr (Clight.Eaddrof e'), stmt, tmps) + + | Clight.Eunop (unop, (Clight.Expr (ed', t') as e')) + when List.mem_assoc (Runtime.Unary (unop, t')) replacement_assoc -> + let (e', stmt, tmps) = aux e' in + call fresh (Runtime.Unary (unop, t')) + type_substitutions replacement_assoc [(e', t')] + [stmt] tmps t + + | Clight.Eunop (unop, e') -> + let (e', stmt, tmps) = aux e' in + (expr (Clight.Eunop (unop, e')), stmt, tmps) + + | Clight.Ebinop (binop, + (Clight.Expr (ed1, t1) as e1), + (Clight.Expr (ed2, t2) as e2)) + when + List.mem_assoc (Runtime.Binary (binop, t1, t2)) replacement_assoc -> + let (e1, stmt1, tmps1) = aux e1 in + let (e2, stmt2, tmps2) = aux e2 in + call fresh (Runtime.Binary (binop, t1, t2)) + type_substitutions replacement_assoc + [(e1, t1) ; (e2, t2)] [stmt1 ; stmt2] (tmps1 @ tmps2) t + + | Clight.Ebinop (binop, e1, e2) -> + let (e1, stmt1, tmps1) = aux e1 in + let (e2, stmt2, tmps2) = aux e2 in + let stmt = seq [stmt1 ; stmt2] in + (expr (Clight.Ebinop (binop, e1, e2)), stmt, tmps1 @ tmps2) + + | Clight.Ecast (t, (Clight.Expr (_, t') as e')) + when List.mem_assoc (Runtime.Cast (t, t')) replacement_assoc -> + let (e', stmt, tmps) = aux e' in + call fresh (Runtime.Cast (t, t')) + type_substitutions replacement_assoc [(e', t')] [stmt] + tmps t + + | Clight.Ecast (t', e') -> + let (e', stmt, tmps) = aux e' in + (expr (Clight.Ecast (t', e')), stmt, tmps) + + | Clight.Econdition (e1, e2, e3) -> + let (e1, stmt1, tmps1) = aux e1 in + let (e2, stmt2, tmps2) = aux e2 in + let (e3, stmt3, tmps3) = aux e3 in + let stmt = seq [stmt1 ; stmt2 ; stmt3] in + (expr (Clight.Econdition (e1, e2, e3)), stmt, tmps1 @ tmps2 @ tmps3) + + | Clight.Eandbool (e1, e2) -> + let (e1, stmt1, tmps1) = aux e1 in + let (e2, stmt2, tmps2) = aux e2 in + let stmt = seq [stmt1 ; stmt2] in + (expr (Clight.Eandbool (e1, e2)), stmt, tmps1 @ tmps2) + + | Clight.Eorbool (e1, e2) -> + let (e1, stmt1, tmps1) = aux e1 in + let (e2, stmt2, tmps2) = aux e2 in + let stmt = seq [stmt1 ; stmt2] in + (expr (Clight.Eorbool (e1, e2)), stmt, tmps1 @ tmps2) + + | Clight.Efield (e', field) -> + let (e', stmt, tmps) = aux e' in + (expr (Clight.Efield (e', field)), stmt, tmps) + + | Clight.Ecost (lbl, e') -> + let (e', stmt, tmps) = aux e' in + (expr (Clight.Ecost (lbl, e')), stmt, tmps) + + | Clight.Ecall (id, e1, e2) -> + let (e1, stmt1, tmps1) = aux e1 in + let (e2, stmt2, tmps2) = aux e2 in + let stmt = seq [stmt1 ; stmt2] in + (expr (Clight.Ecall (id, e1, e2)), stmt, tmps1 @ tmps2) + + in + aux e + + +let replace_expression_list fresh type_substitutions replacement_assoc = + let f (l, stmt, tmps) e = + let (e', stmt', tmps') = + replace_expression fresh type_substitutions replacement_assoc e in + (l @ [e'], seq [stmt ; stmt'], tmps @ tmps') in + List.fold_left f ([], Clight.Sskip, []) + + +let replace_statement fresh type_substitutions replacement_assoc = + let aux_exp = + replace_expression fresh type_substitutions replacement_assoc in + let aux_exp_list = + replace_expression_list fresh type_substitutions replacement_assoc in + + let rec aux = function + + | Clight.Sskip | Clight.Sbreak | Clight.Scontinue | Clight.Sgoto _ + | Clight.Sreturn None + as stmt -> (stmt, []) + + | Clight.Slabel (lbl, stmt) -> + let (stmt', tmps) = aux stmt in + (Clight.Slabel (lbl, stmt'), tmps) + + | Clight.Scost (lbl, stmt) -> + let (stmt', tmps) = aux stmt in + (Clight.Scost (lbl, stmt'), tmps) + + | Clight.Sassign (e1, e2) -> + let (e1', stmt1, tmps1) = aux_exp e1 in + let (e2', stmt2, tmps2) = aux_exp e2 in + let stmt = seq [stmt1 ; stmt2 ; Clight.Sassign (e1', e2')] in + (stmt, tmps1 @ tmps2) + + | Clight.Scall (None, f, args) -> + let (f', stmt1, tmps1) = aux_exp f in + let (args', stmt2, tmps2) = aux_exp_list args in + let stmt = seq [stmt1 ; stmt2 ; Clight.Scall (None, f', args')] in + (stmt, tmps1 @ tmps2) + + | Clight.Scall (Some e, f, args) -> + let (e', stmt1, tmps1) = aux_exp e in + let (f', stmt2, tmps2) = aux_exp f in + let (args', stmt3, tmps3) = aux_exp_list args in + let stmt = seq [stmt1 ; stmt2 ; stmt3 ; + Clight.Scall (Some e', f', args')] in + (stmt, tmps1 @ tmps2 @ tmps3) + + | Clight.Sifthenelse (e, stmt1, stmt2) -> + let (e', stmte, tmpse) = aux_exp e in + let (stmt1', tmps1) = aux stmt1 in + let (stmt2', tmps2) = aux stmt2 in + let stmt = seq [stmte ; Clight.Sifthenelse (e', stmt1', stmt2')] in + (stmt, tmpse @ tmps1 @ tmps2) + + | Clight.Swhile (e, stmt) -> + let (e', stmte, tmpse) = aux_exp e in + let (stmt', tmps) = aux stmt in + let stmt = seq [stmte ; Clight.Swhile (e', seq [stmt' ; stmte])] in + (stmt, tmpse @ tmps) + + | Clight.Sdowhile (e, stmt) -> + let (e', stmte, tmpse) = aux_exp e in + let (stmt', tmps) = aux stmt in + let stmt = seq [Clight.Sdowhile (e', seq [stmt' ; stmte])] in + (stmt, tmpse @ tmps) + + | Clight.Sfor (stmt1, e, stmt2, stmt3) -> + let (e', stmte, tmpse) = aux_exp e in + let (stmt1', tmps1) = aux stmt1 in + let (stmt2', tmps2) = aux stmt2 in + let (stmt3', tmps3) = aux stmt3 in + let stmt = seq [stmt1' ; stmte ; + Clight.Swhile (e', seq [stmt3' ; stmt2' ; stmte])] in + (stmt, tmpse @ tmps1 @ tmps2 @ tmps3) + + | Clight.Sswitch (e, lbl_stmts) -> + let (e', stmte, tmpse) = aux_exp e in + let (lbl_stmts', tmps) = aux_lbl_stmts lbl_stmts in + let stmt = seq [stmte ; Clight.Sswitch (e', lbl_stmts')] in + (stmt, tmpse @ tmps) + + | Clight.Sreturn (Some e) -> + let (e', stmte, tmpse) = aux_exp e in + let stmt = seq [stmte ; Clight.Sreturn (Some e')] in + (stmt, tmpse) + + | Clight.Ssequence (stmt1, stmt2) -> + let (stmt1', tmps1) = aux stmt1 in + let (stmt2', tmps2) = aux stmt2 in + let stmt = seq [stmt1' ; stmt2'] in + (stmt, tmps1 @ tmps2) + + and aux_lbl_stmts = function + + | Clight.LSdefault stmt -> + let (stmt', tmps) = aux stmt in + (Clight.LSdefault stmt', tmps) + + | Clight.LScase (i, stmt, lbl_stmts) -> + let (stmt', tmps1) = aux stmt in + let (lbl_stmts', tmps2) = aux_lbl_stmts lbl_stmts in + (Clight.LScase (i, stmt', lbl_stmts'), tmps1 @ tmps2) + + in + + aux + + +let f_ctype type_substitutions ctype sub_ctypes_res = match ctype with + | _ when List.mem_assoc ctype type_substitutions -> + List.assoc ctype type_substitutions + | _ -> ClightFold.ctype_fill_subs ctype sub_ctypes_res + +let replace_ctype type_substitutions = + ClightFold.ctype (f_ctype type_substitutions) + +let f_expr = ClightFold.expr_fill_subs + +let f_expr_descr = ClightFold.expr_descr_fill_subs + +let f_stmt = ClightFold.statement_fill_subs + +let statement_replace_ctype type_substitutions = + ClightFold.statement (f_ctype type_substitutions) f_expr f_expr_descr f_stmt + + +let replace_internal fresh type_substitutions replacement_assoc def = + let (new_body, tmps) = + replace_statement fresh type_substitutions replacement_assoc + def.Clight.fn_body in + let new_body = statement_replace_ctype type_substitutions new_body in + let f (x, t) = (x, replace_ctype type_substitutions t) in + let params = List.map f def.Clight.fn_params in + let vars = List.map f (def.Clight.fn_vars @ tmps) in + { Clight.fn_return = replace_ctype type_substitutions def.Clight.fn_return ; + Clight.fn_params = params ; + Clight.fn_vars = vars ; + Clight.fn_body = new_body } + +let replace_funct fresh type_substitutions replacement_assoc (id, fundef) = + let fundef' = match fundef with + | Clight.Internal def -> + Clight.Internal + (replace_internal fresh type_substitutions replacement_assoc def) + | _ -> fundef in + (id, fundef') + +let replace fresh type_substitutions replacement_assoc p = + let prog_funct = + List.map (replace_funct fresh type_substitutions replacement_assoc) + p.Clight.prog_funct in + { p with Clight.prog_funct = prog_funct } + + +(* The constant replacement replaces each 32 bits and 16 bits integer constant + by a global variable of the same value. They will be replaced by the + appropriate structural value by the global replacement that comes + afterwards. *) + +module CstMap = + Map.Make + (struct + type t = (int * Clight.intsize * Clight.ctype) + let compare = Pervasives.compare + end) + +let f_subs fresh replace subs map = + let f (l, map) x = + let (x, map) = replace fresh map x in + (l @ [x], map) in + List.fold_left f ([], map) subs + +let rec replace_constant_expr fresh map (Clight.Expr (ed, t) as e) = + match ed, t with + | Clight.Econst_int i, Clight.Tint (Clight.I8, _) -> + (e, map) + | Clight.Econst_int i, Clight.Tint (size, _) + when CstMap.mem (i, size, t) map -> + let id = CstMap.find (i, size, t) map in + (Clight.Expr (Clight.Evar id, t), map) + | Clight.Econst_int i, Clight.Tint (size, _) -> + let id = fresh () in + let map = CstMap.add (i, size, t) id map in + let id = CstMap.find (i, size, t) map in + (Clight.Expr (Clight.Evar id, t), map) + | _ -> + let (sub_ctypes, sub_exprs) = ClightFold.expr_descr_subs ed in + let (sub_exprs, map) = f_subs fresh replace_constant_expr sub_exprs map in + let ed = ClightFold.expr_descr_fill_subs ed sub_ctypes sub_exprs in + (Clight.Expr (ed, t), map) + +let rec replace_constant_stmt fresh map stmt = + let (sub_exprs, sub_stmts) = ClightFold.statement_subs stmt in + let (sub_exprs, map) = + f_subs fresh replace_constant_expr sub_exprs map in + let (sub_stmts, map) = + f_subs fresh replace_constant_stmt sub_stmts map in + (ClightFold.statement_fill_subs stmt sub_exprs sub_stmts, map) + +let replace_constant_fundef fresh (functs, map) (id, fundef) = + match fundef with + | Clight.Internal cfun -> + let (body, map) = replace_constant_stmt fresh map cfun.Clight.fn_body in + let fundef = Clight.Internal { cfun with Clight.fn_body = body } in + (functs @ [(id, fundef)], map) + | Clight.External _ -> (functs @ [(id, fundef)], map) + +let init_datas i size = + [match size with + | Clight.I8 -> Clight.Init_int8 i + | Clight.I16 -> Clight.Init_int16 i + | Clight.I32 -> Clight.Init_int32 i] + +let globals_of_map map = + let f (i, size, t) id l = l @ [((id, init_datas i size), t)] in + CstMap.fold f map [] + +let replace_constant p = + let tmp_universe = ClightAnnotator.fresh_universe "_cst" p in + let fresh () = StringTools.Gen.fresh tmp_universe in + let (functs, map) = + List.fold_left (replace_constant_fundef fresh) + ([], CstMap.empty) p.Clight.prog_funct in + let csts = globals_of_map map in + { p with + Clight.prog_funct = functs ; Clight.prog_vars = p.Clight.prog_vars @ csts } + + +(* Globals replacement *) + +let expand_int size i = + let i = Big_int.big_int_of_int i in + let i = + if Big_int.ge_big_int i Big_int.zero_big_int then i + else Big_int.add_big_int i (Big_int.power_int_positive_int 2 size) in + let bound = Big_int.power_int_positive_int 2 8 in + let rec aux n i = + if n >= size then [] + else + let (next, chunk) = Big_int.quomod_big_int i bound in + chunk :: (aux (n+1) next) in + List.map (fun i -> Clight.Init_int8 (Big_int.int_of_big_int i)) (aux 0 i) + +let expand_init_data = function + | Clight.Init_int16 i -> expand_int 2 i + | Clight.Init_int32 i -> expand_int 4 i + | init_data -> [init_data] + +let expand_init_datas init_datas = + List.flatten (List.map expand_init_data init_datas) + +let replace_global type_substitutions ((id, init_datas), t) = + let init_datas = expand_init_datas init_datas in + ((id, init_datas), replace_ctype type_substitutions t) + +let replace_globals type_substitutions p = + let vars = List.map (replace_global type_substitutions) p.Clight.prog_vars in + { p with Clight.prog_vars = vars } + + +(* Unsupported operations by the 8051. *) + +(* 8 bits signed division *) + +let divs_fun s _ = + "signed char " ^ s ^ " (signed char x, signed char y) {\n" ^ + " unsigned char x1 = (unsigned char) x;\n" ^ + " unsigned char y1 = (unsigned char) y;\n" ^ + " signed char sign = 1;\n" ^ + " if (x < 0) { x1 = (unsigned char) (-x); sign = -sign; }\n" ^ + " if (y < 0) { y1 = (unsigned char) (-y); sign = -sign; }\n" ^ + " return (sign * ((signed char) (x1/y1)));\n" ^ + "}\n\n" + +let divs = + (Runtime.Binary (Clight.Odiv, cint8s, cint8s), "_divs", [], divs_fun, []) + + +(* 8 bits signed modulo *) + +let mods_fun s _ = + "signed char " ^ s ^ " (signed char x, signed char y) {\n" ^ + " return (x - (x/y) * y);\n" ^ + "}\n\n" + +let mods = + (Runtime.Binary (Clight.Omod, cint8s, cint8s), "_mods", [], mods_fun, + [Runtime.Binary (Clight.Odiv, cint8s, cint8s)]) + + +(* Shifts *) + +let sh_fun signedness op s _ = + signedness ^ " char " ^ s ^ " (" ^ signedness ^ " char x, " ^ + signedness ^ " char y) {\n" ^ + " " ^ signedness ^ " char res = x, i;\n" ^ + " for (i = 0 ; i < y ; i++) res = res " ^ op ^ " 2;\n" ^ + " return res;\n" ^ + "}\n\n" + +(* 8 bits shifts left *) + +let shls_fun = sh_fun "signed" "*" + +let shls = + (Runtime.Binary (Clight.Oshl, cint8s, cint8s), "_shls", [], shls_fun, []) + +let shlu_fun s _ = + "unsigned char " ^ s ^ " (unsigned char x, unsigned char y) {\n" ^ + " return ((unsigned char) ((signed char) x << (signed char) y));\n" ^ + "}\n\n" + +let shlu = + (Runtime.Binary (Clight.Oshl, cint8u, cint8u), "_shlu", [], shlu_fun, + [Runtime.Binary (Clight.Oshl, cint8s, cint8s)]) + +(* 8 bits shifts right *) + +let shrs_fun s _ = + "signed char " ^ s ^ " (signed char x, signed char y) {\n" ^ + " signed char res = x, i;\n" ^ + " for (i = 0 ; i < y ; i++) {\n" ^ + " res = ((unsigned char) res) / 2;\n" ^ + " res = res + ((signed char) 128);\n" ^ + " }\n" ^ + " return res;\n" ^ + "}\n\n" + +let shrs = + (Runtime.Binary (Clight.Oshr, cint8s, cint8s), "_shrs", [], shrs_fun, []) + +let shru_fun = sh_fun "unsigned" "/" + +let shru = + (Runtime.Binary (Clight.Oshr, cint8u, cint8u), "_shru", [], shru_fun, []) + + +(* int32 *) + +let struct_int32 name fields = match fields with + | lolo :: lohi :: hilo :: hihi :: _ -> + Clight.Tstruct + (name, + [(lolo, cint8u) ; (lohi, cint8u) ; (hilo, cint8u) ; (hihi, cint8u)]) + | _ -> error ("bad field names when defining type " ^ name ^ ".") + +let struct_int32_name = "struct _int32_" + +let new_int32 int32 = + let lolo = "lolo" in + let lohi = "lohi" in + let hilo = "hilo" in + let hihi = "hihi" in + (int32, struct_int32_name, [lolo ; lohi ; hilo ; hihi], struct_int32) + +let int32s = new_int32 (Clight.Tint (Clight.I32, AST.Signed)) +let int32u = new_int32 (Clight.Tint (Clight.I32, AST.Unsigned)) + +(* 32 bits operations *) + +(* 32 bits equality *) + +let eq_int32s_fun s l = + let (int32, lolo, lohi, hilo, hihi) = match l with + | (int32, lolo :: lohi :: hilo :: hihi :: _) :: _ -> + (int32, lolo, lohi, hilo, hihi) + | _ -> error ("new type definition not coherent in function " ^ s ^ ".") in + int32 ^ " " ^ s ^ " (" ^ int32 ^ " x, " ^ int32 ^ " y) {\n" ^ + " " ^ int32 ^ " res;\n" ^ + " res." ^ lolo ^ " = 1;\n" ^ + " if (x." ^ lolo ^ " != y." ^ lolo ^ ") res." ^ lolo ^ " = 0;\n" ^ + " if (x." ^ lohi ^ " != y." ^ lohi ^ ") res." ^ lolo ^ " = 0;\n" ^ + " if (x." ^ hilo ^ " != y." ^ hilo ^ ") res." ^ lolo ^ " = 0;\n" ^ + " if (x." ^ hihi ^ " != y." ^ hihi ^ ") res." ^ lolo ^ " = 0;\n" ^ + " res." ^ lohi ^ " = 0;\n" ^ + " res." ^ hilo ^ " = 0;\n" ^ + " res." ^ hihi ^ " = 0;\n" ^ + " return (res);\n" ^ + "}\n\n" + +let eq32s = + (Runtime.Binary (Clight.Oeq, cint32s, cint32s), "eq_int32s", + [struct_int32_name], eq_int32s_fun, []) + +(* 32 bits casts *) + +let int32s_to_int8s_fun s l = + let (int32, lolo, lohi, hilo, hihi) = match l with + | (int32, lolo :: lohi :: hilo :: hihi :: _) :: _ -> + (int32, lolo, lohi, hilo, hihi) + | _ -> error ("new type definition not coherent in function " ^ s ^ ".") in + "signed char " ^ s ^ " (" ^ int32 ^ " x) {\n" ^ + " return ((signed char) x." ^ lolo ^ ");\n" ^ + "}\n\n" + +let int32s_to_int8s = + (Runtime.Cast (cint8s, cint32s), "int32s_to_int8s", [struct_int32_name], + int32s_to_int8s_fun, []) + + +(* int16 *) + +let struct_int16 name fields = match fields with + | lo :: hi :: _ -> + Clight.Tstruct (name, [(lo, cint8u) ; (hi, cint8u)]) + | _ -> error ("bad field names when defining type " ^ name ^ ".") + +let struct_int16_name = "struct _int16_" + +let new_int16 int16 = + let lo = "lo" in + let hi = "hi" in + (int16, struct_int16_name, [lo ; hi], struct_int16) + +let int16s = new_int16 (Clight.Tint (Clight.I16, AST.Signed)) +let int16u = new_int16 (Clight.Tint (Clight.I16, AST.Unsigned)) + + +(* int32 and int16 *) + +let int32_and_int16_types = [int32s ; int32u ; int16s ; int16u] +let int32_and_int16_replacements = [eq32s ; int32s_to_int8s] + +let unsupported = [divs ; mods ; shls ; shlu ; shrs ; shru] + +let save_and_parse p = + ClightParser.process (`Source ("32to8", ClightPrinter.print_program p)) + +let add_replacements p new_types replacements = + let p = ClightCasts.simplify p in + let (p, type_substitutions, replacement_assoc) = + Runtime.add p new_types replacements in + let p = ClightCasts.simplify p in + let tmp_universe = ClightAnnotator.fresh_universe "_tmp" p in + let fresh () = StringTools.Gen.fresh tmp_universe in + let p = replace fresh type_substitutions replacement_assoc p in + let p = replace_globals type_substitutions p in + (* Printf.printf "%s\n%!" (ClightPrinter.print_program p) ; *) + let p = save_and_parse p in + ClightCasts.simplify p + +let translate p = + let p = main_returns_char p in + let p = replace_constant p in + let p = + add_replacements p int32_and_int16_types int32_and_int16_replacements in + add_replacements p [] unsupported diff --git a/src/clight/clight32ToClight8.mli b/src/clight/clight32ToClight8.mli new file mode 100644 index 0000000..0d912e6 --- /dev/null +++ b/src/clight/clight32ToClight8.mli @@ -0,0 +1,13 @@ + +(** This module performs a transformation of a [Clight] program with potentially + 32 and 16 bits integers to an equivalent [Clight] program that only uses 8 + bits integers. + + The main changes are: defining two types that represent 32 and 16 bits + integers with a structure of 8 bits integers, making the substitution, + replacing primitive integer operations on 32 and 16 bits integers with new + functions emulating them on the new types, and finally defining a global + variable for each 32 and 16 bits integer constant, which is then replaced by + its associated variable. *) + +val translate : Clight.program -> Clight.program diff --git a/src/clight/clightAnnotator.ml b/src/clight/clightAnnotator.ml new file mode 100644 index 0000000..bf479a5 --- /dev/null +++ b/src/clight/clightAnnotator.ml @@ -0,0 +1,362 @@ +(* This module provides an annotation function for Clight programs + when given the cost associated to each cost labels of the + program. *) + + +let error_prefix = "Clight Annotator" +let error = Error.global_error error_prefix + + +let cost_id_prefix = "__cost" +let cost_incr_prefix = "__cost_incr" + + +(* Program var and fun names, cost labels and labels *) + +let string_set_of_list l = + List.fold_left (fun res s -> StringTools.Set.add s res) + StringTools.Set.empty l + +let triple_union + (names1, cost_labels1, user_labels1) + (names2, cost_labels2, user_labels2) = + (StringTools.Set.union names1 names2, + CostLabel.Set.union cost_labels1 cost_labels2, + Label.Set.union user_labels1 user_labels2) + +let empty_triple = (StringTools.Set.empty, CostLabel.Set.empty, Label.Set.empty) + +let name_singleton id = + (StringTools.Set.singleton id, CostLabel.Set.empty, Label.Set.empty) + +let cost_label_singleton cost_lbl = + (StringTools.Set.empty, CostLabel.Set.singleton cost_lbl, Label.Set.empty) + +let label_singleton lbl = + (StringTools.Set.empty, CostLabel.Set.empty, Label.Set.singleton lbl) + +let list_union l = List.fold_left triple_union empty_triple l + +let f_ctype ctype sub_ctypes_res = + let res = match ctype with + | Clight.Tstruct (id, fields) | Clight.Tunion (id, fields) -> + (string_set_of_list (id :: (List.map fst fields)), + CostLabel.Set.empty, Label.Set.empty) + | Clight.Tcomp_ptr id -> name_singleton id + | _ -> empty_triple in + list_union (res :: sub_ctypes_res) + +let f_expr _ sub_ctypes_res sub_expr_descrs_res = + list_union (sub_ctypes_res @ sub_expr_descrs_res) + +let f_expr_descr ed sub_ctypes_res sub_exprs_res = + let res = match ed with + | Clight.Evar id | Clight.Efield (_, id) | Clight.Ecall (id, _, _) -> + name_singleton id + | Clight.Ecost (cost_lbl, _) -> cost_label_singleton cost_lbl + | _ -> empty_triple in + list_union (res :: (sub_ctypes_res @ sub_exprs_res)) + +let f_stmt stmt sub_exprs_res sub_stmts_res = + let stmt_res = match stmt with + | Clight.Slabel (lbl, _) | Clight.Sgoto lbl -> label_singleton lbl + | Clight.Scost (cost_lbl, _) -> cost_label_singleton cost_lbl + | _ -> empty_triple in + list_union (stmt_res :: (sub_exprs_res @ sub_stmts_res)) + +let body_idents = ClightFold.statement f_ctype f_expr f_expr_descr f_stmt + +let prog_idents p = + let def_idents = function + | Clight.Internal def -> + let vars = + string_set_of_list + (List.map fst (def.Clight.fn_params @ def.Clight.fn_vars)) in + let (names, cost_labels, user_labels) = + body_idents def.Clight.fn_body in + (StringTools.Set.union vars names, cost_labels, user_labels) + | Clight.External (id, _, _) -> + (StringTools.Set.singleton id, CostLabel.Set.empty, Label.Set.empty) in + let fun_idents (id, f_def) = + let (names, cost_labels, user_labels) = def_idents f_def in + (StringTools.Set.add id names, cost_labels, user_labels) in + let f idents def = triple_union idents (fun_idents def) in + List.fold_left f empty_triple p.Clight.prog_funct + +let names p = + let (names, _, _) = prog_idents p in names +let cost_labels p = + let (_, cost_labels, _) = prog_idents p in cost_labels +let user_labels p = + let (_, _, user_labels) = prog_idents p in user_labels + +let all_labels p = + let (_, cost_labels, user_labels) = prog_idents p in + let all = + CostLabel.Set.fold (fun lbl lbls -> StringTools.Set.add lbl lbls) + cost_labels StringTools.Set.empty in + Label.Set.fold (fun lbl lbls -> StringTools.Set.add lbl lbls) user_labels all + +let all_idents p = + let (names, cost_labels, user_labels) = prog_idents p in + let to_string_set fold set = + fold (fun lbl idents -> StringTools.Set.add lbl idents) set + StringTools.Set.empty in + let cost_labels = to_string_set CostLabel.Set.fold cost_labels in + let user_labels = to_string_set Label.Set.fold user_labels in + StringTools.Set.union names (StringTools.Set.union cost_labels user_labels) + +let fresh_ident base p = + StringTools.Gen.fresh_prefix (all_idents p) base + +let fresh_universe base p = + let universe = fresh_ident base p in + StringTools.Gen.new_universe universe + +let make_fresh base p = + let universe = fresh_universe base p in + (fun () -> StringTools.Gen.fresh universe) + + +(* Instrumentation *) + +let int_typ = Clight.Tint (Clight.I32, AST.Signed) + +let const_int i = Clight.Expr (Clight.Econst_int i, int_typ) + +(* Instrument an expression. *) + +let rec instrument_expr cost_mapping cost_incr e = + let Clight.Expr (e, t) = e in + match e with + | Clight.Ecost (lbl, e) + when CostLabel.Map.mem lbl cost_mapping && + CostLabel.Map.find lbl cost_mapping = 0 -> + e + | _ -> + let e' = instrument_expr_descr cost_mapping cost_incr e in + Clight.Expr (e', t) +and instrument_expr_descr cost_mapping cost_incr e = match e with + | Clight.Econst_int _ | Clight.Econst_float _ | Clight.Evar _ + | Clight.Esizeof _ -> e + | Clight.Ederef e -> + let e' = instrument_expr cost_mapping cost_incr e in + Clight.Ederef e' + | Clight.Eaddrof e -> + let e' = instrument_expr cost_mapping cost_incr e in + Clight.Eaddrof e' + | Clight.Eunop (op, e) -> + let e' = instrument_expr cost_mapping cost_incr e in + Clight.Eunop (op, e') + | Clight.Ebinop (op, e1, e2) -> + let e1' = instrument_expr cost_mapping cost_incr e1 in + let e2' = instrument_expr cost_mapping cost_incr e2 in + Clight.Ebinop (op, e1', e2') + | Clight.Ecast (t, e) -> + let e' = instrument_expr cost_mapping cost_incr e in + Clight.Ecast (t, e') + | Clight.Econdition (e1, e2, e3) -> + let e1' = instrument_expr cost_mapping cost_incr e1 in + let e2' = instrument_expr cost_mapping cost_incr e2 in + let e3' = instrument_expr cost_mapping cost_incr e3 in + Clight.Econdition (e1', e2', e3') + | Clight.Eandbool (e1, e2) -> + let e1' = instrument_expr cost_mapping cost_incr e1 in + let e2' = instrument_expr cost_mapping cost_incr e2 in + Clight.Eandbool (e1', e2') + | Clight.Eorbool (e1, e2) -> + let e1' = instrument_expr cost_mapping cost_incr e1 in + let e2' = instrument_expr cost_mapping cost_incr e2 in + Clight.Eorbool (e1', e2') + | Clight.Efield (e, x) -> + let e' = instrument_expr cost_mapping cost_incr e in + Clight.Efield (e', x) + | Clight.Ecost (lbl, e) when CostLabel.Map.mem lbl cost_mapping -> + let e' = instrument_expr cost_mapping cost_incr e in + let incr = CostLabel.Map.find lbl cost_mapping in + if incr = 0 then let Clight.Expr (e'', _) = e' in e'' + else Clight.Ecall (cost_incr, const_int incr, e') + | Clight.Ecost (_, e) -> + let Clight.Expr (e', _) = instrument_expr cost_mapping cost_incr e in + e' + | Clight.Ecall (x, e1, e2) -> assert false (* Should not happen. *) + +(* Instrument a statement. *) + +let rec instrument_body cost_mapping cost_incr stmt = match stmt with + | Clight.Sskip | Clight.Sbreak | Clight.Scontinue | Clight.Sreturn None + | Clight.Sgoto _ -> + stmt + | Clight.Sassign (e1, e2) -> + let e1' = instrument_expr cost_mapping cost_incr e1 in + let e2' = instrument_expr cost_mapping cost_incr e2 in + Clight.Sassign (e1', e2') + | Clight.Scall (eopt, f, args) -> + let eopt' = match eopt with + | None -> None + | Some e -> Some (instrument_expr cost_mapping cost_incr e) in + let f' = instrument_expr cost_mapping cost_incr f in + let args' = List.map (instrument_expr cost_mapping cost_incr) args in + Clight.Scall (eopt', f', args') + | Clight.Ssequence (s1, s2) -> + Clight.Ssequence (instrument_body cost_mapping cost_incr s1, + instrument_body cost_mapping cost_incr s2) + | Clight.Sifthenelse (e, s1, s2) -> + let e' = instrument_expr cost_mapping cost_incr e in + let s1' = instrument_body cost_mapping cost_incr s1 in + let s2' = instrument_body cost_mapping cost_incr s2 in + Clight.Sifthenelse (e', s1', s2') + | Clight.Swhile (e, s) -> + let e' = instrument_expr cost_mapping cost_incr e in + let s' = instrument_body cost_mapping cost_incr s in + Clight.Swhile (e', s') + | Clight.Sdowhile (e, s) -> + let e' = instrument_expr cost_mapping cost_incr e in + let s' = instrument_body cost_mapping cost_incr s in + Clight.Sdowhile (e', s') + | Clight.Sfor (s1, e, s2, s3) -> + let s1' = instrument_body cost_mapping cost_incr s1 in + let e' = instrument_expr cost_mapping cost_incr e in + let s2' = instrument_body cost_mapping cost_incr s2 in + let s3' = instrument_body cost_mapping cost_incr s3 in + Clight.Sfor (s1', e', s2', s3') + | Clight.Sreturn (Some e) -> + let e' = instrument_expr cost_mapping cost_incr e in + Clight.Sreturn (Some e') + | Clight.Sswitch (e, ls) -> + let e' = instrument_expr cost_mapping cost_incr e in + let ls' = instrument_ls cost_mapping cost_incr ls in + Clight.Sswitch (e', ls') + | Clight.Slabel (lbl, s) -> + let s' = instrument_body cost_mapping cost_incr s in + Clight.Slabel (lbl, s') + | Clight.Scost (lbl, s) when CostLabel.Map.mem lbl cost_mapping -> + (* Keep the cost label in the code. *) + let s' = instrument_body cost_mapping cost_incr s in + let incr = CostLabel.Map.find lbl cost_mapping in + let fun_typ = Clight.Tfunction ([int_typ], Clight.Tvoid) in + let f = Clight.Expr (Clight.Evar cost_incr, fun_typ) in + let args = [Clight.Expr (Clight.Econst_int incr, int_typ)] in + Clight.Scost (lbl, Clight.Ssequence (Clight.Scall (None, f, args), s')) + (* + let s' = instrument_body cost_mapping cost_incr s in + let incr = CostLabel.Map.find lbl cost_mapping in + if incr = 0 then s' + else + let fun_typ = Clight.Tfunction ([int_typ], Clight.Tvoid) in + let f = Clight.Expr (Clight.Evar cost_incr, fun_typ) in + let args = [Clight.Expr (Clight.Econst_int incr, int_typ)] in + Clight.Ssequence (Clight.Scall (None, f, args), s') + *) + | Clight.Scost (lbl, s) -> + (* Keep the cost label in the code and show the increment of 0. *) + let s' = instrument_body cost_mapping cost_incr s in + let fun_typ = Clight.Tfunction ([int_typ], Clight.Tvoid) in + let f = Clight.Expr (Clight.Evar cost_incr, fun_typ) in + let args = [Clight.Expr (Clight.Econst_int 0, int_typ)] in + Clight.Scost (lbl, Clight.Ssequence (Clight.Scall (None, f, args), s')) + (* + instrument_body cost_mapping cost_incr s + *) +and instrument_ls cost_mapping cost_incr = function + | Clight.LSdefault s -> + let s' = instrument_body cost_mapping cost_incr s in + Clight.LSdefault s' + | Clight.LScase (i, s, ls) -> + let s' = instrument_body cost_mapping cost_incr s in + let ls' = instrument_ls cost_mapping cost_incr ls in + Clight.LScase (i, s', ls') + +(* Instrument a function. *) + +let instrument_funct cost_mapping cost_incr (id, def) = + let def = match def with + | Clight.Internal def -> + let body = instrument_body cost_mapping cost_incr def.Clight.fn_body in + Clight.Internal { def with Clight.fn_body = body } + | Clight.External _ -> def + in + (id, def) + +(* This is the declaration of the cost variable. *) + +let cost_decl cost_id = + let init = [Clight.Init_int32 0] in + ((cost_id, init), int_typ) + +(* This is the definition of the increment cost function. *) + +let cost_incr_def cost_id cost_incr = + let int_var x = Clight.Expr (Clight.Evar x, int_typ) in + let param = "incr" in + let cost = int_var cost_id in + let increment = int_var param in + let cost_increment = + Clight.Expr (Clight.Ebinop (Clight.Oadd, cost, increment), int_typ) in + let stmt = Clight.Sassign (cost, cost_increment) in + let cfun = + { Clight.fn_return = Clight.Tvoid ; + Clight.fn_params = [(param, int_typ)] ; + Clight.fn_vars = [] ; + Clight.fn_body = stmt } in + (cost_incr, Clight.Internal cfun) + +(* Create a fresh uninitialized cost variable for each external function. This + will be used by the Cost plug-in of the Frama-C platform. *) + +let extern_cost_variables make_unique functs = + let prefix = "_cost_of_" in + let f (decls, map) (_, def) = match def with + | Clight.Internal _ -> (decls, map) + | Clight.External (id, _, _) -> + let new_var = make_unique (prefix ^ id) in + (decls @ [cost_decl new_var], StringTools.Map.add id new_var map) in + List.fold_left f ([], StringTools.Map.empty) functs + +let save_tmp tmp_file s = + let cout = open_out tmp_file in + output_string cout s ; + flush cout ; + close_out cout + +(** [instrument prog cost_map] instruments the program [prog]. First a fresh + global variable --- the so-called cost variable --- is added to the program. + Then, each cost label in the program is replaced by an increment of the cost + variable, following the mapping [cost_map]. The function also returns the + name of the cost variable and the name of the cost increment function. *) + +let instrument p cost_mapping = + + (* Create a fresh 'cost' variable. *) + let names = names p in + let make_unique = StringTools.make_unique names in + let cost_id = make_unique cost_id_prefix in + let cost_decl = cost_decl cost_id in + + (* Create a fresh uninitialized global variable for each extern function. *) + let (extern_cost_decls, extern_cost_variables) = + extern_cost_variables make_unique p.Clight.prog_funct in + + (* Define an increment function for the cost variable. *) + let cost_incr = + StringTools.Gen.fresh_prefix (StringTools.Set.add cost_id names) + cost_incr_prefix in + let cost_incr_def = cost_incr_def cost_id cost_incr in + + (* Instrument each function *) + let prog_funct = + List.map (instrument_funct cost_mapping cost_incr) p.Clight.prog_funct in + + (* Glue all this together. *) + let prog_vars = cost_decl :: extern_cost_decls @ p.Clight.prog_vars in + let prog_funct = cost_incr_def :: prog_funct in + let p' = + { p with Clight.prog_vars = prog_vars ; Clight.prog_funct = prog_funct } in + + (* Save the resulted program. Then re-parse it. + Indeed, the instrumentation may add side-effects in expressions, which is + not Clight compliant. Re-parsing the result with CIL will remove these + side-effects in expressions to obtain a Clight program. *) + let output = ClightPrinter.print_program p' in + let res = ClightParser.process (`Source ("annotated", output)) in + (res, cost_id, cost_incr, extern_cost_variables) diff --git a/src/clight/clightAnnotator.mli b/src/clight/clightAnnotator.mli new file mode 100644 index 0000000..4d25d31 --- /dev/null +++ b/src/clight/clightAnnotator.mli @@ -0,0 +1,30 @@ + +(** This module defines the instrumentation of a [Clight] program. *) + +(** [instrument prog cost_map] instruments the program [prog]. First a fresh + global variable --- the so-called cost variable --- is added to the program. + Then, each cost label in the program is replaced by an increment of the cost + variable, following the mapping [cost_map]. The function also returns the + name of the cost variable, the name of the cost increment function, and a + fresh uninitialized global (cost) variable associated to each extern + function. *) + +val instrument : Clight.program -> int CostLabel.Map.t -> + Clight.program * string * string * string StringTools.Map.t + +val cost_labels : Clight.program -> CostLabel.Set.t +val user_labels : Clight.program -> Label.Set.t +val all_labels : Clight.program -> StringTools.Set.t +val all_idents : Clight.program -> StringTools.Set.t + +val fresh_ident : string (* base *) -> Clight.program -> string + +val fresh_universe : + string (* prefix *) -> Clight.program -> StringTools.Gen.universe + +val make_fresh : + string (* prefix *) -> Clight.program -> (unit -> string) + + +(** utils *) +val names : Clight.program -> StringTools.Set.t diff --git a/src/clight/clightCasts.ml b/src/clight/clightCasts.ml new file mode 100644 index 0000000..8a3875a --- /dev/null +++ b/src/clight/clightCasts.ml @@ -0,0 +1,274 @@ + +(** [simplify p] removes unnecessary casts in the Clight program [p]. + + Example: [(char) ((int)x + (int)y)] where [x] and [y] are of type [char] + will be transformed into [x + y]. Primitive operations are thus supposed to + be polymorphic, but working only on homogene types. *) + + +let error_prefix = "Clight casts simplification" +let error = Error.global_error error_prefix +let error_float () = error "float not supported." + + +(* Int sizes *) + +let int_of_intsize = function + | Clight.I8 -> 8 + | Clight.I16 -> 16 + | Clight.I32 -> 32 + +let intsize_of_int = function + | i when i <= 8 -> Clight.I8 + | i when i <= 16 -> Clight.I16 + | _ -> Clight.I32 + +let op_intsize_no_cast op size1 size2 = + op (int_of_intsize size1) (int_of_intsize size2) + +let cmp_intsize cmp size1 size2 = op_intsize_no_cast cmp size1 size2 + +let op_intsize op size1 size2 = + intsize_of_int (op_intsize_no_cast op size1 size2) + +let max_intsize size1 size2 = op_intsize max size1 size2 + +let intsize_union size1 size2 = op_intsize (+) size1 size2 + +let pow2 = MiscPottier.pow 2 + +let belongs_to_int_type size sign i = match size, sign with + | Clight.I8, AST.Unsigned -> 0 <= i && i <= (pow2 8) - 1 + | Clight.I8, AST.Signed -> -(pow2 7) <= i && i <= (pow2 7) - 1 + | Clight.I16, AST.Unsigned -> 0 <= i && i <= (pow2 16) - 1 + | Clight.I16, AST.Signed -> -(pow2 15) <= i && i <= (pow2 15) - 1 + | Clight.I32, AST.Unsigned -> 0 <= i + | Clight.I32, AST.Signed -> + let pow2_30 = pow2 30 in + (-(pow2_30 + pow2_30)) <= i && + i <= ((pow2_30 - 1) + pow2_30) (* = 2^31 - 1 *) + +let smallest_int_type i = + let (size, sign) = match i with + | _ when belongs_to_int_type Clight.I8 AST.Signed i -> + (Clight.I8, AST.Signed) + | _ when belongs_to_int_type Clight.I8 AST.Unsigned i -> + (Clight.I8, AST.Unsigned) + | _ when belongs_to_int_type Clight.I16 AST.Signed i -> + (Clight.I16, AST.Signed) + | _ when belongs_to_int_type Clight.I16 AST.Unsigned i -> + (Clight.I16, AST.Unsigned) + | _ when belongs_to_int_type Clight.I32 AST.Unsigned i -> + (Clight.I32, AST.Unsigned) + | _ -> + (Clight.I32, AST.Signed) in + Clight.Tint (size, sign) + +let le_int_type size1 sign1 size2 sign2 = match sign1, sign2 with + | AST.Unsigned, AST.Signed -> cmp_intsize (<) size1 size2 + | AST.Signed, AST.Unsigned -> false + | _ -> cmp_intsize (<=) size1 size2 + +let int_type_union size1 sign1 size2 sign2 = + if sign1 = sign2 then (max_intsize size1 size2, sign1) + else (intsize_union size1 size2, AST.Signed) + + +(* C types *) + +let type_of_expr (Clight.Expr (_, t)) = t + +let cast_if_needed t (Clight.Expr (ed, t') as e) = match t, ed with + | _ when t = t' -> e + | Clight.Tint (size, sign), Clight.Econst_int i + when belongs_to_int_type size sign i -> + Clight.Expr (Clight.Econst_int i, t) + | _ -> Clight.Expr (Clight.Ecast (t, e), t) + +let cast_if_needed_opt opt_t e = match opt_t with + | None -> e + | Some t -> cast_if_needed t e + +let is_int_type = function + | Clight.Tint _ -> true + | _ -> false + +let le_ctype t1 t2 = match t1, t2 with + | Clight.Tint (size1, sign1), Clight.Tint (size2, sign2) -> + le_int_type size1 sign1 size2 sign2 + | _ -> t1 = t2 + +let ctype_union t1 t2 = match t1, t2 with + | Clight.Tint (size1, sign1), Clight.Tint (size2, sign2) -> + let (size, sign) = int_type_union size1 sign1 size2 sign2 in + Clight.Tint (size, sign) + | _ -> assert false (* only use on int types *) + +let belongs_to_ctype t i = match t with + | Clight.Tint (size, sign) -> belongs_to_int_type size sign i + | _ -> false + + +(* Simplification *) + +let rec is_const_int (Clight.Expr (ed, _)) = match ed with + | Clight.Econst_int _ -> true + | Clight.Ecast (_, e) | Clight.Ecost (_, e) -> is_const_int e + | _ -> false + +let rec simplify_bool_op f_bool target_t e1 e2 = + let (e1', e2', t') = simplify_and_same_type target_t e1 e2 in + Clight.Expr (f_bool e1' e2', t') + +and simplify_and_same_type target_t e1 e2 = match target_t with + + | None when is_const_int e1 && is_const_int e2 -> + let e1' = simplify_expr target_t e1 in + let t1 = type_of_expr e1' in + let e2' = simplify_expr target_t e2 in + let t2 = type_of_expr e2' in + if is_int_type t1 && is_int_type t2 then + let t = ctype_union t1 t2 in + let e1' = cast_if_needed t e1' in + let e2' = cast_if_needed t e2' in + (e1', e2', t) + else (e1, e2, type_of_expr e1) + + | None when is_const_int e1 -> + let e2 = simplify_expr target_t e2 in + let t2 = type_of_expr e2 in + let e1 = simplify_expr (Some t2) e1 in + (e1, e2, t2) + + | None when is_const_int e2 -> + let e1 = simplify_expr target_t e1 in + let t1 = type_of_expr e1 in + let e2 = simplify_expr (Some t1) e2 in + (e1, e2, t1) + + | _ -> + let e1' = simplify_expr target_t e1 in + let t1 = type_of_expr e1' in + let e2' = simplify_expr target_t e2 in + let t2 = type_of_expr e2' in + if t1 = t2 then (e1', e2', t1) + else (e1, e2, type_of_expr e1) + +and simplify_expr target_t (Clight.Expr (ed, t) as e) = match target_t, ed with + + | None, Clight.Econst_int i -> + let t' = smallest_int_type i in + Clight.Expr (ed, t') + + | Some t', Clight.Econst_int i when belongs_to_ctype t' i -> + Clight.Expr (ed, t') + + | Some t', Clight.Econst_int _ -> cast_if_needed t' e + + | _, Clight.Evar _ -> cast_if_needed_opt target_t e + + | _, Clight.Esizeof _ -> + let i = Driver.TargetArch.int_size * 8 in + let t = smallest_int_type i in + cast_if_needed_opt target_t (Clight.Expr (ed, t)) + + | _, Clight.Econst_float _ -> error_float () + + | _, Clight.Ederef e -> + let e' = simplify_expr (Some (Clight.Tpointer t)) e in + cast_if_needed_opt target_t (Clight.Expr (Clight.Ederef e', t)) + + | _, Clight.Eaddrof e -> + let e' = simplify_expr None e in + let e' = + Clight.Expr (Clight.Eaddrof e', Clight.Tpointer (type_of_expr e')) in + cast_if_needed_opt target_t e' + + | _, Clight.Eunop (unop, e) -> + let e' = simplify_expr target_t e in + Clight.Expr (Clight.Eunop (unop, e'), type_of_expr e') + + (* Particular case: shifts. The first argument will always be casted to int by + CIL (except for unsigned int, treated in another pattern). *) + (* TODO: is above really true?! *) + (* [(_) e1 >> e2], when [e1] and [e2] simplified have the same type, is + simplified to [e1 >> e2] (and respectively with [<<]). *) + | _, Clight.Ebinop ((Clight.Oshl | Clight.Oshr) as binop, + Clight.Expr (Clight.Ecast (_, e1), _), e2) -> + let e1 = simplify_expr target_t e1 in + let t1 = type_of_expr e1 in + let e2 = simplify_expr target_t e2 in + let t2 = type_of_expr e2 in + if t1 = t2 then Clight.Expr (Clight.Ebinop (binop, e1, e2), t1) + else cast_if_needed_opt target_t e + + | _, Clight.Ebinop (binop, e1, e2) + when is_int_type (type_of_expr e1) && is_int_type (type_of_expr e2) -> + let (e1, e2, t) = simplify_and_same_type target_t e1 e2 in + cast_if_needed_opt target_t (Clight.Expr (Clight.Ebinop (binop, e1, e2), t)) + + | _, Clight.Ebinop (binop, e1, e2) -> + let e1' = cast_if_needed (type_of_expr e1) (simplify_expr None e1) in + let e2' = cast_if_needed (type_of_expr e2) (simplify_expr None e2) in + Clight.Expr (Clight.Ebinop (binop, e1', e2'), t) + + | _, Clight.Ecast (_, e) -> simplify_expr target_t e + + | _, Clight.Econdition (e1, e2, e3) -> + let e1' = simplify_expr None e1 in + let (e2', e3', t') = simplify_and_same_type target_t e2 e3 in + Clight.Expr (Clight.Econdition (e1', e2', e3'), t') + + | _, Clight.Eandbool (e1, e2) -> + simplify_bool_op (fun e1' e2' -> Clight.Eandbool (e1', e2')) target_t e1 e2 + + | _, Clight.Eorbool (e1, e2) -> + simplify_bool_op (fun e1' e2' -> Clight.Eorbool (e1', e2')) target_t e1 e2 + + | _, Clight.Efield (e, field) -> + let e' = simplify_expr (Some (type_of_expr e)) e in + cast_if_needed_opt target_t (Clight.Expr (Clight.Efield (e', field), t)) + + | _, Clight.Ecost (lbl, e) -> + let e' = simplify_expr target_t e in + Clight.Expr (Clight.Ecost (lbl, e'), type_of_expr e') + + | _, Clight.Ecall _ -> + assert false (* should be impossible *) + + +let f_ctype ctype _ = ctype + +let f_expr e _ _ = e + +let f_expr_descr e _ _ = e + +let f_statement stmt _ sub_stmts_res = + let f_expr b e = + simplify_expr (if b then Some (type_of_expr e) else None) e in + let f_exprs b = List.map (f_expr b) in + let f_sub_exprs = match stmt with + | Clight.Sassign _ | Clight.Scall _ | Clight.Sreturn _ -> f_exprs true + | _ -> f_exprs false in + let sub_exprs = f_sub_exprs (ClightFold.statement_sub_exprs stmt) in + ClightFold.statement_fill_subs stmt sub_exprs sub_stmts_res + +let simplify_stmt = ClightFold.statement f_ctype f_expr f_expr_descr f_statement + +let simplify_funct (id, fundef) = + let fundef' = match fundef with + | Clight.Internal cfun -> + Clight.Internal + { cfun with Clight.fn_body = simplify_stmt cfun.Clight.fn_body } + | _ -> fundef in + (id, fundef') + +let simplify p = + { p with Clight.prog_funct = List.map simplify_funct p.Clight.prog_funct } + +(* TODO: restore above, but buggy with + (unsigned int) (-x) -> - ((unsigned int) x) *) + +(* +let simplify p = p +*) diff --git a/src/clight/clightCasts.mli b/src/clight/clightCasts.mli new file mode 100644 index 0000000..098059b --- /dev/null +++ b/src/clight/clightCasts.mli @@ -0,0 +1,8 @@ + +(** [simplify p] removes unnecessary casts in the Clight program [p]. + + Example: [(char) ((int)x + (int)y)] where [x] and [y] are of type [char] + will be transformed into [x + y]. Primitive operations are thus supposed to + be polymorphic, but working only on homogene types. *) + +val simplify : Clight.program -> Clight.program diff --git a/src/clight/clightFlags.ml b/src/clight/clightFlags.ml new file mode 100644 index 0000000..badd04a --- /dev/null +++ b/src/clight/clightFlags.ml @@ -0,0 +1,30 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Command-line flags *) + +let prepro_options = ref ([]: string list) +let linker_options = ref ([]: string list) +let exe_name = ref "a.out" +let option_flonglong = ref true +let option_fstruct_passing = ref false +let option_fstruct_assign = ref false +let option_fbitfields = ref false +let option_fvararg_calls = ref true +let option_fmadd = ref false +let option_dparse = ref false +let option_dclight = ref false +let option_dasm = ref false +let option_E = ref false +let option_S = ref false +let option_c = ref false +let option_v = ref false diff --git a/src/clight/clightFold.ml b/src/clight/clightFold.ml new file mode 100644 index 0000000..afd12e7 --- /dev/null +++ b/src/clight/clightFold.ml @@ -0,0 +1,171 @@ + +(** This module provides folding functions over the constructors of the + [Clight]'s AST. *) + + +let ctype_subs = function + | Clight.Tvoid | Clight.Tint _ | Clight.Tfloat _ | Clight.Tcomp_ptr _ -> [] + | Clight.Tpointer ctype | Clight.Tarray (ctype, _) -> [ctype] + | Clight.Tfunction (args, res) -> args @ [res] + | Clight.Tstruct (_, fields) | Clight.Tunion (_, fields) -> + List.map snd fields + +let ctype_fill_subs ctype sub_ctypes = match ctype, sub_ctypes with + | Clight.Tvoid, _ | Clight.Tint _, _ | Clight.Tfloat _, _ + | Clight.Tcomp_ptr _, _ -> ctype + | Clight.Tpointer _, ctype :: _ -> Clight.Tpointer ctype + | Clight.Tarray (_, size), ctype :: _ -> Clight.Tarray (ctype, size) + | Clight.Tfunction _, _ -> + let (args, res) = MiscPottier.split_last sub_ctypes in + Clight.Tfunction (args, res) + | Clight.Tstruct (name, fields), _ -> + let fields = List.map2 (fun (x, _) ctype -> (x, ctype)) fields sub_ctypes in + Clight.Tstruct (name, fields) + | Clight.Tunion (name, fields), _ -> + let fields = List.map2 (fun (x, _) ctype -> (x, ctype)) fields sub_ctypes in + Clight.Tunion (name, fields) + | _ -> assert false (* wrong arguments, do not use on these values *) + +let rec ctype f t = + let sub_ctypes_res = List.map (ctype f) (ctype_subs t) in + f t sub_ctypes_res + + +let expr_subs = function + | Clight.Expr (expr_descr, ctype) -> ([ctype], [expr_descr]) + +let expr_descr_subs = function + | Clight.Econst_int _ | Clight.Econst_float _ | Clight.Evar _ -> ([], []) + | Clight.Ederef e | Clight.Eaddrof e | Clight.Eunop (_, e) + | Clight.Efield (e, _) -> ([], [e]) + | Clight.Ebinop (_, e1, e2) | Clight.Eandbool (e1, e2) + | Clight.Eorbool (e1, e2) -> ([], [e1 ; e2]) + | Clight.Ecast (ctype, e) -> ([ctype], [e]) + | Clight.Econdition (e1, e2, e3) -> ([], [e1 ; e2 ; e3]) + | Clight.Esizeof ctype -> ([ctype], []) + | Clight.Ecost (_, e) -> ([], [e]) + | Clight.Ecall (_, e1, e2) -> ([], [e1 ; e2]) + +let expr_fill_subs e sub_ctypes sub_expr_descrs = + match e, sub_ctypes, sub_expr_descrs with + | Clight.Expr _, ctype :: _, expr_descr :: _ -> + Clight.Expr (expr_descr, ctype) + | _ -> assert false (* wrong arguments, do not use on these values *) + +let expr_descr_fill_subs e sub_ctypes sub_exprs = + match e, sub_ctypes, sub_exprs with + | Clight.Econst_int _, _, _ | Clight.Econst_float _, _, _ + | Clight.Evar _, _, _ -> e + | Clight.Ederef _, _, e :: _ -> Clight.Ederef e + | Clight.Eaddrof _, _, e :: _ -> Clight.Eaddrof e + | Clight.Eunop (unop, _), _, e :: _ -> Clight.Eunop (unop, e) + | Clight.Ebinop (binop, _, _), _, e1 :: e2 :: _ -> + Clight.Ebinop (binop, e1, e2) + | Clight.Ecast _, ctype :: _, e :: _ -> Clight.Ecast (ctype, e) + | Clight.Econdition _, _, e1 :: e2 :: e3 :: _ -> + Clight.Econdition (e1, e2, e3) + | Clight.Eandbool (_, _), _, e1 :: e2 :: _ -> + Clight.Eandbool (e1, e2) + | Clight.Eorbool (_, _), _, e1 :: e2 :: _ -> + Clight.Eorbool (e1, e2) + | Clight.Esizeof _, ctype :: _, _ -> Clight.Esizeof ctype + | Clight.Efield (_, field_name), _, e :: _ -> Clight.Efield (e, field_name) + | Clight.Ecost (lbl, _), _, e :: _ -> Clight.Ecost (lbl, e) + | Clight.Ecall (id, _, _), _, e1 :: e2 :: _ -> Clight.Ecall (id, e1, e2) + | _ -> assert false (* wrong arguments, do not use on these values *) + +let expr_fill_exprs (Clight.Expr (ed, t)) exprs = + let (sub_ctypes, _) = expr_descr_subs ed in + let ed = expr_descr_fill_subs ed sub_ctypes exprs in + Clight.Expr (ed, t) + +let rec expr f_ctype f_expr f_expr_descr e = + let (sub_ctypes, sub_expr_descrs) = expr_subs e in + let sub_expr_descrs_res = + List.map (expr_descr f_ctype f_expr f_expr_descr) sub_expr_descrs in + let sub_ctypes_res = List.map (ctype f_ctype) sub_ctypes in + f_expr e sub_ctypes_res sub_expr_descrs_res + +and expr_descr f_ctype f_expr f_expr_descr e = + let (sub_ctypes, sub_exprs) = expr_descr_subs e in + let sub_exprs_res = + List.map (expr f_ctype f_expr f_expr_descr) sub_exprs in + let sub_ctypes_res = List.map (ctype f_ctype) sub_ctypes in + f_expr_descr e sub_ctypes_res sub_exprs_res + + +let expr_subs2 e = + let (_, expr_descrs) = expr_subs e in + let l = List.map expr_descr_subs expr_descrs in + List.flatten (List.map snd l) + +let rec expr2 f e = f e (List.map (expr2 f) (expr_subs2 e)) + + +let rec labeled_statements_subs = function + | Clight.LSdefault stmt -> [stmt] + | Clight.LScase (_, stmt, lbl_stmts) -> + stmt :: (labeled_statements_subs lbl_stmts) + +let statement_subs = function + | Clight.Sskip | Clight.Sbreak | Clight.Scontinue | Clight.Sreturn None + | Clight.Sgoto _ -> ([], []) + | Clight.Sassign (e1, e2) -> ([e1 ; e2], []) + | Clight.Scall (None, e, args) -> (e :: args, []) + | Clight.Scall (Some e1, e2, args) -> (e1 :: e2 :: args, []) + | Clight.Ssequence (stmt1, stmt2) -> ([], [stmt1 ; stmt2]) + | Clight.Sifthenelse (e, stmt1, stmt2) -> ([e], [stmt1 ; stmt2]) + | Clight.Swhile (e, stmt) | Clight.Sdowhile (e, stmt) -> ([e], [stmt]) + | Clight.Sfor (stmt1, e, stmt2, stmt3) -> ([e], [stmt1 ; stmt2 ; stmt3]) + | Clight.Sreturn (Some e) -> ([e], []) + | Clight.Sswitch (e, lbl_stmts) -> ([e], labeled_statements_subs lbl_stmts) + | Clight.Slabel (_, stmt) | Clight.Scost (_, stmt) -> ([], [stmt]) + +let statement_sub_exprs stmt = fst (statement_subs stmt) + +let rec labeled_statements_fill_subs lbl_stmts sub_statements = + match lbl_stmts, sub_statements with + | Clight.LSdefault _, stmt :: _ -> Clight.LSdefault stmt + | Clight.LScase (i, _, lbl_stmts), stmt :: sub_statements -> + Clight.LScase (i, stmt, + labeled_statements_fill_subs lbl_stmts sub_statements) + | _ -> assert false (* wrong arguments, do not use on these values *) + +let statement_fill_subs statement sub_exprs sub_statements = + match statement, sub_exprs, sub_statements with + | Clight.Sskip, _, _ | Clight.Sbreak, _, _ | Clight.Scontinue, _, _ + | Clight.Sreturn None, _, _ | Clight.Sgoto _, _, _ -> statement + | Clight.Sassign _, e1 :: e2 :: _, _ -> Clight.Sassign (e1, e2) + | Clight.Scall (None, _, _), e :: args, _ -> + Clight.Scall (None, e, args) + | Clight.Scall (Some _, _, _), e1 :: e2 :: args, _ -> + Clight.Scall (Some e1, e2, args) + | Clight.Ssequence _, _, stmt1 :: stmt2 :: _ -> + Clight.Ssequence (stmt1, stmt2) + | Clight.Sifthenelse _, e :: _, stmt1 :: stmt2 :: _ -> + Clight.Sifthenelse (e, stmt1, stmt2) + | Clight.Swhile _, e :: _, stmt :: _ -> + Clight.Swhile (e, stmt) + | Clight.Sdowhile _, e :: _, stmt :: _ -> + Clight.Sdowhile (e, stmt) + | Clight.Sfor _, e :: _, stmt1 :: stmt2 :: stmt3 :: _ -> + Clight.Sfor (stmt1, e, stmt2, stmt3) + | Clight.Sreturn (Some _), e :: _, _ -> Clight.Sreturn (Some e) + | Clight.Sswitch (_, lbl_stmts), e :: _, _ -> + Clight.Sswitch (e, labeled_statements_fill_subs lbl_stmts sub_statements) + | Clight.Slabel (lbl, _), _, stmt :: _ -> Clight.Slabel (lbl, stmt) + | Clight.Scost (lbl, _), _, stmt :: _ -> Clight.Scost (lbl, stmt) + | _ -> assert false (* wrong arguments, do not use on these values *) + +let rec statement f_ctype f_expr f_expr_descr f_statement stmt = + let (sub_exprs, sub_stmts) = statement_subs stmt in + let sub_exprs_res = List.map (expr f_ctype f_expr f_expr_descr) sub_exprs in + let sub_stmts_res = + List.map (statement f_ctype f_expr f_expr_descr f_statement) sub_stmts in + f_statement stmt sub_exprs_res sub_stmts_res + +let rec statement2 f_expr f_statement stmt = + let (sub_exprs, sub_stmts) = statement_subs stmt in + let sub_exprs_res = List.map (expr2 f_expr) sub_exprs in + let sub_stmts_res = List.map (statement2 f_expr f_statement) sub_stmts in + f_statement stmt sub_exprs_res sub_stmts_res diff --git a/src/clight/clightFold.mli b/src/clight/clightFold.mli new file mode 100644 index 0000000..7eb33c2 --- /dev/null +++ b/src/clight/clightFold.mli @@ -0,0 +1,62 @@ + +(** This module provides folding functions over the constructors of the + [Clight]'s AST. *) + +val ctype_fill_subs : Clight.ctype -> Clight.ctype list -> Clight.ctype + +val ctype : (Clight.ctype -> 'a list -> 'a) -> Clight.ctype -> 'a + +val expr_fill_subs : + Clight.expr -> Clight.ctype list -> Clight.expr_descr list -> + Clight.expr + +val expr_fill_exprs : + Clight.expr -> Clight.expr list -> Clight.expr + +val expr : + (Clight.ctype -> 'a list -> 'a) -> + (Clight.expr -> 'a list -> 'b list -> 'c) -> + (Clight.expr_descr -> 'a list -> 'c list -> 'b) -> + Clight.expr -> + 'c + +val expr2 : + (Clight.expr -> 'a list -> 'a) -> Clight.expr -> 'a + +val expr_descr_subs : + Clight.expr_descr -> Clight.ctype list * Clight.expr list + +val expr_descr_fill_subs : + Clight.expr_descr -> Clight.ctype list -> Clight.expr list -> + Clight.expr_descr + +val expr_descr : + (Clight.ctype -> 'a list -> 'a) -> + (Clight.expr -> 'a list -> 'b list -> 'c) -> + (Clight.expr_descr -> 'a list -> 'c list -> 'b) -> + Clight.expr_descr -> + 'b + +val statement_subs : + Clight.statement -> + (Clight.expr list * Clight.statement list) + +val statement_sub_exprs : Clight.statement -> Clight.expr list + +val statement_fill_subs : + Clight.statement -> Clight.expr list -> Clight.statement list -> + Clight.statement + +val statement : + (Clight.ctype -> 'a list -> 'a) -> + (Clight.expr -> 'a list -> 'b list -> 'c) -> + (Clight.expr_descr -> 'a list -> 'c list -> 'b) -> + (Clight.statement -> 'c list -> 'd list -> 'd) -> + Clight.statement -> + 'd + +val statement2 : + (Clight.expr -> 'a list -> 'a) -> + (Clight.statement -> 'a list -> 'b list -> 'b) -> + Clight.statement -> + 'b diff --git a/src/clight/clightFromC.ml b/src/clight/clightFromC.ml new file mode 100644 index 0000000..f6c274d --- /dev/null +++ b/src/clight/clightFromC.ml @@ -0,0 +1,902 @@ +open Printf + +open Cparser +open Cparser.C +open Cparser.Env + +open Clight + +(** Extract the type part of a type-annotated Clight expression. *) + +let typeof e = match e with Expr(_,te) -> te + +(** Natural alignment of a type, in bytes. *) +let rec alignof = function + | Tvoid -> 1 + | Tint (I8,_) -> 1 + | Tint (I16,_) -> 2 + | Tint (I32,_) -> 4 + | Tfloat F32 -> 4 + | Tfloat F64 -> 8 + | Tpointer _ -> 4 + | Tarray (t',n) -> alignof t' + | Tfunction (_,_) -> 1 + | Tstruct (_,fld) -> alignof_fields fld + | Tunion (_,fld) -> alignof_fields fld + | Tcomp_ptr _ -> 4 +and alignof_fields = function + | [] -> 1 + | (id,t)::f' -> max (alignof t) (alignof_fields f') + +(** Size of a type, in bytes. *) + +let align n amount = + ((n + amount - 1) / amount) * amount + +let rec sizeof t = + match t with + | Tvoid -> 1 + | Tint (I8,_) -> 1 + | Tint (I16,_) -> 2 + | Tint (I32,_) -> 4 + | Tfloat F32 -> 4 + | Tfloat F64 -> 8 + | Tpointer _ -> 4 + | Tarray (t',n) -> sizeof t' * max 1 n + | Tfunction (_,_) -> 1 + | Tstruct (_,fld) -> align (max 1 (sizeof_struct fld 0)) (alignof t) + | Tunion (_,fld) -> align (max 1 (sizeof_union fld)) (alignof t) + | Tcomp_ptr _ -> 4 +and sizeof_struct fld pos = + match fld with + | [] -> pos + | (id,t)::fld' -> sizeof_struct fld' (align pos (alignof t) + sizeof t) +and sizeof_union = function + | [] -> 0 + | (id,t)::fld' -> max (sizeof t) (sizeof_union fld') + +(** Record the declarations of global variables and associate them + with the corresponding atom. *) + +let decl_atom : (AST.ident, Env.t * C.decl) Hashtbl.t = Hashtbl.create 103 + +(** Hooks -- overriden in machine-dependent CPragmas module *) + +let process_pragma_hook = ref (fun (s: string) -> false) +let define_variable_hook = ref (fun (id: AST.ident) (d: C.decl) -> ()) +let define_function_hook = ref (fun (id: AST.ident) (d: C.decl) -> ()) +let define_stringlit_hook = ref (fun (id: AST.ident) -> ()) + +(** ** Error handling *) + +let currentLocation = ref Cutil.no_loc + +let updateLoc l = currentLocation := l + +let numErrors = ref 0 + +let error msg = + incr numErrors; + eprintf "%aError: %s\n" Cutil.printloc !currentLocation msg + +let unsupported msg = + incr numErrors; + eprintf "%aUnsupported feature: %s\n" Cutil.printloc !currentLocation msg + +let warning msg = + eprintf "%aWarning: %s\n" Cutil.printloc !currentLocation msg + + +(** ** Functions used to handle string literals *) + +let stringNum = ref 0 (* number of next global for string literals *) +let stringTable = Hashtbl.create 47 + +let name_for_string_literal env s = + try + Hashtbl.find stringTable s + with Not_found -> + incr stringNum; + let name = Printf.sprintf "__stringlit_%d" !stringNum in + let id = name in + Hashtbl.add decl_atom id + (env, (C.Storage_static, + Env.fresh_ident name, + C.TPtr(C.TInt(C.IChar,[C.AConst]),[]), + None)); + !define_stringlit_hook id; + Hashtbl.add stringTable s id; + id + +let typeStringLiteral s = + Tarray(Tint(I8, AST.Unsigned), String.length s + 1) + +let global_for_string s id = + let init = ref [] in + let add_char c = + init := + Init_int8(Char.code c) + :: !init in + add_char '\000'; + for i = String.length s - 1 downto 0 do add_char s.[i] done; + ((id, !init), typeStringLiteral s) + +let globals_for_strings globs = + Hashtbl.fold + (fun s id l -> global_for_string s id :: l) + stringTable globs + +(** ** Handling of stubs for variadic functions *) + +let stub_function_table = Hashtbl.create 47 + +let register_stub_function name tres targs = + let rec letters_of_type = function + | [] -> [] + | Tfloat(_)::tl -> "f" :: letters_of_type tl + | _::tl -> "i" :: letters_of_type tl in + let stub_name = + name ^ "$" ^ String.concat "" (letters_of_type targs) in + try + (stub_name, Hashtbl.find stub_function_table stub_name) + with Not_found -> + let rec types_of_types = function + | [] -> [] + | Tfloat(_)::tl -> Tfloat(F64)::(types_of_types tl) + | _::tl -> Tpointer(Tvoid)::(types_of_types tl) in + let stub_type = Tfunction (types_of_types targs, tres) in + Hashtbl.add stub_function_table stub_name stub_type; + (stub_name, stub_type) + +let declare_stub_function stub_name stub_type = + match stub_type with + | Tfunction(targs, tres) -> + (stub_name, + External(stub_name, targs, tres)) + | _ -> assert false + +let declare_stub_functions k = + Hashtbl.fold + (fun n i k -> declare_stub_function n i :: k) + stub_function_table k + +(** ** Translation functions *) + +(** Constants *) + +let convertInt n = Int64.to_int n + +(** Types *) + +let convertIkind = function + | C.IBool -> unsupported "'_Bool' type"; (AST.Unsigned, I8) + | C.IChar -> (AST.Unsigned, I8) + | C.ISChar -> (AST.Signed, I8) + | C.IUChar -> (AST.Unsigned, I8) + | C.IInt -> (AST.Signed, I32) + | C.IUInt -> (AST.Unsigned, I32) + | C.IShort -> (AST.Signed, I16) + | C.IUShort -> (AST.Unsigned, I16) + | C.ILong -> (AST.Signed, I32) + | C.IULong -> (AST.Unsigned, I32) + | C.ILongLong -> + if not !ClightFlags.option_flonglong then unsupported "'long long' type"; + (AST.Signed, I32) + | C.IULongLong -> + if not !ClightFlags.option_flonglong then unsupported "'unsigned long long' type"; + (AST.Unsigned, I32) + +let convertFkind = function + | C.FFloat -> F32 + | C.FDouble -> F64 + | C.FLongDouble -> + if not !ClightFlags.option_flonglong then unsupported "'long double' type"; + F64 + +let convertTyp env t = + + let rec convertTyp seen t = + match Cutil.unroll env t with + | C.TVoid a -> Tvoid + | C.TInt(ik, a) -> + let (sg, sz) = convertIkind ik in Tint(sz, sg) + | C.TFloat(fk, a) -> + Tfloat(convertFkind fk) + | C.TPtr(C.TStruct(id, _), _) when List.mem id seen -> + Tcomp_ptr("struct " ^ id.name) + | C.TPtr(C.TUnion(id, _), _) when List.mem id seen -> + Tcomp_ptr("union " ^ id.name) + | C.TPtr(ty, a) -> + Tpointer(convertTyp seen ty) + | C.TArray(ty, None, a) -> + (* Cparser verified that the type ty[] occurs only in + contexts that are safe for Clight, so just treat as ty[0]. *) + (* warning "array type of unspecified size"; *) + Tarray(convertTyp seen ty, 0) + | C.TArray(ty, Some sz, a) -> + Tarray(convertTyp seen ty, convertInt sz ) + | C.TFun(tres, targs, va, a) -> + if va then unsupported "variadic function type"; + if Cutil.is_composite_type env tres then + unsupported "return type is a struct or union"; + Tfunction(begin match targs with + | None -> warning "un-prototyped function type"; [] + | Some tl -> convertParams seen tl + end, + convertTyp seen tres) + | C.TNamed _ -> + assert false + | C.TStruct(id, a) -> + let flds = + try + convertFields (id :: seen) (Env.find_struct env id) + with Env.Error e -> + error (Env.error_message e); [] in + Tstruct("struct " ^ id.name, flds) + | C.TUnion(id, a) -> + let flds = + try + convertFields (id :: seen) (Env.find_union env id) + with Env.Error e -> + error (Env.error_message e); [] in + Tunion("union " ^ id.name, flds) + + and convertParams seen = function + | [] -> [] + | (id, ty) :: rem -> + if Cutil.is_composite_type env ty then + unsupported "function parameter of struct or union type"; + (convertTyp seen ty)::(convertParams seen rem) + + and convertFields seen ci = + convertFieldList seen ci.Env.ci_members + + and convertFieldList seen = function + | [] -> [] + | f :: fl -> + if f.fld_bitfield <> None then + unsupported "bit field in struct or union"; + (f.fld_name, convertTyp seen f.fld_typ)::( + convertFieldList seen fl) + + in convertTyp [] t + +let rec convertTypList env = function + | [] -> [] + | t1 :: tl -> (convertTyp env t1 )::( convertTypList env tl) + +(** Expressions *) + +let ezero = Expr(Econst_int(0), Tint(I32, AST.Signed)) + +let rec convertExpr env e = + let ty = convertTyp env e.etyp in + match e.edesc with + | C.EConst(C.CInt(i, _, _)) -> + Expr(Econst_int( convertInt i), ty) + | C.EConst(C.CFloat(f, _, _)) -> + Expr(Econst_float f, ty) + | C.EConst(C.CStr s) -> + Expr(Evar(name_for_string_literal env s), typeStringLiteral s) + | C.EConst(C.CWStr s) -> + unsupported "wide string literal"; ezero + | C.EConst(C.CEnum(id, i)) -> + Expr(Econst_int(convertInt i), ty) + + | C.ESizeof ty1 -> + Expr(Esizeof(convertTyp env ty1), ty) + | C.EVar id -> + Expr(Evar(id.name), ty) + + | C.EUnop(C.Oderef, e1) -> + Expr(Ederef(convertExpr env e1), ty) + | C.EUnop(C.Oaddrof, e1) -> + Expr(Eaddrof(convertExpr env e1), ty) + | C.EUnop(C.Odot id, e1) -> + Expr(Efield(convertExpr env e1, id), ty) + | C.EUnop(C.Oarrow id, e1) -> + let e1' = convertExpr env e1 in + let ty1 = + match typeof e1' with + | Tpointer t -> t + | _ -> error ("wrong type for ->" ^ id ^ " access"); Tvoid in + Expr(Efield(Expr(Ederef(convertExpr env e1), ty1), + id), ty) + | C.EUnop(C.Oplus, e1) -> + convertExpr env e1 + | C.EUnop(C.Ominus, e1) -> + Expr(Eunop(Oneg, convertExpr env e1), ty) + | C.EUnop(C.Olognot, e1) -> + Expr(Eunop(Onotbool, convertExpr env e1), ty) + | C.EUnop(C.Onot, e1) -> + Expr(Eunop(Onotint, convertExpr env e1), ty) + | C.EUnop(_, _) -> + unsupported "pre/post increment/decrement operator"; ezero + + | C.EBinop(C.Oindex, e1, e2, _) -> + Expr(Ederef(Expr(Ebinop(Oadd, convertExpr env e1, convertExpr env e2), + Tpointer ty)), ty) + | C.EBinop(C.Ologand, e1, e2, _) -> + Expr(Eandbool(convertExpr env e1, convertExpr env e2), ty) + | C.EBinop(C.Ologor, e1, e2, _) -> + Expr(Eorbool(convertExpr env e1, convertExpr env e2), ty) + | C.EBinop(op, e1, e2, _) -> + let op' = + match op with + | C.Oadd -> Oadd + | C.Osub -> Osub + | C.Omul -> Omul + | C.Odiv -> Odiv + | C.Omod -> Omod + | C.Oand -> Oand + | C.Oor -> Oor + | C.Oxor -> Oxor + | C.Oshl -> Oshl + | C.Oshr -> Oshr + | C.Oeq -> Oeq + | C.One -> One + | C.Olt -> Olt + | C.Ogt -> Ogt + | C.Ole -> Ole + | C.Oge -> Oge + | C.Ocomma -> unsupported "sequence operator"; Oadd + | _ -> unsupported "assignment operator"; Oadd in + Expr(Ebinop(op', convertExpr env e1, convertExpr env e2), ty) + | C.EConditional(e1, e2, e3) -> + Expr(Econdition(convertExpr env e1, convertExpr env e2, convertExpr env e3), ty) + | C.ECast(ty1, e1) -> + Expr(Ecast(convertTyp env ty1, convertExpr env e1), ty) + | C.ECall _ -> + unsupported "function call within expression"; ezero + +(* Function calls *) + +let rec projFunType env ty = + match Cutil.unroll env ty with + | TFun(res, args, vararg, attr) -> Some(res, vararg) + | TPtr(ty', attr) -> projFunType env ty' + | _ -> None + +let convertFuncall env lhs fn args = + match projFunType env fn.etyp with + | None -> + error "wrong type for function part of a call"; Sskip + | Some(res, false) -> + (* Non-variadic function *) + Scall(lhs, convertExpr env fn, List.map (convertExpr env) args) + | Some(res, true) -> + (* Variadic function: generate a call to a stub function with + the appropriate number and types of arguments. Works only if + the function expression e is a global variable. *) + let fun_name = + match fn with + | {edesc = C.EVar id} when !ClightFlags.option_fvararg_calls -> + (*warning "emulating call to variadic function"; *) + id.name + | _ -> + unsupported "call to variadic function"; + "" in + let targs = convertTypList env (List.map (fun e -> e.etyp) args) in + let tres = convertTyp env res in + let (stub_fun_name, stub_fun_typ) = + register_stub_function fun_name tres targs in + Scall(lhs, + Expr(Evar( stub_fun_name), stub_fun_typ), + List.map (convertExpr env) args) + +(* Handling of volatile *) + +let is_volatile_access env e = + List.mem C.AVolatile (Cutil.attributes_of_type env e.etyp) + && Cutil.is_lvalue env e + +let volatile_fun_suffix_type ty = + match ty with + | Tint(I8, AST.Unsigned) -> ("int8unsigned", ty) + | Tint(I8, AST.Signed) -> ("int8signed", ty) + | Tint(I16, AST.Unsigned) -> ("int16unsigned", ty) + | Tint(I16, AST.Signed) -> ("int16signed", ty) + | Tint(I32, _) -> ("int32", Tint(I32, AST.Signed)) + | Tfloat F32 -> ("float32", ty) + | Tfloat F64 -> ("float64", ty) + | Tpointer _ | Tarray _ | Tfunction _ | Tcomp_ptr _ -> + ("pointer", Tpointer Tvoid) + | _ -> + unsupported "operation on volatile struct or union"; ("", Tvoid) + +let volatile_read_fun ty = + let (suffix, ty') = volatile_fun_suffix_type ty in + Expr(Evar( ("__builtin_volatile_read_" ^ suffix)), + Tfunction((Tpointer Tvoid)::[], ty')) + +let volatile_write_fun ty = + let (suffix, ty') = volatile_fun_suffix_type ty in + Expr(Evar( ("__builtin_volatile_write_" ^ suffix)), + Tfunction((Tpointer Tvoid)::(ty'::[]), Tvoid)) + +(* Toplevel expression, argument of an Sdo *) + +let convertTopExpr env e = + match e.edesc with + | C.EBinop(C.Oassign, lhs, {edesc = C.ECall(fn, args)}, _) -> + convertFuncall env (Some (convertExpr env lhs)) fn args + | C.EBinop(C.Oassign, lhs, rhs, _) -> + if Cutil.is_composite_type env lhs.etyp then + unsupported "assignment between structs or between unions"; + let lhs' = convertExpr env lhs + and rhs' = convertExpr env rhs in + begin match (is_volatile_access env lhs, is_volatile_access env rhs) with + | true, true -> (* should not happen *) + unsupported "volatile-to-volatile assignment"; + Sskip + | false, true -> (* volatile read *) + Scall(Some lhs', + volatile_read_fun (typeof rhs'), + [ Expr (Eaddrof rhs', Tpointer (typeof rhs')) ]) + | true, false -> (* volatile write *) + Scall(None, + volatile_write_fun (typeof lhs'), + [ Expr(Eaddrof lhs', Tpointer (typeof lhs')); rhs' ]) + | false, false -> (* regular assignment *) + Sassign(convertExpr env lhs, convertExpr env rhs) + end + | C.ECall(fn, args) -> + convertFuncall env None fn args + | _ -> + unsupported "illegal toplevel expression"; Sskip + +(* Separate the cases of a switch statement body *) + +type switchlabel = + | Case of C.exp + | Default + +type switchbody = + | Label of switchlabel + | Stmt of C.stmt + +let rec flattenSwitch = function + | {sdesc = C.Sseq(s1, s2)} -> + flattenSwitch s1 @ flattenSwitch s2 + | {sdesc = C.Slabeled(C.Scase e, s1)} -> + Label(Case e) :: flattenSwitch s1 + | {sdesc = C.Slabeled(C.Sdefault, s1)} -> + Label Default :: flattenSwitch s1 + | s -> + [Stmt s] + +let rec groupSwitch = function + | [] -> + (Cutil.sskip, []) + | Label case :: rem -> + let (fst, cases) = groupSwitch rem in + (Cutil.sskip, (case, fst) :: cases) + | Stmt s :: rem -> + let (fst, cases) = groupSwitch rem in + (Cutil.sseq s.sloc s fst, cases) + +(* Statement *) + +let rec convertStmt env s = + updateLoc s.sloc; + match s.sdesc with + | C.Sskip -> + Sskip + | C.Sdo e -> + convertTopExpr env e + | C.Sseq(s1, s2) -> + Ssequence(convertStmt env s1, convertStmt env s2) + | C.Sif(e, s1, s2) -> + Sifthenelse(convertExpr env e, convertStmt env s1, convertStmt env s2) + | C.Swhile(e, s1) -> + Swhile(convertExpr env e, convertStmt env s1) + | C.Sdowhile(s1, e) -> + Sdowhile(convertExpr env e, convertStmt env s1) + | C.Sfor(s1, e, s2, s3) -> + Sfor(convertStmt env s1, convertExpr env e, convertStmt env s2, + convertStmt env s3) + | C.Sbreak -> + Sbreak + | C.Scontinue -> + Scontinue + | C.Sswitch(e, s1) -> + let (init, cases) = groupSwitch (flattenSwitch s1) in + if cases = [] then + unsupported "ill-formed 'switch' statement"; + if init.sdesc <> C.Sskip then + warning "ignored code at beginning of 'switch'"; + Sswitch(convertExpr env e, convertSwitch env cases) + | C.Slabeled(C.Slabel lbl, s1) -> + Slabel( lbl, convertStmt env s1) + | C.Slabeled(C.Scase _, _) -> + unsupported "'case' outside of 'switch'"; Sskip + | C.Slabeled(C.Sdefault, _) -> + unsupported "'default' outside of 'switch'"; Sskip + | C.Sgoto lbl -> + Sgoto( lbl) + | C.Sreturn None -> + Sreturn None + | C.Sreturn(Some e) -> + Sreturn(Some(convertExpr env e)) + | C.Sblock _ -> + unsupported "nested blocks"; Sskip + | C.Sdecl _ -> + unsupported "inner declarations"; Sskip + +and convertSwitch env = function + | [] -> + LSdefault Sskip + | [Default, s] -> + LSdefault (convertStmt env s) + | (Default, s) :: _ -> + updateLoc s.sloc; + unsupported "'default' case must occur last"; + LSdefault Sskip + | (Case e, s) :: rem -> + updateLoc s.sloc; + let v = + match Ceval.integer_expr env e with + | None -> unsupported "'case' label is not a compile-time integer"; 0L + | Some v -> v in + LScase(convertInt v, + convertStmt env s, + convertSwitch env rem) + +(** Function definitions *) + +let convertFundef env fd = + if Cutil.is_composite_type env fd.fd_ret then + unsupported "function returning a struct or union"; + let ret = + convertTyp env fd.fd_ret in + let params = + List.map + (fun (id, ty) -> + if Cutil.is_composite_type env ty then + unsupported "function parameter of struct or union type"; + ( id.name, convertTyp env ty)) + fd.fd_params in + let vars = + List.map + (fun (sto, id, ty, init) -> + if sto = Storage_extern || sto = Storage_static then + unsupported "'static' or 'extern' local variable"; + if init <> None then + unsupported "initialized local variable"; + ( id.name, convertTyp env ty)) + fd.fd_locals in + let body' = convertStmt env fd.fd_body in + let id' = fd.fd_name.name in + let decl = + (fd.fd_storage, fd.fd_name, Cutil.fundef_typ fd, None) in + Hashtbl.add decl_atom id' (env, decl); + !define_function_hook id' decl; + (id', + Internal {fn_return = ret; fn_params = params; + fn_vars = vars; fn_body = body'}) + +(** External function declaration *) + +let convertFundecl env (sto, id, ty, optinit) = + match convertTyp env ty with + | Tfunction(args, res) -> + let id' = id.name in + (id', External(id', args, res)) + | _ -> + assert false + +(** Initializers *) + +let init_data_of_string s = + let id = ref [] in + let enter_char c = + let n = (Char.code c) in + id := Init_int8 n :: !id in + enter_char '\000'; + for i = String.length s - 1 downto 0 do enter_char s.[i] done; + !id + +let convertInit env ty init = + + let k = ref [] + and pos = ref 0 in + let emit size datum = + k := datum :: !k; + pos := !pos + size in + let emit_space size = + emit size (Init_space size) in + let align size = + let n = !pos land (size - 1) in + if n > 0 then emit_space (size - n) in + let check_align size = + assert (!pos land (size - 1) = 0) in + + let rec reduceInitExpr = function + | { edesc = C.EVar id; etyp = ty } -> + begin match Cutil.unroll env ty with + | C.TArray _ | C.TFun _ -> Some id + | _ -> None + end + | {edesc = C.EUnop(C.Oaddrof, {edesc = C.EVar id})} -> Some id + | {edesc = C.ECast(ty, e)} -> reduceInitExpr e + | _ -> None in + + let rec cvtInit ty = function + | Init_single e -> + begin match reduceInitExpr e with + | Some id -> + check_align 4; + emit 4 (Init_addrof( id.name, 0)) + | None -> + match Ceval.constant_expr env ty e with + | Some(C.CInt(v, ik, _)) -> + begin match convertIkind ik with + | (_, I8) -> + emit 1 (Init_int8(convertInt v)) + | (_, I16) -> + check_align 2; + emit 2 (Init_int16(convertInt v)) + | (_, I32) -> + check_align 4; + emit 4 (Init_int32(convertInt v)) + end + | Some(C.CFloat(v, fk, _)) -> + begin match convertFkind fk with + | F32 -> + check_align 4; + emit 4 (Init_float32 v) + | F64 -> + check_align 8; + emit 8 (Init_float64 v) + end + | Some(C.CStr s) -> + check_align 4; + let id = name_for_string_literal env s in + emit 4 (Init_addrof(id, 0)) + | Some(C.CWStr _) -> + unsupported "wide character strings" + | Some(C.CEnum _) -> + error "enum tag after constant folding" + | None -> + error "initializer is not a compile-time constant" + end + | Init_array il -> + let ty_elt = + match Cutil.unroll env ty with + | C.TArray(t, _, _) -> t + | _ -> error "array type expected in initializer"; C.TVoid [] in + List.iter (cvtInit ty_elt) il + | Init_struct(_, flds) -> + cvtPadToSizeof ty (fun () -> List.iter cvtFieldInit flds) + | Init_union(_, fld, i) -> + cvtPadToSizeof ty (fun () -> cvtFieldInit (fld,i)) + + and cvtFieldInit (fld, i) = + let ty' = convertTyp env fld.fld_typ in + let al = alignof ty' in + align al; + cvtInit fld.fld_typ i + + and cvtPadToSizeof ty fn = + let ty' = convertTyp env ty in + let sz = sizeof ty' in + let pos0 = !pos in + fn(); + let pos1 = !pos in + assert (pos1 <= pos0 + sz); + if pos1 < pos0 + sz then emit_space (pos0 + sz - pos1) + + in cvtInit ty init; List.rev !k + +(** Global variable *) + +let convertGlobvar env (sto, id, ty, optinit as decl) = + let id' = id.name in + let ty' = convertTyp env ty in + let init' = + match optinit with + | None -> + if sto = C.Storage_extern then [] else [Init_space(sizeof ty')] + | Some i -> + convertInit env ty i in + Hashtbl.add decl_atom id' (env, decl); + !define_variable_hook id' decl; + ((id', init'), ty') + +(** Convert a list of global declarations. + Result is a pair [(funs, vars)] where [funs] are + the function definitions (internal and external) + and [vars] the variable declarations. *) + +let rec convertGlobdecls env funs vars gl = + match gl with + | [] -> (List.rev funs, List.rev vars) + | g :: gl' -> + updateLoc g.gloc; + match g.gdesc with + | C.Gdecl((sto, id, ty, optinit) as d) -> + (* Prototyped functions become external declarations. + Variadic functions are skipped. + Other types become variable declarations. *) + begin match Cutil.unroll env ty with + | TFun(_, Some _, false, _) -> + convertGlobdecls env (convertFundecl env d :: funs) vars gl' + | TFun(_, None, false, _) -> + error "function declaration without prototype"; + convertGlobdecls env funs vars gl' + | TFun(_, _, true, _) -> + convertGlobdecls env funs vars gl' + | _ -> + convertGlobdecls env funs (convertGlobvar env d :: vars) gl' + end + | C.Gfundef fd -> + convertGlobdecls env (convertFundef env fd :: funs) vars gl' + | C.Gcompositedecl _ | C.Gcompositedef _ + | C.Gtypedef _ | C.Genumdef _ -> + (* typedefs are unrolled, structs are expanded inline, and + enum tags are folded. So we just skip their declarations. *) + convertGlobdecls env funs vars gl' + | C.Gpragma s -> + if not (!process_pragma_hook s) then + warning ("'#pragma " ^ s ^ "' directive ignored"); + convertGlobdecls env funs vars gl' + +(** Build environment of typedefs and structs *) + +let rec translEnv env = function + | [] -> env + | g :: gl -> + let env' = + match g.gdesc with + | C.Gcompositedecl(su, id) -> + Env.add_composite env id (Cutil.composite_info_decl env su) + | C.Gcompositedef(su, id, fld) -> + Env.add_composite env id (Cutil.composite_info_def env su fld) + | C.Gtypedef(id, ty) -> + Env.add_typedef env id ty + | _ -> + env in + translEnv env' gl + +(** Eliminate forward declarations of globals that are defined later. *) + +module IdentSet = Set.Make(struct type t = C.ident let compare = compare end) + +let cleanupGlobals p = + + let rec clean defs accu = function + | [] -> accu + | g :: gl -> + updateLoc g.gloc; + match g.gdesc with + | C.Gdecl(sto, id, ty, None) -> + if IdentSet.mem id defs + then clean defs accu gl + else clean (IdentSet.add id defs) (g :: accu) gl + | C.Gdecl(_, id, ty, _) -> + if IdentSet.mem id defs then + error ("multiple definitions of " ^ id.name); + clean (IdentSet.add id defs) (g :: accu) gl + | C.Gfundef fd -> + if IdentSet.mem fd.fd_name defs then + error ("multiple definitions of " ^ fd.fd_name.name); + clean (IdentSet.add fd.fd_name defs) (g :: accu) gl + | _ -> + clean defs (g :: accu) gl + + in clean IdentSet.empty [] (List.rev p) + +(** Convert a [C.program] into a [Csyntax.program] *) + +let convertProgram p = + numErrors := 0; + stringNum := 0; + Hashtbl.clear decl_atom; + Hashtbl.clear stringTable; + Hashtbl.clear stub_function_table; + (* Hack: externals are problematic for Cerco. TODO *) + let p = (* Builtins.declarations() @ *) p in + try + let (funs1, vars1) = + convertGlobdecls (translEnv Env.empty p) [] [] (cleanupGlobals p) in + let funs2 = declare_stub_functions funs1 in + let main = if List.mem_assoc "main" funs2 then Some "main" else None in + let vars2 = globals_for_strings vars1 in + if !numErrors > 0 + then None + else Some { prog_funct = funs2; + prog_vars = vars2; + prog_main = main } + with Env.Error msg -> + error (Env.error_message msg); None + +(** ** Extracting information about global variables from their atom *) + +let rec type_is_readonly env t = + let a = Cutil.attributes_of_type env t in + if List.mem C.AVolatile a then false else + if List.mem C.AConst a then true else + match Cutil.unroll env t with + | C.TArray(t', _, _) -> type_is_readonly env t' + | _ -> false + +let atom_is_static a = + try + let (env, (sto, id, ty, init)) = Hashtbl.find decl_atom a in + sto = C.Storage_static + with Not_found -> + false + +let atom_is_readonly a = + try + let (env, (sto, id, ty, init)) = Hashtbl.find decl_atom a in + type_is_readonly env ty + with Not_found -> + false + +let atom_sizeof a = + try + let (env, (sto, id, ty, init)) = Hashtbl.find decl_atom a in + Cutil.sizeof env ty + with Not_found -> + None + +let atom_alignof a = + try + let (env, (sto, id, ty, init)) = Hashtbl.find decl_atom a in + Cutil.alignof env ty + with Not_found -> + None + +(** ** The builtin environment *) + +open Builtins + +let builtins_generic = { + typedefs = [ + (* keeps GCC-specific headers happy, harmless for others *) + "__builtin_va_list", C.TPtr(C.TVoid [], []) + ]; + functions = [ + (* The volatile read/volatile write functions *) + "__builtin_volatile_read_int8unsigned", + (TInt(IUChar, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_int8signed", + (TInt(ISChar, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_int16unsigned", + (TInt(IUShort, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_int16signed", + (TInt(IShort, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_int32", + (TInt(IInt, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_float32", + (TFloat(FFloat, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_float64", + (TFloat(FDouble, []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_read_pointer", + (TPtr(TVoid [], []), [TPtr(TVoid [], [])], false); + "__builtin_volatile_write_int8unsigned", + (TVoid [], [TPtr(TVoid [], []); TInt(IUChar, [])], false); + "__builtin_volatile_write_int8signed", + (TVoid [], [TPtr(TVoid [], []); TInt(ISChar, [])], false); + "__builtin_volatile_write_int16unsigned", + (TVoid [], [TPtr(TVoid [], []); TInt(IUShort, [])], false); + "__builtin_volatile_write_int16signed", + (TVoid [], [TPtr(TVoid [], []); TInt(IShort, [])], false); + "__builtin_volatile_write_int32", + (TVoid [], [TPtr(TVoid [], []); TInt(IInt, [])], false); + "__builtin_volatile_write_float32", + (TVoid [], [TPtr(TVoid [], []); TFloat(FFloat, [])], false); + "__builtin_volatile_write_float64", + (TVoid [], [TPtr(TVoid [], []); TFloat(FDouble, [])], false); + "__builtin_volatile_write_pointer", + (TVoid [], [TPtr(TVoid [], []); TPtr(TVoid [], [])], false) + ] +} + +(* Add processor-dependent builtins *) + +let builtins = + { typedefs = builtins_generic.typedefs @ CBuiltins.builtins.typedefs; + functions = builtins_generic.functions @ CBuiltins.builtins.functions + } diff --git a/src/clight/clightInterpret.ml b/src/clight/clightInterpret.ml new file mode 100644 index 0000000..119f6e3 --- /dev/null +++ b/src/clight/clightInterpret.ml @@ -0,0 +1,621 @@ +module Mem = Driver.ClightMemory +module Value = Driver.ClightMemory.Value +module LocalEnv = Map.Make(String) +type localEnv = Value.address LocalEnv.t +type memory = Clight.fundef Mem.memory + +open Clight +open AST + + +let error_prefix = "Clight interpret" +let error s = Error.global_error error_prefix s +let warning s = Error.warning error_prefix s +let error_float () = error "float not supported." + + +(* Helpers *) + +let value_of_address = List.hd +let address_of_value v = [v] + + +(* State of execution *) + +type continuation = + | Kstop + | Kseq of statement*continuation + | Kwhile of expr*statement*continuation + | Kdowhile of expr*statement*continuation + | Kfor2 of expr*statement*statement*continuation + | Kfor3 of expr*statement*statement*continuation + | Kswitch of continuation + | Kcall of (Value.address*ctype) option*cfunction*localEnv*continuation + +type state = + | State of cfunction*statement*continuation*localEnv*memory + | Callstate of fundef*Value.t list*continuation*memory + | Returnstate of Value.t*continuation*memory + +let string_of_unop = function + | Onotbool -> "!" + | Onotint -> "~" + | Oneg -> "-" + +let string_of_binop = function + | Oadd -> "+" + | Osub -> "-" + | Omul -> "*" + | Odiv -> "/" + | Omod -> "%" + | Oand -> "&" + | Oor -> "|" + | Oxor -> "^" + | Oshl -> "<<" + | Oshr -> ">>" + | Oeq -> "==" + | One -> "!=" + | Olt -> "<" + | Ogt -> ">" + | Ole -> "<=" + | Oge -> ">=" + +let string_of_signedness = function + | Signed -> "signed" + | Unsigned -> "unsigned" + +let string_of_sized_int = function + | I8 -> "char" + | I16 -> "short" + | I32 -> "int" + +let rec string_of_ctype = function + | Tvoid -> "void" + | Tint (size, sign) -> + (string_of_signedness sign) ^ " " ^ (string_of_sized_int size) + | Tfloat _ -> error_float () + | Tpointer ty -> (string_of_ctype ty) ^ "*" + | Tarray (ty, _) -> (string_of_ctype ty) ^ "[]" + | Tfunction _ -> assert false (* do not cast to a function type *) + | Tstruct (id, _) + | Tunion (id, _) -> id + | Tcomp_ptr id -> id ^ "*" + +let rec string_of_expr (Expr (e, _)) = string_of_expr_descr e +and string_of_expr_descr = function + | Econst_int i -> string_of_int i + | Econst_float _ -> error_float () + | Evar x -> x + | Ederef e -> "*(" ^ (string_of_expr e) ^ ")" + | Eaddrof e -> "&(" ^ (string_of_expr e) ^ ")" + | Eunop (unop, e) -> (string_of_unop unop) ^ "(" ^ (string_of_expr e) ^ ")" + | Ebinop (binop, e1, e2) -> + "(" ^ (string_of_expr e1) ^ ")" ^ (string_of_binop binop) ^ + "(" ^ (string_of_expr e2) ^ ")" + | Ecast (ty, e) -> + "(" ^ (string_of_ctype ty) ^ ") (" ^ (string_of_expr e) ^ ")" + | Econdition (e1, e2, e3) -> + "(" ^ (string_of_expr e1) ^ ") ? (" ^ (string_of_expr e2) ^ + ") : (" ^ (string_of_expr e3) ^ ")" + | Eandbool (e1, e2) -> + "(" ^ (string_of_expr e1) ^ ") && (" ^ (string_of_expr e2) ^ ")" + | Eorbool (e1, e2) -> + "(" ^ (string_of_expr e1) ^ ") || (" ^ (string_of_expr e2) ^ ")" + | Esizeof ty -> "sizeof(" ^ (string_of_ctype ty) ^ ")" + | Efield (e, field) -> "(" ^ (string_of_expr e) ^ ")." ^ field + | Ecost (cost_lbl, e) -> "/* " ^ cost_lbl ^ " */ " ^ (string_of_expr e) + | Ecall (f, arg, e) -> + "(" ^ f ^ "(" ^ (string_of_expr arg) ^ "), " ^ (string_of_expr e) ^ ")" + +let string_of_args args = + "(" ^ (MiscPottier.string_of_list ", " string_of_expr args) ^ ")" + +let rec string_of_statement = function + | Sskip -> "skip" + | Sassign (e1, e2) -> (string_of_expr e1) ^ " = " ^ (string_of_expr e2) + | Scall (None, f, args) -> (string_of_expr f) ^ (string_of_args args) + | Scall (Some e, f, args) -> + (string_of_expr e) ^ " = " ^ (string_of_expr f) ^ (string_of_args args) + | Ssequence _ -> "sequence" + | Sifthenelse (e, _, _) -> "if (" ^ (string_of_expr e) ^ ")" + | Swhile (e, _) -> "while (" ^ (string_of_expr e) ^ ")" + | Sdowhile _ -> "dowhile" + | Sfor (s, _, _, _) -> "for (" ^ (string_of_statement s) ^ "; ...)" + | Sbreak -> "break" + | Scontinue -> "continue" + | Sreturn None -> "return" + | Sreturn (Some e) -> "return (" ^ (string_of_expr e) ^ ")" + | Sswitch (e, _) -> "switch (" ^ (string_of_expr e) ^ ")" + | Slabel (lbl, _) -> "label " ^ lbl + | Sgoto lbl -> "goto " ^ lbl + | Scost (lbl, _) -> "cost " ^ lbl + +let string_of_local_env lenv = + let f x addr s = + s ^ x ^ " = " ^ (Value.to_string (value_of_address addr)) ^ " " in + LocalEnv.fold f lenv "" + +let print_state = function + | State (_, stmt, _, lenv, mem) -> + Printf.printf "Local environment:\n%s\n\nMemory:%s\nRegular state: %s\n\n%!" + (string_of_local_env lenv) + (Mem.to_string mem) + (string_of_statement stmt) + | Callstate (_, args, _, mem) -> + Printf.printf "Memory:%s\nCall state\n\nArguments:\n%s\n\n%!" + (Mem.to_string mem) + (MiscPottier.string_of_list " " Value.to_string args) + | Returnstate (v, _, mem) -> + Printf.printf "Memory:%s\nReturn state: %s\n\n%!" + (Mem.to_string mem) + (Value.to_string v) + + +(* Continuations and labels *) + +let rec call_cont = function + | Kseq (_,k) | Kwhile (_,_,k) | Kdowhile (_,_,k) + | Kfor2 (_,_,_,k) | Kfor3 (_,_,_,k) | Kswitch k -> call_cont k + | k -> k + +let rec seq_of_labeled_statement = function + | LSdefault s -> s + | LScase (c,s,sl') -> Ssequence (s,(seq_of_labeled_statement sl')) + +let rec find_label1 lbl s k = match s with + | Ssequence (s1,s2) -> + (match find_label1 lbl s1 (Kseq (s2,k)) with + | Some sk -> Some sk + | None -> find_label1 lbl s2 k + ) + | Sifthenelse (a,s1,s2) -> + (match find_label1 lbl s1 k with + | Some sk -> Some sk + | None -> find_label1 lbl s2 k + ) + | Swhile (a,s1) -> find_label1 lbl s1 (Kwhile(a,s1,k)) + | Sdowhile (a,s1) -> find_label1 lbl s1 (Kdowhile(a,s1,k)) + | Sfor (a1,a2,a3,s1) -> + (match find_label1 lbl a1 (Kseq ((Sfor(Sskip,a2,a3,s1)),k)) with + | Some sk -> Some sk + | None -> + (match find_label1 lbl s1 (Kfor2(a2,a3,s1,k)) with + | Some sk -> Some sk + | None -> find_label1 lbl a3 (Kfor3(a2,a3,s1,k)) + )) + | Sswitch (e,sl) -> find_label_ls lbl sl (Kswitch k) + | Slabel (lbl',s') -> if lbl=lbl' then Some(s', k) else find_label1 lbl s' k + | Scost (_,s') -> find_label1 lbl s' k + | Sskip | Sassign (_,_) | Scall (_,_,_) | Sbreak + | Scontinue | Sreturn _ | Sgoto _ -> None + +and find_label_ls lbl sl k = match sl with + | LSdefault s -> find_label1 lbl s k + | LScase (_,s,sl') -> + (match find_label1 lbl s (Kseq((seq_of_labeled_statement sl'),k)) with + | Some sk -> Some sk + | None -> find_label_ls lbl sl' k + ) + +let find_label lbl s k = match find_label1 lbl s k with + | Some res -> res + | _ -> assert false (* should be impossible *) + +let rec select_switch i = function + | LSdefault d -> LSdefault d + | LScase (c,s,sl') when c=i-> LScase (c,s,sl') + | LScase (_,_,sl') -> select_switch i sl' + + +(* ctype functions *) + +let sizeof ctype = Mem.concrete_size (ClightToCminor.sizeof_ctype ctype) + +let size_of_ctype = function + | Tint (I8, _) -> 1 + | Tint (I16, _) -> 2 + | Tint (I32, _) -> 4 + | Tfloat _ -> error_float () + | Tcomp_ptr _ + | Tpointer _ + | Tarray _ + | Tstruct _ + | Tunion _ -> Mem.ptr_size + | _ -> assert false (* do not use on these arguments *) + +let is_function_type = function + | Tfunction _ -> true + | _ -> false + +let is_array_type = function + | Tarray _ -> true + | _ -> false + +let is_complex_type = function + | Tstruct _ | Tunion _ -> true + | _ -> false + +let is_big_type t = (is_array_type t) || (is_complex_type t) + +let dest_type = function + | Tpointer ty | Tarray (ty, _) -> ty + | _ -> assert false (* do not use on these arguments *) + + +(* Global and local environment management *) + +let find_local x lenv = + if LocalEnv.mem x lenv then LocalEnv.find x lenv + else error ("Unknown local variable " ^ x ^ ".") + +let find_global x mem = + if Mem.mem_global mem x then Mem.find_global mem x + else error ("Unknown global variable " ^ x ^ ".") + +let find_symbol lenv mem x = + if LocalEnv.mem x lenv then LocalEnv.find x lenv + else + if Mem.mem_global mem x then Mem.find_global mem x + else error ("Unknown variable " ^ x ^ ".") + +let find_fundef f mem = + let addr = Mem.find_global mem f in + Mem.find_fun_def mem addr + + +(* Interpret *) + +let byte_of_intsize = function + | I8 -> 1 + | I16 -> 2 + | I32 -> 4 + +let choose_cast sign n m v = + let f = match sign with + | Signed -> Value.sign_ext + | Unsigned -> Value.zero_ext in + f v n m + +let eval_cast = function + (* Cast Integer *) + | (v,Tint(isize,sign),Tint(isize',_)) -> + choose_cast sign (byte_of_intsize isize) (byte_of_intsize isize') v + | (v,_,_) -> v + +let to_int32 (v, t) = eval_cast (v, t, Tint (I32, Signed)) + +let eval_unop ret_ctype ((_, t) as e) op = + let v = to_int32 e in + let v = match op with + | Onotbool -> Value.notbool v + | Onotint -> Value.notint v + | Oneg -> Value.negint v in + eval_cast (v, t, ret_ctype) + +let eval_add (v1,t1) (v2,t2) = match t1, t2 with + | Tpointer ty, Tint _ | Tarray (ty, _), Tint _ -> + let v = Value.mul (Value.of_int (sizeof ty)) v2 in + Value.add v1 v + | Tint _, Tpointer ty | Tint _, Tarray (ty, _) -> + let v = Value.mul (Value.of_int (sizeof ty)) v1 in + Value.add v2 v + | _ -> Value.add v1 v2 + +let eval_sub (v1,t1) (v2,t2) = match t1, t2 with + | Tpointer ty, Tint _ | Tarray (ty, _), Tint _ -> + let v = Value.mul (Value.of_int (sizeof ty)) v2 in + Value.sub v1 v + | _ -> Value.sub v1 v2 + +let choose_sign op_signed op_unsigned v1 v2 t = + let op = match t with + | Tint (_, Signed) -> op_signed + | Tint (_, Unsigned) -> op_unsigned + | _ -> op_unsigned in + op v1 v2 + +let eval_binop ret_ctype ((_, t1) as e1) ((_, t2) as e2) op = + let v1 = to_int32 e1 in + let v2 = to_int32 e2 in + let e1 = (v1, t1) in + let e2 = (v2, t2) in + let v = match op with + | Oadd -> eval_add e1 e2 + | Osub -> eval_sub e1 e2 + | Omul -> Value.mul v1 v2 + | Odiv -> choose_sign Value.div Value.divu v1 v2 t1 + | Omod -> choose_sign Value.modulo Value.modulou v1 v2 t1 + | Oand -> Value.and_op v1 v2 + | Oor -> Value.or_op v1 v2 + | Oxor -> Value.xor v1 v2 + | Oshl-> Value.shl v1 v2 + | Oshr-> Value.shr v1 v2 + | Oeq -> choose_sign Value.cmp_eq Value.cmp_eq_u v1 v2 t1 + | One -> choose_sign Value.cmp_ne Value.cmp_ne_u v1 v2 t1 + | Olt -> choose_sign Value.cmp_lt Value.cmp_lt_u v1 v2 t1 + | Ole -> choose_sign Value.cmp_le Value.cmp_le_u v1 v2 t1 + | Ogt -> choose_sign Value.cmp_gt Value.cmp_gt_u v1 v2 t1 + | Oge -> choose_sign Value.cmp_ge Value.cmp_ge_u v1 v2 t1 in + eval_cast (v, t1, ret_ctype) + +let rec get_offset_struct v size id fields = + let offsets = fst (Mem.concrete_offsets_size size) in + let fields = List.combine (List.map fst fields) offsets in + let off = Value.of_int (List.assoc id fields) in + Value.add v off + +let get_offset v id = function + | Tstruct (_, fields) as t -> + let size = ClightToCminor.sizeof_ctype t in + get_offset_struct v size id fields + | Tunion _ -> v + | _ -> assert false (* do not use on these arguments *) + +let is_true (v, _) = Value.is_true v +let is_false (v, _) = Value.is_false v + +let rec eval_expr localenv m (Expr (ee, tt)) = + match ee with + | Econst_int i -> + let v = eval_cast (Value.of_int i, Tint(I32, Signed), tt) in + ((v, tt),[]) + | Econst_float _ -> error_float () + | Evar id when is_function_type tt || is_big_type tt -> + let v = value_of_address (find_symbol localenv m id) in + ((v, tt), []) + | Evar id -> + let addr = find_symbol localenv m id in + let v = Mem.load m (size_of_ctype tt) addr in + ((v, tt), []) + | Ederef e when is_function_type tt || is_big_type tt -> + let ((v1,_),l1) = eval_expr localenv m e in + ((v1,tt),l1) + | Ederef e -> + let ((v1,_),l1) = eval_expr localenv m e in + let addr = address_of_value v1 in + let v = Mem.load m (size_of_ctype tt) addr in + ((v,tt),l1) + | Eaddrof exp -> + let ((addr,_),l) = eval_lvalue localenv m exp in + ((value_of_address addr,tt),l) + | Ebinop (op,exp1,exp2) -> + let (v1,l1) = eval_expr localenv m exp1 in + let (v2,l2) = eval_expr localenv m exp2 in + ((eval_binop tt v1 v2 op,tt),l1@l2) + | Eunop (op,exp) -> + let (e1,l1) = eval_expr localenv m exp in + ((eval_unop tt e1 op,tt),l1) + | Econdition (e1,e2,e3) -> + let (v1,l1) = eval_expr localenv m e1 in + if is_true v1 then let (v2,l2) = eval_expr localenv m e2 in (v2,l1@l2) + else + if is_false v1 then let (v3,l3) = eval_expr localenv m e3 in (v3,l1@l3) + else (v1,l1) + | Eandbool (e1,e2) -> + let (v1,l1) = eval_expr localenv m e1 in + if is_true v1 then let (v2,l2) = eval_expr localenv m e2 in (v2,l1@l2) + else (v1,l1) + | Eorbool (e1,e2) -> + let (v1,l1) = eval_expr localenv m e1 in + if is_false v1 then let (v2,l2) = eval_expr localenv m e2 in (v2,l1@l2) + else (v1,l1) + | Esizeof cty -> ((Value.of_int (sizeof cty),tt),[]) + | Efield (e1,id) -> + let ((v1,t1),l1) = eval_expr localenv m e1 in + let addr = address_of_value (get_offset v1 id t1) in + ((Mem.load m (size_of_ctype tt) addr, tt), l1) + | Ecost (lbl,e1) -> + let (v1,l1) = eval_expr localenv m e1 in + (v1,lbl::l1) + | Ecall _ -> assert false (* only used by the annotation process *) + | Ecast (cty,exp) -> + let ((v,ty),l1) = eval_expr localenv m exp in + ((eval_cast (v,ty,cty),tt),l1) + +and eval_lvalue localenv m (Expr (e,t)) = match e with + | Econst_int _ | Econst_float _ | Eaddrof _ | Eunop (_,_) | Ebinop (_,_,_) + | Ecast (_,_) | Econdition (_,_,_) | Eandbool (_,_) | Eorbool (_,_) + | Esizeof _ -> assert false (*Not allowed in left side of assignement*) + | Evar id -> ((find_symbol localenv m id,t),[]) + | Ederef ee -> + let ((v,_),l1) = eval_expr localenv m ee in + ((address_of_value v,t),l1) + | Efield (ee,id) -> + let ((v,tt),l1) = eval_expr localenv m ee in + let v' = get_offset v id tt in + ((address_of_value v', t), l1) + | Ecost (lbl,ee) -> + let (v,l) = eval_lvalue localenv m ee in + (v,lbl::l) + | Ecall _ -> assert false (* only used in the annotation process *) + +let eval_exprlist lenv mem es = + let f (vs, cost_lbls) e = + let ((v, _), cost_lbls') = eval_expr lenv mem e in + (vs @ [v], cost_lbls @ cost_lbls') in + List.fold_left f ([], []) es + + +let bind (mem, lenv) (x, ty) v = + let (mem, addr) = Mem.alloc mem (sizeof ty) in + let mem = Mem.store mem (sizeof ty) addr v in + let lenv = LocalEnv.add x addr lenv in + (mem, lenv) + +let bind_var (mem, lenv) (x, ty) = bind (mem, lenv) (x, ty) Value.undef + +let init_fun_env mem params args vars = + let lenv = LocalEnv.empty in + let (mem, lenv) = + try List.fold_left2 bind (mem, lenv) params args + with Invalid_argument _ -> error "wrong size of arguments." in + List.fold_left bind_var (mem, lenv) vars + +let assign m v ty ptr = Mem.store m (size_of_ctype ty) ptr v + + +let free_local_env mem lenv = + let f _ addr mem = Mem.free mem addr in + LocalEnv.fold f lenv mem + +let condition v a_true a_false = + if Value.is_false v then a_false + else if Value.is_true v then a_true + else error "undefined condition guard value." + +let eval_stmt f k e m s = match s, k with + | Sskip, Kseq(s,k) -> (State(f,s,k,e,m),[]) + | Sskip, Kwhile(a,s,k) -> (State(f,Swhile(a,s),k,e,m),[]) + | Sskip, Kdowhile(a,s,k) -> + let ((v1, _),l1) = eval_expr e m a in + let a_false = (State(f,Sskip,k,e,m),l1) in + let a_true = (State(f,Sdowhile(a,s),k,e,m),l1) in + condition v1 a_true a_false + | Sskip, Kfor3(a2,a3,s,k) -> (State(f,Sfor(Sskip,a2,a3,s),k,e,m),[]) + | Sskip, Kfor2(a2,a3,s,k) -> (State(f,a3,Kfor3(a2,a3,s,k),e,m),[]) + | Sskip, Kswitch k -> (State(f,Sskip,k,e,m),[]) + | Sskip, Kcall _ -> + let m' = free_local_env m e in + (Returnstate(Value.undef,k,m'),[]) + | Sassign(a1, a2), _ -> + let ((v1,t1),l1) = (eval_lvalue e m a1) in + let ((v2,t2),l2) = eval_expr e m a2 in + (State(f,Sskip,k,e,assign m v2 t1 v1),l1@l2) + | Scall(None,a,al), _ -> + let ((v1,_),l1) = eval_expr e m a in + let fd = Mem.find_fun_def m (address_of_value v1) in + let (vargs,l2) = eval_exprlist e m al in + (Callstate(fd,vargs,Kcall(None,f,e,k),m),l1@l2) + | Scall(Some lhs,a,al), _ -> + let ((v1,_),l1) = eval_expr e m a in + let fd = Mem.find_fun_def m (address_of_value v1) in + let (vargs,l2) = eval_exprlist e m al in + let (vt3,l3) = eval_lvalue e m lhs in + (Callstate(fd,vargs,Kcall(Some vt3,f,e,k),m),l1@l2@l3) + | Ssequence(s1,s2), _ -> (State(f,s1,Kseq(s2,k),e,m),[]) + | Sifthenelse(a,s1,s2), _ -> + let ((v1,_),l1) = eval_expr e m a in + let a_true = (State(f,s1,k,e,m),l1) in + let a_false = (State(f,s2,k,e,m),l1) in + condition v1 a_true a_false + | Swhile(a,s), _ -> + let ((v1,_),l1) = eval_expr e m a in + let a_false = (State(f,Sskip,k,e,m),l1) in + let a_true = (State(f,s,Kwhile(a,s,k),e,m),l1) in + condition v1 a_true a_false + | Sdowhile(a,s), _ -> (State(f,s,Kdowhile(a,s,k),e,m),[]) + | Sfor(Sskip,a2,a3,s), _ -> + let ((v1,_),l1) = eval_expr e m a2 in + let a_false = (State(f,Sskip,k,e,m),l1) in + let a_true = (State(f,s,Kfor2(a2,a3,s,k),e,m),l1) in + condition v1 a_true a_false + | Sfor(a1,a2,a3,s), _ -> (State(f,a1,Kseq(Sfor(Sskip,a2,a3,s),k),e,m),[]) + | Sbreak, Kseq(s,k) -> (State(f,Sbreak,k,e,m),[]) + | Sbreak, Kwhile(_,_,k) -> (State(f,Sskip,k,e,m),[]) + | Sbreak, Kdowhile(_,_,k) -> (State(f,Sskip,k,e,m),[]) + | Sbreak, Kfor2(_,_,_,k) -> (State(f,Sskip,k,e,m),[]) + | Sbreak, Kswitch k -> (State(f,Sskip,k,e,m),[]) + | Scontinue, Kseq(_,k) -> (State(f,Scontinue,k,e,m),[]) + | Scontinue, Kwhile(a,s,k) -> (State(f,Swhile(a,s),k,e,m),[]) + | Scontinue, Kdowhile(a,s,k) -> + let ((v1,_),l1) = eval_expr e m a in + let a_false = (State(f,Sskip,k,e,m),l1) in + let a_true = (State(f,Sdowhile(a,s),k,e,m),l1) in + condition v1 a_true a_false + | Scontinue, Kfor2(a2,a3,s,k) -> (State(f,a3,Kfor3(a2,a3,s,k),e,m),[]) + | Scontinue, Kswitch k -> (State(f,Scontinue,k,e,m),[]) + | Sreturn None, _ -> + let m' = free_local_env m e in + (Returnstate(Value.undef,(call_cont k),m'),[]) + | Sreturn (Some a), _ -> + let ((v1,_),l1) = eval_expr e m a in + let m' = free_local_env m e in + (Returnstate(v1,call_cont k,m'),l1) + | Sswitch(a,sl), _ -> + let ((v,_),l) = eval_expr e m a in + let n = Value.to_int v in + (State(f,(seq_of_labeled_statement (select_switch n sl)),Kswitch k,e,m),l) + | Slabel(lbl,s), _ -> (State(f,s,k,e,m),[]) + | Scost(lbl,s), _ -> (State(f,s,k,e,m),[lbl]) + | Sgoto lbl, _ -> + let (s', k') = find_label lbl f.fn_body (call_cont k) in + (State(f,s',k',e,m),[]) + | _ -> assert false (* should be impossible *) + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external k mem f args = + let (mem', v) = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> + let v = if List.length vs = 0 then Value.undef else List.hd vs in + (mem', v) + | (mem', InterpretExternal.A addr) -> (mem', value_of_address addr) in + Returnstate (v, k, mem') + +let step_call args cont mem = function + | Internal f -> + let (mem', e) = init_fun_env mem f.fn_params args f.fn_vars in + State (f, f.fn_body, cont, e, mem') + | External(id,targs,tres) when List.length targs = List.length args -> + interpret_external cont mem id args + | External(id,_,_) -> + error ("wrong size of arguments when calling external " ^ id ^ ".") + +let step = function + | State(f,stmt,k,e,m) -> eval_stmt f k e m stmt + | Callstate(fun_def,vargs,k,m) -> (step_call vargs k m fun_def,[]) + | Returnstate(v,Kcall(None,f,e,k),m) -> (State(f,Sskip,k,e,m),[]) + | Returnstate(v,Kcall((Some(vv, ty)),f,e,k),m) -> + let m' = assign m v ty vv in + (State(f,Sskip,k,e,m'),[]) + | _ -> error "state malformation." + + +let data_of_init_data = function + | Init_int8 i -> Data_int8 i + | Init_int16 i -> Data_int16 i + | Init_int32 i -> Data_int32 i + | Init_float32 f -> error_float () + | Init_float64 f -> error_float () + | Init_space i -> error "bad global initialization style." + | Init_addrof (x,off) -> assert false (* TODO: need the size of [x]'s cells *) + +let datas_of_init_datas = function + | [Init_space _] -> None + | l -> Some (List.map data_of_init_data l) + +let init_mem prog = + let f_var mem ((x, init_datas), ty) = + Mem.add_var mem x (ClightToCminor.sizeof_ctype ty) + (datas_of_init_datas init_datas) in + let mem = List.fold_left f_var Mem.empty prog.prog_vars in + let f_fun_def mem (f, def) = Mem.add_fun_def mem f def in + List.fold_left f_fun_def mem prog.prog_funct + +let compute_result v = + if Value.is_int v then IntValue.Int32.cast (Value.to_int_repr v) + else IntValue.Int32.zero + +let rec exec debug trace (state, l) = + let cost_labels = l @ trace in + let print_and_return_result res = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state state ; + match state with + | Returnstate(v,Kstop,_) -> (* Explicit return in main *) + print_and_return_result (compute_result v) + | State(_,Sskip,Kstop,_,_) -> (* Implicit return in main *) + print_and_return_result IntValue.Int32.zero + | state -> exec debug cost_labels (step state) + +let interpret debug prog = + Printf.printf "*** Clight interpret ***\n%!" ; + match prog.prog_main with + | None -> (IntValue.Int32.zero, []) + | Some main -> + let mem = init_mem prog in + let first_state = (Callstate (find_fundef main mem,[],Kstop,mem),[]) in + exec debug [] first_state diff --git a/src/clight/clightInterpret.mli b/src/clight/clightInterpret.mli new file mode 100644 index 0000000..93e0163 --- /dev/null +++ b/src/clight/clightInterpret.mli @@ -0,0 +1,7 @@ +(** This module provides a function to interpret a [Clight] program + and return the trace of cost labels encountered. This function + can also print debug informations. *) + +(** [interpret debug p] returns the trace of execution of program [p]. *) + +val interpret: bool -> Clight.program -> AST.trace diff --git a/src/clight/clightLabelling.ml b/src/clight/clightLabelling.ml new file mode 100644 index 0000000..fa2f1dc --- /dev/null +++ b/src/clight/clightLabelling.ml @@ -0,0 +1,165 @@ + +(** This module defines the labelling of a [Clight] program. *) + +open Clight +open CostLabel + + +(* Add a cost label in front of a statement. *) + +let add_starting_cost_label cost_universe stmt = + Clight.Scost (CostLabel.Gen.fresh cost_universe, stmt) + +(* Add a cost label at the end of a statement. *) + +let add_ending_cost_label cost_universe stmt = + Clight.Ssequence (stmt, add_starting_cost_label cost_universe Clight.Sskip) + + +let int_type = Tint (I32, AST.Signed) +let const_int i = Expr (Econst_int i, int_type) + + +let typeof e = let Expr (_,t) = e in t + + +let add_cost_label_e cost_universe e = + Expr (Ecost (CostLabel.Gen.fresh cost_universe, e), typeof e) + + +(* Add cost labels to an expression. *) + +let rec add_cost_labels_e cost_universe = function + | Expr (exp,cty) -> Expr (add_cost_labels_expr cost_universe exp,cty) + +and add_cost_labels_expr cost_universe exp = match exp with + | Econst_int _ | Econst_float _ | Evar _ | Esizeof _ -> exp + | Ederef e -> Ederef (add_cost_labels_e cost_universe e) + | Eaddrof e -> Eaddrof (add_cost_labels_e cost_universe e) + | Eunop (op,e) -> Eunop (op,(add_cost_labels_e cost_universe e)) + | Ebinop (op,e1,e2) -> + Ebinop (op, + add_cost_labels_e cost_universe e1, + add_cost_labels_e cost_universe e2) + | Ecast (t,e) -> Ecast (t, add_cost_labels_e cost_universe e) + | Eandbool (e1,e2) -> + let e1' = add_cost_labels_e cost_universe e1 in + let e2' = add_cost_labels_e cost_universe e2 in + let b1 = add_cost_label_e cost_universe (const_int 1) in + let b2 = add_cost_label_e cost_universe (const_int 0) in + let e2' = Expr (Econdition (e2', b1, b2), int_type) in + let e2' = add_cost_label_e cost_universe e2' in + let e3' = add_cost_label_e cost_universe (const_int 0) in + Econdition (e1', e2', e3') + | Eorbool (e1,e2) -> + let e1' = add_cost_labels_e cost_universe e1 in + let e2' = add_cost_label_e cost_universe (const_int 1) in + let e3' = add_cost_labels_e cost_universe e2 in + let b1 = add_cost_label_e cost_universe (const_int 1) in + let b2 = add_cost_label_e cost_universe (const_int 0) in + let e3' = Expr (Econdition (e3', b1, b2), int_type) in + let e3' = add_cost_label_e cost_universe e3' in + Econdition (e1', e2', e3') + | Efield (e,id) -> Efield (add_cost_labels_e cost_universe e,id) + | Econdition (e1,e2,e3) -> + let e1' = add_cost_labels_e cost_universe e1 in + let e2' = add_cost_labels_e cost_universe e2 in + let e2' = add_cost_label_e cost_universe e2' in + let e3' = add_cost_labels_e cost_universe e3 in + let e3' = add_cost_label_e cost_universe e3' in + Econdition (e1', e2', e3') + | Ecost (_,_) | Ecall _ -> assert false (* Should not happen *) + +let add_cost_labels_opt cost_universe = function + | None -> None + | Some e -> Some (add_cost_labels_e cost_universe e) + +let add_cost_labels_lst cost_universe l = + List.map (add_cost_labels_e cost_universe) l + + +(* Add cost labels to a statement. *) + +let rec add_cost_labels_st cost_universe = function + | Sskip -> Sskip + | Sassign (e1,e2) -> + Sassign (add_cost_labels_e cost_universe e1, + add_cost_labels_e cost_universe e2) + | Scall (e1,e2,lst) -> + Scall (add_cost_labels_opt cost_universe e1, + add_cost_labels_e cost_universe e2, + add_cost_labels_lst cost_universe lst) + | Ssequence (s1,s2) -> + Ssequence (add_cost_labels_st cost_universe s1, + add_cost_labels_st cost_universe s2) + | Sifthenelse (e,s1,s2) -> + let s1' = add_cost_labels_st cost_universe s1 in + let s1' = add_starting_cost_label cost_universe s1' in + let s2' = add_cost_labels_st cost_universe s2 in + let s2' = add_starting_cost_label cost_universe s2' in + Sifthenelse (add_cost_labels_e cost_universe e, s1', s2') + | Swhile (e,s) -> + let s' = add_cost_labels_st cost_universe s in + let s' = add_starting_cost_label cost_universe s' in + add_ending_cost_label cost_universe + (Swhile (add_cost_labels_e cost_universe e, s')) + | Sdowhile (e,s) -> + let s = add_cost_labels_st cost_universe s in + let s' = add_starting_cost_label cost_universe s in + add_ending_cost_label cost_universe + (Sdowhile (add_cost_labels_e cost_universe e, s')) + | Sfor (s1,e,s2,s3) -> + let s1' = add_cost_labels_st cost_universe s1 in + let s2' = add_cost_labels_st cost_universe s2 in + let s3' = add_cost_labels_st cost_universe s3 in + let s3' = add_starting_cost_label cost_universe s3' in + add_ending_cost_label cost_universe + (Sfor (s1', add_cost_labels_e cost_universe e, s2', s3')) + | Sreturn e -> Sreturn (add_cost_labels_opt cost_universe e) + | Sswitch (e,ls) -> + Sswitch (add_cost_labels_e cost_universe e, + add_cost_labels_ls cost_universe ls) + | Slabel (lbl,s) -> + let s' = add_cost_labels_st cost_universe s in + let s' = add_starting_cost_label cost_universe s' in + Slabel (lbl,s') + | Scost (_,_) -> assert false + | _ as stmt -> stmt + +and add_cost_labels_ls cost_universe = function + | LSdefault s -> + let s' = add_cost_labels_st cost_universe s in + let s' = add_starting_cost_label cost_universe s' in + LSdefault s' + | LScase (i,s,ls) -> + let s' = add_cost_labels_st cost_universe s in + let s' = add_starting_cost_label cost_universe s' in + LScase (i, s', add_cost_labels_ls cost_universe ls) + + +(* Add cost labels to a function. *) + +let add_cost_labels_f cost_universe = function + | (id,Internal fd) -> (id,Internal { + fn_return = fd.fn_return ; + fn_params = fd.fn_params ; + fn_vars = fd.fn_vars ; + fn_body = add_starting_cost_label cost_universe + (add_cost_labels_st cost_universe fd.fn_body) + }) + | (id,External (a,b,c)) -> (id,External (a,b,c)) + + +(** [add_cost_labels prog] inserts some labels to enable + cost annotation. *) + +let add_cost_labels p = + let labs = ClightAnnotator.all_labels p in + let labs = StringTools.Set.fold CostLabel.Set.add labs CostLabel.Set.empty in + let cost_prefix = CostLabel.Gen.fresh_prefix labs "__cost" in + let cost_universe = CostLabel.Gen.new_universe cost_prefix in + { + prog_funct = List.map (add_cost_labels_f cost_universe) p.prog_funct; + prog_main = p.prog_main; + prog_vars = p.prog_vars + } diff --git a/src/clight/clightLabelling.mli b/src/clight/clightLabelling.mli new file mode 100644 index 0000000..83c8e74 --- /dev/null +++ b/src/clight/clightLabelling.mli @@ -0,0 +1,22 @@ +(** This module defines the labelling of a [Clight] program. *) + +(** [add_cost_labels prog] inserts some labels to enable + cost annotation. + + The labelling of a function proceeds as follows: + + - A label is added at the beginning of the function. + + - For each branching instruction in the function, a cost label is added at + the beginning of each branch. The concerned instructions are: + - ternary expressions (includind boolean 'and' and 'or' operators that are + transformed at this point); + - conditionals; + - loops; + - switches. + + - For each label instruction in the function, a cost label is added after + the label, in order to capture loops potentially created by gotos. +*) + +val add_cost_labels : Clight.program -> Clight.program diff --git a/src/clight/clightLustre.ml b/src/clight/clightLustre.ml new file mode 100644 index 0000000..e8a2a87 --- /dev/null +++ b/src/clight/clightLustre.ml @@ -0,0 +1,44 @@ + + +let f_expr set locals e sub_exprs_res = + let e_res = match e with + | Clight.Expr (Clight.Evar id, _) -> + StringTools.Set.mem id set && not (List.mem id locals) + | _ -> false in + List.fold_left (||) false (e_res :: sub_exprs_res) + +let f_stmt _ sub_exprs_res sub_stmts_res = + List.fold_left (||) false (sub_exprs_res @ sub_stmts_res) + +let references_stmt set locals stmt = + ClightFold.statement2 (f_expr set locals) f_stmt stmt + +let references_funct set (id, def) = match def with + | Clight.Internal def -> + let locals = List.map fst (def.Clight.fn_params @ def.Clight.fn_vars) in + if references_stmt set locals def.Clight.fn_body then + StringTools.Set.add id set + else set + | _ -> set + +let references set p = + List.fold_left references_funct set p.Clight.prog_funct + + +let unsupported_functions p = + let rec fixpoint set = + let set' = references set p in + if StringTools.Set.equal set set' then set + else fixpoint set' in + fixpoint (StringTools.Set.of_list ["calloc" ; "memcpy"]) + + +let remove_functions functions p = + let f (id, _) = not (StringTools.Set.mem id functions) in + let functs = List.filter f p.Clight.prog_funct in + { p with Clight.prog_funct = functs } + + +let simplify p = + let unsupported = unsupported_functions p in + remove_functions unsupported p diff --git a/src/clight/clightLustre.mli b/src/clight/clightLustre.mli new file mode 100644 index 0000000..13488bf --- /dev/null +++ b/src/clight/clightLustre.mli @@ -0,0 +1,5 @@ + +(** [simplify p] removes in the Clight program [p] references to external + functions generated by the Lustre compiler and that we do not know of. *) + +val simplify : Clight.program -> Clight.program diff --git a/src/clight/clightLustreMain.ml b/src/clight/clightLustreMain.ml new file mode 100644 index 0000000..da864d7 --- /dev/null +++ b/src/clight/clightLustreMain.ml @@ -0,0 +1,197 @@ + +let error_prefix = "Clight-Lustre main" +let error s = Error.global_error error_prefix s + + +let extract_info lustre_test = + let error () = error ("bad format of file " ^ lustre_test) in + try + let ic = open_in lustre_test in + let step_fun = input_line ic in + let step_cost = input_line ic in + let cost_var = input_line ic in + let cost_incr = input_line ic in + let rec aux_external_costs () = + try + let s = input_line ic in + if s = "" then StringTools.Map.empty + else + if String.contains s ' ' then + let i = String.index s ' ' in + let extern_name = String.sub s 0 i in + let cost = String.sub s (i+1) ((String.length s) - (i+1)) in + StringTools.Map.add extern_name cost (aux_external_costs ()) + else error () + with End_of_file -> error () in + let rec aux_inputs () = + try + let s = input_line ic in + if s = "" then [] + else s :: (aux_inputs ()) + with End_of_file -> error () in + let rec aux_booleans () = + try + let s = input_line ic in + s :: (aux_booleans ()) + with End_of_file -> [] in + let external_costs = aux_external_costs () in + let inputs = aux_inputs () in + let booleans = aux_booleans () in + (booleans, inputs, step_fun, step_cost, + cost_var, cost_incr, external_costs) + with Sys_error _ | End_of_file -> error () + + +let define_void_external cost_incr arg_types ret_type cost_var = + let fresh = StringTools.make_fresh StringTools.Set.empty "x" in + let fn_return = ret_type in + let fn_params = List.map (fun t -> (fresh (), t)) arg_types in + let fn_vars = [] in + let int_type = Clight.Tint (Clight.I32, AST.Signed) in + let f_type = Clight.Tfunction ([int_type], Clight.Tvoid) in + let f = Clight.Expr (Clight.Evar cost_incr, f_type) in + let args = [Clight.Expr (Clight.Evar cost_var, int_type)] in + let fn_body = Clight.Scall (None, f, args) in + { Clight.fn_return = fn_return ; Clight.fn_params = fn_params ; + Clight.fn_vars = fn_vars ; Clight.fn_body = fn_body } + +let define_void_externals_funct cost_incr external_costs (id, def) = + let def' = match def with + | Clight.External (_, args, Clight.Tvoid) + when StringTools.Map.mem id external_costs -> + Clight.Internal + (define_void_external cost_incr args Clight.Tvoid + (StringTools.Map.find id external_costs)) + | _ -> def in + (id, def') + +let define_void_externals cost_incr external_costs p = + let prog_funct = + List.map + (define_void_externals_funct cost_incr external_costs) + p.Clight.prog_funct in + { p with Clight.prog_funct = prog_funct } + + +let get_struct_arg fun_name p = + let error () = + error ("could not fetch the structure of the context of function " ^ + fun_name ^ ".") in + if List.mem_assoc fun_name p.Clight.prog_funct then + match List.assoc fun_name p.Clight.prog_funct with + | Clight.Internal def when List.length def.Clight.fn_params = 1 -> + (match snd (List.hd def.Clight.fn_params) with + | Clight.Tpointer (Clight.Tstruct (struct_name, fields)) -> + (struct_name, fields) + | _ -> error ()) + | _ -> error () + else error () + +let first_init_field ctx (id, t) = match t with + | Clight.Tint _ -> ctx ^ "." ^ id ^ " = 0;\n" + | _ when id = "client_data" -> "" + | _ -> error ("unsupported type " ^ (ClightPrinter.string_of_ctype t) ^ ".") + +let init_fields ctx fields = + let f res field = res ^ (first_init_field ctx field) in + List.fold_left f "" fields + +let init_field + lustre_test_min_int lustre_test_max_int booleans inputs ctx (id, t) = + let lustre_full_range = (lustre_test_max_int - lustre_test_min_int) + 1 in + match t with + | Clight.Tint _ when List.mem id inputs && List.mem id booleans -> + ctx ^ "." ^ id ^ " = rand_bool();\n" + | Clight.Tint _ when List.mem id inputs -> + ctx ^ "." ^ id ^ " = rand_int(" ^ (string_of_int lustre_full_range) ^ + ") - " ^ (string_of_int lustre_test_min_int) ^ ";\n" + | _ when id = "client_data" || not (List.mem id inputs) -> "" + | _ -> error ("unsupported type " ^ (ClightPrinter.string_of_ctype t) ^ ".") + +let main_fields + lustre_test_min_int lustre_test_max_int booleans inputs ctx fields = + let f res field = + res ^ + (init_field + lustre_test_min_int lustre_test_max_int booleans inputs ctx field) in + List.fold_left f "" fields + +let main_def + lustre_test_cases lustre_test_cycles lustre_test_min_int lustre_test_max_int + (struct_name, fields) booleans inputs step_fun step_cost cost_var = + let ctx = "ctx" in + let reset_fun = Str.global_replace (Str.regexp "_step") "_reset" step_fun in + let big_init = init_fields ctx fields in + let init_inputs = + main_fields lustre_test_min_int lustre_test_max_int booleans inputs ctx + fields in + + "int main () {\n" ^ + (* Initializations *) + " " ^ struct_name ^ " " ^ ctx ^ ";\n" ^ + " int wcet = " ^ step_cost ^ ";\n" ^ + " int old_cost;\n" ^ + " int et = 0;\n" ^ + " int min = -1, max = -1, nb_cycles = 0\n;" ^ + " int i_case, i_cycle;\n" ^ + + (* Body *) + big_init ^ + " for (i_case = 0 ; i_case < " ^ (string_of_int lustre_test_cases) ^ + " ; i_case++) {\n" ^ + " old_cost = " ^ cost_var ^ ";\n" ^ + " " ^ reset_fun ^ "(&" ^ ctx ^ ");\n" ^ + " " ^ cost_var ^ " = old_cost;\n" ^ + " for (i_cycle = 0 ; i_cycle < " ^ (string_of_int lustre_test_cycles) ^ + " ; i_cycle++) {\n" ^ + init_inputs ^ + " old_cost = " ^ cost_var ^ ";\n" ^ + " " ^ step_fun ^ "(&" ^ ctx ^ ");\n" ^ + " et = " ^ cost_var ^ " - old_cost;\n" ^ + " if ((min == -1) || (et < min)) min = et;\n" ^ + " if ((max == -1) || (et > max)) max = et;\n" ^ + " nb_cycles++;\n" ^ + " }\n" ^ + " }\n" ^ + + (* Printing the results *) + " print_sint(wcet);\n" ^ + " newline();\n" ^ + " print_sint(min);\n" ^ + " newline();\n" ^ + " print_sint(max);\n" ^ + " newline();\n" ^ + " if (nb_cycles == 0) print_sint(-1);\n" ^ + " else print_sint(" ^ cost_var ^ "/nb_cycles);\n" ^ + " newline();\n" ^ + " return(0);\n" ^ + "}\n" + +let add_main_def + lustre_test_cases lustre_test_cycles lustre_test_min_int + lustre_test_max_int booleans inputs step_fun step_cost cost_var p = + let tmp_file = Filename.temp_file "lustre_add_main" ".c" in + try + let struct_arg = get_struct_arg step_fun p in + let s = + (ClightPrinter.print_program p) ^ + (main_def + lustre_test_cases lustre_test_cycles lustre_test_min_int + lustre_test_max_int struct_arg booleans inputs + step_fun step_cost cost_var) in + let oc = open_out tmp_file in + output_string oc s ; + close_out oc ; + ClightParser.process (`Filename tmp_file) + with Sys_error _ -> + error ("could not save temporary file " ^ tmp_file ^ " with main.") + + +let add lustre_test lustre_test_cases lustre_test_cycles + lustre_test_min_int lustre_test_max_int p = + let (booleans, inputs, step_fun, step_cost, + cost_var, cost_incr, external_costs) = + extract_info lustre_test in + let p = define_void_externals cost_incr external_costs p in + add_main_def lustre_test_cases lustre_test_cycles lustre_test_min_int + lustre_test_max_int booleans inputs step_fun step_cost cost_var p diff --git a/src/clight/clightLustreMain.mli b/src/clight/clightLustreMain.mli new file mode 100644 index 0000000..8108407 --- /dev/null +++ b/src/clight/clightLustreMain.mli @@ -0,0 +1,11 @@ + +(** [add_lustre_main lustre_test lustre_test_cases lustre_test_cycles + lustre_test_min_int lustre_test_max_int ast] adds a main function that tests + a Lustre step function to a Clight AST. The file [lustre_test] contains + CerCo information (e.g. the name of the cost variable). The integer + [lustre_test_cases] is the number of test cases that are performed, and the + integer [lustre_test_cycles] is the number of cycles per test + case. [lustre_test_min_int] (resp. [lustre_test_max_int]) is the minimum + (resp. maximum) integer value randomly generated during testing, and. *) + +val add : string -> int -> int -> int -> int -> Clight.program -> Clight.program diff --git a/src/clight/clightParser.ml b/src/clight/clightParser.ml new file mode 100644 index 0000000..1f33665 --- /dev/null +++ b/src/clight/clightParser.ml @@ -0,0 +1,72 @@ + +let process_filename ?is_lustre_file ?remove_lustre_externals file = + let temp_dir = Filename.dirname file in + let tmp_file1 = Filename.temp_file ~temp_dir "cparser1" ".c" + and tmp_file2 = Filename.temp_file ~temp_dir "cparser2" ".i" + and prepro_opts = [] in + + (* Add CerCo's primitives *) + let _ = + try + let oc = open_out tmp_file1 in + if is_lustre_file = Some true || remove_lustre_externals = Some true then + output_string oc "#include"; + output_string oc Primitive.prototypes ; + close_out oc + with Sys_error _ -> failwith "Error adding primitive prototypes." in + let rc = Sys.command + (Printf.sprintf "cat %s >> %s" + (Filename.quote file) (Filename.quote tmp_file1)) in + if rc <> 0 then ( + Misc.SysExt.safe_remove tmp_file1; + failwith "Error adding primitive prototypes." + ); + + (* Preprocessing *) + Cparser.Builtins.set Cparser.GCC.builtins; + let rc = Sys.command + (Printf.sprintf "gcc -E -U__GNUC__ %s %s > %s" + (String.concat " " (List.map Filename.quote prepro_opts)) + (Filename.quote tmp_file1) (Filename.quote tmp_file2)) in + if rc <> 0 then ( + Misc.SysExt.safe_remove tmp_file1; + Misc.SysExt.safe_remove tmp_file2; + failwith "Error calling gcc." + ); + + (* C to Cil *) + let ic = open_in tmp_file2 in + let lexbuf = Lexing.from_channel ic in + lexbuf.Lexing.lex_curr_p <- { lexbuf.Lexing.lex_curr_p with Lexing.pos_fname = tmp_file2 }; + let r = Cparser.Parse.preprocessed_file "CSf" file lexbuf in + close_in ic; + match r with + | None -> failwith "Error during C parsing." + | Some p -> + (* Cil to Clight *) + (match ClightFromC.convertProgram p with + | None -> failwith "Error during C to Clight pass." + | Some(pp) -> + Misc.SysExt.safe_remove tmp_file1; + Misc.SysExt.safe_remove tmp_file2; + if remove_lustre_externals = Some true then ClightLustre.simplify pp + else pp) + +let process_source name contents = + let lexbuf = Lexing.from_string contents in + let r = Cparser.Parse.preprocessed_file "CSf" name lexbuf in + match r with + | None -> failwith "Error during C parsing." + | Some p -> + (* Cil to Clight *) + (match ClightFromC.convertProgram p with + | None -> failwith "Error during C to Clight pass." + | Some (pp) -> + pp) + +let process ?is_lustre_file ?remove_lustre_externals = function + | `Filename file -> + process_filename ?is_lustre_file ?remove_lustre_externals file + | `Source (name, contents) -> + process_source name contents + diff --git a/src/clight/clightParser.mli b/src/clight/clightParser.mli new file mode 100644 index 0000000..f8c41a0 --- /dev/null +++ b/src/clight/clightParser.mli @@ -0,0 +1,10 @@ + +(** This module implements a parser for [C] based on [gcc] and + [CIL]. *) + +(** [process ?is_lustre_file ?remove_lustre_externals filename] parses the + contents of [filename] to obtain an abstract syntax tree that represents a + Clight program. *) +val process : + ?is_lustre_file:bool -> ?remove_lustre_externals:bool -> + [`Filename of string | `Source of string * string] -> Clight.program diff --git a/src/clight/clightPrinter.ml b/src/clight/clightPrinter.ml new file mode 100644 index 0000000..89ce4a3 --- /dev/null +++ b/src/clight/clightPrinter.ml @@ -0,0 +1,562 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(** Pretty-printer for Csyntax *) + +open Format +open AST +open Clight + +let name_unop = function + | Onotbool -> "!" + | Onotint -> "~" + | Oneg -> "-" + + +let name_binop = function + | Oadd -> "+" + | Osub -> "-" + | Omul -> "*" + | Odiv -> "/" + | Omod -> "%" + | Oand -> "&" + | Oor -> "|" + | Oxor -> "^" + | Oshl -> "<<" + | Oshr -> ">>" + | Oeq -> "==" + | One -> "!=" + | Olt -> "<" + | Ogt -> ">" + | Ole -> "<=" + | Oge -> ">=" + +let name_inttype sz sg = + match sz, sg with + | I8, Signed -> "signed char" + | I8, Unsigned -> "unsigned char" + | I16, Signed -> "short" + | I16, Unsigned -> "unsigned short" + | I32, Signed -> "int" + | I32, Unsigned -> "unsigned int" + +let name_floattype sz = + match sz with + | F32 -> "float" + | F64 -> "double" + +(* Collecting the names and fields of structs and unions *) + +module StructUnionSet = Set.Make(struct + type t = string * (ident*ctype) list + let compare (n1, _ : t) (n2, _ : t) = compare n1 n2 +end) + +let struct_unions = ref StructUnionSet.empty + +let register_struct_union id fld = + struct_unions := StructUnionSet.add (id, fld) !struct_unions + +(* Declarator (identifier + type) *) + +let name_optid id = + if id = "" then "" else " " ^ id + +let parenthesize_if_pointer id = + if String.length id > 0 && id.[0] = '*' then "(" ^ id ^ ")" else id + +let rec name_cdecl id ty = + match ty with + | Tvoid -> + "void" ^ name_optid id + | Tint(sz, sg) -> + name_inttype sz sg ^ name_optid id + | Tfloat sz -> + name_floattype sz ^ name_optid id + | Tpointer t -> + name_cdecl ("*" ^ id) t + | Tarray(t, n) -> + name_cdecl + (sprintf "%s[%ld]" (parenthesize_if_pointer id) (Int32.of_int n)) + t + | Tfunction(args, res) -> + let b = Buffer.create 20 in + if id = "" + then Buffer.add_string b "(*)" + else Buffer.add_string b (parenthesize_if_pointer id); + Buffer.add_char b '('; + begin match args with + | [] -> + Buffer.add_string b "void" + | _ -> + let rec add_args first = function + | [] -> () + | t1::tl -> + if not first then Buffer.add_string b ", "; + Buffer.add_string b (name_cdecl "" t1); + add_args false tl in + add_args true args + end; + Buffer.add_char b ')'; + name_cdecl (Buffer.contents b) res + | Tstruct(name, fld) -> + name ^ name_optid id + | Tunion(name, fld) -> + name ^ name_optid id + | Tcomp_ptr name -> + name ^ " *" ^ id + +(* Type *) + +let name_type ty = name_cdecl "" ty + +(* Expressions *) + +let parenthesis_level (Expr (e, ty)) = + match e with + | Econst_int _ -> 0 + | Econst_float _ -> 0 + | Evar _ -> 0 + | Eunop(_, _) -> 30 + | Ederef _ -> 20 + | Eaddrof _ -> 30 + | Ebinop(op, _, _) -> + begin match op with + | Oand | Oor | Oxor -> 75 + | Oeq | One | Olt | Ogt | Ole | Oge -> 70 + | Oadd | Osub | Oshl | Oshr -> 60 + | Omul | Odiv | Omod -> 40 + end + | Ecast _ -> 30 + | Econdition(_, _, _) -> 80 + | Eandbool(_, _) -> 80 + | Eorbool(_, _) -> 80 + | Esizeof _ -> 20 + | Efield _ -> 20 + | Ecost (_,_) -> 20 + | Ecall (_,_,_) -> 20 + +let rec print_expr p (Expr (eb, ty) as e) = + let level = parenthesis_level e in + match eb with + | Econst_int n -> + fprintf p "%ld" (Int32.of_int n) + | Econst_float f -> + fprintf p "%F" f + | Evar id -> + fprintf p "%s" id + | Eunop(op, e1) -> + fprintf p "%s%a" (name_unop op) print_expr_prec (level, e1) + | Ederef (Expr (Ebinop(Oadd, e1, e2), _)) -> + fprintf p "@[%a@,[%a]@]" + print_expr_prec (level, e1) + print_expr_prec (level, e2) + | Ederef (Expr (Efield(e1, id), _)) -> + fprintf p "%a->%s" print_expr_prec (level, e1) id + | Ederef e -> + fprintf p "*%a" print_expr_prec (level, e) + | Eaddrof e -> + fprintf p "&%a" print_expr_prec (level, e) + | Ebinop(op, e1, e2) -> + fprintf p "@[%a@ %s %a@]" + print_expr_prec (level, e1) + (name_binop op) + print_expr_prec (level, e2) + | Ecast(ty, e1) -> + fprintf p "@[(%s)@,%a@]" + (name_type ty) + print_expr_prec (level, e1) + | Econdition(e1, e2, e3) -> + fprintf p "@[%a@ ? %a@ : %a@]" + print_expr_prec (level, e1) + print_expr_prec (level, e2) + print_expr_prec (level, e3) + | Eandbool(e1, e2) -> + fprintf p "@[%a@ && %a@]" + print_expr_prec (level, e1) + print_expr_prec (level, e2) + | Eorbool(e1, e2) -> + fprintf p "@[%a@ || %a@]" + print_expr_prec (level, e1) + print_expr_prec (level, e2) + | Esizeof ty -> + fprintf p "sizeof(%s)" (name_type ty) + | Efield(e1, id) -> + fprintf p "%a.%s" print_expr_prec (level, e1) id + | Ecost (lbl,e1) -> + fprintf p "(/* %s */ %a)" lbl print_expr e1 + | Ecall (f, arg, e) -> + fprintf p "(%s(%a), %a)" f print_expr arg print_expr e + +and print_expr_prec p (context_prec, e) = + let this_prec = parenthesis_level e in + if this_prec >= context_prec + then fprintf p "(%a)" print_expr e + else print_expr p e + +let rec print_expr_list p (first, el) = + match el with + | [] -> () + | e1 :: et -> + if not first then fprintf p ",@ "; + print_expr p e1; + print_expr_list p (false, et) + +let rec print_stmt p s = + match s with + | Sskip -> + fprintf p "/*skip*/;" + | Sassign(e1, e2) -> + fprintf p "@[%a =@ %a;@]" print_expr e1 print_expr e2 + | Scall(None, e1, el) -> + fprintf p "@[%a@,(@[%a@]);@]" + print_expr e1 + print_expr_list (true, el) + | Scall(Some lhs, e1, el) -> + fprintf p "@[%a =@ %a@,(@[%a@]);@]" + print_expr lhs + print_expr e1 + print_expr_list (true, el) + | Ssequence(s1, s2) -> + fprintf p "%a@ %a" print_stmt s1 print_stmt s2 + | Sifthenelse(e, s1, Sskip) -> + fprintf p "@[if (%a) {@ %a@;<0 -2>}@]" + print_expr e + print_stmt s1 + | Sifthenelse(e, s1, s2) -> + fprintf p "@[if (%a) {@ %a@;<0 -2>} else {@ %a@;<0 -2>}@]" + print_expr e + print_stmt s1 + print_stmt s2 + | Swhile(e, s) -> + fprintf p "@[while (%a) {@ %a@;<0 -2>}@]" + print_expr e + print_stmt s + | Sdowhile(e, s) -> + fprintf p "@[do {@ %a@;<0 -2>} while(%a);@]" + print_stmt s + print_expr e + | Sfor(s_init, e, s_iter, s_body) -> + fprintf p "@[for (@[%a;@ %a;@ %a) {@]@ %a@;<0 -2>}@]" + print_stmt_for s_init + print_expr e + print_stmt_for s_iter + print_stmt s_body + | Sbreak -> + fprintf p "break;" + | Scontinue -> + fprintf p "continue;" + | Sswitch(e, cases) -> + fprintf p "@[switch (%a) {@ %a@;<0 -2>}@]" + print_expr e + print_cases cases + | Sreturn None -> + fprintf p "return;" + | Sreturn (Some e) -> + fprintf p "return %a;" print_expr e + | Slabel(lbl, s1) -> + fprintf p "%s:@ %a" lbl print_stmt s1 + | Sgoto lbl -> + fprintf p "goto %s;" lbl + | Scost (lbl,s1) -> + fprintf p "%s:@ %a" lbl print_stmt s1 + +and print_cases p cases = + match cases with + | LSdefault Sskip -> + () + | LSdefault s -> + fprintf p "@[default:@ %a@]" print_stmt s + | LScase(lbl, Sskip, rem) -> + fprintf p "case %ld:@ %a" + (Int32.of_int lbl) + print_cases rem + | LScase(lbl, s, rem) -> + fprintf p "@[case %ld:@ %a@]@ %a" + (Int32.of_int lbl) + print_stmt s + print_cases rem + +and print_stmt_for p s = + match s with + | Sskip -> + fprintf p "/*nothing*/" + | Sassign(e1, e2) -> + fprintf p "%a = %a" print_expr e1 print_expr e2 + | Ssequence(s1, s2) -> + fprintf p "%a, %a" print_stmt_for s1 print_stmt_for s2 + | Scall(None, e1, el) -> + fprintf p "@[%a@,(@[%a@])@]" + print_expr e1 + print_expr_list (true, el) + | Scall(Some lhs, e1, el) -> + fprintf p "@[%a =@ %a@,(@[%a@])@]" + print_expr lhs + print_expr e1 + print_expr_list (true, el) + | _ -> + fprintf p "({ %a })" print_stmt s + +let name_function_parameters fun_name params = + let b = Buffer.create 20 in + Buffer.add_string b fun_name; + Buffer.add_char b '('; + begin match params with + | [] -> + Buffer.add_string b "void" + | _ -> + let rec add_params first = function + | [] -> () + | (id, ty) :: rem -> + if not first then Buffer.add_string b ", "; + Buffer.add_string b (name_cdecl id ty); + add_params false rem in + add_params true params + end; + Buffer.add_char b ')'; + Buffer.contents b + +let print_function p id f = + fprintf p "%s@ " + (name_cdecl (name_function_parameters id f.fn_params) + f.fn_return); + fprintf p "@[{@ "; + List.iter + (fun ((id, ty)) -> + fprintf p "%s;@ " (name_cdecl id ty)) + f.fn_vars; + print_stmt p f.fn_body; + fprintf p "@;<0 -2>}@]@ @ " + +let print_fundef p (id, fd) = + match fd with + | External(_, args, res) -> + fprintf p "extern %s;@ @ " + (name_cdecl id (Tfunction(args, res))) + | Internal f -> + print_function p id f + +let string_of_init id = + let b = Buffer.create (List.length id) in + let add_init = function + | Init_int8 n -> + if n >= 32 && n <= 126 && n <> Char.code '\"' && n <> Char.code '\\' + then Buffer.add_char b (Char.chr n) + else Buffer.add_string b (Printf.sprintf "\\%03o" n) + | _ -> + assert false + in List.iter add_init id; Buffer.contents b + +let chop_last_nul id = + match List.rev id with + | Init_int8 0 :: tl -> List.rev tl + | _ -> id + +let print_init p = function + | Init_int8 n -> fprintf p "%ld,@ " (Int32.of_int n) + | Init_int16 n -> fprintf p "%ld,@ " (Int32.of_int n) + | Init_int32 n -> fprintf p "%ld,@ " (Int32.of_int n) + | Init_float32 n -> fprintf p "%F,@ " n + | Init_float64 n -> fprintf p "%F,@ " n + | Init_space n -> fprintf p "/* skip %ld, */@ " (Int32.of_int n) + | Init_addrof(symb, ofs) -> + let ofs = Int32.of_int ofs in + if ofs = Int32.zero + then fprintf p "&%s,@ " symb + else fprintf p "(void *)((char *)&%s + %ld),@ " symb ofs + +let print_init1 p = function + | Init_int8 n -> fprintf p "%ld" (Int32.of_int n) + | Init_int16 n -> fprintf p "%ld" (Int32.of_int n) + | Init_int32 n -> fprintf p "%ld" (Int32.of_int n) + | Init_float32 n -> fprintf p "%F" n + | Init_float64 n -> fprintf p "%F" n + | Init_space n -> fprintf p "/* skip %ld */" (Int32.of_int n) + | Init_addrof(symb, ofs) -> + let ofs = Int32.of_int ofs in + if ofs = Int32.zero + then fprintf p "&%s" symb + else fprintf p "(void *)((char *)&%s + %ld)" symb ofs + +let match_string_literal s pos = + let s_len = String.length s - 1 in + let prefix = "__stringlit_" in + let len_prefix = String.length prefix in + s_len >= len_prefix + && String.sub s 0 len_prefix = prefix && + match Misc.LexingExt.lex_num s len_prefix with + | None -> false + | Some (pos, pos', v) -> pos' = String.length s - 1 + +let print_globvar p (((id, init), ty)) = + match init with + | [] -> + fprintf p "extern %s;@ @ " + (name_cdecl id ty) + | [Init_space _] -> + fprintf p "%s;@ @ " + (name_cdecl id ty) + | [init] -> + fprintf p "@[%s = %a;@]@ @ " + (name_cdecl id ty) print_init1 init + | _ -> + fprintf p "@[%s = " + (name_cdecl id ty); + if match_string_literal id 0 + && List.for_all (function Init_int8 _ -> true | _ -> false) init + then + fprintf p "\"%s\"" (string_of_init (chop_last_nul init)) + else begin + fprintf p "{@ "; + List.iter (print_init p) init; + fprintf p "}" + end; + fprintf p ";@]@ @ " + +(* Collect struct and union types *) + +let rec collect_type = function + | Tvoid -> () + | Tint(sz, sg) -> () + | Tfloat sz -> () + | Tpointer t -> collect_type t + | Tarray(t, n) -> collect_type t + | Tfunction(args, res) -> collect_type_list args; collect_type res + | Tstruct(id, fld) -> register_struct_union id fld; collect_fields fld + | Tunion(id, fld) -> register_struct_union id fld; collect_fields fld + | Tcomp_ptr _ -> () + +and collect_type_list = function + | [] -> () + | hd::tl -> collect_type hd; collect_type_list tl + +and collect_fields = function + | [] -> () + | (id, hd)::tl -> collect_type hd; collect_fields tl + +let rec collect_expr (Expr(ed, ty)) = + match ed with + | Econst_int n -> () + | Econst_float f -> () + | Evar id -> () + | Eunop(op, e1) -> collect_expr e1 + | Ederef e -> collect_expr e + | Eaddrof e -> collect_expr e + | Ebinop(op, e1, e2) -> collect_expr e1; collect_expr e2 + | Ecast(ty, e1) -> collect_type ty; collect_expr e1 + | Econdition(e1, e2, e3) -> collect_expr e1; collect_expr e2; collect_expr e3 + | Eandbool(e1, e2) -> collect_expr e1; collect_expr e2 + | Eorbool(e1, e2) -> collect_expr e1; collect_expr e2 + | Esizeof ty -> collect_type ty + | Efield(e1, id) -> collect_expr e1 + | Ecost(_, e) -> collect_expr e + | Ecall(_, arg, e) -> collect_expr arg; collect_expr e + +let rec collect_expr_list = function + | [] -> () + | hd :: tl -> collect_expr hd; collect_expr_list tl + +let rec collect_stmt = function + | Sskip -> () + | Sassign(e1, e2) -> collect_expr e1; collect_expr e2 + | Scall(None, e1, el) -> collect_expr e1; collect_expr_list el + | Scall(Some lhs, e1, el) -> collect_expr lhs; collect_expr e1; collect_expr_list el + | Ssequence(s1, s2) -> collect_stmt s1; collect_stmt s2 + | Sifthenelse(e, s1, s2) -> collect_expr e; collect_stmt s1; collect_stmt s2 + | Swhile(e, s) -> collect_expr e; collect_stmt s + | Sdowhile(e, s) -> collect_stmt s; collect_expr e + | Sfor(s_init, e, s_iter, s_body) -> + collect_stmt s_init; collect_expr e; + collect_stmt s_iter; collect_stmt s_body + | Sbreak -> () + | Scontinue -> () + | Sswitch(e, cases) -> collect_expr e; collect_cases cases + | Sreturn None -> () + | Sreturn (Some e) -> collect_expr e + | Slabel(lbl, s) -> collect_stmt s + | Sgoto lbl -> () + | Scost (_,s1) -> collect_stmt s1 + +and collect_cases = function + | LSdefault s -> collect_stmt s + | LScase(lbl, s, rem) -> collect_stmt s; collect_cases rem + +let collect_function f = + collect_type f.fn_return; + List.iter (fun ((id, ty)) -> collect_type ty) f.fn_params; + List.iter (fun ((id, ty)) -> collect_type ty) f.fn_vars; + collect_stmt f.fn_body + +let collect_fundef ((id, fd)) = + match fd with + | External(_, args, res) -> collect_type_list args; collect_type res + | Internal f -> collect_function f + +let collect_globvar (((id, init), ty)) = + collect_type ty + +let collect_program p = + List.iter collect_globvar p.prog_vars; + List.iter collect_fundef p.prog_funct + +let declare_struct_or_union p (name, fld) = + fprintf p "%s;@ @ " name + +let print_struct_or_union p (name, fld) = + fprintf p "@[%s {" name; + let rec print_fields = function + | [] -> () + | (id, ty)::rem -> + fprintf p "@ %s;" (name_cdecl id ty); + print_fields rem in + print_fields fld; + fprintf p "@;<0 -2>};@]@ " + +let print_program_2 p prog = + struct_unions := StructUnionSet.empty; + collect_program prog; + fprintf p "@["; + StructUnionSet.iter (declare_struct_or_union p) !struct_unions; + StructUnionSet.iter (print_struct_or_union p) !struct_unions; + List.iter (print_globvar p) prog.prog_vars; + List.iter (print_fundef p) prog.prog_funct; + fprintf p "@]@." + +let print_program prog = + print_program_2 str_formatter prog; + flush_str_formatter () + +let string_of_ctype = name_type + +let print_expression e = + print_expr str_formatter e; + flush_str_formatter () + +let print_statement s = + print_stmt str_formatter s; + flush_str_formatter () + +let print_ctype_prot = name_type + +let print_ctype_def = function + | Tstruct (name, fld) | Tunion (name, fld) -> + let f_fld s (id, t) = s ^ " " ^ (print_ctype_prot t) ^ " " ^ id ^ ";\n" in + let s_fld = List.fold_left f_fld "" in + name ^ " {\n" ^ (s_fld fld) ^ "};\n" + | _ -> "" (* no definition associated to the other types *) + +let string_of_unop = name_unop + +let string_of_binop = name_binop diff --git a/src/clight/clightPrinter.mli b/src/clight/clightPrinter.mli new file mode 100644 index 0000000..32952bf --- /dev/null +++ b/src/clight/clightPrinter.mli @@ -0,0 +1,18 @@ +(** This module provides functions to print elements of [Clight] + programs. *) + +val print_program: Clight.program -> string + +val print_expression: Clight.expr -> string + +val string_of_ctype: Clight.ctype -> string + +val print_statement: Clight.statement -> string + +val print_ctype_prot: Clight.ctype -> string + +val print_ctype_def: Clight.ctype -> string + +val string_of_unop : Clight.unary_operation -> string + +val string_of_binop : Clight.binary_operation -> string diff --git a/src/clight/clightSwitch.ml b/src/clight/clightSwitch.ml new file mode 100644 index 0000000..159c278 --- /dev/null +++ b/src/clight/clightSwitch.ml @@ -0,0 +1,71 @@ + +(** This module performs a switch simplification: they are replaced by + equivalent if-then-else statements. This is a temporary hack before + implementing switch tables. *) + +let type_of (Clight.Expr (_, t)) = t + + +let f_expr e _ = e + +let f_stmt lbl stmt sub_exprs_res sub_stmts_res = + match stmt, sub_stmts_res with + | Clight.Sbreak, _ -> Clight.Sgoto lbl + | Clight.Swhile _, _ | Clight.Sdowhile _, _ + | Clight.Sfor _, _ | Clight.Sswitch _, _ -> stmt + | _ -> ClightFold.statement_fill_subs stmt sub_exprs_res sub_stmts_res + +let replace_undeep_break lbl = ClightFold.statement2 f_expr (f_stmt lbl) + + +let add_starting_lbl fresh stmt = + let lbl = fresh () in + (lbl, Clight.Slabel (lbl, stmt)) + +let add_starting_lbl_list fresh stmts = List.map (add_starting_lbl fresh) stmts + +let add_ending_goto lbl stmt = + Clight.Ssequence (stmt, Clight.Slabel (lbl, Clight.Sskip)) + +let make_sequence stmts = + let f sequence stmt = Clight.Ssequence (sequence, stmt) in + List.fold_left f Clight.Sskip stmts + +let simplify_switch fresh e cases stmts = + let exit_lbl = fresh () in + let (lbls, stmts) = List.split (add_starting_lbl_list fresh stmts) in + let stmts = List.map (replace_undeep_break exit_lbl) stmts in + let rec aux cases lbls = match cases, lbls with + | Clight.LSdefault _, lbl :: _ -> [Clight.Sgoto lbl] + | Clight.LScase (i, _, cases), lbl :: lbls -> + let next_cases = aux cases lbls in + let ret_type = Clight.Tint (Clight.I32, AST.Signed) in + let cst_i = Clight.Expr (Clight.Econst_int i, type_of e) in + let test = Clight.Expr (Clight.Ebinop (Clight.Oeq, e, cst_i), ret_type) in + Clight.Sifthenelse (test, Clight.Sgoto lbl, Clight.Sskip) :: next_cases + | _ -> + (* Do not use on these arguments: wrong list size. *) + assert false in + add_ending_goto exit_lbl (make_sequence ((aux cases lbls) @ stmts)) + +let f_expr e _ = e + +let f_stmt fresh stmt sub_exprs_res sub_stmts_res = + match stmt, sub_stmts_res with + | Clight.Sswitch (e, cases), sub_stmts -> + simplify_switch fresh e cases sub_stmts + | _ -> ClightFold.statement_fill_subs stmt sub_exprs_res sub_stmts_res + +let simplify_statement fresh = ClightFold.statement2 f_expr (f_stmt fresh) + +let simplify_fundef fresh = function + | Clight.Internal cfun -> + let fn_body = simplify_statement fresh cfun.Clight.fn_body in + Clight.Internal { cfun with Clight.fn_body = fn_body } + | fundef -> fundef + +let simplify p = + let labels = ClightAnnotator.all_labels p in + let fresh = StringTools.make_fresh labels "_tmp_switch" in + let f (id, fundef) = (id, simplify_fundef fresh fundef) in + { p with Clight.prog_funct = List.map f p.Clight.prog_funct } diff --git a/src/clight/clightSwitch.mli b/src/clight/clightSwitch.mli new file mode 100644 index 0000000..2de5c4d --- /dev/null +++ b/src/clight/clightSwitch.mli @@ -0,0 +1,6 @@ + +(** This module performs a switch simplification: they are replaced by + equivalent if-then-else statements. This is a temporary hack before + implementing switch tables. *) + +val simplify : Clight.program -> Clight.program diff --git a/src/clight/clightToCminor.ml b/src/clight/clightToCminor.ml new file mode 100644 index 0000000..5d19dbb --- /dev/null +++ b/src/clight/clightToCminor.ml @@ -0,0 +1,626 @@ + + +let error_prefix = "Clight to Cminor" +let error = Error.global_error error_prefix +let error_float () = error "float not supported." + + +(* General helpers *) + +let clight_type_of (Clight.Expr (_, t)) = t + +let cminor_type_of (Cminor.Expr (_, t)) = t + + +(* Translate types *) + +let byte_size_of_intsize = function + | Clight.I8 -> 1 + | Clight.I16 -> 2 + | Clight.I32 -> 4 + +let sig_type_of_ctype = function + | Clight.Tvoid -> assert false (* do not use on this argument *) + | Clight.Tint (intsize, sign) -> + AST.Sig_int (byte_size_of_intsize intsize, sign) + | Clight.Tfloat _ -> error_float () + | Clight.Tfunction _ | Clight.Tstruct _ | Clight.Tunion _ + | Clight.Tpointer _ | Clight.Tarray _ | Clight.Tcomp_ptr _ -> AST.Sig_ptr + +let translate_args_types = List.map sig_type_of_ctype + +let type_return_of_ctype = function + | Clight.Tvoid -> AST.Type_void + | t -> AST.Type_ret (sig_type_of_ctype t) + +let quantity_of_sig_type = function + | AST.Sig_int (size, _) -> AST.QInt size + | AST.Sig_float _ -> error_float () + | AST.Sig_offset -> AST.QOffset + | AST.Sig_ptr -> AST.QPtr + +let quantity_of_ctype t = quantity_of_sig_type (sig_type_of_ctype t) + +let rec sizeof_ctype = function + | Clight.Tvoid | Clight.Tfunction _ -> AST.SQ (AST.QInt 1) + | Clight.Tfloat _ -> error_float () + | Clight.Tint (size, _) -> AST.SQ (AST.QInt (byte_size_of_intsize size)) + | Clight.Tpointer _ + | Clight.Tcomp_ptr _ -> AST.SQ AST.QPtr + | Clight.Tarray (t, n) -> AST.SArray (n, sizeof_ctype t) + | Clight.Tstruct (_, fields) -> + AST.SProd (List.map sizeof_ctype (List.map snd fields)) + | Clight.Tunion (_, fields) -> + AST.SSum (List.map sizeof_ctype (List.map snd fields)) + +let global_size_of_ctype = sizeof_ctype + + +(** Helpers on abstract sizes and offsets *) + +let max_stacksize size1 size2 = match size1, size2 with + | AST.SProd l1, AST.SProd l2 when List.length l1 > List.length l2 -> size1 + | AST.SProd l1, AST.SProd l2 -> size2 + | _ -> raise (Failure "ClightToCminor.max_stacksize") + +(** Hypothesis: [offset1] is a prefix of [offset2] or vice-versa. *) +let max_offset offset1 offset2 = + if List.length offset1 > List.length offset2 then offset1 + else offset2 + +let next_depth = function + | AST.SProd l -> List.length l + | _ -> raise (Failure "ClightToCminor.next_offset") + +let add_stack offset = + let e1 = Cminor.Expr (Cminor.Cst AST.Cst_stack, AST.Sig_ptr) in + let e2 = Cminor.Expr (Cminor.Cst (AST.Cst_offset offset), AST.Sig_offset) in + Cminor.Op2 (AST.Op_addp, e1, e2) + +let add_stacksize t = function + | AST.SProd l -> AST.SProd (l @ [sizeof_ctype t]) + | _ -> raise (Failure "ClightToCminor.add_stacksize") + +let struct_depth field fields = + let rec aux i = function + | [] -> error ("unknown field " ^ field ^ ".") + | (field', t) :: _ when field' = field -> i + | (_, t) :: fields -> aux (i+1) fields in + aux 0 fields + +let struct_offset t field fields = + let size = sizeof_ctype t in + let depth = struct_depth field fields in + let offset = (size, depth) in + let t = AST.Sig_offset in + Cminor.Expr (Cminor.Cst (AST.Cst_offset offset), t) + + +(** Sort variables: locals, parameters, globals, in stack. *) + +type location = + | Local + | LocalStack of AST.abstract_offset + | Param + | ParamStack of AST.abstract_offset + | Global + +(** Below are some helper definitions to ease the manipulation of a translation + environment for variables. *) + +type var_locations = (location * Clight.ctype) StringTools.Map.t + +let empty_var_locs : var_locations = StringTools.Map.empty + +let add_var_locs : AST.ident -> (location * Clight.ctype) -> var_locations -> + var_locations = + StringTools.Map.add + +let mem_var_locs : AST.ident -> var_locations -> bool = StringTools.Map.mem + +let find_var_locs : AST.ident -> var_locations -> (location * Clight.ctype) = + StringTools.Map.find + +let fold_var_locs : (AST.ident -> (location * Clight.ctype) -> 'a -> 'a) -> + var_locations -> 'a -> 'a = + StringTools.Map.fold + + +let is_local_or_param id var_locs = match find_var_locs id var_locs with + | (Local, _) | (Param, _) -> true + | _ -> false + +let get_locals var_locs = + let f id (location, ctype) locals = + let added = match location with + | Local -> [(id, sig_type_of_ctype ctype)] + | _ -> [] in + locals @ added in + fold_var_locs f var_locs [] + +let get_stacksize var_locs = + let f _ (location, _) res = match location with + | LocalStack (stacksize, _) | ParamStack (stacksize, _) -> + max_stacksize res stacksize + | _ -> res in + fold_var_locs f var_locs (AST.SProd []) + + +(* Variables of a function that will go in stack: variables of a complex type + (array, structure or union) and variables whose address is evaluated. *) + +let is_function_ctype = function + | Clight.Tfunction _ -> true + | _ -> false + +let is_scalar_ctype : Clight.ctype -> bool = function + | Clight.Tint _ | Clight.Tfloat _ | Clight.Tpointer _ -> true + | _ -> false + +let is_complex_ctype : Clight.ctype -> bool = function + | Clight.Tarray _ | Clight.Tstruct _ | Clight.Tunion _ | Clight.Tfunction _ -> + true + | _ -> false + +let complex_ctype_vars cfun = + let f set (x, t) = + if is_complex_ctype t then StringTools.Set.add x set else set in + (* Because of CIL, parameters should not have a complex type, but let's add + them just in case. *) + List.fold_left f StringTools.Set.empty + (cfun.Clight.fn_params @ cfun.Clight.fn_vars) + +let union_list = List.fold_left StringTools.Set.union StringTools.Set.empty + +let f_expr (Clight.Expr (ed, _)) sub_exprs_res = + let res_ed = match ed with + | Clight.Eaddrof (Clight.Expr (Clight.Evar id, _)) -> + StringTools.Set.singleton id + | _ -> StringTools.Set.empty in + union_list (res_ed :: sub_exprs_res) + +let f_stmt _ sub_exprs_res sub_stmts_res = + union_list (sub_exprs_res @ sub_stmts_res) + +let addr_vars_fun cfun = ClightFold.statement2 f_expr f_stmt cfun.Clight.fn_body + +let stack_vars cfun = + StringTools.Set.union (complex_ctype_vars cfun) (addr_vars_fun cfun) + + +let sort_stacks stack_location vars var_locs = + let stacksize = get_stacksize var_locs in + let f (current_stacksize, var_locs) (id, t) = + let depth = next_depth current_stacksize in + let current_stacksize = add_stacksize t current_stacksize in + let offset = (current_stacksize, depth) in + let var_locs = add_var_locs id (stack_location offset, t) var_locs in + (current_stacksize, var_locs) in + snd (List.fold_left f (stacksize, var_locs) vars) + +let sort_normals normal_location vars var_locs = + let f var_locs (id, ctype) = + add_var_locs id (normal_location, ctype) var_locs in + List.fold_left f var_locs vars + +let sort_vars normal_location stack_location_opt stack_vars vars var_locs = + let f_stack (x, _) = StringTools.Set.mem x stack_vars in + let (f_normal, var_locs) = match stack_location_opt with + | None -> ((fun _ -> true), var_locs) + | Some stack_location -> + ((fun var -> not (f_stack var)), + sort_stacks stack_location (List.filter f_stack vars) var_locs) in + sort_normals normal_location (List.filter f_normal vars) var_locs + +let sort_locals = sort_vars Local (Some (fun offset -> LocalStack offset)) + +let sort_params = sort_vars Param (Some (fun offset -> ParamStack offset)) + +let sort_globals stack_vars globals functs var_locs = + let globals = List.map (fun ((id, _), ctype) -> (id, ctype)) globals in + let f_functs (id, fundef) = + let (params, return) = match fundef with + | Clight.Internal cfun -> + (List.map snd cfun.Clight.fn_params, cfun.Clight.fn_return) + | Clight.External (_, params, return) -> (params, return) in + (id, Clight.Tfunction (params, return)) in + let functs = List.map f_functs functs in + let globals = globals @ functs in + sort_vars Global None stack_vars globals var_locs + +(* The order of insertion in the sorting environment is important: it follows + the scope conventions of C. Local variables hide parameters that hide + globals. *) + +let sort_variables globals functs cfun = + let stack_vars = stack_vars cfun in + let var_locs = empty_var_locs in + let var_locs = sort_globals stack_vars globals functs var_locs in + let var_locs = sort_params stack_vars cfun.Clight.fn_params var_locs in + let var_locs = sort_locals stack_vars cfun.Clight.fn_vars var_locs in + var_locs + + +(* Translate globals *) + +let init_to_data = function + | [Clight.Init_space _] -> None + | l -> Some (List.map ( + function + | Clight.Init_int8 i -> AST.Data_int8 i + | Clight.Init_int16 i -> AST.Data_int16 i + | Clight.Init_int32 i -> AST.Data_int32 i + | Clight.Init_float32 _ + | Clight.Init_float64 _ -> error_float () + | Clight.Init_space n -> error "bad global initialization style." + | Clight.Init_addrof (_,_) -> assert false (*TODO*) +) l) + +let translate_global ((id,lst),t) = (id,global_size_of_ctype t,init_to_data lst) + + +(* Translate expression *) + +let translate_unop = function + | Clight.Onotbool -> AST.Op_notbool + | Clight.Onotint -> AST.Op_notint + | Clight.Oneg -> AST.Op_negint + +let esizeof_ctype res_type t = + Cminor.Expr (Cminor.Cst (AST.Cst_sizeof (sizeof_ctype t)), res_type) + +let translate_add res_type ctype1 ctype2 e1 e2 = match ctype1, ctype2 with + | Clight.Tint _, Clight.Tint _ -> + Cminor.Expr (Cminor.Op2 (AST.Op_add, e1, e2), res_type) + | Clight.Tfloat _, Clight.Tfloat _ -> error_float () + | Clight.Tpointer t, Clight.Tint _ + | Clight.Tarray (t, _), Clight.Tint _ -> + let t2 = cminor_type_of e2 in + let size = esizeof_ctype t2 t in + let index = Cminor.Expr (Cminor.Op2 (AST.Op_mul, e2, size), t2) in + Cminor.Expr (Cminor.Op2 (AST.Op_addp, e1, index), res_type) + | Clight.Tint _, Clight.Tpointer t + | Clight.Tint _, Clight.Tarray (t, _) -> + let t1 = cminor_type_of e1 in + let size = esizeof_ctype t1 t in + let index = Cminor.Expr (Cminor.Op2 (AST.Op_mul, e1, size), t1) in + Cminor.Expr (Cminor.Op2 (AST.Op_addp, e2, index), res_type) + | _ -> error "type error." + +let translate_sub res_type ctype1 ctype2 e1 e2 = match ctype1, ctype2 with + | Clight.Tint _, Clight.Tint _ -> + Cminor.Expr (Cminor.Op2 (AST.Op_sub, e1, e2), res_type) + | Clight.Tfloat _, Clight.Tfloat _ -> error_float () + | Clight.Tpointer t, Clight.Tint _ + | Clight.Tarray (t, _), Clight.Tint _ -> + let t2 = cminor_type_of e2 in + let size = esizeof_ctype t2 t in + let index = Cminor.Expr (Cminor.Op2 (AST.Op_mul, e2, size), t2) in + Cminor.Expr (Cminor.Op2 (AST.Op_subp, e1, index), res_type) + | Clight.Tpointer _, Clight.Tpointer _ + | Clight.Tarray _, Clight.Tpointer _ + | Clight.Tpointer _, Clight.Tarray _ + | Clight.Tarray _, Clight.Tarray _ -> + Cminor.Expr (Cminor.Op2 (AST.Op_subpp, e1, e2), res_type) + | _ -> error "type error." + +let is_signed = function + | Clight.Tint (_, AST.Signed) -> true + | _ -> false + +let is_pointer = function + | Clight.Tpointer _ | Clight.Tarray _ -> true + | _ -> false + +let cmp_of_clight_binop = function + | Clight.Oeq -> AST.Cmp_eq + | Clight.One -> AST.Cmp_ne + | Clight.Olt -> AST.Cmp_lt + | Clight.Ole -> AST.Cmp_le + | Clight.Ogt -> AST.Cmp_gt + | Clight.Oge -> AST.Cmp_ge + | _ -> assert false (* do not use on these arguments *) + +let translate_simple_binop t = function + | Clight.Omul -> AST.Op_mul + | Clight.Odiv when is_signed t -> AST.Op_div + | Clight.Odiv -> AST.Op_divu + | Clight.Omod when is_signed t -> AST.Op_mod + | Clight.Omod -> AST.Op_modu + | Clight.Oand -> AST.Op_and + | Clight.Oor -> AST.Op_or + | Clight.Oxor -> AST.Op_xor + | Clight.Oshl -> AST.Op_shl + | Clight.Oshr when is_signed t -> AST.Op_shr + | Clight.Oshr -> AST.Op_shru + | binop when is_pointer t -> AST.Op_cmpp (cmp_of_clight_binop binop) + | binop when is_signed t -> AST.Op_cmp (cmp_of_clight_binop binop) + | binop -> AST.Op_cmpu (cmp_of_clight_binop binop) + +let translate_binop res_type ctype1 ctype2 e1 e2 binop = + match binop with + | Clight.Oadd -> translate_add res_type ctype1 ctype2 e1 e2 + | Clight.Osub -> translate_sub res_type ctype1 ctype2 e1 e2 + | _ -> + let cminor_binop = translate_simple_binop ctype1 binop in + Cminor.Expr (Cminor.Op2 (cminor_binop, e1, e2), res_type) + +let translate_ident var_locs res_type x = + let ed = match find_var_locs x var_locs with + | (Local, _) | (Param, _) -> Cminor.Id x + | (LocalStack off, t) | (ParamStack off, t) when is_scalar_ctype t -> + let addr = Cminor.Expr (add_stack off, AST.Sig_ptr) in + Cminor.Mem (quantity_of_ctype t, addr) + | (LocalStack off, _) | (ParamStack off, _) -> + add_stack off + | (Global, t) when is_scalar_ctype t -> + let addr = Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol x), AST.Sig_ptr) in + Cminor.Mem (quantity_of_ctype t, addr) + | (Global, _) -> Cminor.Cst (AST.Cst_addrsymbol x) in + Cminor.Expr (ed, res_type) + +let translate_field res_type t e field = + let (fields, offset) = match t with + | Clight.Tstruct (_, fields) -> (fields, struct_offset t field fields) + | Clight.Tunion (_, fields) -> + (fields, Cminor.Expr (Cminor.Cst (AST.Cst_int 0), AST.Sig_offset)) + | _ -> assert false (* type error *) in + let addr = Cminor.Expr (Cminor.Op2 (AST.Op_addp, e, offset), AST.Sig_ptr) in + let quantity = quantity_of_ctype (List.assoc field fields) in + Cminor.Expr (Cminor.Mem (quantity, addr), res_type) + +let translate_cast e src_type dest_type = + let res_type = sig_type_of_ctype dest_type in + match src_type, dest_type with + | Clight.Tint (size1, sign1), Clight.Tint (size2, _) -> + let t1 = (byte_size_of_intsize size1, sign1) in + let t2 = byte_size_of_intsize size2 in + Cminor.Expr (Cminor.Op1 (AST.Op_cast (t1, t2), e), res_type) + | Clight.Tint _, Clight.Tpointer _ + | Clight.Tint _, Clight.Tarray _ -> + Cminor.Expr (Cminor.Op1 (AST.Op_ptrofint, e), res_type) + | Clight.Tpointer _, Clight.Tint _ + | Clight.Tarray _, Clight.Tint _ -> + Cminor.Expr (Cminor.Op1 (AST.Op_intofptr, e), res_type) + | _ -> e + +let rec f_expr var_locs (Clight.Expr (ed, t)) sub_exprs_res = + let t_cminor = sig_type_of_ctype t in + let cst_int i t = Cminor.Expr (Cminor.Cst (AST.Cst_int i), t) in + match ed, sub_exprs_res with + + | Clight.Econst_int i, _ -> + Cminor.Expr (Cminor.Cst (AST.Cst_int i), t_cminor) + + | Clight.Econst_float _, _ -> error_float () + + | Clight.Evar x, _ when is_function_ctype t -> + Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol x), t_cminor) + + | Clight.Evar x, _ -> translate_ident var_locs t_cminor x + + | Clight.Ederef _, e :: _ when is_scalar_ctype t -> + Cminor.Expr (Cminor.Mem (quantity_of_ctype t, e), t_cminor) + + | Clight.Ederef _, e :: _ -> + (* When dereferencing something pointing to a struct for instance, the + result is the address of the struct. *) + e + + | Clight.Eaddrof e, _ -> translate_addrof var_locs e + + | Clight.Eunop (unop, _), e :: _ -> + Cminor.Expr (Cminor.Op1 (translate_unop unop, e), t_cminor) + + | Clight.Ebinop (binop, e1, e2), e1' :: e2' :: _ -> + translate_binop t_cminor (clight_type_of e1) (clight_type_of e2) e1' e2' + binop + + | Clight.Ecast (t, Clight.Expr (_, t')), e :: _ -> translate_cast e t' t + + | Clight.Econdition _, e1 :: e2 :: e3 :: _ -> + Cminor.Expr (Cminor.Cond (e1, e2, e3), t_cminor) + + | Clight.Eandbool _, e1 :: e2 :: _ -> + let zero = cst_int 0 t_cminor in + let one = cst_int 1 t_cminor in + let e2_cond = Cminor.Expr (Cminor.Cond (e2, one, zero), t_cminor) in + Cminor.Expr (Cminor.Cond (e1, e2_cond, zero), t_cminor) + + | Clight.Eorbool _, e1 :: e2 :: _ -> + let zero = cst_int 0 t_cminor in + let one = cst_int 1 t_cminor in + let e2_cond = Cminor.Expr (Cminor.Cond (e2, one, zero), t_cminor) in + Cminor.Expr (Cminor.Cond (e1, one, e2_cond), t_cminor) + + | Clight.Esizeof t, _ -> esizeof_ctype t_cminor t + + | Clight.Ecost (lbl, _), e :: _ -> + Cminor.Expr (Cminor.Exp_cost (lbl, e), t_cminor) + + | Clight.Ecall _, _ -> assert false (* only for annotations *) + + | Clight.Efield (Clight.Expr (_, t), field), e :: _ -> + translate_field t_cminor t e field + + | _ -> assert false (* wrong number of arguments *) + +and translate_addrof_ident res_type var_locs id = + assert (mem_var_locs id var_locs) ; + match find_var_locs id var_locs with + | (Local, _) | (Param, _) -> assert false (* location error *) + | (LocalStack off, _) | (ParamStack off, _) -> + Cminor.Expr (add_stack off, res_type) + | (Global, _) -> + Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol id), res_type) + +and translate_addrof_field res_type t field e = + let (fields, offset) = match t with + | Clight.Tstruct (_, fields) -> (fields, struct_offset t field fields) + | Clight.Tunion (_, fields) -> + (fields, Cminor.Expr (Cminor.Cst (AST.Cst_int 0), AST.Sig_offset)) + | _ -> assert false (* type error *) in + Cminor.Expr (Cminor.Op2 (AST.Op_addp, e, offset), res_type) + +and translate_addrof var_locs (Clight.Expr (ed, _)) = + let res_type = AST.Sig_ptr in + match ed with + + | Clight.Evar id -> translate_addrof_ident res_type var_locs id + + | Clight.Ederef e -> translate_expr var_locs e + + | Clight.Efield ((Clight.Expr (_, t) as e), field) -> + let e = translate_expr var_locs e in + translate_addrof_field res_type t field e + + | _ -> assert false (* not a lvalue *) + +and translate_expr var_locs e = ClightFold.expr2 (f_expr var_locs) e + + +(* Translate statement *) + +let assign var_locs (Clight.Expr (ed, t) as e_res_clight) e_arg_cminor = + match ed with + | Clight.Evar id when is_local_or_param id var_locs -> + Cminor.St_assign (id, e_arg_cminor) + | _ -> + let quantity = quantity_of_ctype t in + let addr = translate_addrof var_locs e_res_clight in + Cminor.St_store (quantity, addr, e_arg_cminor) + +let call_sig ret_type args = + { AST.args = List.map cminor_type_of args ; + AST.res = ret_type } + +let f_stmt fresh var_locs stmt sub_exprs_res sub_stmts_res = + let (tmps, sub_stmts_res) = List.split sub_stmts_res in + let tmps = List.flatten tmps in + + let (added_tmps, stmt) = match stmt, sub_exprs_res, sub_stmts_res with + + | Clight.Sskip, _, _ -> ([], Cminor.St_skip) + + | Clight.Sassign (e1, _), _ :: e2 :: _, _ -> + ([], assign var_locs e1 e2) + + | Clight.Scall (None, _, _), f :: args, _ -> + ([], Cminor.St_call (None, f, args, call_sig AST.Type_void args)) + + | Clight.Scall (Some e, _, _), _ :: f :: args, _ -> + let t = sig_type_of_ctype (clight_type_of e) in + let tmp = fresh () in + let tmpe = Cminor.Expr (Cminor.Id tmp, t) in + let stmt_call = + Cminor.St_call (Some tmp, f, args, call_sig (AST.Type_ret t) args) in + let stmt_assign = assign var_locs e tmpe in + ([(tmp, t)], Cminor.St_seq (stmt_call, stmt_assign)) + + | Clight.Swhile _, e :: _, stmt :: _ -> + let econd = + Cminor.Expr (Cminor.Op1 (AST.Op_notbool, e), cminor_type_of e) in + let scond = + Cminor.St_ifthenelse (econd, Cminor.St_exit 0, Cminor.St_skip) in + ([], + Cminor.St_block (Cminor.St_loop (Cminor.St_seq (scond, + Cminor.St_block stmt)))) + + | Clight.Sdowhile _, e :: _, stmt :: _ -> + let econd = + Cminor.Expr (Cminor.Op1 (AST.Op_notbool, e), cminor_type_of e) in + let scond = + Cminor.St_ifthenelse (econd, Cminor.St_exit 0, Cminor.St_skip) in + ([], + Cminor.St_block (Cminor.St_loop (Cminor.St_seq (Cminor.St_block stmt, + scond)))) + + | Clight.Sfor _, e :: _, stmt1 :: stmt2 :: stmt3 :: _ -> + let econd = + Cminor.Expr (Cminor.Op1 (AST.Op_notbool, e), cminor_type_of e) in + let scond = + Cminor.St_ifthenelse (econd, Cminor.St_exit 0, Cminor.St_skip) in + let body = Cminor.St_seq (Cminor.St_block stmt3, stmt2) in + ([], + Cminor.St_seq (stmt1, + Cminor.St_block + (Cminor.St_loop (Cminor.St_seq (scond, body))))) + + | Clight.Sifthenelse _, e :: _, stmt1 :: stmt2 :: _ -> + ([], Cminor.St_ifthenelse (e, stmt1, stmt2)) + + | Clight.Ssequence _, _, stmt1 :: stmt2 :: _ -> + ([], Cminor.St_seq (stmt1, stmt2)) + + | Clight.Sbreak, _, _ -> ([], Cminor.St_exit 1) + + | Clight.Scontinue, _, _ -> ([], Cminor.St_exit 0) + + | Clight.Sswitch _, _, _ -> + (* Should not appear because of switch transformation performed + beforehand. *) + assert false + + | Clight.Sreturn None, _, _ -> ([], Cminor.St_return None) + + | Clight.Sreturn (Some _), e :: _, _ -> ([], Cminor.St_return (Some e)) + + | Clight.Slabel (lbl, _), _, stmt :: _ -> ([], Cminor.St_label (lbl, stmt)) + + | Clight.Sgoto lbl, _, _ -> ([], Cminor.St_goto lbl) + + | Clight.Scost (lbl, _), _, stmt :: _ -> ([], Cminor.St_cost (lbl, stmt)) + + | _ -> assert false (* type error *) in + + (tmps @ added_tmps, stmt) + +let translate_statement fresh var_locs = + ClightFold.statement2 (f_expr var_locs) (f_stmt fresh var_locs) + + +(* Translate functions and programs *) + +let add_stack_parameter_initialization x t off body = + let addr = Cminor.Expr (add_stack off, AST.Sig_ptr) in + let e = Cminor.Expr (Cminor.Id x, sig_type_of_ctype t) in + let stmt = Cminor.St_store (quantity_of_ctype t, addr, e) in + Cminor.St_seq (stmt, body) + +let add_stack_parameters_initialization var_locs body = + let f x (location, t) body = match location with + | ParamStack offset -> add_stack_parameter_initialization x t offset body + | _ -> body in + fold_var_locs f var_locs body + +let translate_internal fresh globals functs cfun = + let var_locs = sort_variables globals functs cfun in + let params = + List.map (fun (x, t) -> (x, sig_type_of_ctype t)) cfun.Clight.fn_params in + let (tmps, body) = translate_statement fresh var_locs cfun.Clight.fn_body in + let body = add_stack_parameters_initialization var_locs body in + { Cminor.f_return = type_return_of_ctype cfun.Clight.fn_return ; + Cminor.f_params = params ; + Cminor.f_vars = (get_locals var_locs) @ tmps ; + Cminor.f_stacksize = get_stacksize var_locs ; + Cminor.f_body = body } + +let translate_external id params return = + { AST.ef_tag = id ; + AST.ef_sig = { AST.args = translate_args_types params ; + AST.res = type_return_of_ctype return } } + +let translate_funct fresh globals functs (id, def) = + let def = match def with + | Clight.Internal ff -> + Cminor.F_int (translate_internal fresh globals functs ff) + | Clight.External (i,p,r) -> Cminor.F_ext (translate_external i p r) in + (id, def) + +let translate p = + let fresh = ClightAnnotator.make_fresh "_tmp" p in + let translate_funct = + translate_funct fresh p.Clight.prog_vars p.Clight.prog_funct in + { Cminor.vars = List.map translate_global p.Clight.prog_vars ; + Cminor.functs = List.map translate_funct p.Clight.prog_funct ; + Cminor.main = p.Clight.prog_main } diff --git a/src/clight/clightToCminor.mli b/src/clight/clightToCminor.mli new file mode 100644 index 0000000..a011a09 --- /dev/null +++ b/src/clight/clightToCminor.mli @@ -0,0 +1,9 @@ +(** This module translates a {!Clight} program into a {!Cminor} + program. *) + +val sizeof_ctype : Clight.ctype -> AST.abstract_size + +(** [translate cp] compiles a Clight program into a Cminor program. *) +(* Translation simplifies control structures and explicits memory operations *) + +val translate : Clight.program -> Cminor.program diff --git a/src/clight/clightUtils.ml b/src/clight/clightUtils.ml new file mode 100644 index 0000000..0e70709 --- /dev/null +++ b/src/clight/clightUtils.ml @@ -0,0 +1,73 @@ + +open Clight + + +(* TODO: Alignment constraints? *) +let rec size_of_ctype = function + | Tvoid -> 0 + | Tint (I8,_) -> 1 + | Tint (I16,_) -> 2 + | Tint (I32,_) -> 4 + | Tfloat _ -> assert false (* Not supported *) + | Tpointer (sp,_) -> Memory.size_of_region sp + | Tarray (sp,t,s) -> s*(size_of_ctype t) + | Tfunction (_,_) -> assert false (* Not supported *) + | Tstruct (_,lst) -> + List.fold_left (fun n (_,ty) -> n + (size_of_ctype ty)) 0 lst + | Tunion (_,lst) -> + List.fold_left + (fun n (_,ty) -> + let sz = (size_of_ctype ty) in (if n>sz then n else sz) + ) 0 lst + | Tcomp_ptr (sp,_) -> Memory.size_of_region sp + + +let rec memory_q_of_ctype = function + | Tvoid -> assert false + | Tint (I8,Signed) -> Memory.MQ_int8signed + | Tint (I8,Unsigned) -> Memory.MQ_int8unsigned + | Tint (I16,Signed) -> Memory.MQ_int16signed + | Tint (I16,Unsigned) -> Memory.MQ_int16unsigned + | Tint (I32,Signed) -> Memory.MQ_int32 + | Tint (I32,Unsigned) -> assert false (* Not supported *) + | Tfloat _ -> assert false (* Not supported *) + | Tpointer (sp,_) -> Memory.mq_of_region sp + | Tarray (sp,c,s) -> Memory.mq_of_region sp + | Tfunction (_,_) -> assert false (* should not happen thanks to CIL *) + | Tstruct (_,_) -> assert false (* should not happen thanks to CIL *) + | Tunion (_,_) -> assert false (* should not happen thanks to CIL *) + | Tcomp_ptr (sp,_) -> Memory.mq_of_region sp + + +let is_int_type = function + | Tint (_,_) -> true + | _ -> false + +let is_float_type = function + | Tfloat _ -> true + | _ -> false + +let is_pointer_type = function + | Tpointer _ | Tarray _ | Tcomp_ptr _ -> true + | _ -> false + +let is_stack_type = function + | Tarray _ | Tstruct _ | Tunion _ -> true + | _ -> false + +let is_struct = function + | Tstruct _ | Tunion _ -> true + | _ -> false + +let is_ptr_to_struct = function + | Tpointer (_,t) when is_struct t -> true + | Tcomp_ptr _ -> true + | _ -> false + +let is_function = function + | Tfunction _ -> true + | _ -> false + +let region_of_pointer_type = function + | Tpointer (sp,_) | Tarray (sp,_,_) | Tcomp_ptr (sp,_) -> sp + | _ -> assert false (* do not use on those arguments *) diff --git a/src/clight/clightUtils.mli b/src/clight/clightUtils.mli new file mode 100644 index 0000000..8aa593e --- /dev/null +++ b/src/clight/clightUtils.mli @@ -0,0 +1,14 @@ + +val size_of_ctype : Clight.ctype -> int + +val memory_q_of_ctype : Clight.ctype -> Memory.memory_q + +val is_int_type : Clight.ctype -> bool +val is_float_type : Clight.ctype -> bool +val is_pointer_type : Clight.ctype -> bool +val is_stack_type : Clight.ctype -> bool +val is_struct : Clight.ctype -> bool +val is_ptr_to_struct : Clight.ctype -> bool +val is_function : Clight.ctype -> bool + +val region_of_pointer_type : Clight.ctype -> AST.region diff --git a/src/clight/runtime.ml b/src/clight/runtime.ml new file mode 100644 index 0000000..8dbcbcf --- /dev/null +++ b/src/clight/runtime.ml @@ -0,0 +1,509 @@ + +(** This module adds runtime functions in a [Clight] program. These functions + implement unsupported functions by the target architecture that introduce a + branch. We need to define them at the [Clight] level in order to have a + correct labelling. *) + + +let error_prefix = "Adding runtime functions" +let error = Error.global_error error_prefix + +let add_program p s = + let output = s ^ (ClightPrinter.print_program p) in + ClightParser.process (`Source ("add_program", output)) + +type operation = + | Unary of Clight.unary_operation * Clight.ctype + | Binary of Clight.binary_operation * Clight.ctype * Clight.ctype + | Cast of Clight.ctype (* destination type *) * Clight.ctype (* source type *) + | Fun of string (* name of the function *) + +type op_replacement = + (* operation to be replaced *) + operation * + (* base name of the replacement function *) + string * + (* C definition of the replacement function, provided a name for the + function *) + (string -> string) * + (* dependencies *) + operation list + +let string_of_operation = function + | Unary (unop, ctype) -> + (ClightPrinter.string_of_unop unop) ^ "(" ^ + (ClightPrinter.string_of_ctype ctype) ^ ")" + | Binary (binop, ctype1, ctype2) -> + (ClightPrinter.string_of_binop binop) ^ "(" ^ + (ClightPrinter.string_of_ctype ctype1) ^ ", " ^ + (ClightPrinter.string_of_ctype ctype1) ^ ")" + | Cast (ctype1, ctype2) -> + "Cast " ^ (ClightPrinter.string_of_ctype ctype1) ^ " " ^ + (ClightPrinter.string_of_ctype ctype2) + | Fun fun_name -> "Fun " ^ fun_name + +let string_of_op_replacement (replaced, base_name, c_def, _) = + Printf.sprintf "Replaced: %s\n%s\n" + (string_of_operation replaced) (c_def base_name) + +module CtypeSet = + Set.Make (struct type t = Clight.ctype let compare = Pervasives.compare end) + + +let deps op replacements = + let f res (op', _, _, deps) = if op' = op then deps else res in + List.fold_left f [] replacements + + +(* Filter used operations only *) + +module OperationSet = + Set.Make (struct type t = operation let compare = Pervasives.compare end) + +let union_list l = List.fold_left OperationSet.union OperationSet.empty l + +let f_ctype ctype _ = ctype + +let f_expr e _ sub_expr_descrs_res = + let res_e = match e with + | Clight.Expr (Clight.Evar x, Clight.Tfunction _) -> + OperationSet.singleton (Fun x) + | _ -> OperationSet.empty in + union_list (res_e :: sub_expr_descrs_res) + +let f_expr_descr ed _ sub_exprs_res = + let res_ed = match ed with + | Clight.Eunop (unop, Clight.Expr (_, t)) -> + OperationSet.singleton (Unary (unop, t)) + | Clight.Ebinop (binop, Clight.Expr (_, t1), Clight.Expr (_, t2)) -> + OperationSet.singleton (Binary (binop, t1, t2)) + | Clight.Ecast (t, Clight.Expr (_, t')) -> + OperationSet.singleton (Cast (t, t')) + | _ -> OperationSet.empty in + union_list (res_ed :: sub_exprs_res) + +let f_stmt _ sub_exprs_res sub_stmts_res = + OperationSet.union (union_list sub_exprs_res) (union_list sub_stmts_res) + +let used_ops_stmt = ClightFold.statement f_ctype f_expr f_expr_descr f_stmt + +let used_ops_fundef = function + | Clight.Internal cfun -> used_ops_stmt cfun.Clight.fn_body + | Clight.External _ -> OperationSet.empty + +let used_ops p = + let f ops (_, fundef) = OperationSet.union ops (used_ops_fundef fundef) in + List.fold_left f OperationSet.empty p.Clight.prog_funct + + +let mem_replacements op = + let f res (op', _, _, _) = res || (op' = op) in + List.fold_left f false + +let rec fix equal next x = + let y = next x in + if equal x y then x + else fix equal next y + +let needed_replacements used_ops replacements = + let f op = mem_replacements op replacements in + let reduced_used_ops = OperationSet.filter f used_ops in + let next_ops ops = + let add ops op = OperationSet.add op ops in + let f op next_ops = List.fold_left add next_ops (deps op replacements) in + OperationSet.fold f ops ops in + let needed_ops = fix OperationSet.equal next_ops reduced_used_ops in + let f (op, _, _, _) = OperationSet.mem op needed_ops in + List.filter f replacements + + +let map_fresh_name unique map base_name = + if StringTools.Map.mem base_name map then + (map, StringTools.Map.find base_name map) + else + let fresh_name = unique base_name in + (StringTools.Map.add base_name fresh_name map, fresh_name) + +let fresh_replacements unique replacements = + let f (map, l) (op, base_name, new_fun, deps) = + let (map, fresh_name) = map_fresh_name unique map base_name in + (map, l @ [(op, fresh_name, new_fun fresh_name, deps)]) in + snd (List.fold_left f (StringTools.Map.empty, []) replacements) + + +let add_replacements replacements p = + let f_replacements s (_, _, new_fun, _) = s ^ "\n" ^ new_fun in + let added_string = List.fold_left f_replacements "" replacements in + add_program p added_string + + +let make_replacement_assoc = List.map (fun (op, name, _, _) -> (op, name)) + + +let add p replacements = + let used_ops = used_ops p in + let needed_replacements = needed_replacements used_ops replacements in + let unique = StringTools.make_unique (ClightAnnotator.all_idents p) in + let replacements = fresh_replacements unique needed_replacements in + let p = add_replacements replacements p in + (p, make_replacement_assoc replacements) + + +(* Replacement *) + +let seq = + List.fold_left + (fun stmt1 stmt2 -> + if stmt1 = Clight.Sskip then stmt2 + else + if stmt2 = Clight.Sskip then stmt1 + else Clight.Ssequence (stmt1, stmt2)) + Clight.Sskip + +let f_ctype ctype _ = ctype + +let call fresh replaced replacement_assoc args ret_type = + let tmp = fresh () in + let replacement_fun_name = List.assoc replaced replacement_assoc in + let tmpe = Clight.Expr (Clight.Evar tmp, ret_type) in + let (args, args_types) = List.split args in + let f_type = Clight.Tfunction (args_types, ret_type) in + let f = Clight.Expr (Clight.Evar replacement_fun_name, f_type) in + let call = Clight.Scall (Some tmpe, f, args) in + (tmpe, call, [(tmp, ret_type)]) + +let replace_ident replacement_assoc x t = + let new_name = match t with + | Clight.Tfunction _ + when List.mem_assoc (Fun x) replacement_assoc -> + let replacement_fun_name = List.assoc (Fun x) replacement_assoc in + replacement_fun_name + | _ -> x in + (Clight.Expr (Clight.Evar new_name, t), Clight.Sskip, []) + +let f_expr fresh replacement_assoc e _ _ = + + let f (Clight.Expr (ed, t) as e) sub_exprs_res = + let f_sub_exprs (es, stmt, tmps) (e, stmt', tmps') = + (es @ [e], seq [stmt ; stmt'], tmps @ tmps') in + let (sub_exprs, stmt1, tmps1) = + List.fold_left f_sub_exprs ([], Clight.Sskip, []) sub_exprs_res in + let (e, stmt2, tmps2) = match ed, sub_exprs with + | Clight.Evar x, _ -> replace_ident replacement_assoc x t + | Clight.Eunop (unop, Clight.Expr (_, t')), e' :: _ + when List.mem_assoc (Unary (unop, t')) replacement_assoc -> + call fresh (Unary (unop, t')) replacement_assoc [(e', t')] t + | Clight.Ebinop (binop, Clight.Expr (_, t1), Clight.Expr (_, t2)), + e1 :: e2 :: _ + when List.mem_assoc (Binary (binop, t1, t2)) replacement_assoc -> + call fresh (Binary (binop, t1, t2)) replacement_assoc + [(e1, t1) ; (e2, t2)] t + | Clight.Ecast (t, Clight.Expr (_, t')), e' :: _ + when List.mem_assoc (Cast (t, t')) replacement_assoc -> + call fresh (Cast (t, t')) replacement_assoc [(e', t')] t + | _ -> (e, Clight.Sskip, []) in + (ClightFold.expr_fill_exprs e sub_exprs, + seq [stmt1 ; stmt2], + tmps1 @ tmps2) in + + ClightFold.expr2 f e + +let f_expr_descr ed _ _ _ = ed + +let f_stmt stmt sub_exprs_res sub_stmts_res = + let f_sub_exprs (es, stmt, tmps) (e, stmt', tmps') = + (es @ [e], seq [stmt ; stmt'], tmps @ tmps') in + let (sub_exprs, added_stmt, tmps1) = + List.fold_left f_sub_exprs ([], Clight.Sskip, []) sub_exprs_res in + let f_sub_stmts (stmts, tmps) (stmt, tmps') = + (stmts @ [stmt], tmps @ tmps') in + let (sub_stmts, tmps2) = List.fold_left f_sub_stmts ([], []) sub_stmts_res in + let stmt' = ClightFold.statement_fill_subs stmt sub_exprs sub_stmts in + (seq [added_stmt ; stmt'], tmps1 @ tmps2) + +let replace_statement fresh replacement_assoc = + ClightFold.statement f_ctype (f_expr fresh replacement_assoc) + f_expr_descr f_stmt + +let replace_internal fresh replacement_assoc def = + let (new_body, tmps) = + replace_statement fresh replacement_assoc def.Clight.fn_body in + { def with + Clight.fn_vars = def.Clight.fn_vars @ tmps ; Clight.fn_body = new_body } + +let replace_funct fresh replacement_assoc (id, fundef) = + let fundef' = match fundef with + | Clight.Internal def -> + Clight.Internal (replace_internal fresh replacement_assoc def) + | _ -> fundef in + (id, fundef') + +let replace fresh replacement_assoc p = + let prog_funct = + List.map (replace_funct fresh replacement_assoc) p.Clight.prog_funct in + { p with Clight.prog_funct = prog_funct } + + +let save_and_parse p = + try + ClightParser.process (`Source ("replaced", ClightPrinter.print_program p)) + with Sys_error _ -> failwith "Error reparsing Clight8 transformation." + +let add_replacements p replacements = + let p = ClightCasts.simplify p in + let (p, replacement_assoc) = add p replacements in + let p = ClightCasts.simplify p in + let tmp_universe = ClightAnnotator.fresh_universe "_tmp" p in + let fresh () = StringTools.Gen.fresh tmp_universe in + let p = replace fresh replacement_assoc p in + let p = save_and_parse p in + ClightCasts.simplify p + + +(* Unsupported operations by the 8051. *) + +let cint size sign = Clight.Tint (size, sign) + +let cints size = cint size AST.Signed +let cintu size = cint size AST.Unsigned + +let cint8s = cints Clight.I8 +let cint8u = cintu Clight.I8 +let cint16s = cints Clight.I16 +let cint16u = cintu Clight.I16 +let cint32s = cints Clight.I32 +let cint32u = cintu Clight.I32 + +let byte_size_of_intsize = function + | Clight.I8 -> 1 + | Clight.I16 -> 2 + | Clight.I32 -> 4 + +let bit_size_of_intsize size = (byte_size_of_intsize size) * 8 + +let string_of_intsize size = string_of_int (bit_size_of_intsize size) + +let ctype_of_intsize = function + | Clight.I8 -> "char" + | Clight.I16 -> "short" + | Clight.I32 -> "int" + + +(* Unsigned divisions and modulos *) + +let divumodu_fun res t s = + "unsigned " ^ t ^ " " ^ s ^ " (unsigned " ^ t ^ " x, unsigned " ^ t ^ " y)" ^ + "{\n" ^ + " unsigned " ^ t ^ " quo = 0;\n" ^ + " unsigned " ^ t ^ " rem = x;\n" ^ + " while (rem >= y) {\n" ^ + " quo = quo + 1;\n" ^ + " rem = rem - y;\n" ^ + " }\n" ^ + " return (" ^ res ^ ");\n" ^ + "}\n\n" + +let divumodu op sizes sizec t = + let (prefix, res) = match op with + | Clight.Odiv -> ("div", "quo") + | Clight.Omod -> ("mod", "rem") + | _ -> assert false (* do not use on these arguments *) in + let cu = cintu sizec in + (Binary (op, cu, cu), "_" ^ prefix ^ sizes ^ "u", divumodu_fun res t, []) + +let divu = divumodu Clight.Odiv +let modu = divumodu Clight.Omod + + +(* Unsigned divisions *) + +(* 16 bits unsigned division *) + +let div16u = divu "16" Clight.I16 "short" + +(* 32 bits unsigned division *) + +let div32u = divu "32" Clight.I32 "int" + +(* Signed divisions *) + +let divs_fun t s = + "signed " ^ t ^ " " ^ s ^ " (signed " ^ t ^ " x, signed " ^ t ^ " y) {\n" ^ + " unsigned " ^ t ^ " x1 = (unsigned " ^ t ^ ") x;\n" ^ + " unsigned " ^ t ^ " y1 = (unsigned " ^ t ^ ") y;\n" ^ + " signed " ^ t ^ " sign = 1;\n" ^ + " if (x < 0) { x1 = (unsigned " ^ t ^ ") (-x); sign = -sign; }\n" ^ + " if (y < 0) { y1 = (unsigned " ^ t ^ ") (-y); sign = -sign; }\n" ^ + " unsigned " ^ t ^ " res = (x1/y1);\n" ^ + " return (sign * ((signed " ^ t ^ ") res));\n" ^ + "}\n\n" + +let divs sizes sizec t = + let cs = cints sizec in + let cu = cintu sizec in + (Binary (Clight.Odiv, cs, cs), "_div" ^ sizes ^ "s", divs_fun t, + [Binary (Clight.Odiv, cu, cu)]) + +(* 8 bits signed division *) + +let div8s = divs "8" Clight.I8 "char" + +(* 16 bits signed division *) + +let div16s = divs "16" Clight.I16 "short" + +(* 32 bits signed division *) + +let div32s = divs "32" Clight.I32 "int" + + +(* Unsigned modulos *) + +(* 16 bits unsigned modulo *) + +let mod16u = modu "16" Clight.I16 "short" + +(* 32 bits unsigned modulo *) + +let mod32u = modu "32" Clight.I32 "int" + +(* Signed modulos *) + +let mods_fun t s = + "signed " ^ t ^ " " ^ s ^ " (signed " ^ t ^ " x, signed " ^ t ^ " y) {\n" ^ + " return (x - (x/y) * y);\n" ^ + "}\n\n" + +let mods size ct t = + (Binary (Clight.Omod, ct, ct), "_mod" ^ size ^ "s", mods_fun t, + [Binary (Clight.Odiv, ct, ct)]) + +(* 8 bits signed modulo *) + +let mod8s = mods "8" cint8s "char" + +(* 16 bits signed modulo *) + +let mod16s = mods "16" cint16s "short" + +(* 32 bits signed modulo *) + +let mod32s = mods "32" cint32s "int" + + +(* Shifts *) + +let sh_fun op t s = + t ^ " " ^ s ^ " (" ^ t ^ " x, " ^ t ^ " y) {\n" ^ + " " ^ t ^ " res = x, i;\n" ^ + " for (i = 0 ; i < y ; i++) res = res " ^ op ^ " 2;\n" ^ + " return res;\n" ^ + "}\n\n" + +let sh cop sop direction deps size sign = + let sizes = string_of_intsize size in + let ct = Clight.Tint (size, sign) in + let (short_sign, long_sign) = match sign with + | AST.Signed -> ("s", "signed ") + | AST.Unsigned -> ("u", "unsigned ") in + let t = long_sign ^ (ctype_of_intsize size) in + (Binary (cop, ct, ct), "_sh" ^ direction ^ sizes ^ short_sign, + sh_fun sop t, deps) + + +(* Shift lefts *) + +let shl = sh Clight.Oshl "*" "l" [] + +(* Signed shift lefts *) + +(* 8 bits signed shift left *) + +let shl8s = shl Clight.I8 AST.Signed + +(* 16 bits signed shift left *) + +let shl16s = shl Clight.I16 AST.Signed + +(* 32 bits signed shift left *) + +let shl32s = shl Clight.I32 AST.Signed + +(* Unsigned shift lefts *) + +(* 8 bits unsigned shift left *) + +let shl8u = shl Clight.I8 AST.Unsigned + +(* 16 bits unsigned shift left *) + +let shl16u = shl Clight.I16 AST.Unsigned + +(* 32 bits unsigned shift left *) + +let shl32u = shl Clight.I32 AST.Unsigned + + +(* Shift rights *) + +(* Signed shift rights *) + +let shrs_fun size t s = + "signed " ^ t ^ " " ^ s ^ " (signed " ^ t ^ " x, signed " ^ t ^ " y) {\n" ^ + " unsigned " ^ t ^ " x1, y1, to_add, res, i;\n" ^ + " if (y < 0) return 0;\n" ^ + " x1 = x; y1 = y; to_add = 1; res = x1;" ^ + " for (i = 0 ; i < " ^ size ^ " ; i++) to_add = to_add * 2;\n" ^ + " to_add = to_add & x1;\n" ^ + " for (i = 0 ; i < y1 ; i++) res = (res / 2) + to_add;\n" ^ + " return ((signed " ^ t ^ ") res);\n" ^ + "}\n\n" + +let shrs size = + let sizes = string_of_int (bit_size_of_intsize size) in + let op_sizes = string_of_int ((bit_size_of_intsize size) - 1) in + let t = ctype_of_intsize size in + let ct = Clight.Tint (size, AST.Signed) in + let ctdep = Clight.Tint (size, AST.Unsigned) in + (Binary (Clight.Oshr, ct, ct), "_shr" ^ sizes ^ "s", shrs_fun op_sizes t, + [Binary (Clight.Odiv, ctdep, ctdep)]) + +(* 8 bits signed shift right *) + +let shr8s = shrs Clight.I8 + +(* 16 bits signed shift right *) + +let shr16s = shrs Clight.I16 + +(* 32 bits signed shift right *) + +let shr32s = shrs Clight.I32 + +(* Unsigned shift rights *) + +let shru size = + let t_dep = Clight.Tint (size, AST.Unsigned) in + sh Clight.Oshr "/" "r" [Binary (Clight.Odiv, t_dep, t_dep)] size AST.Unsigned + +(* 8 bits unsigned shift right *) + +let shr8u = shru Clight.I8 + +(* 16 bits unsigned shift right *) + +let shr16u = shru Clight.I16 + +(* 32 bits unsigned shift right *) + +let shr32u = shru Clight.I32 + + +let unsupported = + [div16u ; div32u ; div8s ; div16s ; div32s ; + mod16u ; mod32u ; mod8s ; mod16s ; mod32s ; + shl8s ; shl16s ; shl32s ; shl8u ; shl16u ; shl32u ; + shr8s ; shr16s ; shr32s ; shr8u ; shr16u ; shr32u] + + +let replace_unsupported p = add_replacements p unsupported diff --git a/src/clight/runtime.mli b/src/clight/runtime.mli new file mode 100644 index 0000000..1dcba1f --- /dev/null +++ b/src/clight/runtime.mli @@ -0,0 +1,28 @@ + +(** This module adds runtime functions in a [Clight] program. These functions + implement unsupported functions by the target architecture that introduce a + branch. We need to define them at the [Clight] level in order to have a + correct labelling. *) + +type operation = + | Unary of Clight.unary_operation * Clight.ctype + | Binary of Clight.binary_operation * Clight.ctype * Clight.ctype + | Cast of Clight.ctype (* destination type *) * Clight.ctype (* source type *) + | Fun of string (* name of the function *) + +type op_replacement = + (* operation to be replaced *) + operation * + (* base name of the replacement function *) + string * + (* C definition of the replacement function, provided a name for the + function *) + (string -> string) * + (* dependences *) + operation list + +val add : + Clight.program -> op_replacement list -> + (Clight.program * (operation * string) list (* operation association *)) + +val replace_unsupported : Clight.program -> Clight.program diff --git a/src/cminor/cminor.mli b/src/cminor/cminor.mli new file mode 100644 index 0000000..1c1485e --- /dev/null +++ b/src/cminor/cminor.mli @@ -0,0 +1,69 @@ + +(** This module defines the abstract syntax tree of [Cminor]. *) + +(* This file describes the abstract syntax of the Cminor language. + Only types are: int8, int16, int32 and void. *) + +type etype = AST.sig_type + +type expression = Expr of expr_descr * etype +and expr_descr = + | Id of AST.ident + | Cst of AST.cst + | Op1 of AST.op1 * expression + | Op2 of AST.op2 * expression * expression + | Mem of AST.quantity * expression (* Memory read *) + | Cond of expression * expression * expression (* Ternary expression *) + | Exp_cost of CostLabel.t * expression (* Labelled expression *) + +type statement = + | St_skip + | St_assign of AST.ident * expression + | St_store of AST.quantity * expression * expression + + (* Function call. Parameters are an optional variable to store the + result of the function, the name of the function, the arguments, + and finally its signature. *) + | St_call of AST.ident option * expression * expression list * AST.signature + + (* Tail call to a function, that is, a call to a function following + by a return statement. Parameters are the name of the function, + the arguments and its signature. *) + | St_tailcall of expression * expression list * AST.signature + + | St_seq of statement * statement + | St_ifthenelse of expression * statement * statement + | St_loop of statement + | St_block of statement + | St_exit of int + + (* Switch. Parameters are the expression whose value is switch, a + table of cases and their corresponding number of blocks to exit, + and the number of block to exit in the default case. *) + | St_switch of expression * (int*int) list * int + + | St_return of expression option + | St_label of AST.ident * statement + | St_goto of string + | St_cost of CostLabel.t * statement + + +type internal_function = + { f_return : AST.type_return ; + f_params : (AST.ident * etype) list ; + f_vars : (AST.ident * etype) list ; + f_stacksize : AST.abstract_size ; + f_body : statement } + +type function_def = + | F_int of internal_function + | F_ext of AST.external_function + +(* A program is a list of global variables and their initialization + datas, a list of function names and their definition, and the name + of the main function. *) + +type program = + { vars : (AST.ident * AST.abstract_size * AST.data list option) list ; + functs : (AST.ident * function_def) list ; + main : AST.ident option } diff --git a/src/cminor/cminorAnnotator.ml b/src/cminor/cminorAnnotator.ml new file mode 100644 index 0000000..634087f --- /dev/null +++ b/src/cminor/cminorAnnotator.ml @@ -0,0 +1,209 @@ + +let int_size = Driver.CminorMemory.int_size + +let funct_vars (id, fun_def) = match fun_def with + | Cminor.F_int def -> + id :: (List.map fst (def.Cminor.f_params @ def.Cminor.f_vars)) + | _ -> [id] + +let prog_idents p = + let vars = List.map (fun (x, _, _) -> x) p.Cminor.vars in + let f vars funct = vars @ (funct_vars funct) in + let vars = List.fold_left f vars p.Cminor.functs in + let f vars var = StringTools.Set.add var vars in + List.fold_left f StringTools.Set.empty vars + +let fresh_cost_id prefix p = + let vars = prog_idents p in + StringTools.Gen.fresh_prefix vars prefix + + +(* +let increment cost_id incr = + let cost = + Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol cost_id), AST.Sig_ptr) in + let load = Cminor.Expr (Cminor.Mem (Memory.QInt 4, cost), AST.Sig_int 4) in + let incr = Cminor.Expr (Cminor.Cst (AST.Cst_int incr), AST.Sig_int 4) in + let incr = Cminor.Expr (Cminor.Op2 (AST.Op_add, load, incr), AST.Sig_int 4) in + Cminor.St_store (Memory.QInt 4, cost, incr) + + +let f_remove_cost_labels_exp e subexp_res = match e, subexp_res with + | Cminor.Id _, _ | Cminor.Cst _, _ -> e + | Cminor.Op1 (op, _), [e1] -> Cminor.Op1 (op, e1) + | Cminor.Op2 (op, _, _), [e1 ; e2] -> Cminor.Op2 (op, e1, e2) + | Cminor.Mem (chunk, _), [e] -> Cminor.Mem (chunk, e) + | Cminor.Cond (_, _, _), [e1 ; e2 ; e3] -> Cminor.Cond (e1, e2, e3) + | Cminor.Exp_cost _, [e] -> e + | _ -> assert false (* wrong number of arguments *) + +let remove_cost_labels_exp e = + CminorFold.expression f_remove_cost_labels_exp e + +let remove_cost_labels_exps exps = + List.map remove_cost_labels_exp exps + + +let list_seq l = + let f res stmt = Cminor.St_seq (res, stmt) in + List.fold_left f Cminor.St_skip l + +let f_update_cost_exp costs_mapping cost_id e subexp_res = + match e, subexp_res with + | Cminor.Cond (e1, _, _), [stmt1 ; stmt2 ; stmt3] -> + Cminor.St_seq (stmt1, Cminor.St_ifthenelse (e1, stmt2, stmt3)) + | Cminor.Exp_cost (lbl, _), [stmt2] -> + let incr = + if CostLabel.Map.mem lbl costs_mapping then + CostLabel.Map.find lbl costs_mapping + else 0 in + let stmt1 = increment cost_id incr in + Cminor.St_seq (stmt1, stmt2) + | _ -> list_seq subexp_res + +let update_cost_exp costs_mapping cost_id e = + CminorFold.expression (f_update_cost_exp costs_mapping cost_id) e + +let update_cost_exps costs_mapping cost_id exps = + let l = List.map (update_cost_exp costs_mapping cost_id) exps in + let f stmt upd = Cminor.St_seq (stmt, upd) in + List.fold_left f Cminor.St_skip l + + +let rec instrument_stmt costs_mapping cost_id body = match body with + | Cminor.St_skip | Cminor.St_exit _ | Cminor.St_return None -> body + | Cminor.St_assign (x, e) -> + let upd = update_cost_exp costs_mapping cost_id e in + let e = remove_cost_labels_exp e in + Cminor.St_seq (upd, Cminor.St_assign (x, e)) + | Cminor.St_store (chunk, e1, e2) -> + let upd = update_cost_exps costs_mapping cost_id [e1 ; e2] in + let e1 = remove_cost_labels_exp e1 in + let e2 = remove_cost_labels_exp e2 in + Cminor.St_seq (upd, Cminor.St_store (chunk, e1, e2)) + | Cminor.St_call (ox, f, args, sg) -> + let upd = update_cost_exps costs_mapping cost_id (f :: args) in + let f = remove_cost_labels_exp f in + let args = remove_cost_labels_exps args in + Cminor.St_seq (upd, Cminor.St_call (ox, f, args, sg)) + | Cminor.St_tailcall (f, args, sg) -> + let upd = update_cost_exps costs_mapping cost_id (f :: args) in + let f = remove_cost_labels_exp f in + let args = remove_cost_labels_exps args in + Cminor.St_seq (upd, Cminor.St_tailcall (f, args, sg)) + | Cminor.St_seq (stmt1, stmt2) -> + let stmt1 = instrument_stmt costs_mapping cost_id stmt1 in + let stmt2 = instrument_stmt costs_mapping cost_id stmt2 in + Cminor.St_seq (stmt1, stmt2) + | Cminor.St_ifthenelse (e, stmt1, stmt2) -> + let upd = update_cost_exp costs_mapping cost_id e in + let e = remove_cost_labels_exp e in + let stmt1 = instrument_stmt costs_mapping cost_id stmt1 in + let stmt2 = instrument_stmt costs_mapping cost_id stmt2 in + Cminor.St_seq (upd, Cminor.St_ifthenelse (e, stmt1, stmt2)) + | Cminor.St_loop stmt -> + Cminor.St_loop (instrument_stmt costs_mapping cost_id stmt) + | Cminor.St_block stmt -> + Cminor.St_block (instrument_stmt costs_mapping cost_id stmt) + | Cminor.St_switch (e, tbl, dflt) -> + let upd = update_cost_exp costs_mapping cost_id e in + let e = remove_cost_labels_exp e in + Cminor.St_seq (upd, Cminor.St_switch (e, tbl, dflt)) + | Cminor.St_label (lbl, stmt) -> + Cminor.St_label (lbl, instrument_stmt costs_mapping cost_id stmt) + | Cminor.St_goto lbl -> body + | Cminor.St_return (Some e) -> + let upd = update_cost_exp costs_mapping cost_id e in + let e = remove_cost_labels_exp e in + Cminor.St_seq (upd, Cminor.St_return (Some e)) + | Cminor.St_cost (lbl, stmt) -> + let incr = + if CostLabel.Map.mem lbl costs_mapping then + CostLabel.Map.find lbl costs_mapping + else 0 in + let stmt = instrument_stmt costs_mapping cost_id stmt in + if incr = 0 then stmt + else Cminor.St_seq (increment cost_id incr, stmt) + + +let instrument_function costs_mapping cost_id = function + | Cminor.F_int int_def -> + let body = instrument_stmt costs_mapping cost_id int_def.Cminor.f_body in + let def = { int_def with Cminor.f_body = body} in + Cminor.F_int def + | def -> def + + +(** [instrument prog cost_map] instruments the program [prog]. First a fresh + global variable --- the so-called cost variable --- is added to the program. + Then, each cost label in the program is replaced by an increment of the cost + variable, following the mapping [cost_map]. The function also returns the + name of the cost variable and the name of the cost increment function. *) + +let instrument p costs_mapping = + let cost_id = fresh_cost_id "_cost" p in + let vars = (cost_id, [AST.Data_int32 0]) :: p.Cminor.vars in + let f (f_name, f_def) = + (f_name, instrument_function costs_mapping cost_id f_def) in + let functs = List.map f p.Cminor.functs in + ({ Cminor.vars = vars ; + Cminor.functs = functs ; + Cminor.main = p.Cminor.main }, + "" (* TODO *), + "" (* TODO *)) +*) + + +(* Program cost labels and labels *) + +let labels_empty = (CostLabel.Set.empty, Label.Set.empty) + +let add_cost_label lbl (cost_label, user_label) = + (CostLabel.Set.add lbl cost_label, user_label) + +let add_label lbl (cost_label, user_label) = + (cost_label, Label.Set.add lbl user_label) + +let labels_union (cost_labels1, user_labels1) (cost_labels2, user_labels2) = + (CostLabel.Set.union cost_labels1 cost_labels2, + Label.Set.union user_labels1 user_labels2) + +let labels_union_list l = + let f res labels = labels_union res labels in + List.fold_left f labels_empty l + +let f_exp_labels (Cminor.Expr (ed, _)) subexp_res = + let labels1 = labels_union_list subexp_res in + let labels2 = match ed with + | Cminor.Exp_cost (lbl, _) -> add_cost_label lbl labels_empty + | _ -> labels_empty in + labels_union labels1 labels2 + +let f_body_labels stmt subexp_res substmt_res = + let labels1 = labels_union_list subexp_res in + let labels2 = labels_union_list substmt_res in + let labels = labels_union labels1 labels2 in + let labels3 = match stmt with + | Cminor.St_label (lbl, _) -> add_label lbl labels_empty + | Cminor.St_cost (lbl, _) -> add_cost_label lbl labels_empty + | _ -> labels_empty in + labels_union labels labels3 + +let body_labels stmt = CminorFold.statement f_exp_labels f_body_labels stmt + +let prog_labels p = + let f lbls (_, f_def) = match f_def with + | Cminor.F_int def -> + labels_union lbls (body_labels def.Cminor.f_body) + | _ -> lbls in + List.fold_left f (CostLabel.Set.empty, Label.Set.empty) p.Cminor.functs + +let cost_labels p = fst (prog_labels p) +let user_labels p = snd (prog_labels p) + +let all_labels p = + let (cost_labels, user_labels) = prog_labels p in + let all = + CostLabel.Set.fold (fun lbl lbls -> StringTools.Set.add lbl lbls) + cost_labels StringTools.Set.empty in + Label.Set.fold (fun lbl lbls -> StringTools.Set.add lbl lbls) user_labels all diff --git a/src/cminor/cminorAnnotator.mli b/src/cminor/cminorAnnotator.mli new file mode 100644 index 0000000..9b3b4d1 --- /dev/null +++ b/src/cminor/cminorAnnotator.mli @@ -0,0 +1,19 @@ + +(** This module defines the instrumentation of a [Cminor] program. *) + +(* +(** [instrument prog cost_map] instruments the program [prog]. First a fresh + global variable --- the so-called cost variable --- is added to the program. + Then, each cost label in the program is replaced by an increment of the cost + variable, following the mapping [cost_map]. The function also returns the + name of the cost variable and the name of the cost increment function. *) + +val instrument : Cminor.program -> int CostLabel.Map.t -> + Cminor.program * string * string +*) + +val cost_labels : Cminor.program -> CostLabel.Set.t +val user_labels : Cminor.program -> Label.Set.t +val all_labels : Cminor.program -> StringTools.Set.t + +val prog_idents : Cminor.program -> StringTools.Set.t diff --git a/src/cminor/cminorFold.ml b/src/cminor/cminorFold.ml new file mode 100644 index 0000000..eee130e --- /dev/null +++ b/src/cminor/cminorFold.ml @@ -0,0 +1,88 @@ + +(** This module provides folding functions over the constructors of the + [Cminor]'s AST. *) + + +let expression_subs (Cminor.Expr (ed, _)) = match ed with + | Cminor.Id _ | Cminor.Cst _ -> [] + | Cminor.Op1 (_, e) | Cminor.Mem (_, e) | Cminor.Exp_cost (_, e) -> [e] + | Cminor.Op2 (_, e1, e2) -> [e1 ; e2] + | Cminor.Cond (e1, e2, e3) -> [e1 ; e2 ; e3] + +let expression_fill_subs (Cminor.Expr (ed, t)) subs = + let ed = match ed, subs with + | Cminor.Id _, _ | Cminor.Cst _, _ -> ed + | Cminor.Op1 (op1, _), e :: _ -> Cminor.Op1 (op1, e) + | Cminor.Op2 (op2, _, _), e1 :: e2 :: _ -> Cminor.Op2 (op2, e1, e2) + | Cminor.Mem (size, _), e :: _ -> Cminor.Mem (size, e) + | Cminor.Cond _, e1 :: e2 :: e3 :: _ -> Cminor.Cond (e1, e2, e3) + | Cminor.Exp_cost (lbl, _), e :: _ -> Cminor.Exp_cost (lbl, e) + | _ -> assert false (* wrong parameter size *) in + Cminor.Expr (ed, t) + + +(* In [expression f e], [f]'s second argument is the list of + [expression]'s results on [e]'s sub-expressions. *) + +let rec expression f_expr e = + let sub_es_res = List.map (expression f_expr) (expression_subs e) in + f_expr e sub_es_res + + +let statement_subs = function + | Cminor.St_skip | Cminor.St_exit _ | Cminor.St_return None + | Cminor.St_goto _ -> ([], []) + | Cminor.St_assign (_, e) | Cminor.St_switch (e, _, _) + | Cminor.St_return (Some e) -> ([e], []) + | Cminor.St_store (_, e1, e2) -> + ([e1 ; e2], []) + | Cminor.St_call (_, f, args, _) | Cminor.St_tailcall (f, args, _) -> + (f :: args, []) + | Cminor.St_seq (stmt1, stmt2) -> + ([], [stmt1 ; stmt2]) + | Cminor.St_ifthenelse (e, stmt1, stmt2) -> + ([e], [stmt1 ; stmt2]) + | Cminor.St_loop stmt | Cminor.St_block stmt + | Cminor.St_label (_, stmt) | Cminor.St_cost (_, stmt) -> + ([], [stmt]) + +let statement_fill_subs stmt sub_es sub_stmts = + match stmt, sub_es, sub_stmts with + | ( Cminor.St_skip | Cminor.St_exit _ | Cminor.St_return None + | Cminor.St_goto _), _, _ -> stmt + | Cminor.St_assign (x, _), e :: _, _ -> + Cminor.St_assign (x, e) + | Cminor.St_switch (_, cases, dflt), e :: _, _ -> + Cminor.St_switch (e, cases, dflt) + | Cminor.St_return _, e :: _, _ -> + Cminor.St_return (Some e) + | Cminor.St_store (size, _, _), e1 :: e2 :: _, _ -> + Cminor.St_store (size, e1, e2) + | Cminor.St_call (x_opt, _, _, sg), f :: args, _ -> + Cminor.St_call (x_opt, f, args, sg) + | Cminor.St_tailcall (_, _, sg), f :: args, _ -> + Cminor.St_tailcall (f, args, sg) + | Cminor.St_seq _, _, stmt1 :: stmt2 :: _ -> + Cminor.St_seq (stmt1, stmt2) + | Cminor.St_ifthenelse _, e :: _, stmt1 :: stmt2 :: _ -> + Cminor.St_ifthenelse (e, stmt1, stmt2) + | Cminor.St_loop _, _, stmt :: _ -> + Cminor.St_loop stmt + | Cminor.St_block _, _, stmt :: _ -> + Cminor.St_block stmt + | Cminor.St_label (lbl, _), _, stmt :: _ -> + Cminor.St_label (lbl, stmt) + | Cminor.St_cost (lbl, _), _, stmt :: _ -> + Cminor.St_cost (lbl, stmt) + | _ -> assert false (* do not use on these arguments *) + +(* In [statement f_expr f_stmt stmt], [f_stmt]'s second argument is the + list of [expression f_expr]'s results on [stmt]'s sub-expressions, and + [f_stmt]'s third argument is the list of [statement]'s results + on [stmt]'s sub-statements. *) + +let rec statement f_expr f_stmt stmt = + let (sub_es, sub_stmts) = statement_subs stmt in + let sub_es_res = List.map (expression f_expr) sub_es in + let sub_stmts_res = List.map (statement f_expr f_stmt) sub_stmts in + f_stmt stmt sub_es_res sub_stmts_res diff --git a/src/cminor/cminorFold.mli b/src/cminor/cminorFold.mli new file mode 100644 index 0000000..7e724d4 --- /dev/null +++ b/src/cminor/cminorFold.mli @@ -0,0 +1,33 @@ + +(** This module provides folding functions over the constructors of the + [Cminor]'s AST. *) + +val expression_subs : Cminor.expression -> Cminor.expression list + +val expression_fill_subs : Cminor.expression -> Cminor.expression list -> + Cminor.expression + +(* In [expression f e], [f]'s second argument is the list of + [expression]'s results on [e]'s sub-expressions. *) + +val expression : (Cminor.expression -> 'a list -> 'a) -> + Cminor.expression -> + 'a + +val statement_subs : Cminor.statement -> + (Cminor.expression list * Cminor.statement list) + +val statement_fill_subs : Cminor.statement -> + Cminor.expression list -> + Cminor.statement list -> + Cminor.statement + +(* In [statement f_expr f_stmt stmt], [f_stmt]'s second argument is the + list of [expression f_expr]'s results on [stmt]'s sub-expressions, and + [f_stmt]'s third argument is the list of [statement]'s results + on [stmt]'s sub-statements. *) + +val statement : (Cminor.expression -> 'a list -> 'a) -> + (Cminor.statement -> 'a list -> 'b list -> 'b) -> + Cminor.statement -> + 'b diff --git a/src/cminor/cminorInterpret.ml b/src/cminor/cminorInterpret.ml new file mode 100644 index 0000000..6e70555 --- /dev/null +++ b/src/cminor/cminorInterpret.ml @@ -0,0 +1,382 @@ +open AST +open Cminor + +module Mem = Driver.CminorMemory +module Val = Mem.Value +module LocalEnv = Map.Make(String) +type local_env = Val.t LocalEnv.t +type memory = Cminor.function_def Mem.memory + + +let error_prefix = "Cminor interpret" +let error s = Error.global_error error_prefix s +let warning s = Error.warning error_prefix s +let error_float () = error "float not supported." + + +(* Helpers *) + +let value_of_address = List.hd +let address_of_value v = [v] + + +(* State of execution *) + +type continuation = + Ct_stop + | Ct_cont of statement*continuation + | Ct_endblock of continuation + | Ct_returnto of + ident option*internal_function*Val.address*local_env*continuation + +type state = + State_regular of + internal_function*statement*continuation*Val.address*local_env*(function_def Mem.memory) + | State_call of function_def*Val.t list*continuation*(function_def Mem.memory) + | State_return of Val.t*continuation*(function_def Mem.memory) + +let string_of_local_env lenv = + let f x v s = s ^ x ^ " = " ^ (Val.to_string v) ^ " " in + LocalEnv.fold f lenv "" + +let string_of_expr = CminorPrinter.print_expression + +let string_of_args args = + "(" ^ (MiscPottier.string_of_list ", " string_of_expr args) ^ ")" + +let rec string_of_statement = function + | St_skip -> "skip" + | St_assign (x, e) -> x ^ " = " ^ (string_of_expr e) + | St_store (q, e1, e2) -> + Printf.sprintf "%s[%s] = %s" + (Memory.string_of_quantity q) (string_of_expr e1) (string_of_expr e2) + | St_call (None, f, args, _) + | St_tailcall (f, args, _) -> (string_of_expr f) ^ (string_of_args args) + | St_call (Some x, f, args, _) -> + x ^ " = " ^ (string_of_expr f) ^ (string_of_args args) + | St_seq _ -> "sequence" + | St_ifthenelse (e, _, _) -> "if (" ^ (string_of_expr e) ^ ")" + | St_loop _ -> "loop" + | St_block _ -> "block" + | St_exit n -> "exit " ^ (string_of_int n) + | St_switch (e, _, _) -> "switch (" ^ (string_of_expr e) ^ ")" + | St_return None -> "return" + | St_return (Some e) -> "return (" ^ (string_of_expr e) ^ ")" + | St_label (lbl, _) -> "label " ^ lbl + | St_goto lbl -> "goto " ^ lbl + | St_cost (lbl, _) -> "cost " ^ lbl + +let print_state = function + | State_regular (_, stmt, _, sp, lenv, mem) -> + Printf.printf "Local environment:\n%s\n\nMemory:%s\nStack pointer: %s\n\nRegular state: %s\n\n%!" + (string_of_local_env lenv) + (Mem.to_string mem) + (Val.to_string (value_of_address sp)) + (string_of_statement stmt) + | State_call (_, args, _, mem) -> + Printf.printf "Memory:%s\nCall state\n\nArguments:\n%s\n\n%!" + (Mem.to_string mem) + (MiscPottier.string_of_list " " Val.to_string args) + | State_return (v, _, mem) -> + Printf.printf "Memory:%s\nReturn state: %s\n\n%!" + (Mem.to_string mem) + (Val.to_string v) + + +(* Global and local environment management *) + +let init_local_env args params vars = + let f_param lenv (x, _) v = LocalEnv.add x v lenv in + let f_var lenv (x, _) = LocalEnv.add x Val.undef lenv in + let lenv = List.fold_left2 f_param LocalEnv.empty params args in + List.fold_left f_var lenv vars + +let find_fundef f mem = + let addr = Mem.find_global mem f in + Mem.find_fun_def mem addr + + +(* Expression evaluation *) + +module Eval_op (M : Memory.S) = struct + + let concrete_stacksize = M.concrete_size + + let ext_fun_of_sign = function + | AST.Signed -> M.Value.sign_ext + | AST.Unsigned -> M.Value.zero_ext + + let cast_to_std t v = match t with + | AST.Sig_int (size, sign) -> (ext_fun_of_sign sign) v size M.int_size + | AST.Sig_float _ -> error_float () + | AST.Sig_offset | AST.Sig_ptr -> v + + let cast_from_std t v = match t with + | AST.Sig_int (size, _) -> (ext_fun_of_sign AST.Unsigned) v M.int_size size + | AST.Sig_float _ -> error_float () + | AST.Sig_offset | AST.Sig_ptr -> v + + let cst mem sp t = function + | Cst_int i -> cast_to_std t (M.Value.of_int i) + | Cst_float _ -> error_float () + | Cst_addrsymbol id when M.mem_global mem id -> + value_of_address (M.find_global mem id) + | Cst_addrsymbol id -> error ("unknown global variable " ^ id ^ ".") + | Cst_stack -> value_of_address sp + | Cst_offset off -> M.Value.of_int (M.concrete_offset off) + | Cst_sizeof t' -> cast_to_std t (M.Value.of_int (M.concrete_size t')) + + let fun_of_op1 = function + | Op_cast ((from_size, from_sign), to_size) -> + (fun v -> (ext_fun_of_sign from_sign) v from_size to_size) + | Op_negint -> M.Value.negint + | Op_notbool -> M.Value.notbool + | Op_notint -> M.Value.negint + | Op_id -> (fun v -> v) + | Op_ptrofint + | Op_intofptr -> + error "conversion between integers and pointers not supported yet." + + let op1 ret_type t op v = + cast_from_std ret_type ((fun_of_op1 op) (cast_to_std t v)) + + let fun_of_op2 = function + | Op_add | Op_addp -> M.Value.add + | Op_sub | Op_subp | Op_subpp -> M.Value.sub + | Op_mul -> M.Value.mul + | Op_div -> M.Value.div + | Op_divu -> M.Value.divu + | Op_mod -> M.Value.modulo + | Op_modu -> M.Value.modulou + | Op_and -> M.Value.and_op + | Op_or -> M.Value.or_op + | Op_xor -> M.Value.xor + | Op_shl -> M.Value.shl + | Op_shr -> M.Value.shr + | Op_shru -> M.Value.shru + | Op_cmp Cmp_eq | Op_cmpp Cmp_eq -> M.Value.cmp_eq + | Op_cmp Cmp_ne | Op_cmpp Cmp_ne -> M.Value.cmp_ne + | Op_cmp Cmp_gt | Op_cmpp Cmp_gt -> M.Value.cmp_gt + | Op_cmp Cmp_ge | Op_cmpp Cmp_ge -> M.Value.cmp_ge + | Op_cmp Cmp_lt | Op_cmpp Cmp_lt -> M.Value.cmp_lt + | Op_cmp Cmp_le | Op_cmpp Cmp_le -> M.Value.cmp_le + | Op_cmpu Cmp_eq -> M.Value.cmp_eq_u + | Op_cmpu Cmp_ne -> M.Value.cmp_ne_u + | Op_cmpu Cmp_gt -> M.Value.cmp_gt_u + | Op_cmpu Cmp_ge -> M.Value.cmp_ge_u + | Op_cmpu Cmp_lt -> M.Value.cmp_lt_u + | Op_cmpu Cmp_le -> M.Value.cmp_le_u + + let op2 ret_type t1 t2 op2 v1 v2 = + let v1 = cast_to_std t1 v1 in + let v2 = cast_to_std t2 v2 in + cast_from_std ret_type ((fun_of_op2 op2) v1 v2) +end + +module Eval = Eval_op (Mem) + +let concrete_stacksize = Eval.concrete_stacksize +let eval_constant = Eval.cst +let eval_unop = Eval.op1 +let eval_binop = Eval.op2 + +let type_of_expr (Cminor.Expr (_, t)) = t + +let rec eval_expression stack local_env memory (Cminor.Expr (ed, t)) = + match ed with + | Id x when LocalEnv.mem x local_env -> (LocalEnv.find x local_env,[]) + | Id x -> error ("unknown local variable " ^ x ^ ".") + | Cst(c) -> (eval_constant memory stack t c,[]) + | Op1(op,arg) -> + let (v,l) = eval_expression stack local_env memory arg in + (eval_unop t (type_of_expr arg) op v,l) + | Op2(op, arg1, arg2) -> + let (v1,l1) = eval_expression stack local_env memory arg1 in + let (v2,l2) = eval_expression stack local_env memory arg2 in + (eval_binop t (type_of_expr arg1) (type_of_expr arg2) op v1 v2,l1@l2) + | Mem(q,a) -> + let (v,l) = eval_expression stack local_env memory a in + (Mem.loadq memory q (address_of_value v),l) + | Cond(a1,a2,a3) -> + let (v1,l1) = eval_expression stack local_env memory a1 in + if Val.is_true v1 then + let (v2,l2) = eval_expression stack local_env memory a2 in + (v2,l1@l2) + else + if Val.is_false v1 then + let (v3,l3) = eval_expression stack local_env memory a3 in + (v3,l1@l3) + else error "undefined conditional value." + | Exp_cost(lbl,e) -> + let (v,l) = eval_expression stack local_env memory e in + (v,l@[lbl]) + +let eval_exprlist sp lenv mem es = + let f (vs, cost_lbls) e = + let (v, cost_lbls') = eval_expression sp lenv mem e in + (vs @ [v], cost_lbls @ cost_lbls') in + List.fold_left f ([], []) es + +(* State transition *) + +let rec callcont = function + Ct_stop -> Ct_stop + | Ct_cont(_,k) -> callcont k + | Ct_endblock(k) -> callcont k + | Ct_returnto(a,b,c,d,e) -> Ct_returnto(a,b,c,d,e) + +let findlabel lbl st k = + let rec fdlbl k = function + St_skip -> None + | St_assign(_,_) -> None + | St_store(_,_,_) -> None + | St_call(_,_,_,_) -> None + | St_tailcall(_,_,_) -> None + | St_seq(s1,s2) -> + (match fdlbl (Ct_cont(s2,k)) s1 with + None -> fdlbl k s2 + | Some(v) -> Some(v) + ) + | St_ifthenelse(_,s1,s2) -> + (match fdlbl k s1 with + None -> fdlbl k s2 + | Some(v) -> Some(v) + ) + | St_loop(s) -> fdlbl (Ct_cont(St_loop(s),k)) s + | St_block(s) -> fdlbl (Ct_endblock(k)) s + | St_exit(_) -> None + | St_switch(_,_,_) -> None + | St_return(_) -> None + | St_label(l,s) when l = lbl -> Some((s,k)) + | St_goto(_) -> None + | St_cost (_,s) | St_label (_,s) -> fdlbl k s + in match fdlbl k st with + None -> assert false (*Wrong label*) + | Some(v) -> v + + +let call_state sigma e m f params cont = + let (addr,l1) = eval_expression sigma e m f in + let fun_def = Mem.find_fun_def m (address_of_value addr) in + let (args,l2) = eval_exprlist sigma e m params in + (State_call(fun_def,args,cont,m),l1@l2) + +let eval_stmt f k sigma e m s = match s, k with + | St_skip,Ct_cont(s,k) -> (State_regular(f, s, k, sigma, e, m),[]) + | St_skip,Ct_endblock(k) -> (State_regular(f, St_skip, k, sigma, e, m),[]) + | St_skip, (Ct_returnto _ as k) -> + (State_return (Val.undef,k,Mem.free m sigma),[]) + | St_skip,Ct_stop -> + (State_return (Val.undef,Ct_stop,Mem.free m sigma),[]) + | St_assign(x,exp),_ -> + let (v,l) = eval_expression sigma e m exp in + let e = LocalEnv.add x v e in + (State_regular(f, St_skip, k, sigma, e, m),l) + | St_store(q,a1,a2),_ -> + let (v1,l1) = eval_expression sigma e m a1 in + let (v2,l2) = eval_expression sigma e m a2 in + let m = Mem.storeq m q (address_of_value v1) v2 in + (State_regular(f, St_skip, k, sigma, e, m),l1@l2) + | St_call(xopt,f',params,_),_ -> + call_state sigma e m f' params (Ct_returnto(xopt,f,sigma,e,k)) + | St_tailcall(f',params,_),_ -> + call_state sigma e m f' params (callcont k) + | St_seq(s1,s2),_ -> (State_regular(f, s1, Ct_cont(s2, k), sigma, e, m),[]) + | St_ifthenelse(exp,s1,s2),_ -> + let (v,l) = eval_expression sigma e m exp in + let next_stmt = + if Val.is_true v then s1 + else + if Val.is_false v then s2 + else error "undefined conditional value." in + (State_regular(f,next_stmt,k,sigma,e,m),l) + | St_loop(s),_ -> (State_regular(f,s,Ct_cont((St_loop s),k),sigma,e,m),[]) + | St_block(s),_ -> (State_regular(f,s,(Ct_endblock k),sigma,e,m),[]) + | St_exit(n),Ct_cont(s,k) -> (State_regular(f,(St_exit n),k,sigma,e,m),[]) + | St_exit(0),Ct_endblock(k) -> (State_regular(f,St_skip,k,sigma,e,m),[]) + | St_exit(n),Ct_endblock(k) -> + (State_regular(f,(St_exit (n-1)),k,sigma,e,m),[]) + | St_label(_,s),_ -> (State_regular(f,s,k,sigma,e,m),[]) + | St_goto(lbl),_ -> + let (s2,k2) = findlabel lbl f.f_body (callcont k) in + (State_regular(f,s2,k2,sigma,e,m),[]) + | St_switch(exp,lst,def),_ -> + let (v,l) = eval_expression sigma e m exp in + if Val.is_int v then + try + let i = Val.to_int v in + let nb_exit = + if List.mem_assoc i lst then List.assoc i lst + else def in + (State_regular(f, St_exit nb_exit,k, sigma, e, m),l) + with _ -> error "int value too big." + else error "undefined switch value." + | St_return(None),_ -> + (State_return (Val.undef,callcont k,Mem.free m sigma),[]) + | St_return(Some(a)),_ -> + let (v,l) = eval_expression sigma e m a in + (State_return (v,callcont k,Mem.free m sigma),l) + | St_cost(lbl,s),_ -> (State_regular(f,s,k,sigma,e,m),[lbl]) + | _ -> error "state malformation." + + +module InterpretExternal = Primitive.Interpret (Mem) + +let interpret_external k mem f args = + let (mem', v) = match InterpretExternal.t mem f args with + | (mem', InterpretExternal.V vs) -> + let v = if List.length vs = 0 then Val.undef else List.hd vs in + (mem', v) + | (mem', InterpretExternal.A addr) -> (mem', value_of_address addr) in + State_return (v, k, mem') + +let step_call vargs k m = function + | F_int f -> + let (m, sp) = Mem.alloc m (concrete_stacksize f.f_stacksize) in + let lenv = init_local_env vargs f.f_params f.f_vars in + State_regular(f,f.f_body,k,sp,lenv,m) + | F_ext f -> interpret_external k m f.ef_tag vargs + +let step = function + | State_regular(f,stmt,k,sp,e,m) -> eval_stmt f k sp e m stmt + | State_call(fun_def,vargs,k,m) -> (step_call vargs k m fun_def,[]) + | State_return(v,Ct_returnto(None,f,sigma,e,k),m) -> + (State_regular(f,St_skip,k,sigma,e,m),[]) + | State_return(v,Ct_returnto(Some x,f,sigma,e,k),m) -> + let e = LocalEnv.add x v e in + (State_regular(f,St_skip,k,sigma,e,m),[]) + | _ -> error "state malformation." + + +let init_mem prog = + let f_var mem (x, size, init_datas) = Mem.add_var mem x size init_datas in + let mem = List.fold_left f_var Mem.empty prog.vars in + let f_fun_def mem (f, def) = Mem.add_fun_def mem f def in + List.fold_left f_fun_def mem prog.functs + +let compute_result v = + if Val.is_int v then IntValue.Int32.cast (Val.to_int_repr v) + else IntValue.Int32.zero + +let rec exec debug trace (state, l) = + let cost_labels = l @ trace in + let print_and_return_result res = + if debug then Printf.printf "Result = %s\n%!" + (IntValue.Int32.to_string res) ; + (res, cost_labels) in + if debug then print_state state ; + match state with + | State_return(v,Ct_stop,_) -> (* Explicit return in main *) + print_and_return_result (compute_result v) + | State_regular(_,St_skip,Ct_stop,_,_,_) -> (* Implicit return in main *) + print_and_return_result IntValue.Int32.zero + | state -> exec debug cost_labels (step state) + +let interpret debug prog = + Printf.printf "*** Cminor interpret ***\n%!" ; + match prog.main with + | None -> (IntValue.Int32.zero, []) + | Some main -> + let mem = init_mem prog in + let first_state = (State_call (find_fundef main mem,[],Ct_stop,mem),[]) in + exec debug [] first_state diff --git a/src/cminor/cminorInterpret.mli b/src/cminor/cminorInterpret.mli new file mode 100644 index 0000000..2c092aa --- /dev/null +++ b/src/cminor/cminorInterpret.mli @@ -0,0 +1,17 @@ +(** This module provides a function to interpret a [Cminor] program and + return the trace of cost labels encountered. This function can + also print debug informations. *) + +module Eval_op (M : Memory.S) : sig + val concrete_stacksize : AST.abstract_size -> int + val cst : + 'a M.memory -> M.Value.address -> AST.sig_type -> AST.cst -> M.Value.t + val op1 : + AST.sig_type (* returned type *) -> AST.sig_type -> AST.op1 -> M.Value.t -> + M.Value.t + val op2 : + AST.sig_type (* returned type *) -> AST.sig_type -> AST.sig_type -> + AST.op2 -> M.Value.t -> M.Value.t -> M.Value.t +end + +val interpret : bool -> Cminor.program -> AST.trace diff --git a/src/cminor/cminorLabelling.ml b/src/cminor/cminorLabelling.ml new file mode 100644 index 0000000..157922e --- /dev/null +++ b/src/cminor/cminorLabelling.ml @@ -0,0 +1,101 @@ + +(** This module defines the labelling of a [Cminor] program. *) + + +let prefix = "_cost" + + +(* Add a cost label in front of a statement. *) + +let add_starting_cost_label cost_universe stmt = + Cminor.St_cost (CostLabel.Gen.fresh cost_universe, stmt) + +(* Add a cost label at the end of a statement. *) + +let add_ending_cost_label cost_universe stmt = + Cminor.St_seq (stmt, add_starting_cost_label cost_universe Cminor.St_skip) + + +(* This function adds cost labels to an expression, given the result on its + sub-expressions. *) + +let f_add_cost_labels_exp cost_universe e subexp_res = match e, subexp_res with + | Cminor.Id _, _ | Cminor.Cst _, _ -> e + | Cminor.Op1 (op1, _), [e] -> Cminor.Op1 (op1, e) + | Cminor.Op2 (op2, _, _), [e1 ; e2] -> Cminor.Op2 (op2, e1, e2) + | Cminor.Mem (chunk, _), [e] -> Cminor.Mem (chunk, e) + | Cminor.Cond _, [e1 ; e2 ; e3] -> + let e2 = Cminor.Exp_cost (CostLabel.Gen.fresh cost_universe, e2) in + let e3 = Cminor.Exp_cost (CostLabel.Gen.fresh cost_universe, e3) in + Cminor.Cond (e1, e2, e3) + | Cminor.Exp_cost (lab, _), [e] -> Cminor.Exp_cost (lab, e) + | _ -> assert false (* wrong number of arguments *) + +(* This function adds cost labels to a statement, given the result on its + sub-expressions and sub-statements. *) + +let f_add_cost_labels_body cost_universe stmt subexp_res substmt_res = + match stmt, subexp_res, substmt_res with + | Cminor.St_skip, _, _ | Cminor.St_exit _, _, _ + | Cminor.St_goto _, _, _ | Cminor.St_return None, _, _ -> + stmt + | Cminor.St_assign (x, _), [e], _ -> + Cminor.St_assign (x, e) + | Cminor.St_store (chunk, _, _), [e1 ; e2], _ -> + Cminor.St_store (chunk, e1, e2) + | Cminor.St_call (x, _, _, sg), f :: args, _ -> + Cminor.St_call (x, f, args, sg) + | Cminor.St_tailcall (_, _, sg), f :: args, _ -> + Cminor.St_tailcall (f, args, sg) + | Cminor.St_seq _, _, [stmt1 ; stmt2] -> + Cminor.St_seq (stmt1, stmt2) + | Cminor.St_ifthenelse _, [e], [stmt1 ; stmt2] -> + let stmt1 = add_starting_cost_label cost_universe stmt1 in + let stmt2 = add_starting_cost_label cost_universe stmt2 in + Cminor.St_ifthenelse (e, stmt1, stmt2) + | Cminor.St_loop _, _, [stmt] -> + let stmt = add_starting_cost_label cost_universe stmt in + add_ending_cost_label cost_universe (Cminor.St_loop stmt) + | Cminor.St_block _, _, [stmt] -> + Cminor.St_block stmt + | Cminor.St_switch (_, tbl, dflt), [e], _ -> + add_ending_cost_label cost_universe (Cminor.St_switch (e, tbl, dflt)) + | Cminor.St_return _, [e], _ -> + Cminor.St_return (Some e) + | Cminor.St_label (lab, _), _, [stmt] -> + let stmt = add_starting_cost_label cost_universe stmt in + Cminor.St_label (lab, stmt) + | Cminor.St_cost (lab, _), _, [stmt] -> + Cminor.St_cost (lab, stmt) + | _ -> assert false (* wrong number of arguments *) + +(* Add cost labels to a statement. *) + +let add_cost_labels_body cost_universe stmt = + CminorFold.statement + (f_add_cost_labels_exp cost_universe) + (f_add_cost_labels_body cost_universe) + stmt + +(* Add cost labels to a function definition. *) + +let add_cost_labels_functs cost_universe functs (f_id, f_def) = + match f_def with + | Cminor.F_int def -> + let body = add_cost_labels_body cost_universe def.Cminor.f_body in + let body = add_starting_cost_label cost_universe body in + let def' = { def with Cminor.f_body = body } in + functs @ [(f_id, Cminor.F_int def')] + | Cminor.F_ext _ -> functs @ [(f_id, f_def)] + +(** [add_cost_labels prog] inserts some labels to enable cost annotation. *) + +let add_cost_labels prog = + let labs = CminorAnnotator.all_labels prog in + let labs = StringTools.Set.fold CostLabel.Set.add labs CostLabel.Set.empty in + let cost_prefix = CostLabel.Gen.fresh_prefix labs prefix in + let cost_universe = CostLabel.Gen.new_universe cost_prefix in + let functs = + List.fold_left (add_cost_labels_functs cost_universe) [] + prog.Cminor.functs in + { prog with Cminor.functs = functs } diff --git a/src/cminor/cminorLabelling.mli b/src/cminor/cminorLabelling.mli new file mode 100644 index 0000000..16a3c2d --- /dev/null +++ b/src/cminor/cminorLabelling.mli @@ -0,0 +1,22 @@ + +(** This module defines the labelling of a [Cminor] program. *) + +(** [add_cost_labels prog] inserts some labels to enable + cost annotation. + + The labelling of a function proceeds as follows: + + - A label is added at the beginning of the function. + + - For each branching instruction in the function, a cost label is added at + the beginning of each branch. The concerned instructions are: + - ternary expressions; + - conditionals; + - loops; + - switches. + + - For each label instruction in the function, a cost label is added after + the label, in order to capture loops potentially created by gotos. +*) + +val add_cost_labels : Cminor.program -> Cminor.program diff --git a/src/cminor/cminorLexer.mll b/src/cminor/cminorLexer.mll new file mode 100644 index 0000000..8b87e7d --- /dev/null +++ b/src/cminor/cminorLexer.mll @@ -0,0 +1,150 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +{ + open CminorParser + exception Error of string +} + +let ret = ['\010'] +let blank = [' ' '\009' '\012' '\013'] +let floatlit = + ['0'-'9'] ['0'-'9' '_']* + ('.' ['0'-'9' '_']* )? + (['e' 'E'] ['+' '-']? ['0'-'9'] ['0'-'9' '_']*)? +let ident = ['A'-'Z' 'a'-'z' '_'] ['A'-'Z' 'a'-'z' '_' '0'-'9']* +let intlit = "-"? ( ['0'-'9']+ | "0x" ['0'-'9' 'a'-'f' 'A'-'F']+ + | "0o" ['0'-'7']+ | "0b" ['0'-'1']+ ) +let stringlit = "\"" [ ^ '"' ] * '"' + +rule token = parse + | ret { Misc.LexingExt.new_line lexbuf ; token lexbuf } + | blank + { token lexbuf } + | "/*" { comment lexbuf; token lexbuf } + | "absf" { ABSF } + | "&" { AMPERSAND } + | "&&" { AMPERSANDAMPERSAND } + | "!" { BANG } + | "!=" { BANGEQUAL } + | "!=f" { BANGEQUALF } + | "!=u" { BANGEQUALU } + | "|" { BAR } + | "||" { BARBAR } + | "^" { CARET } + | "case" { CASE } + | ":" { COLON } + | "," { COMMA } + | "default" { DEFAULT } +(* | "$" { DOLLAR } *) + | "else" { ELSE } + | "=" { EQUAL } + | "==" { EQUALEQUAL } + | "==f" { EQUALEQUALF } + | "==u" { EQUALEQUALU } + | "exit" { EXIT } + | "extern" { EXTERN } + | "float" { FLOAT } + | "float32" { FLOAT32 } + | "float64" { FLOAT64 } + | "floatofint" { FLOATOFINT } + | "floatofintu" { FLOATOFINTU } + | ">" { GREATER } + | ">f" { GREATERF } + | ">u" { GREATERU } + | ">=" { GREATEREQUAL } + | ">=f" { GREATEREQUALF } + | ">=u" { GREATEREQUALU } + | ">>" { GREATERGREATER } + | ">>u" { GREATERGREATERU } + | "if" { IF } +(* | "in" { IN } *) + | "int" { INT } + | "int8" { INT8 } + | "int16" { INT16 } + | "int32" { INT32 } + | "int8sto8" { INT8STO8 } + | "int8sto16" { INT8STO16 } + | "int8sto32" { INT8STO32 } + | "int8uto8" { INT8UTO8 } + | "int8uto16" { INT8UTO16 } + | "int8uto32" { INT8UTO32 } + | "int16sto8" { INT16STO8 } + | "int16sto16" { INT16STO16 } + | "int16sto32" { INT16STO32 } + | "int16uto8" { INT16UTO8 } + | "int16uto16" { INT16UTO16 } + | "int16uto32" { INT16UTO32 } + | "int32sto8" { INT32STO8 } + | "int32sto16" { INT32STO16 } + | "int32sto32" { INT32STO32 } + | "int32uto8" { INT32UTO8 } + | "int32uto16" { INT32UTO16 } + | "int32uto32" { INT32UTO32 } + | "intoffloat" { INTOFFLOAT } + | "intuoffloat" { INTUOFFLOAT } + | "ptr" { PTR } + | "{" { LBRACE } +(* | "{{" { LBRACELBRACE } *) + | "[" { LBRACKET } + | "<" { LESS } + | "" { MINUSGREATER } + | "-f" { MINUSF } + | "%" { PERCENT } + | "%u" { PERCENTU } + | "+" { PLUS } + | "+f" { PLUSF } + | "?" { QUESTION } + | "}" { RBRACE } +(* | "}}" { RBRACERBRACE } *) + | "]" { RBRACKET } + | "return" { RETURN } + | ")" { RPAREN } + | ";" { SEMICOLON } + | "/" { SLASH } + | "/f" { SLASHF } + | "/u" { SLASHU } + | "stack" { STACK } + | "*" { STAR } + | "*f" { STARF } + | "switch" { SWITCH } + | "tailcall" { TAILCALL } + | "~" { TILDE } + | "var" { VAR } + | "void" { VOID } + | "goto" { GOTO } + | "block" { BLOCK } + | intlit { INTLIT(int_of_string(Lexing.lexeme lexbuf)) } + | floatlit { FLOATLIT(float_of_string(Lexing.lexeme lexbuf)) } + | stringlit { let s = Lexing.lexeme lexbuf in + STRINGLIT(String.sub s 1 (String.length s - 2)) } + | ident { IDENT(Lexing.lexeme lexbuf) } + | eof { EOF } + | _ { raise(Error("illegal character `" ^ Char.escaped (Lexing.lexeme_char lexbuf 0) ^ "'")) } + +and comment = parse + "*/" { () } + | eof { raise(Error "unterminated comment") } + | _ { comment lexbuf } diff --git a/src/cminor/cminorParser.mly b/src/cminor/cminorParser.mly new file mode 100644 index 0000000..86d023e --- /dev/null +++ b/src/cminor/cminorParser.mly @@ -0,0 +1,632 @@ +/* Adapted from Leroy's CompCert */ +/* TODO: check coherence with CminorPrinter */ + +/* tokens ALLOC, DOLLAR, IN, LET, p_let were unused and have been removed */ +/* precedence levels unused were also removed */ + +/* *********************************************************************/ +/* */ +/* The Compcert verified compiler */ +/* */ +/* Xavier Leroy, INRIA Paris-Rocquencourt */ +/* */ +/* Copyright Institut National de Recherche en Informatique et en */ +/* Automatique. All rights reserved. This file is distributed */ +/* under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 2 of the License, or */ +/* (at your option) any later version. This file is also distributed */ +/* under the terms of the INRIA Non-Commercial License Agreement. */ +/* */ +/* *********************************************************************/ + +%{ + + open AST + open Cminor + open Memory + + let error_prefix = "Cminor parser" + let error s = Error.global_error error_prefix s + let warning s = Error.warning error_prefix s + let error_float () = error "float not supported." + + let uint32 = (4, Unsigned) + let int32 = (4, Signed) + + (* Function calls are not allowed in the AST of expressions, but function + calls in the AST of statements have a special argument which can be used to + store the result of the function call in a side-effect manner. + Example: the statement + x = y + f(z,g(t)); + will be transformed into the (simplified syntax) AST statements + g(_t1,t) + f(_t2,y,_t1); + x = y + _t2 + where _t1 and _t2 are fresh temporary variables. *) + + + (* Thus, to deal with function calls in expressions, we need to create fresh + temporary variables *) + + let temp_counter = ref 0 + let temporaries = ref [] + + let mktemp () = + incr temp_counter; + let id = Printf.sprintf "_t%d" !temp_counter in + temporaries := id :: !temporaries; + id + + + (* Expressions with function calls *) + + type rexpr = + | RId of ident + | RCst of cst + | ROp1 of op1 * rexpr + | ROp2 of op2 * rexpr * rexpr + | RMem of Memory.quantity * rexpr + | RCond of rexpr * rexpr * rexpr + | RCall of rexpr * rexpr list * signature + + (* [convert_accu] stores the function calls of expressions with function + calls being converted to expressions without function calls *) + let convert_accu = ref [] + + (* [convert_rexpr rexpr] converts the expression with function calls [rexpr] + into an expression without function calls. The function calls in [rexpr] + are stored in [convert_accu] *) + let rec convert_rexpr = function + | RId id -> Id id + | RCst c -> Cst c + | ROp1 (op, e1) -> Op1 (op, convert_rexpr e1) + | ROp2 (op, e1, e2) -> Op2 (op, convert_rexpr e1, convert_rexpr e2) + | RMem (chunk, e1) -> Mem (chunk, convert_rexpr e1) + | RCond (e1, e2, e3) -> + Cond (convert_rexpr e1, convert_rexpr e2, convert_rexpr e3) + | RCall(e1, el, sg) -> + let c1 = convert_rexpr e1 in + let cl = convert_rexpr_list el in + let t = mktemp() in + convert_accu := St_call (Some t, c1, cl, sg) :: !convert_accu; + Id t + + and convert_rexpr_list el = List.map convert_rexpr el + + (* [prepend_seq stmts last] reverses and sequences the list of statements + [stmts] and puts [last] at the end *) + let rec prepend_seq stmts last = + match stmts with + | [] -> last + | s1 :: sl -> prepend_seq sl (St_seq (s1, last)) + + (* [mkeval e] creates the AST statement associated to the Cminor instruction + e; + where [e] is an expression with possible function calls *) + let mkeval e = + convert_accu := []; + match e with + | RCall (e1, el, sg) -> + let c1 = convert_rexpr e1 in + let cl = convert_rexpr_list el in + prepend_seq !convert_accu (St_call (None, c1, cl, sg)) + | _ -> + ignore (convert_rexpr e); + prepend_seq !convert_accu St_skip + + (* [mkeval id e] creates the AST statement associated to the Cminor + instruction + id = e; + where [e] is an expression with possible function calls *) + let mkassign id e = + convert_accu := []; + match e with + | RCall (e1, el, sg) -> + let c1 = convert_rexpr e1 in + let cl = convert_rexpr_list el in + prepend_seq !convert_accu (St_call (Some id, c1, cl, sg)) + | _ -> + let c = convert_rexpr e in + prepend_seq !convert_accu (St_assign (id, c)) + + (* [mkstore size e1 e2] creates the AST statement associated to the Cminor + instruction + size[e1] = e2; + where [e1] and [e2] are expressions with possible function calls *) + let mkstore size e1 e2 = + convert_accu := []; + let c1 = convert_rexpr e1 in + let c2 = convert_rexpr e2 in + prepend_seq !convert_accu (St_store (size, c1, c2)) + + (* [mkifthenelse e s1 s2] creates the AST statement associated to the Cminor + instruction + if (e) { s1 } else { s2 } + where [e] is an expression with possible function calls *) + let mkifthenelse e s1 s2 = + convert_accu := []; + let c = convert_rexpr e in + prepend_seq !convert_accu (St_ifthenelse (c, s1, s2)) + + (* [mkreturn_some e] creates the AST statement associated to the Cminor + instruction + return e; + where [e] is an expression with possible function calls *) + let mkreturn_some e = + convert_accu := []; + let c = convert_rexpr e in + prepend_seq !convert_accu (St_return (Some c)) + + (* [mkswitch e (cases, dfl)] creates the AST statement associated to the + Cminor instruction + switch (e) { + case i: exit j_i; + ... + default: exit j_default; } + where [e] is an expression with possible function calls *) + let mkswitch e (cases, dfl) = + convert_accu := []; + let c = convert_rexpr e in + prepend_seq !convert_accu (St_switch (c, cases, dfl)) + + (* The Cminor instruction + match (e) { + case 0: s0; + case 1: s1; + case 2: s2; } + is syntaxic sugar for the Cminor instruction + block { + block { + block { + block { + switch (e) { + case 0: exit 0; + case 1: exit 1; + default: exit 2; } + } s0; exit 2; + } s1; exit 1; + } s2; + } + Note that matches are assumed to be exhaustive *) + + let mkmatch_aux e cases = + let ncases = List.length cases in + let rec mktable n = function + | [] -> assert false + | [key, action] -> [] + | (key, action) :: rem -> (key, n) :: mktable (n+1) rem in + let sw = + St_switch (e, mktable 0 cases, pred ncases) in + let rec mkblocks body n = function + | [] -> assert false + | [key, action] -> St_block (St_seq (body, action)) + | (key, action) :: rem -> + mkblocks + (St_block (St_seq (body, St_seq (action, St_exit n)))) + (pred n) rem in + mkblocks (St_block sw) (pred ncases) cases + + (* [mkmatch e cases] creates the AST statement associated to the Cminor + instruction + match (e) { + case i: s_i; + ... } + where [e] is an expression with possible function calls *) + let mkmatch e cases = + convert_accu := []; + let c = convert_rexpr e in + let s = + match cases with + | [] -> St_skip (* ??? *) + | [key, action] -> action + | _ -> mkmatch_aux c cases in + prepend_seq !convert_accu s + + (* [mktailcall f [e1;e2;...] sig] creates the AST statement associated to the + Cminor instruction + tailcall f(e1,e2,...): sig + where [e], [e1], [e2], ... are expressions with possible function calls *) + let mktailcall e1 el sg = + convert_accu := []; + let c1 = convert_rexpr e1 in + let cl = convert_rexpr_list el in + prepend_seq !convert_accu (St_tailcall (c1, cl, sg)) + + (* Parse error handler *) + let raise_error (_, pos) s = Error.error "parse error" pos (s ^ "\n") + +%} + +%token ABSF +%token AMPERSAND +%token AMPERSANDAMPERSAND +%token BANG +%token BANGEQUAL +%token BANGEQUALF +%token BANGEQUALU +%token BAR +%token BARBAR +%token CARET +%token CASE +%token COLON +%token COMMA +%token DEFAULT +%token ELSE +%token EQUAL +%token EQUALEQUAL +%token EQUALEQUALF +%token EQUALEQUALU +%token EOF +%token EXIT +%token EXTERN +%token FLOAT +%token FLOAT32 +%token FLOAT64 +%token FLOATLIT +%token FLOATOFINT +%token FLOATOFINTU +%token GREATER +%token GREATERF +%token GREATERU +%token GREATEREQUAL +%token GREATEREQUALF +%token GREATEREQUALU +%token GREATERGREATER +%token GREATERGREATERU +%token IDENT +%token IF +%token INT +%token INT8 +%token INT16 +%token INT32 +%token INT8STO8 +%token INT8STO16 +%token INT8STO32 +%token INT8UTO8 +%token INT8UTO16 +%token INT8UTO32 +%token INT16STO8 +%token INT16STO16 +%token INT16STO32 +%token INT16UTO8 +%token INT16UTO16 +%token INT16UTO32 +%token INT32STO8 +%token INT32STO16 +%token INT32STO32 +%token INT32UTO8 +%token INT32UTO16 +%token INT32UTO32 +%token INTLIT +%token INTOFFLOAT +%token INTUOFFLOAT +%token LBRACE +/* %token LBRACELBRACE */ +%token LBRACKET +%token LESS +%token LESSU +%token LESSF +%token LESSEQUAL +%token LESSEQUALU +%token LESSEQUALF +%token LESSLESS +%token LOOP +%token LPAREN +%token MATCH +%token MINUS +%token MINUSF +%token MINUSGREATER +%token PERCENT +%token PERCENTU +%token PLUS +%token PLUSF +%token QUESTION +%token RBRACE +/* %token RBRACERBRACE */ +%token RBRACKET +%token RETURN +%token RPAREN +%token SEMICOLON +%token SLASH +%token SLASHF +%token SLASHU +%token STACK +%token STAR +%token STARF +%token STRINGLIT +%token SWITCH +%token TILDE +%token TAILCALL +%token VAR +%token VOID +%token GOTO BLOCK +%token PTR + +/* Unused */ +/* %token ALLOC DOLLAR IN LET p_let */ + +/* Precedences from low to high */ + +/* %left COMMA */ +/* %left p_let */ +/* %right EQUAL */ +%right QUESTION COLON +%left BARBAR +%left AMPERSANDAMPERSAND +%left BAR +%left CARET +%left AMPERSAND +%left EQUALEQUAL BANGEQUAL LESS LESSEQUAL GREATER GREATEREQUAL EQUALEQUALU BANGEQUALU LESSU LESSEQUALU GREATERU GREATEREQUALU EQUALEQUALF BANGEQUALF LESSF LESSEQUALF GREATERF GREATEREQUALF +%left LESSLESS GREATERGREATER GREATERGREATERU +%left PLUS PLUSF MINUS MINUSF +%left STAR SLASH PERCENT STARF SLASHF SLASHU PERCENTU +%nonassoc BANG TILDE p_uminus ABSF INTOFFLOAT INTUOFFLOAT FLOATOFINT FLOATOFINTU FLOAT32 /* ALLOC */ +%left LPAREN + +/* Entry point */ + +%start program +%type program + +%% + +%inline position(X): x = X { (x, Position.lex_join $startpos $endpos) } + +/* Programs */ + +program: + global_declarations proc_list EOF { { vars = List.rev $1 ; + functs = List.rev $2 ; + main = Some "main" } } +; + +global_declarations: + /* empty */ { [] } + | global_declarations global_declaration { $2 :: $1 } +; + +global_declaration: + VAR STRINGLIT init_datas { ($2, List.rev $3) } + | pos = position(error) { raise_error pos + "Global declaration syntax error" } +; + +init_datas: + /* empty */ { [] } + | init_data { [$1] } + | LBRACE init_data_list RBRACE { $2 } +; + +init_data: + INTLIT { AST.Data_int32 $1 } + | FLOATLIT { AST.Data_float32 $1 } + | LPAREN INT8 RPAREN INTLIT { AST.Data_int8 $4 } + | LPAREN INT16 RPAREN INTLIT { AST.Data_int16 $4 } + | LPAREN INT32 RPAREN INTLIT { AST.Data_int32 $4 } + | LPAREN FLOAT32 RPAREN FLOATLIT { AST.Data_float32 $4 } + | LPAREN FLOAT64 RPAREN FLOATLIT { AST.Data_float64 $4 } + | LBRACKET INTLIT RBRACKET { AST.Data_reserve $2 } +; + +quantity: + INTLIT { Memory.QInt $1 } + | PTR { Memory.QPtr } + +init_data_list: + init_data { [$1] } + | init_data COMMA init_data_list { $1 :: $3 } +; + +proc_list: + /* empty */ { [] } + | proc_list proc { $2 :: $1 } +; + +/* Procedures */ + +proc: + STRINGLIT LPAREN parameters RPAREN COLON signature + LBRACE + stack_declaration + var_declarations + stmt_list + RBRACE + { let tmp = !temporaries in + temporaries := []; + temp_counter := 0; + ($1, F_int { f_sig = $6 ; + f_params = List.rev $3 ; + f_vars = List.rev (tmp @ $9) ; + f_ptrs = [] (* TODO *) ; + f_stacksize = $8 ; + f_body = $10 }) } + | EXTERN STRINGLIT COLON signature { ($2, F_ext { ef_tag = $2 ; + ef_sig = $4 }) } + | pos = position(error) { raise_error pos + "Procedure or function declaration syntax error" } +; + +parameters: + /* empty */ { [] } + | parameter_list { $1 } +; + +parameter_list: + IDENT { $1 :: [] } + | parameter_list COMMA IDENT { $3 :: $1 } + | pos = position(error) { raise_error pos + "Parameter declaration syntax error" } +; + +signature: + type_ { { args = [] ; res = Type_ret $1 } } + | VOID + { { args = [] ; res = Type_void } } + | type_ MINUSGREATER signature + { let s = $3 in {s with args = $1 :: s.args } } + | pos = position(error) { raise_error pos "Signature syntax error" } +; + +stack_declaration: + /* empty */ { 0 } + | STACK INTLIT SEMICOLON { $2 } + | pos = position(error) { raise_error pos "Stack declaration syntax error" } +; + +var_declarations: + /* empty */ { [] } + | var_declarations var_declaration { $2 @ $1 } + | pos = position(error) { raise_error pos + "Variable declaration syntax error" } +; + +var_declaration: + VAR parameter_list SEMICOLON { $2 } +; + +/* Statements */ + +stmt: + expr SEMICOLON { mkeval $1 } + | IDENT EQUAL expr SEMICOLON { mkassign $1 $3 } + | quantity LBRACKET expr RBRACKET EQUAL expr SEMICOLON + { mkstore $1 $3 $6 } + | IF LPAREN expr RPAREN stmts ELSE stmts { mkifthenelse $3 $5 $7 } + | IF LPAREN expr RPAREN stmts { mkifthenelse $3 $5 St_skip } + | LOOP stmts { St_loop $2 } + | BLOCK LBRACE stmt_list RBRACE { St_block $3 } + | EXIT SEMICOLON { St_exit 0 } + | EXIT INTLIT SEMICOLON { St_exit $2 } + | RETURN SEMICOLON { St_return None } + | RETURN expr SEMICOLON { mkreturn_some $2 } + | GOTO IDENT SEMICOLON { St_goto $2 } + | IDENT COLON stmt { St_label ($1, $3) } + | SWITCH LPAREN expr RPAREN LBRACE switch_cases RBRACE + { mkswitch $3 $6 } + | MATCH LPAREN expr RPAREN LBRACE match_cases RBRACE + { mkmatch $3 $6 } + | TAILCALL expr LPAREN expr_list RPAREN COLON signature SEMICOLON + { mktailcall $2 $4 $7 } +; + +stmt_list: + /* empty */ { St_skip } + | stmt stmt_list { St_seq ($1, $2) } + | pos = position(error) { raise_error pos "Statement syntax error" } +; + +stmts: + LBRACE stmt_list RBRACE { $2 } + | stmt { $1 } +; + +switch_cases: + DEFAULT COLON EXIT INTLIT SEMICOLON + { ([], $4) } + | CASE INTLIT COLON EXIT INTLIT SEMICOLON switch_cases + { let (cases, dfl) = $7 in (($2, $5) :: cases, dfl) } + | pos = position(error) { raise_error pos "Syntax error in switch construct" } +; + +match_cases: + /* empty */ { [] } + | CASE INTLIT COLON stmt_list match_cases { ($2, $4) :: $5 } + | pos = position(error) { raise_error pos "Syntax error in match construct" } +; + +/* Expressions */ + +expr: + LPAREN expr RPAREN { $2 } + | IDENT { RId $1 } + | INTLIT { RCst (Cst_int $1) } + | FLOATLIT { RCst (Cst_float $1) } + | STRINGLIT { RCst (Cst_addrsymbol $1) } + | AMPERSAND INTLIT { RCst (Cst_stackoffset $2) } + | MINUS expr %prec p_uminus { ROp1 (Op_negint int32, $2) } + | MINUSF expr %prec p_uminus { error_float () } + | ABSF expr { error_float () } + | INTOFFLOAT expr { error_float () } + | INTUOFFLOAT expr { error_float () } + | FLOATOFINT expr { error_float () } + | FLOATOFINTU expr { error_float () } + | TILDE expr { ROp1 (Op_notint int32, $2) } + | BANG expr { ROp1 (Op_notbool, $2) } + | INT8STO8 expr { ROp1 (Op_cast ((8, Signed), 8), $2) } + | INT8STO16 expr { ROp1 (Op_cast ((8, Signed), 16), $2) } + | INT8STO32 expr { ROp1 (Op_cast ((8, Signed), 32), $2) } + | INT8UTO8 expr { ROp1 (Op_cast ((8, Unsigned), 8), $2) } + | INT8UTO16 expr { ROp1 (Op_cast ((8, Unsigned), 16), $2) } + | INT8UTO32 expr { ROp1 (Op_cast ((8, Unsigned), 32), $2) } + | INT16STO8 expr { ROp1 (Op_cast ((16, Signed), 16), $2) } + | INT16STO16 expr { ROp1 (Op_cast ((16, Signed), 16), $2) } + | INT16STO32 expr { ROp1 (Op_cast ((16, Signed), 32), $2) } + | INT16UTO8 expr { ROp1 (Op_cast ((16, Unsigned), 8), $2) } + | INT16UTO16 expr { ROp1 (Op_cast ((16, Unsigned), 16), $2) } + | INT16UTO32 expr { ROp1 (Op_cast ((16, Unsigned), 32), $2) } + | INT32STO8 expr { ROp1 (Op_cast ((32, Signed), 8), $2) } + | INT32STO16 expr { ROp1 (Op_cast ((32, Signed), 16), $2) } + | INT32STO32 expr { ROp1 (Op_cast ((32, Signed), 32), $2) } + | INT32UTO8 expr { ROp1 (Op_cast ((32, Unsigned), 8), $2) } + | INT32UTO16 expr { ROp1 (Op_cast ((32, Unsigned), 16), $2) } + | INT32UTO32 expr { ROp1 (Op_cast ((32, Unsigned), 32), $2) } + | FLOAT32 expr { error_float () } + | expr PLUS expr { ROp2 (Op_add int32, $1, $3) } + | expr MINUS expr { ROp2 (Op_sub int32, $1, $3) } + | expr STAR expr { ROp2 (Op_mul int32, $1, $3) } + | expr SLASH expr { ROp2 (Op_div int32, $1, $3) } + | expr PERCENT expr { ROp2 (Op_mod int32, $1, $3) } + | expr SLASHU expr { ROp2 (Op_div uint32, $1, $3) } + | expr PERCENTU expr { ROp2 (Op_mod uint32, $1, $3) } + | expr AMPERSAND expr { ROp2 (Op_and, $1, $3) } + | expr BAR expr { ROp2 (Op_or, $1, $3) } + | expr CARET expr { ROp2 (Op_xor, $1, $3) } + | expr LESSLESS expr { ROp2 (Op_shl int32, $1, $3) } + | expr GREATERGREATER expr { ROp2 (Op_shr int32, $1, $3) } + | expr GREATERGREATERU expr { ROp2 (Op_shr uint32, $1, $3) } + | expr PLUSF expr { error_float () } + | expr MINUSF expr { error_float () } + | expr STARF expr { error_float () } + | expr SLASHF expr { error_float () } + | expr EQUALEQUAL expr { ROp2 (Op_cmp (Cmp_eq, int32), $1, $3) } + | expr BANGEQUAL expr { ROp2 (Op_cmp (Cmp_ne, int32), $1, $3) } + | expr LESS expr { ROp2 (Op_cmp (Cmp_lt, int32), $1, $3) } + | expr LESSEQUAL expr { ROp2 (Op_cmp (Cmp_le, int32), $1, $3) } + | expr GREATER expr { ROp2 (Op_cmp (Cmp_gt, int32), $1, $3) } + | expr GREATEREQUAL expr { ROp2 (Op_cmp (Cmp_ge, int32), $1, $3) } + | expr EQUALEQUALU expr { ROp2 (Op_cmp (Cmp_eq, uint32), $1, $3) } + | expr BANGEQUALU expr { ROp2 (Op_cmp (Cmp_ne, uint32), $1, $3) } + | expr LESSU expr { ROp2 (Op_cmp (Cmp_lt, uint32), $1, $3) } + | expr LESSEQUALU expr { ROp2 (Op_cmp (Cmp_le, uint32), $1, $3) } + | expr GREATERU expr { ROp2 (Op_cmp (Cmp_gt, uint32), $1, $3) } + | expr GREATEREQUALU expr { ROp2 (Op_cmp (Cmp_ge, uint32), $1, $3) } + | expr EQUALEQUALF expr { error_float () } + | expr BANGEQUALF expr { error_float () } + | expr LESSF expr { error_float () } + | expr LESSEQUALF expr { error_float () } + | expr GREATERF expr { error_float () } + | expr GREATEREQUALF expr { error_float () } + | quantity LBRACKET expr RBRACKET { RMem ($1, $3) } + | expr AMPERSANDAMPERSAND expr { RCond ($1, $3, RCst (Cst_int 0)) } + | expr BARBAR expr { RCond ($1, RCst (Cst_int 1), $3) } + | expr QUESTION expr COLON expr { RCond ($1, $3, $5) } + | expr LPAREN expr_list RPAREN COLON signature + { RCall ($1, $3, $6) } + | pos = position(error) { raise_error pos "Expression syntax error" } +; + +expr_list: + /* empty */ { [] } + | expr_list_1 { $1 } +; + +expr_list_1: + expr /* %prec COMMA */ { $1 :: [] } + | expr COMMA expr_list_1 { $1 :: $3 } +; + +type_: + INT { Sig_int } + | FLOAT { Sig_float } +; + diff --git a/src/cminor/cminorPrinter.ml b/src/cminor/cminorPrinter.ml new file mode 100644 index 0000000..8733230 --- /dev/null +++ b/src/cminor/cminorPrinter.ml @@ -0,0 +1,255 @@ +open AST + + +let rec print_size = function + | AST.SQ q -> Memory.string_of_quantity q + | AST.SProd l -> "struct {" ^ (print_size_list l) ^ "}" + | AST.SSum l -> "union {" ^ (print_size_list l) ^ "}" + | AST.SArray (i, se) -> + (print_size se) ^ "[" ^ (string_of_int i) ^ "]" +and print_size_list l = + MiscPottier.string_of_list ", " print_size l + +let print_stacksize = print_size + +let print_offset (size, depth) = + "offset[" ^ (print_size size) ^ ", " ^ (string_of_int depth) ^ "]" + +let print_sizeof = print_size + +let print_global_size = print_size + +let print_data = function +(* + | Data_reserve n -> Printf.sprintf "[%d]" n +*) + | Data_int8 i -> Printf.sprintf "(int8) %d" i + | Data_int16 i -> Printf.sprintf "(int16) %d" i + | Data_int32 i -> Printf.sprintf "%d" i + | Data_float32 f -> Printf.sprintf "%f" f + | Data_float64 f -> Printf.sprintf "(float64) %f" f + +let print_datas init = + let rec aux = function + | [] -> "" + | [data] -> print_data data + | data :: datas -> Printf.sprintf "%s, %s" (print_data data) (aux datas) + in + Printf.sprintf "{%s}" (aux init) + +let print_datas_opt = function + | None -> "" + | Some init -> " = " ^ (print_datas init) + +let print_var (id, size, init_opt) = + Printf.sprintf "var \"%s\" : %s%s;\n" + id (print_global_size size) (print_datas_opt init_opt) + +let print_vars = List.fold_left (fun s v -> s ^ (print_var v)) "" + +let print_constant = function + | Cst_int i -> string_of_int i + | Cst_float f -> string_of_float f + | Cst_addrsymbol id -> "\"" ^ id ^ "\"" + | Cst_stack -> "&0" + | Cst_offset off -> "{" ^ (print_offset off) ^ "}" + | Cst_sizeof t -> "sizeof (" ^ (print_sizeof t) ^ ")" + +let print_cmp = function + | Cmp_eq -> "==" + | Cmp_ne -> "!=" + | Cmp_gt -> ">" + | Cmp_ge -> ">=" + | Cmp_lt -> "<" + | Cmp_le -> "<=" + +let print_op1 = function + | Op_cast ((src_size, sign), dest_size) -> + Printf.sprintf "int%s%sto%s" + (Primitive.print_size src_size) + (Primitive.print_signedness sign) + (Primitive.print_size dest_size) + | Op_negint -> "-" + | Op_notbool -> "!" + | Op_notint -> "~" + | Op_id -> "" + | Op_intofptr -> "intofptr" + | Op_ptrofint -> "ptrofint" + +let print_op2 = function + | Op_add -> "+" + | Op_sub -> "-" + | Op_mul -> "*" + | Op_div -> "/" + | Op_divu -> "/u" + | Op_mod -> "%" + | Op_modu -> "%u" + | Op_and -> "&&" + | Op_or -> "||" + | Op_xor -> "^" + | Op_shl -> "<<" + | Op_shr -> ">>" + | Op_shru -> ">>u" + | Op_cmp cmp -> print_cmp cmp + | Op_cmpu cmp -> (print_cmp cmp) ^ "u" + | Op_addp -> "+p" + | Op_subp -> "-p" + | Op_subpp -> "-pp" + | Op_cmpp cmp -> (print_cmp cmp) ^ "p" + +let rec print_expression (Cminor.Expr (ed, _)) = match ed with + | Cminor.Id id -> id + | Cminor.Cst cst -> print_constant cst + | Cminor.Op1 (op1, e) -> + Printf.sprintf "%s %s" (print_op1 op1) (add_parenthesis e) + | Cminor.Op2 (op2, e1, e2) -> + Printf.sprintf "%s %s %s" + (add_parenthesis e1) + (print_op2 op2) + (add_parenthesis e2) + | Cminor.Mem (q, e) -> + Printf.sprintf "%s[%s]" (Memory.string_of_quantity q) (print_expression e) + | Cminor.Cond (e1, e2, e3) -> + Printf.sprintf "%s ? %s : %s" + (add_parenthesis e1) + (add_parenthesis e2) + (add_parenthesis e3) + | Cminor.Exp_cost (lab, e) -> + Printf.sprintf "/* %s */ %s" lab (print_expression e) +and add_parenthesis (Cminor.Expr (ed, _) as e) = match ed with + | Cminor.Id _ | Cminor.Cst _ | Cminor.Mem _ -> print_expression e + | _ -> Printf.sprintf "(%s)" (print_expression e) + + +let print_args = + MiscPottier.string_of_list ", " print_expression + +let print_decl (x, t) = (Primitive.print_type t) ^ " " ^ x + +let print_decls vars = + MiscPottier.string_of_list ", " print_decl vars + + +let n_spaces n = String.make n ' ' + + +let print_table n = + let f s (case, exit) = + Printf.sprintf "%s%scase %d: exit %d;\n" s (n_spaces n) case exit + in + List.fold_left f "" + + +let rec print_body n = function + | Cminor.St_skip -> "" + | Cminor.St_assign (id, e) -> + Printf.sprintf "%s%s = %s;\n" (n_spaces n) id (print_expression e) + | Cminor.St_store (q, e1, e2) -> + Printf.sprintf "%s%s[%s] = %s;\n" + (n_spaces n) + (Memory.string_of_quantity q) + (print_expression e1) + (print_expression e2) + | Cminor.St_call (None, f, args, sg) -> + Printf.sprintf "%s%s(%s) : %s;\n" + (n_spaces n) + (print_expression f) + (print_args args) + (Primitive.print_sig sg) + | Cminor.St_call (Some id, f, args, sg) -> + Printf.sprintf "%s%s = %s(%s) : %s;\n" + (n_spaces n) + id + (print_expression f) + (print_args args) + (Primitive.print_sig sg) + | Cminor.St_tailcall (f, args, sg) -> + Printf.sprintf "%stailcall %s(%s) : %s;\n" + (n_spaces n) + (print_expression f) + (print_args args) + (Primitive.print_sig sg) + | Cminor.St_seq (s1, s2) -> (print_body n s1) ^ (print_body n s2) + | Cminor.St_ifthenelse (e, s1, s2) -> + Printf.sprintf "%sif (%s) {\n%s%s}\n%selse {\n%s%s}\n" + (n_spaces n) + (print_expression e) + (print_body (n+2) s1) + (n_spaces n) + (n_spaces n) + (print_body (n+2) s2) + (n_spaces n) + | Cminor.St_loop s -> + Printf.sprintf "%sloop {\n%s%s}\n" + (n_spaces n) + (print_body (n+2) s) + (n_spaces n) + | Cminor.St_block s -> + Printf.sprintf "%sblock {\n%s%s}\n" + (n_spaces n) + (print_body (n+2) s) + (n_spaces n) + | Cminor.St_exit i -> + Printf.sprintf "%sexit %d;\n" (n_spaces n) i + | Cminor.St_switch (e, tbl, dflt) -> + Printf.sprintf "%sswitch (%s) {\n%s%sdefault: exit %d;\n%s}\n" + (n_spaces n) + (print_expression e) + (print_table ( n+2) tbl) + (n_spaces (n+2)) + dflt + (n_spaces n) + | Cminor.St_return None -> Printf.sprintf "%sreturn;\n" (n_spaces n) + | Cminor.St_return (Some e) -> + Printf.sprintf "%sreturn %s;\n" (n_spaces n) (print_expression e) + | Cminor.St_label (lbl, s) -> + Printf.sprintf "%s%s:\n%s" (n_spaces n) lbl (print_body n s) + | Cminor.St_goto lbl -> + Printf.sprintf "%sgoto %s;\n" (n_spaces n) lbl + | Cminor.St_cost (lbl, s) -> + Printf.sprintf "%s%s:\n%s" + (n_spaces n) lbl (print_body n s) + +let print_internal f_name f_def = + Printf.sprintf "\"%s\" (%s) : %s {\n\n stack: %s\n\n vars: %s;\n\n%s}\n\n\n" + f_name + (print_decls f_def.Cminor.f_params) + (Primitive.print_type_return f_def.Cminor.f_return) + (print_stacksize f_def.Cminor.f_stacksize) + (print_decls f_def.Cminor.f_vars) + (print_body 2 f_def.Cminor.f_body) + + +let print_external f_name f_def = + Printf.sprintf "extern \"%s\" : %s\n\n\n" + f_name + (Primitive.print_sig f_def.ef_sig) + + +let print_funct (f_name, f_def) = match f_def with + | Cminor.F_int f_def -> print_internal f_name f_def + | Cminor.F_ext f_def -> print_external f_name f_def + +let print_functs = List.fold_left (fun s f -> s ^ (print_funct f)) "" + +let print_program p = + Printf.sprintf "\n%s\n\n%s" + (print_vars p.Cminor.vars) + (print_functs p.Cminor.functs) + +let string_of_statement s = match s with + Cminor.St_skip -> "skip" + | Cminor.St_assign(_,_) -> "assign" + | Cminor.St_store(_,_,_) -> "store" + | Cminor.St_call(_,_,_,_) -> "call" + | Cminor.St_tailcall(_,_,_) -> "tailcall" + | Cminor.St_seq(_,_) -> "seq" + | Cminor.St_ifthenelse(_,_,_) -> "ifthenelse" + | Cminor.St_loop(_) -> "loop" + | Cminor.St_block(_) -> "block" + | Cminor.St_exit(_) -> "exit" + | Cminor.St_switch(_,_,_) -> "switch" + | Cminor.St_return(_) -> "return" + | Cminor.St_label(_,_) -> "label" + | Cminor.St_goto(_) -> "goto" + | Cminor.St_cost(_,_) -> "cost" diff --git a/src/cminor/cminorPrinter.mli b/src/cminor/cminorPrinter.mli new file mode 100644 index 0000000..e71f0a0 --- /dev/null +++ b/src/cminor/cminorPrinter.mli @@ -0,0 +1,12 @@ + +(** This module provides functions to print elements of [Cminor] + programs. *) + +val print_expression : Cminor.expression -> string + +val print_body : int (* indentation *) -> Cminor.statement -> string + +val string_of_statement : Cminor.statement -> string + +val print_program : Cminor.program -> string + diff --git a/src/cminor/cminorToRTLabs.ml b/src/cminor/cminorToRTLabs.ml new file mode 100644 index 0000000..ba052d1 --- /dev/null +++ b/src/cminor/cminorToRTLabs.ml @@ -0,0 +1,538 @@ + +(** This module translates a [Cminor] program into a [RTLabs] program. *) + +open Driver + + +let error_prefix = "Cminor to RTLabs" +let error = Error.global_error error_prefix +let error_float () = error "float not supported." + + +(* Helper functions *) + +let allocate (rtlabs_fun : RTLabs.internal_function) (sig_type : AST.sig_type) + : RTLabs.internal_function * Register.t = + let r = Register.fresh rtlabs_fun.RTLabs.f_runiverse in + let locals = rtlabs_fun.RTLabs.f_locals @ [(r, sig_type)] in + let rtlabs_fun = + { rtlabs_fun with RTLabs.f_locals = locals } in + (rtlabs_fun, r) + +let type_of (Cminor.Expr (_, t)) = t + +let allocate_expr + (rtlabs_fun : RTLabs.internal_function) + (e : Cminor.expression) + : (RTLabs.internal_function * Register.t) = + allocate rtlabs_fun (type_of e) + +type local_env = Register.t StringTools.Map.t + +let find_local (lenv : local_env) (x : AST.ident) : Register.t = + if StringTools.Map.mem x lenv then StringTools.Map.find x lenv + else error ("Unknown local \"" ^ x ^ "\".") + +let find_olocal (lenv : local_env) (ox : AST.ident option) : Register.t option = + match ox with + | None -> None + | Some x -> Some (find_local lenv x) + +let choose_destination + (rtlabs_fun : RTLabs.internal_function) + (lenv : local_env) + (e : Cminor.expression) + : RTLabs.internal_function * Register.t = + match e with + | Cminor.Expr (Cminor.Id x, _) -> (rtlabs_fun, find_local lenv x) + | _ -> allocate_expr rtlabs_fun e + +let choose_destinations + (rtlabs_fun : RTLabs.internal_function) + (lenv : local_env) + (args : Cminor.expression list) + : RTLabs.internal_function * Register.t list = + let f (rtlabs_fun, regs) e = + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e in + (rtlabs_fun, regs @ [r]) in + List.fold_left f (rtlabs_fun, []) args + +let fresh_label (rtlabs_fun : RTLabs.internal_function) : Label.t = + Label.Gen.fresh rtlabs_fun.RTLabs.f_luniverse + +let change_entry + (rtlabs_fun : RTLabs.internal_function) + (new_entry : Label.t) + : RTLabs.internal_function = + { rtlabs_fun with RTLabs.f_entry = new_entry } + + +(* Add a label and its associated instruction at the beginning of a function's + graph *) +let add_graph + (rtlabs_fun : RTLabs.internal_function) + (lbl : Label.t) + (stmt : RTLabs.statement) + : RTLabs.internal_function = + let graph = Label.Map.add lbl stmt rtlabs_fun.RTLabs.f_graph in + let rtlabs_fun = { rtlabs_fun with RTLabs.f_graph = graph } in + change_entry rtlabs_fun lbl + + +let generate + (rtlabs_fun : RTLabs.internal_function) + (stmt : RTLabs.statement) + : RTLabs.internal_function = + let lbl = fresh_label rtlabs_fun in + add_graph rtlabs_fun lbl stmt + + +(* +(* [addressing e] returns the type of address represented by [e], + along with its arguments *) + +let addressing (Cminor.Expr (ed, t) : Cminor.expression) + : (RTLabs.addressing * Cminor.expression list) = + match ed with + | Cminor.Cst (AST.Cst_addrsymbol id) -> (RTLabs.Aglobal (id, 0), []) + | Cminor.Cst (AST.Cst_stackoffset n) -> (RTLabs.Ainstack n, []) + | Cminor.Op2 (AST.Op_addp _, + Cminor.Cst (AST.Cst_addrsymbol id), + Cminor.Cst (AST.Cst_int n)) -> + (RTLabs.Aglobal (id, n), []) + | Cminor.Op2 (AST.Op_addp _, e1, Cminor.Cst (AST.Cst_int n)) -> + (RTLabs.Aindexed n, [e1]) + | Cminor.Op2 (AST.Op_addp _, + Cminor.Cst (AST.Cst_addrsymbol id), + e2) -> + (RTLabs.Abased (id, 0), [e2]) + | Cminor.Op2 (AST.Op_addp _, e1, e2) -> (RTLabs.Aindexed2, [e1 ; e2]) + | _ -> (RTLabs.Aindexed 0, [e]) +*) + + +(* Translating conditions *) + +let rec translate_branch + (rtlabs_fun : RTLabs.internal_function) + (lenv : local_env) + (e : Cminor.expression) + (lbl_true : Label.t) + (lbl_false : Label.t) + : RTLabs.internal_function = + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e in + let stmt = RTLabs.St_cond (r, lbl_true, lbl_false) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_expr rtlabs_fun lenv r e + +(* + let Cminor.Expr (ed, t) = e in + match ed with + + | Cminor.Id x -> + let stmt = + RTLabs.St_cond1 (AST.Op_id, find_local lenv x, lbl_true, lbl_false) in + generate rtlabs_fun stmt + + | Cminor.Cst cst -> + generate rtlabs_fun (RTLabs.St_condcst (cst, t, lbl_true, lbl_false)) + + | Cminor.Op1 (op1, e) -> + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e in + let stmt = RTLabs.St_cond1 (op1, r, lbl_true, lbl_false) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_expr rtlabs_fun lenv r e + + | Cminor.Op2 (op2, e1, e2) -> + let (rtlabs_fun, r1) = choose_destination rtlabs_fun lenv e1 in + let (rtlabs_fun, r2) = choose_destination rtlabs_fun lenv e2 in + let stmt = RTLabs.St_cond2 (op2, r1, r2, lbl_true, lbl_false) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv [r1 ; r2] [e1 ; e2] + + | _ -> + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e in + let stmt = RTLabs.St_cond1 (AST.Op_id, r, lbl_true, lbl_false) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_expr rtlabs_fun lenv r e +*) + +(* Translating expressions *) + +and translate_expr + (rtlabs_fun : RTLabs.internal_function) + (lenv : local_env) + (destr : Register.t) + (e : Cminor.expression) + : RTLabs.internal_function = + let Cminor.Expr (ed, t) = e in + match ed with + + | Cminor.Id x -> + let xr = find_local lenv x in + (* If the destination and source are the same, just do nothing. *) + if Register.equal destr xr then rtlabs_fun + else + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_op1 (AST.Op_id, destr, xr, old_entry) in + generate rtlabs_fun stmt + + | Cminor.Cst cst -> + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_cst (destr, cst, old_entry) in + generate rtlabs_fun stmt + + | Cminor.Op1 (op1, e) -> + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e in + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_op1 (op1, destr, r, old_entry) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_expr rtlabs_fun lenv r e + + | Cminor.Op2 (op2, e1, e2) -> + let (rtlabs_fun, r1) = choose_destination rtlabs_fun lenv e1 in + let (rtlabs_fun, r2) = choose_destination rtlabs_fun lenv e2 in + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_op2 (op2, destr, r1, r2, old_entry) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv [r1 ; r2] [e1 ; e2] + + | Cminor.Mem (chunk, e) -> + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e in + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_load (chunk, r, destr, old_entry) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_expr rtlabs_fun lenv r e + + | Cminor.Cond (e1, e2, e3) -> + let old_entry = rtlabs_fun.RTLabs.f_entry in + let rtlabs_fun = translate_expr rtlabs_fun lenv destr e3 in + let lbl_false = rtlabs_fun.RTLabs.f_entry in + let rtlabs_fun = change_entry rtlabs_fun old_entry in + let rtlabs_fun = translate_expr rtlabs_fun lenv destr e2 in + let lbl_true = rtlabs_fun.RTLabs.f_entry in + translate_branch rtlabs_fun lenv e1 lbl_true lbl_false + + | Cminor.Exp_cost (lbl, e) -> + let rtlabs_fun = translate_expr rtlabs_fun lenv destr e in + let old_entry = rtlabs_fun.RTLabs.f_entry in + generate rtlabs_fun (RTLabs.St_cost (lbl, old_entry)) + +and translate_exprs + (rtlabs_fun : RTLabs.internal_function) + (lenv : local_env) + (regs : Register.t list) + (args : Cminor.expression list) + : RTLabs.internal_function = + let f destr e rtlabs_fun = translate_expr rtlabs_fun lenv destr e in + List.fold_right2 f regs args rtlabs_fun + + +(* +(* Switch transformation + + switch (e) { + case c0: exit i0; + case c1: exit i1; + ... + default: exit idfl; } + + is translated to + + if (e == c0) exit i0; + if (e == c1) exit i1; + ... + exit idfl; *) + +let transform_switch + (e : Cminor.expression) + (cases : (int * int) list) + (dfl : int) + : Cminor.statement = + let rec aux = function + | [] -> Cminor.St_skip + | (case, exit) :: cases -> + let c = + Cminor.Op2 (AST.Op_cmp (AST.Cmp_eq, uint), + e, Cminor.Cst (AST.Cst_int case)) in + let stmt = + Cminor.St_ifthenelse (c, Cminor.St_exit exit, Cminor.St_skip) in + Cminor.St_seq (stmt, aux cases) + in + Cminor.St_seq (aux cases, Cminor.St_exit dfl) +*) + + +(* Translating statements *) + +let rec translate_stmt + (rtlabs_fun : RTLabs.internal_function) + (lenv : local_env) + (exits : Label.t list) + (stmt : Cminor.statement) + : RTLabs.internal_function = + match stmt with + + | Cminor.St_skip -> rtlabs_fun + + | Cminor.St_assign (x, e) -> + translate_expr rtlabs_fun lenv (find_local lenv x) e + + | Cminor.St_store (chunk, e1, e2) -> + let (rtlabs_fun, addr) = choose_destination rtlabs_fun lenv e1 in + let (rtlabs_fun, r) = choose_destination rtlabs_fun lenv e2 in + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_store (chunk, addr, r, old_entry) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv [addr ; r] [e1 ; e2] + + | Cminor.St_call (oret, + Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol f), _), + args, sg) -> + let (rtlabs_fun, regs) = choose_destinations rtlabs_fun lenv args in + let oretr = find_olocal lenv oret in + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_call_id (f, regs, oretr, sg, old_entry) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv regs args + + | Cminor.St_call (oret, f, args, sg) -> + let (rtlabs_fun, fr) = choose_destination rtlabs_fun lenv f in + let (rtlabs_fun, regs) = choose_destinations rtlabs_fun lenv args in + let oretr = find_olocal lenv oret in + let old_entry = rtlabs_fun.RTLabs.f_entry in + let stmt = RTLabs.St_call_ptr (fr, regs, oretr, sg, old_entry) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv (fr :: regs) (f :: args) + + | Cminor.St_tailcall (Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol f), _), + args, sg) -> + let (rtlabs_fun, regs) = choose_destinations rtlabs_fun lenv args in + let stmt = RTLabs.St_tailcall_id (f, regs, sg) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv regs args + + | Cminor.St_tailcall (f, args, sg) -> + let (rtlabs_fun, fr) = choose_destination rtlabs_fun lenv f in + let (rtlabs_fun, regs) = choose_destinations rtlabs_fun lenv args in + let stmt = RTLabs.St_tailcall_ptr (fr, regs, sg) in + let rtlabs_fun = generate rtlabs_fun stmt in + translate_exprs rtlabs_fun lenv (fr :: regs) (f :: args) + + | Cminor.St_seq (s1, s2) -> + let rtlabs_fun = translate_stmt rtlabs_fun lenv exits s2 in + translate_stmt rtlabs_fun lenv exits s1 + + | Cminor.St_ifthenelse (e, s1, s2) -> + let old_entry = rtlabs_fun.RTLabs.f_entry in + let rtlabs_fun = translate_stmt rtlabs_fun lenv exits s2 in + let lbl_false = rtlabs_fun.RTLabs.f_entry in + let rtlabs_fun = change_entry rtlabs_fun old_entry in + let rtlabs_fun = translate_stmt rtlabs_fun lenv exits s1 in + let lbl_true = rtlabs_fun.RTLabs.f_entry in + translate_branch rtlabs_fun lenv e lbl_true lbl_false + + | Cminor.St_loop s -> + let loop_start = fresh_label rtlabs_fun in + let rtlabs_fun = change_entry rtlabs_fun loop_start in + let rtlabs_fun = translate_stmt rtlabs_fun lenv exits s in + let old_entry = rtlabs_fun.RTLabs.f_entry in + add_graph rtlabs_fun loop_start (RTLabs.St_skip old_entry) + + | Cminor.St_block s -> + let old_entry = rtlabs_fun.RTLabs.f_entry in + translate_stmt rtlabs_fun lenv (old_entry :: exits) s + + | Cminor.St_exit n -> + change_entry rtlabs_fun (List.nth exits n) + + | Cminor.St_return eopt -> + let rtlabs_fun = change_entry rtlabs_fun rtlabs_fun.RTLabs.f_exit in + (match eopt, rtlabs_fun.RTLabs.f_result with + | None, None -> rtlabs_fun + | Some e, Some (retr, _) -> translate_expr rtlabs_fun lenv retr e + | _ -> assert false (* should be impossible *)) + + | Cminor.St_switch (e, cases, dfl) -> + assert false (* should have been simplified before *) +(* + let stmt = transform_switch e cases dfl in + translate_stmt rtlabs_fun lenv exits stmt +*) + + | Cminor.St_label (lbl, s) -> + let rtlabs_fun = translate_stmt rtlabs_fun lenv exits s in + let old_entry = rtlabs_fun.RTLabs.f_entry in + add_graph rtlabs_fun lbl (RTLabs.St_skip old_entry) + + | Cminor.St_cost (lbl, s) -> + let rtlabs_fun = translate_stmt rtlabs_fun lenv exits s in + let old_entry = rtlabs_fun.RTLabs.f_entry in + generate rtlabs_fun (RTLabs.St_cost (lbl, old_entry)) + + | Cminor.St_goto lbl -> + change_entry rtlabs_fun lbl + + +(* Translating function definitions *) + +(* The translation consists in the following: + - Create a universe of pseudo-register names + - Create a universe of label names + - Create a local environment; that is, a mapping from local + variables to pseudo-registers + - Extract the registers representing the formal variables + - Extract the registers representing the local variables + - Allocate a fresh register to hold the result of the function + - Allocate a fresh label representing the exit point + - Initialize the graph with a return instruction at the end + - Complete the graph according to the function's body. + Instructions will be added from end to start following the flow of the + function. *) + +let translate_internal lbl_prefix f_def = + + (* Register names *) + let runiverse = Register.new_universe "%" in + + (* Labels of statements *) + let luniverse = Label.Gen.new_universe lbl_prefix in + + (* Local environment *) + let add_local lenv (x, _) = + StringTools.Map.add x (Register.fresh runiverse) lenv in + let lenv = StringTools.Map.empty in + let lenv = List.fold_left add_local lenv f_def.Cminor.f_params in + let lenv = List.fold_left add_local lenv f_def.Cminor.f_vars in + + let extract vars = + let f l (x, t) = l @ [(find_local lenv x, t)] in + List.fold_left f [] vars in + + (* Parameter registers *) + let params = extract f_def.Cminor.f_params in + + (* Local registers *) + let locals = extract f_def.Cminor.f_vars in + + (* [result] is the result of the body, if any. *) + let result = match f_def.Cminor.f_return with + | AST.Type_void -> None + | AST.Type_ret t -> Some (Register.fresh runiverse, t) in + + let locals = + locals @ (match result with None -> [] | Some (r, t) -> [(r, t)]) in + + (* Exit label of the graph *) + let exit = Label.Gen.fresh luniverse in + + (* The control flow graph: for now, it is only a return instruction at the + end. *) + let return = match result with + | None -> None + | Some (retr, _) -> Some retr in + let graph = Label.Map.add exit (RTLabs.St_return return) Label.Map.empty in + + let rtlabs_fun = + { RTLabs.f_luniverse = luniverse ; + RTLabs.f_runiverse = runiverse ; + RTLabs.f_result = result ; + RTLabs.f_params = params ; + RTLabs.f_locals = locals ; + RTLabs.f_stacksize = f_def.Cminor.f_stacksize ; + RTLabs.f_graph = graph ; + RTLabs.f_entry = exit ; + RTLabs.f_exit = exit } in + + (* Complete the graph *) + translate_stmt rtlabs_fun lenv [] f_def.Cminor.f_body + + +let translate_functions lbls (f_id, f_def) = match f_def with + | Cminor.F_int int_def -> + let lbl_prefix = StringTools.Gen.fresh_prefix lbls f_id in + let def = translate_internal lbl_prefix int_def in + (f_id, RTLabs.F_int def) + | Cminor.F_ext def -> (f_id, RTLabs.F_ext def) + + +(* Initialization of globals *) + +let sum_offsets = + let f res off = + let cst_off = + Cminor.Expr (Cminor.Cst (AST.Cst_offset off), AST.Sig_offset) in + Cminor.Expr (Cminor.Op2 (AST.Op_add, res, cst_off), AST.Sig_offset) in + List.fold_left f (Cminor.Expr (Cminor.Cst (AST.Cst_int 0), AST.Sig_offset)) + +let quantity_sig_of_data data = + let i = match data with + | AST.Data_int8 _ -> 1 + | AST.Data_int16 _ -> 2 + | AST.Data_int32 _ -> 4 + | _ -> assert false (* do not use on these arguments *) in + (AST.QInt i, AST.Sig_int (i, AST.Unsigned)) + +let assign_data x stmt (offsets, data) = + let off = sum_offsets offsets in + let addr = Cminor.Expr (Cminor.Cst (AST.Cst_addrsymbol x), AST.Sig_ptr) in + let e = Cminor.Expr (Cminor.Op2 (AST.Op_addp, addr, off), AST.Sig_ptr) in + let stmt' = match data with +(* + | AST.Data_reserve _ -> Cminor.St_skip +*) + | AST.Data_int8 i | AST.Data_int16 i | AST.Data_int32 i -> + let (quantity, etype) = quantity_sig_of_data data in + let cst = Cminor.Expr (Cminor.Cst (AST.Cst_int i), etype) in + Cminor.St_store (quantity, e, cst) + | AST.Data_float32 f | AST.Data_float64 f -> error_float () in + Cminor.St_seq (stmt, stmt') + +let add_global_initializations_body vars body = + let f stmt (x, size, datas_opt) = match datas_opt with + | None -> Cminor.St_skip + | Some datas -> + let offsets = Memory.all_offsets size in + if List.length offsets <> List.length datas then + error "bad global initialization style." + else + let offs_datas = List.combine offsets datas in + List.fold_left (assign_data x) stmt offs_datas in + Cminor.St_seq (List.fold_left f Cminor.St_skip vars, body) + +let add_global_initializations_funct vars = function + | Cminor.F_int def -> + let f_body = add_global_initializations_body vars def.Cminor.f_body in + Cminor.F_int { def with Cminor.f_body = f_body } + | def -> def + +(* [add_global_initializations p] moves the initializations of the globals of + [p] to the beginning of the main function, if any. *) + +let add_global_initializations p = match p.Cminor.main with + | None -> p.Cminor.functs + | Some main -> + let main_def = List.assoc main p.Cminor.functs in + let main_def = add_global_initializations_funct p.Cminor.vars main_def in + MiscPottier.update_list_assoc main main_def p.Cminor.functs + + +(* Translation of a Cminor program to a RTLabs program. *) + +let translate p = + + (* Fetch the labels already used in the program to create new ones. *) + let lbls = CminorAnnotator.all_labels p in + + (* The initialization of globals are moved at the beginning of the main. *) + let functs = p.Cminor.functs (* add_global_initializations p *) in + +(* + (* The globals are associated their size. *) + let f (id, size, _) = (id, size) in +*) + + (* Put all this together and translate each function. *) + { RTLabs.vars = p.Cminor.vars ; + RTLabs.functs = List.map (translate_functions lbls) functs ; + RTLabs.main = p.Cminor.main } diff --git a/src/cminor/cminorToRTLabs.mli b/src/cminor/cminorToRTLabs.mli new file mode 100644 index 0000000..6a229de --- /dev/null +++ b/src/cminor/cminorToRTLabs.mli @@ -0,0 +1,8 @@ + +(** This module translates a [Cminor] program into a [RTLabs] program. *) + +(** The main part of the translation is transforming a Cminor program into a + control flow graph. This is done from the end of the program and up to the + beginning. *) + +val translate : Cminor.program -> RTLabs.program diff --git a/src/common/AST.mli b/src/common/AST.mli new file mode 100644 index 0000000..199593b --- /dev/null +++ b/src/common/AST.mli @@ -0,0 +1,112 @@ + +(** This file defines some common structures of several languages. *) + +(** Types and Signatures *) + +type signedness = Signed | Unsigned + +type size = int (* in bytes *) + +type sig_type = + | Sig_int of size * signedness + | Sig_float of size * signedness + | Sig_offset + | Sig_ptr + +type type_return = Type_ret of sig_type | Type_void + +type signature = { args: sig_type list ; res: type_return } + + +type ident = string (* identifiers for variable and function names *) + +type immediate = int (* immediate values for assembler constants and offsets *) + + +(** Memory quantities is the size of what can fit in memory. *) + +type quantity = + | QInt of size (* concrete size in bytes *) + | QOffset (* size of an offset *) + | QPtr (* size of a pointer *) + +type abstract_size = + | SQ of quantity + | SProd of abstract_size list + | SSum of abstract_size list + | SArray of int * abstract_size + +type abstract_offset = abstract_size * int (* nth in size *) + + +(** Comparison between integers or floats *) + +type cmp = Cmp_eq | Cmp_ne | Cmp_gt | Cmp_ge | Cmp_lt | Cmp_le + +(** Constants in high level languages *) + +type cst = + | Cst_int of int (* integer constant *) + | Cst_float of float (* float constant *) + | Cst_addrsymbol of ident (* address of a global symbol *) + | Cst_stack (* address of the stack *) + | Cst_offset of abstract_offset (* offset *) + | Cst_sizeof of abstract_size (* size of a type *) + +(** Unary operations *) + +type op1 = + | Op_cast of (size * signedness) * size + | Op_negint (**r integer opposite *) + | Op_notbool (**r boolean negation *) + | Op_notint (**r bitwise complement *) + | Op_id (**r identity *) + | Op_ptrofint (**r int to pointer *) + | Op_intofptr (**r pointer to int *) + +(** Binary operations *) + +type op2 = + | Op_add (**r integer addition *) + | Op_sub (**r integer subtraction *) + | Op_mul (**r integer multiplication *) + | Op_div (**r integer division *) + | Op_divu (**r integer unsigned division *) + | Op_mod (**r integer modulus *) + | Op_modu (**r integer unsigned modulus *) + | Op_and (**r bitwise ``and'' *) + | Op_or (**r bitwise ``or'' *) + | Op_xor (**r bitwise ``xor'' *) + | Op_shl (**r left shift *) + | Op_shr (**r right shift *) + | Op_shru (**r unsigned right shift *) + | Op_cmp of cmp (**r integer comparison *) + | Op_cmpu of cmp (**r unsigned integer comparison *) + | Op_addp (**r addition for a pointer and an integer *) + | Op_subp (**r substraction for a pointer and a integer *) + | Op_subpp (**r substraction for two pointers *) + | Op_cmpp of cmp (**r pointer comparaison *) + +(* Datas are used to initialize the value of variables *) + +type data = +(* (* Disabled: needed abstraction. *) + | Data_reserve of int (* only reserve some space *) +*) + | Data_int8 of int + | Data_int16 of int + | Data_int32 of int + | Data_float32 of float + | Data_float64 of float + +type data_size = Byte | HalfWord | Word + +(* External functions. *) + +type external_function = { ef_tag: ident ; ef_sig: signature } + +(* Traces returned by interpreters: result and cost labels are observed. The + result is interpreted as an 8 bits integer for coherence between + languages. *) + +type trace = IntValue.int32 * CostLabel.t list diff --git a/src/common/atom.ml b/src/common/atom.ml new file mode 100644 index 0000000..cf0d9b4 --- /dev/null +++ b/src/common/atom.ml @@ -0,0 +1,387 @@ +(* Adapted from Pottier's PP compiler *) + +(* A universe is a record, whose address defines the identity of the + universe. The integer counter [next] holds the number of the next + fresh atom. The [name] field holds the name of the universe. *) + +type universe = { + mutable next: int; + name: string + } + +let new_universe name = { + next = 0; + name = name +} + +(* An atom is a pair of a universe and an integer. The latter defines + the atom's identity within its universe. *) + +type t = + universe * int + +let fresh u = + let id = u.next in + u.next <- id + 1; + u, id + +let equal (u1, id1) (u2, id2) = + assert (u1 == u2); + ((id1 : int) = (id2 : int)) + +let compare (u1, id1) (u2, id2) = + assert (u1 == u2); + compare (id1 : int) (id2 : int) + +let flex_compare (u1, id1) (u2, id2) = + if String.compare u1.name u2.name = 0 then Pervasives.compare id1 id2 + else String.compare u1.name u2.name + +let flex_equal l1 l2 = flex_compare l1 l2 = 0 + +let universe_of (u, _) = u + +let same_universe (u1, _) (u2, _) = u1 = u2 + +let ends_with_a_digit s = + let n = String.length s in + n > 0 && s.[n-1] >= '0' && s.[n-1] <= '9' + +(* This function is injective, that is, [u] and [id] can be recovered + out of [print (u, id)]. *) + +let print (u, id) = + Printf.sprintf "%s%s%d" u.name (if ends_with_a_digit u.name then "_" else "") id + +(* Added by Nicolas Ayache: more flexible maps and sets where atoms + from different universes can coexist. *) + +type label_t = t + +module OrderedLabel = struct + type t = label_t + let compare = flex_compare +end + +module FlexSet = Set.Make (OrderedLabel) + +module FlexMap = Map.Make (OrderedLabel) + + +module OrderedInt = struct + type t = int + let compare x1 x2 = x1 - x2 +end + +(* We internally rely upon Objective Caml's integer sets and maps. *) + +module ISet = Set.Make (OrderedInt) +module IMap = Map.Make (OrderedInt) + +(* Sets. *) + +module Set = struct + + (* A set is either empty or a pair of a universe and a (possibly + empty) internal set. The fact that we do not require the empty + set to be explicitly associated with a universe means that + [empty] can be a constant, as opposed to an operation that + expects a universe as a parameter. *) + + type elt = + t + + type t = + | E + | U of universe * ISet.t + + let empty = + E + + let is_empty = function + | E -> + true + | U (_, s) -> + ISet.is_empty s + + let mem (u1, x) = function + | E -> + false + | U (u2, s) -> + assert (u1 == u2); + (u1 = u2) && (ISet.mem x s) + + let add (u1, x) = function + | E -> + U (u1, ISet.singleton x) + | U (u2, s) -> + assert (u1 == u2); + U (u1, ISet.add x s) + + let remove (u1, x) = function + | E -> + E + | U (u2, s) -> + assert (u1 == u2); + (* set can become empty but retains its universe *) + U (u1, ISet.remove x s) + + let singleton x = + add x empty + + let couple x1 x2 = + add x1 (singleton x2) + + let of_list xs = + List.fold_right add xs empty + + let union s1 s2 = + match s1, s2 with + | E, s + | s, E -> + s + | U (u1, s1), U (u2, s2) -> + assert (u1 == u2); + U (u1, ISet.union s1 s2) + + let inter s1 s2 = + match s1, s2 with + | E, s + | s, E -> + E + | U (u1, s1), U (u2, s2) -> + assert (u1 == u2); + U (u1, ISet.inter s1 s2) + + let disjoint s1 s2 = + is_empty (inter s1 s2) + + let diff s1 s2 = + match s1, s2 with + | E, _ -> + E + | s, E -> + s + | U (u1, s1), U (u2, s2) -> + assert (u1 == u2); + U (u1, ISet.diff s1 s2) + + let iter f = function + | E -> + () + | U (u, s) -> + ISet.iter (fun x -> f (u, x)) s + + let fold f s accu = + match s with + | E -> + accu + | U (u, s) -> + ISet.fold (fun x accu -> f (u, x) accu) s accu + + let choose = function + | E -> + raise Not_found + | U (u, s) -> + u, ISet.choose s + + let equal s1 s2 = + match s1, s2 with + | E, s + | s, E -> + is_empty s + | U (u1, s1), U (u2, s2) -> + assert (u1 == u2); + ISet.equal s1 s2 + + let cardinal = function + | E -> + 0 + | U (_, s) -> + ISet.cardinal s + + let elements = function + | E -> + [] + | U (u, s) -> + List.map (fun x -> (u, x)) (ISet.elements s) + + let filter p = function + | E -> + E + | U (u, s) -> + U (u, ISet.filter (fun x -> p (u, x)) s) + + let pick s = + let x = choose s in + let s = remove x s in + x, s + + let rec exhaust s accu f = + if is_empty s then + accu + else + let x, s = pick s in + let s', accu = f x accu in + exhaust (union s s') accu f + + open Print + + let print s = + seplist comma (fun () x -> print x) () (elements s) + +end + +(* Maps. *) + +module Map = struct + + (* A map is either empty or a pair of a universe and a (possibly + empty) internal map. The fact that we do not require the empty + map to be explicitly associated with a universe means that + [empty] can be a constant, as opposed to an operation that + expects a universe as a parameter. *) + + type key = + t + + type 'a t = + | E + | U of universe * 'a IMap.t + + let empty = + E + + let is_empty = function + | E -> + true + | U (_, m) -> + IMap.is_empty m + + let mem (u1, x) = function + | E -> + false + | U (u2, m) -> + assert (u1 == u2); + IMap.mem x m + + let add (u1, x) d = function + | E -> + U (u1, IMap.add x d IMap.empty) + | U (u2, m) -> + assert (u1 == u2); + U (u1, IMap.add x d m) + + let remove (u1, x) = function + | E -> + E + | U (u2, m) -> + assert (u1 == u2); + U (u1, IMap.remove x m) + + let singleton x d = + add x d empty + + let find (u1, x) = function + | E -> + raise Not_found + | U (u2, m) -> + assert (u1 == u2); + IMap.find x m + + let iter f = function + | E -> + () + | U (u, m) -> + IMap.iter (fun x d -> f (u, x) d) m + + let fold f m accu = + match m with + | E -> + accu + | U (u, m) -> + IMap.fold (fun x d accu -> f (u, x) d accu) m accu + + let map f = function + | E -> + E + | U (u, m) -> + U (u, IMap.map f m) + + let mapi f = function + | E -> + E + | U (u, m) -> + U (u, IMap.mapi (fun x d -> f (u, x) d) m) + + let domain = function + | E -> + Set.E + | U (u, m) -> + Set.U (u, IMap.fold (fun x _ s -> + ISet.add x s + ) m ISet.empty + ) + + let lift f = function + | Set.E -> + E + | Set.U (u, s) -> + U (u, ISet.fold (fun x m -> + IMap.add x (f (u, x)) m + ) s IMap.empty + ) + + + let generator u = + let m = ref empty in + let generate d = + let label = fresh u in + m := add label d !m; + label + in + m, generate + + let addm m1 m2 = + fold add m1 m2 + + let restrict p m = + fold (fun x d m -> + if p x then + add x d m + else + m + ) m empty + +end + +(* An imperative interface to maps. *) + +module ImperativeMap = struct + + type key = + Map.key + + type 'data t = + 'data Map.t ref + + let create () = + ref Map.empty + + let clear t = + t := Map.empty + + let add k d t = + t := Map.add k d !t + + let find k t = + Map.find k !t + + let iter f t = + Map.iter f !t + +end + +(* Maps of atoms to sets of atoms. *) + +module SetMap = SetMap.MakeHomo(Set)(Map) diff --git a/src/common/atom.mli b/src/common/atom.mli new file mode 100644 index 0000000..051fb76 --- /dev/null +++ b/src/common/atom.mli @@ -0,0 +1,7 @@ + +(* Pasted from Pottier's PP compiler *) + +(** This module implements the signature [AtomSig.S]. *) + +include AtomSig.S + diff --git a/src/common/atomSig.mli b/src/common/atomSig.mli new file mode 100644 index 0000000..f062112 --- /dev/null +++ b/src/common/atomSig.mli @@ -0,0 +1,221 @@ +(* Pasted from Pottier's PP compiler *) + +(** This signature describes atoms, that is, abstract entities + equipped with a fresh element generation operation. *) + +module type S = sig + + (* ------------------------------------------------------------------------- *) + (* This is the type of atoms. *) + + type t + + (* Atoms do not exist in the ether -- they are taken from universes. + Creating a fresh atom requires specifying which universe it + should be taken from. Atoms that belong to distinct universes + cannot be mixed. *) + + type universe + + (* One can create as many universes as desired. A universe initially + contains no atoms. A universe carries a name (a string) that is + used when converting atoms to strings. *) + + val new_universe: string -> universe + + (* A universe is populated by creating fresh atoms. The atom produced + by [fresh u] is guaranteed to be distinct from all existing atoms + in the universe [u]. *) + + val fresh: universe -> t + + (* Comparison of atoms. Only atoms that belong to a common universe + can be compared. *) + + val equal: t -> t -> bool + val compare: t -> t -> int + + (* Added by Nicolas Ayache: flexible comparison. Atoms from + different universes can be compared. *) + val flex_compare: t -> t -> int + val flex_equal: t -> t -> bool + + (* Added by Nicolas Ayache. *) + val universe_of: t -> universe + val same_universe: t -> t -> bool + + (* [print a] converts the atom [a] to a string. The string + representation is unique within the universe that [a] belongs + to. It is globally unique if universe names are unique. *) + + val print: t -> string + + (* ------------------------------------------------------------------------- *) + + + (* Added by Nicolas Ayache: more flexible maps and sets where atoms + from different universes can coexist. *) + + module FlexSet : Set.S with type elt = t + + module FlexMap : Map.S with type key = t + + + (* Sets of atoms. *) + + module Set : sig + + type elt = t + + (* This is the type of sets of atoms. Every set of atoms is + implicitly and permanently associated with a universe, which + all members of the set inhabit. *) + + type t + + (* Operations over sets include those defined in Objective Caml's + standard [Set] module, with the restriction that operations + should never mix atoms, or sets of atoms, that inhabit distinct + universes. Consult [Set.S] in Objective Caml's + documentation. *) + + val empty: t + val is_empty: t -> bool + val mem: elt -> t -> bool + val add: elt -> t -> t + val remove: elt -> t -> t + val singleton: elt -> t + val union: t -> t -> t + val inter: t -> t -> t + val diff: t -> t -> t + val iter: (elt -> unit) -> t -> unit + val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a + val choose: t -> elt + val equal: t -> t -> bool + val cardinal: t -> int + val elements: t -> elt list + val filter: (elt -> bool) -> t -> t + + (* [disjoint s1 s2] tells whether the intersection of [s1] + and [s2] is empty. *) + + val disjoint: t -> t -> bool + + (* [couple x1 x2] is the set that contains [x1] and [x2]. It + can be a singleton set if [x1] and [x2] are equal. *) + + val couple: elt -> elt -> t + + (* [of_list xs] is the set whose members are the elements + of the list [xs]. *) + + val of_list: elt list -> t + + (* [pick s] returns a pair of an element [x] of [s] and of the + set [remove x s]. It raises [Not_found] if [s] is empty. *) + + val pick: t -> elt * t + + (* [exhaust s accu f] takes an element [x] off the set [s], and + applies [f] to [x] and [accu]. This yields a number of new + elements, which are added to [s], and a new accumulator [accu]. + This is repeated until [s] becomes empty, at which point the + final value of the accumulator is returned. In short, this is a + version of [fold] where the function [f] is allowed to produce + new set elements. *) + + val exhaust: t -> 'a -> (elt -> 'a -> t * 'a) -> 'a + + (* [print s] converts the set [s] to a string. *) + + val print: t -> string + + end + + (* ------------------------------------------------------------------------- *) + (* Maps over atoms. *) + + module Map : sig + + type key = t + + (* This is the type of maps over atoms. Every map over atoms is + implicitly and permanently associated with a universe, which + all keys inhabit. *) + + type +'a t + + (* Operations over maps include those defined in Objective Caml's + standard [Map] module, with the restriction that operations + should never mix atoms, or maps over atoms, that inhabit + distinct universes. Consult [Map.S] in Objective Caml's + documentation.*) + + val empty: 'a t + val is_empty: 'a t -> bool + val mem: key -> 'a t -> bool + val add: key -> 'a -> 'a t -> 'a t + val remove: key -> 'a t -> 'a t + val find: key -> 'a t -> 'a + val iter: (key -> 'a -> unit) -> 'a t -> unit + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + val map: ('a -> 'b) -> 'a t -> 'b t + val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t + + (* [singleton x d] is the map that maps [x] to [d]. *) + + val singleton: key -> 'a -> 'a t + + (* [addm m1 m2] adds the bindings in the map [m1] to the map [m2], + overriding any previous binding if [m1] and [m2] have common + keys. *) + + val addm: 'a t -> 'a t -> 'a t + + (* [domain m] is the domain of the map [m]. *) + + val domain: 'a t -> Set.t + + (* [lift f s] lifts the set [s] into a map that maps every + member [x] of [s] to [f x]. *) + + val lift: (key -> 'a) -> Set.t -> 'a t + + (* [restrict p m] restricts the domain of the map [m] to those + keys that satisfy the predicate [p]. *) + + val restrict: (key -> bool) -> 'a t -> 'a t + + (* [generator u] creates a fresh reference [m] that holds an + initially empty map; defines a function [generate] such that + [generate d] generates a fresh atom [a], adds a mapping of [m] + to [d] to [m], and returns [a]; and returns a pair of [m] and + [generate]. *) + + val generator: universe -> 'a t ref * ('a -> key) + + end + + (* ------------------------------------------------------------------------- *) + (* An imperative interface to maps. *) + + module ImperativeMap : sig + type key = Map.key + type 'data t + val create: unit -> 'data t + val clear: 'data t -> unit + val add: key -> 'data -> 'data t -> unit + val find: key -> 'data t -> 'data + val iter: (key -> 'data -> unit) -> 'data t -> unit + end + + (* ------------------------------------------------------------------------- *) + (* Maps of atoms to sets of atoms. Consult the definition of + [SetMap.Homogeneous] for a list of operations. *) + + module SetMap : SetMap.Homogeneous with type key = t + and type item = t + and type itemset = Set.t + and type t = Set.t Map.t + +end diff --git a/src/common/costLabel.ml b/src/common/costLabel.ml new file mode 100644 index 0000000..eaebb12 --- /dev/null +++ b/src/common/costLabel.ml @@ -0,0 +1,5 @@ + +include StringTools + +let constant_map d x = + Set.fold (fun k accu -> Map.add k x accu) d Map.empty diff --git a/src/common/costLabel.mli b/src/common/costLabel.mli new file mode 100644 index 0000000..0b2d95d --- /dev/null +++ b/src/common/costLabel.mli @@ -0,0 +1,9 @@ + +(** This module provides functions to manipulate and create fresh cost + labels. *) + +include StringSig.S + +(** [constant_map d x] produces a finite map which associates + [x] to every element of the set [d]. *) +val constant_map : Set.t -> 'a -> 'a Map.t diff --git a/src/common/hdwRegister.ml b/src/common/hdwRegister.ml new file mode 100644 index 0000000..5483511 --- /dev/null +++ b/src/common/hdwRegister.ml @@ -0,0 +1,15 @@ + +(** Hardware registers. *) + +module OrdInt = +struct + type t = int + let compare = Pervasives.compare +end + +type t = OrdInt.t +let eq r1 r2 = OrdInt.compare r1 r2 = 0 + +module Set = Set.Make(OrdInt) + +module Map = Map.Make(OrdInt) diff --git a/src/common/hdwRegister.mli b/src/common/hdwRegister.mli new file mode 100644 index 0000000..eb86cf8 --- /dev/null +++ b/src/common/hdwRegister.mli @@ -0,0 +1,10 @@ + +(** Hardware registers. *) + +type t + +val eq : t -> t -> bool + +module Set : Set.S + +module Map : Map.S diff --git a/src/common/intByBig_int.ml b/src/common/intByBig_int.ml new file mode 100644 index 0000000..2f04a70 --- /dev/null +++ b/src/common/intByBig_int.ml @@ -0,0 +1,24 @@ +(** This module defines a suited representation for bounded integers. *) + +open Big_int +type t = big_int +let of_int = big_int_of_int +let to_int = int_of_big_int +let compare = compare_big_int +let to_string = string_of_big_int +let zero = zero_big_int +let one = unit_big_int +let succ = succ_big_int +let pred = pred_big_int +let neg = minus_big_int +let eq = eq_big_int +let add = add_big_int +let sub = sub_big_int +let mul = mult_big_int +let div = div_big_int +let modulo = mod_big_int +let lt = lt_big_int +let le = le_big_int +let gt = gt_big_int +let ge = ge_big_int + diff --git a/src/common/intByInt64.ml b/src/common/intByInt64.ml new file mode 100644 index 0000000..2683167 --- /dev/null +++ b/src/common/intByInt64.ml @@ -0,0 +1,12 @@ +(** This module defines a suited representation for bounded integers using + O'Caml Int64. *) + +include Int64 +let from_int_cmp cmp a b = cmp (compare a b) 0 +let eq = from_int_cmp (=) +let lt = from_int_cmp (<) +let le = from_int_cmp (<=) +let gt = from_int_cmp (>) +let ge = from_int_cmp (>=) +let modulo = rem + diff --git a/src/common/intValue.ml b/src/common/intValue.ml new file mode 100644 index 0000000..2a67b95 --- /dev/null +++ b/src/common/intValue.ml @@ -0,0 +1,332 @@ + +(** This module defines functions to manipulate bounded integers. They can be + used to represent sequences of bits. *) + +module Int = IntValueConfig.Int + +(* Integers, whatever their size, will be represented using the Big_int + module. This allows immediate conversion, and allows the representation of + any integer (that fits into memory). *) + +type int_repr = Int.t +let print_int_repr = Int.to_string + + +(* The parameter module. Bounded integers are characterized by the number of + bits used to represent them. *) + +module type INTTYPE = +sig + val size : int (* in bytes *) +end + +module type FULLINTTYPE = +sig + include INTTYPE + type t + val of_int : int -> t + val to_int : t -> int + val compare : t -> t -> int + val eq : t -> t -> bool + val to_string : t -> string + val zero : t + val one : t + val succ : t -> t + val pred : t -> t + val neg : t -> t + val add : t -> t -> t + val sub : t -> t -> t + val mul : t -> t -> t + val div : t -> t -> t + val modulo : t -> t -> t + val lt : t -> t -> bool + val gt : t -> t -> bool + val le : t -> t -> bool + val ge : t -> t -> bool +end + +(* The signature provided to manipulate bounded integers. *) + +module type S = sig + + type t + type repr + + val compare : t -> t -> int + val to_string : t -> string + val zero : t + val one : t + + val to_signed_repr : t -> repr + val to_unsigned_repr : t -> repr + + val succ : t -> t + val pred : t -> t + val add : t -> t -> t + (** [add_of i1 i2] returns [true] iff adding [i1] and [i2] overflows. *) + val add_of : t -> t -> bool + val sub : t -> t -> t + (** [sub_uf i1 i2] returns [true] iff substracting [i1] and [i2] + underflows. *) + val sub_uf : t -> t -> bool + val mul : t -> t -> t + val div : t -> t -> t + val divu : t -> t -> t + val modulo : t -> t -> t + val modulou : t -> t -> t + val eq : t -> t -> bool + val neq : t -> t -> bool + val lt : t -> t -> bool + val ltu : t -> t -> bool + val le : t -> t -> bool + val leu : t -> t -> bool + val gt : t -> t -> bool + val gtu : t -> t -> bool + val ge : t -> t -> bool + val geu : t -> t -> bool + val neg : t -> t + val lognot : t -> t + val logand : t -> t -> t + val logor : t -> t -> t + val logxor : t -> t -> t + val shl : t -> t -> t + val shr : t -> t -> t + val shrl : t -> t -> t + val max : t -> t -> t + val maxu : t -> t -> t + val min : t -> t -> t + val minu : t -> t -> t + val cast : repr -> t + val of_int : int -> t + val to_int : t -> int + + (** [zero_ext n a] performs zero extension on [a] where [n] bits are + significant. *) + val zero_ext : int -> t -> t + (** [sign_ext n a] performs sign extension on [a] where [n] bits are + significant. *) + val sign_ext : int -> t -> t + + (** [break i n] cuts [i] in [n] parts. In the resulting list, the first + element is the low bits, and the last is the high bits (little endian + representation). *) + val break : t -> int -> t list + (** [merge l] creates the integer where the first element of [l] is its low + bits, etc, and the last element of [l] is its high bits (little endian + representation). *) + val merge : t list -> t + +end + + +module FullMake (Int : FULLINTTYPE) + : S with type t = Int.t and type repr = Int.t = +struct + + type t = Int.t + type repr = Int.t + + let size = Int.size * 8 (* real size, i.e. in bits *) + + let compare = Int.compare + let to_string = Int.to_string + let zero = Int.zero + let one = Int.one + let two = Int.succ one + + let rec pow x n = + if Int.eq n zero then one + else Int.mul x (pow x (Int.pred n)) + + (* Integers will all be taken modulo the following value. *) + let _mod = pow two (Int.of_int size) + + (* The lower bound (inclusive). *) + let lower_bound = zero + + (* The upper bound (inclusive). *) + let upper_bound = Int.pred _mod + + (* [cast a] returns a modulo of [a] such that the result fits in the interval + of representation. *) + let cast a = Int.modulo a _mod + + (* Half bound (exclusive), i.e. upper bound of signed integers. *) + let half_bound = pow two (Int.of_int (size-1)) + + (* Signed value of [a]. *) + let signed a = + let a = cast a in + if Int.lt a half_bound then a + else Int.sub a _mod + + let to_signed_repr a = signed a + + let to_unsigned_repr a = a + + let signed_op op a b = op (signed a) (signed b) + + let succ a = cast (Int.succ a) + let pred a = cast (Int.pred a) + let add a b = cast (Int.add a b) + + (* [add_of i1 i2] returns [true] iff adding [i1] and [i2] overflows. *) + let add_of a b = Int.gt (Int.add a b) upper_bound + + let sub a b = cast (Int.sub a b) + + let cast_op op a b = op (cast a) (cast b) + + let mul a b = cast (Int.mul a b) + let div a b = cast (signed_op Int.div a b) + let divu = cast_op Int.div + let modulo a b = cast (signed_op Int.modulo a b) + let modulou = cast_op Int.modulo + + let eq = Int.eq + let neq a b = not (eq a b) + let lt = signed_op Int.lt + let le = signed_op Int.le + let gt = signed_op Int.gt + let ge = signed_op Int.ge + let ltu = cast_op Int.lt + let leu = cast_op Int.le + let gtu = cast_op Int.gt + let geu = cast_op Int.ge + + (* [sub_uf i1 i2] returns [true] iff substracting [i1] and [i2] underflows. *) + let sub_uf a b = Int.lt (Int.sub a b) zero + + let of_int i = cast (Int.of_int i) + let to_int i = Int.to_int (cast i) + + let neg a = cast (Int.neg a) + + let lognot = sub upper_bound + + let shl a b = + let pow = pow two (cast b) in + mul a pow + + let shr a b = + let a = cast a in + let b = cast b in + let added = + if ltu a half_bound then zero + else half_bound in + let rec aux acc b = + if eq b zero then acc + else + let cont_acc = add added (divu acc two) in + let cont_b = pred b in + aux cont_acc cont_b + in + cast (aux a b) + + let shrl a b = + let pow = pow two (cast b) in + cast (div (cast a) pow) + + let max a b = if lt a b then b else a + let min a b = if gt a b then b else a + let maxu a b = if ltu a b then b else a + let minu a b = if gtu a b then b else a + + let is_odd a = eq (modulou a two) one + (* [to_bits a] returns the list of bits (0 or 1) that [a] represents. *) + let to_bits a = + let rec aux acc a i = + if i >= size then acc + else aux ((is_odd a) :: acc) (divu a two) (i+1) + in + aux [] (cast a) 0 + + (* [from_bits bits] returns the integer that the list of bits [bits] + represents. *) + let from_bits bits = + let rec aux acc = function + | [] -> acc + | b :: bits -> + let next_acc = mul acc two in + let next_acc = if b then succ next_acc else next_acc in + aux next_acc bits + in + aux zero bits + + (* [binary_log_op f a b] applies the binary boolean operation [f] + pointwisely to the bits that [a] and [b] represent. *) + let binary_log_op f a b = + from_bits (List.map2 f (to_bits a) (to_bits b)) + + let xor a b = (a || b) && (not (a && b)) + + let logand = binary_log_op (&&) + let logor = binary_log_op (||) + let logxor = binary_log_op xor + + + (* [zero_ext n a] performs zero extension on [a] where [n] bits are + significant. *) + let zero_ext n a = + let pow2 = pow two (of_int n) in + modulo a pow2 + + (* [sign_ext n a] performs sign extension on [a] where [n] bits are + significant. *) + let sign_ext n a = + let a' = zero_ext n a in + let pow2 = pow two (of_int (n - 1)) in + let sign = divu a pow2 in + if is_odd sign then + let added = shr half_bound (of_int (n - 1)) in + add a' added + else a' + + + (* [break i n] cuts [i] in [n] parts. In the resulting list, the first element + is the low bits, and the last is the high bits (little endian + representation). *) + let break a n = + let chunk_size = size / n in + let pow2_chunk_size = pow two (of_int chunk_size) in + let rec aux acc a i = + if i = 0 then acc + else + let next = Int.div a pow2_chunk_size in + let chunk = Int.modulo a pow2_chunk_size in + aux ((cast chunk) :: acc) next (i-1) + in + List.rev (aux [] (cast a) n) + + (* [merge l] creates the integer where the first element of [l] is its low + bits, etc, and the last element of [l] is its high bits (little endian + representation). *) + let merge = function + | [] -> zero + | al -> + let nb_chunks = List.length al in + let chunk_size = size / nb_chunks in + let pow2_chunk_size = pow two (of_int chunk_size) in + let rec aux pow2 = function + | [] -> zero + | a :: al -> add (mul a pow2) (aux (mul pow2 pow2_chunk_size) al) + in + aux one al + +end + + +module type SRepr = S with type t = int_repr and type repr = int_repr + + +module Make (IntType : INTTYPE) : SRepr = + FullMake (struct include IntType include Int end) + + +module Int8 = Make (struct let size = 1 end) +module Int16 = Make (struct let size = 2 end) +module Int32 = Make (struct let size = 4 end) + +type int8 = Int8.t +type int16 = Int16.t +type int32 = Int32.t diff --git a/src/common/intValue.mli b/src/common/intValue.mli new file mode 100644 index 0000000..1fe507a --- /dev/null +++ b/src/common/intValue.mli @@ -0,0 +1,124 @@ + +(** This module defines functions to manipulate bounded integers. They can be + used to represent sequences of bits. *) + +(* Integers, whatever their size, will be represented using the Big_int + module. This allows immediate conversion, and allows the representation of + any integer (that fits into memory). *) + +type int_repr +val print_int_repr : int_repr -> string + +(* The parameter module. Bounded integers are characterized by the number of + bits used to represent them. *) + +module type INTTYPE = +sig + val size : int (* in bytes *) +end + +(* The signature provided to manipulate bounded integers. *) + +module type S = sig + + type t + type repr + + val compare : t -> t -> int + val to_string : t -> string + val zero : t + val one : t + + val to_signed_repr : t -> repr + val to_unsigned_repr : t -> repr + + val succ : t -> t + val pred : t -> t + val add : t -> t -> t + (** [add_of i1 i2] returns [true] iff adding [i1] and [i2] overflows. *) + val add_of : t -> t -> bool + val sub : t -> t -> t + (** [sub_uf i1 i2] returns [true] iff substracting [i1] and [i2] + underflows. *) + val sub_uf : t -> t -> bool + val mul : t -> t -> t + val div : t -> t -> t + val divu : t -> t -> t + val modulo : t -> t -> t + val modulou : t -> t -> t + val eq : t -> t -> bool + val neq : t -> t -> bool + val lt : t -> t -> bool + val ltu : t -> t -> bool + val le : t -> t -> bool + val leu : t -> t -> bool + val gt : t -> t -> bool + val gtu : t -> t -> bool + val ge : t -> t -> bool + val geu : t -> t -> bool + val neg : t -> t + val lognot : t -> t + val logand : t -> t -> t + val logor : t -> t -> t + val logxor : t -> t -> t + val shl : t -> t -> t + val shr : t -> t -> t + val shrl : t -> t -> t + val max : t -> t -> t + val maxu : t -> t -> t + val min : t -> t -> t + val minu : t -> t -> t + val cast : repr -> t + val of_int : int -> t + val to_int : t -> int + + (** [zero_ext n a] performs zero extension on [a] where [n] bits are + significant. *) + val zero_ext : int -> t -> t + (** [sign_ext n a] performs sign extension on [a] where [n] bits are + significant. *) + val sign_ext : int -> t -> t + + (** [break i n] cuts [i] in [n] parts. In the resulting list, the first + element is the low bits, and the last is the high bits (little endian + representation). *) + val break : t -> int -> t list + (** [merge l] creates the integer where the first element of [l] is its low + bits, etc, and the last element of [l] is its high bits (little endian + representation). *) + val merge : t list -> t + +end + +module type SRepr = S with type t = int_repr and type repr = int_repr + +(** The functor to create bounded integers from a size. *) + +module Make: functor (IntType: INTTYPE) -> SRepr + +module Int8 : SRepr +module Int16 : SRepr +module Int32 : SRepr + +type int8 = Int8.t +type int16 = Int16.t +type int32 = Int32.t + + +(* +module Int8s : S +module Int8u : S +module Int16s : S +module Int16u : S +module Int32 : S + +(** Unbounded integers. *) +module Integer : S + +type int8s = Int8s.t +type int8u = Int8u.t +type int16s = Int16s.t +type int16u = Int16u.t +type int32 = Int32.t +type integer = Integer.t +*) diff --git a/src/common/label.ml b/src/common/label.ml new file mode 100644 index 0000000..192cbe8 --- /dev/null +++ b/src/common/label.ml @@ -0,0 +1,2 @@ + +include StringTools diff --git a/src/common/label.mli b/src/common/label.mli new file mode 100644 index 0000000..cf075ac --- /dev/null +++ b/src/common/label.mli @@ -0,0 +1,5 @@ + +(** This module provides functions to manipulate and create fresh + regular labels. *) + +include StringSig.S diff --git a/src/common/memory.ml b/src/common/memory.ml new file mode 100644 index 0000000..39eb7f0 --- /dev/null +++ b/src/common/memory.ml @@ -0,0 +1,548 @@ + +(** This file gives a memory model that can be used by the interpreter + of various languages throughout the compilation process and + following the memory model of the CompCert compiler. *) + +(** In the module, every size is expressed in bytes. *) + + +let error_prefix = "Memory" +let error s = Error.global_error error_prefix s + + +let string_of_quantity = function + | AST.QInt i -> "int" ^ (string_of_int (i*8)) + | AST.QOffset -> "offset" + | AST.QPtr -> "ptr" + + +let size_of_data = function +(* + | AST.Data_reserve n -> n +*) + | AST.Data_int8 _ -> 1 + | AST.Data_int16 _ -> 2 + | AST.Data_int32 _ -> 4 + | AST.Data_float32 _ -> 4 + | AST.Data_float64 _ -> 8 + + +let rec all_offsets size = match size with + | AST.SQ _ -> [[]] + | AST.SProd sizes -> + let fi i offsets = (size, i) :: offsets in + let f i size = List.map (fi i) (all_offsets size) in + List.flatten (MiscPottier.mapi f sizes) + | AST.SSum _ -> [[(size, 0)]] + | AST.SArray (n, size') -> + let all_offsets = all_offsets size' in + let f i = List.map (fun offsets -> (size, i) :: offsets) all_offsets in + let rec aux i = + if i >= n then [] + else (f i) @ (aux (i+1)) in + aux 0 + + +(** This is the signature of the parameter module of the functor. *) + +module type DATA_SIZE = +sig + val int_size : int + val ptr_size : int + val alignment : int option +end + + +(** This is the signature of the module that provides functions and types to + manipulate memories. *) + +module type S = +sig + + val int_size : int + val ptr_size : int + val alignment : int option + + val size_of_quantity : AST.quantity -> int + + module Value : Value.S + + (* Memory. A memory contains values and function definitions. Since the memory + module will be used by the interpreters of the various languages of the + compilation chain, the type of memory is polymorphic with the type of + function definitions. *) + + type 'fun_def memory + + (* Memory manipulation *) + + val empty : 'fun_def memory + + (** [alloc mem size] allocates a block of [size] bytes in the memory [mem]. It + returns the new memory and the address of the beginning of the newly + allocated area. *) + val alloc : 'fun_def memory -> int -> 'fun_def memory * Value.address + + (* Memory free *) + + val free : 'fun_def memory -> Value.address -> 'fun_def memory + + (* Memory load and store *) + + (** [load mem size addr] reads [size] bytes from address [addr] in memory + [mem] and returns the value found. *) + val load : 'fun_def memory -> int -> Value.address -> Value.t + val loadq : 'fun_def memory -> AST.quantity -> Value.address -> Value.t + + (** [store mem size addr v] writes the [size] first bytes (little endian + representation) of value [v] at address [addr] in memory [mem]. *) + val store : 'fun_def memory -> int -> Value.address -> Value.t -> + 'fun_def memory + val storeq : 'fun_def memory -> AST.quantity -> Value.address -> Value.t -> + 'fun_def memory + + (* Globals management *) + + (** [add_var mem x offsets init_datas] stores the datas [init_datas] of + offsets [offsets] in a new block of memory [mem], and associates the + global variable [x] with the address of the block. *) + val add_var : + 'fun_def memory -> AST.ident -> AST.abstract_size -> AST.data list option -> + 'fun_def memory + + (** [add_fun_def mem f def] stores the function definition [def] in a new + block of memory [mem], and associates the function name [f] with the + address of the block. *) + val add_fun_def : 'fun_def memory -> AST.ident -> 'fun_def -> 'fun_def memory + + val mem_global : 'fun_def memory -> AST.ident -> bool + + (** [find_global mem x] returns the address associated with the global symbol + [x] in memory [mem]. [x] may be a global variable or the name of a + function. *) + val find_global : 'fun_def memory -> AST.ident -> Value.address + + (** [find_fun_def mem addr] returns the function definition found at address + [addr] in memory [mem]. Raises an error if no function definition is + found. *) + val find_fun_def : 'fun_def memory -> Value.address -> 'fun_def + + + (** [align off size] returns the aligned offsets (starting at [off]) of datas + of size [size]. *) + val align : int (* starting offset *) -> AST.abstract_size (* sizes *) -> + (int list (* resulting offsets *) * int (* full size *)) + + val concrete_offsets_size : AST.abstract_size -> int list * int + + val concrete_offsets : AST.abstract_size -> int list + + val concrete_size : AST.abstract_size -> int + + val concrete_offset : AST.abstract_offset -> int + +(* + val size_of_datas : AST.data list -> int + + (** [offsets_of_datas datas] returns the aligned offsets for the datas + [datas], starting at offset 0. *) + val offsets_of_datas : AST.data list -> (AST.data * int (* offset *)) list + + val alloc_datas : 'fun_def memory -> AST.data list -> + ('fun_def memory * Value.address) +*) + + val to_string : 'fun_def memory -> string + val print : 'fun_def memory -> unit + +end + + +(** The functor of a memory module. *) + +module Make (D : DATA_SIZE) = +struct + + module Value = Value.Make (D) + module Block = Value.Block + module Offset = Value.Offset + + let address_of_block_offset b off = + Value.of_mem_address (Value.make_mem_address b off) + + let int_size = D.int_size + let ptr_size = D.ptr_size + let alignment = D.alignment + + let size_of_quantity = function + | AST.QInt i -> i + | AST.QOffset -> int_size + | AST.QPtr -> ptr_size + + + module OffsetMap = Map.Make (Offset) + type offsetMap = Value.chunk OffsetMap.t + type offset = Offset.t + + (* Empty cells are interpreted as an undefined byte value. *) + + type contents = + { low : offset ; (* inclusive *) + high : offset ; (* inclusive *) + cells : offsetMap } + + let update_cells contents cells = { contents with cells = cells } + let add_cells contents off v = + update_cells contents (OffsetMap.add off v contents.cells) + let remove_cells contents off = + update_cells contents (OffsetMap.remove off contents.cells) + + (* Alignment *) + + let is_multiple n m = m mod n = 0 + + (** [align_off off size] returns the offset greater or equal to [off] that is + aligned for storing a value of size [size]. *) + let align_off off size = match D.alignment with + | None -> off + | Some alignment when (size <= alignment) && (is_multiple size alignment) -> + let size = Offset.of_int size in + let rem = Offset.modulou off size in + if Offset.eq rem Offset.zero then off + else Offset.add off (Offset.sub size rem) + | Some alignment -> + let size = Offset.of_int alignment in + let rem = Offset.modulou off size in + if Offset.eq rem Offset.zero then off + else Offset.add off (Offset.sub size rem) + + let is_aligned off size = Offset.eq off (align_off off size) + + (** [pad off] returns the offset that is obtained by adding some padding from + [off] and such that the result is aligned. *) + let pad off = match D.alignment with + | None -> off + | Some alignment -> align_off off alignment + + (** [pad_size off size] returns the offset that is obtained by adding [size] + to the offset [off] and then adding some extra padding such that the + result is aligned. *) + let pad_size off size = + Offset.to_int (pad (Offset.add off (Offset.of_int size))) + + + (* Contents in memory. The type of function definitions varies from a language + to another; thus, it is left generic. *) + + type 'fun_def content = + | Contents of contents + | Fun_def of 'fun_def + + + (* The mapping from blocks to contents. *) + + module BlockMap = Map.Make (Block) + type 'fun_def blockMap = 'fun_def content BlockMap.t + type block = Block.t + + (* The mapping from global identifiers to blocks (negative for function + definitions and positive for global variables). *) + + module GlobalMap = Map.Make (String) + type globalMap = Value.address GlobalMap.t + + (* The memory. + It is a mapping from blocks to contents, a mapping from global identifiers + (variables and functions) to pointers, a mapping from (negative) blocks to + function definition, the next free positive block and the next free + negative block. *) + + type 'fun_def memory = + { blocks : 'fun_def blockMap ; + addr_of_global : globalMap ; + next_block : block ; + next_fun_block : block } + + (* Pretty printing *) + + let to_string mem = + let i = ref 0 in + let string_of_cell off v s = + let s' = if !i mod 4 = 0 then (i := 0 ; "\n ") else "" in + i := !i+1 ; + let sv = + if Value.is_undef_byte v then "" + else Printf.sprintf "[%s]: %s" + (Offset.to_string off) (Value.string_of_chunk v) in + Printf.sprintf "%s%s %s" s s' sv in + let string_of_cells cells = OffsetMap.fold string_of_cell cells "" in + let string_of_block b content s = + (Printf.sprintf "%s\nBlock %s: " s (Block.to_string b)) ^ + (match content with + | Contents contents -> + i := 0 ; + Printf.sprintf "(%s -> %s)%s" + (Offset.to_string contents.low) + (Offset.to_string contents.high) + (string_of_cells contents.cells) + | Fun_def _ -> "function definition") in + Printf.sprintf "%s\n" (BlockMap.fold string_of_block mem.blocks "") + + let print mem = Printf.printf "%s%!" (to_string mem) + + + (* Memory manipulation *) + + let empty = + { blocks = BlockMap.empty ; + addr_of_global = GlobalMap.empty ; + next_block = Block.of_int 1 ; + next_fun_block = Block.of_int (-1) } + + (* Memory allocation *) + + (** [alloc2 mem low high] allocates in memory [mem] a new block whose readable + and writable offsets are the interval [low] (inclusive) [high] + (inclusive). *) + let alloc2 mem low high = + let b = mem.next_block in + let contents = { low = low ; high = high ; cells = OffsetMap.empty } in + let blocks = BlockMap.add b (Contents contents) mem.blocks in + let next_block = Block.succ mem.next_block in + let mem' = { mem with blocks = blocks ; next_block = next_block } in + (mem', address_of_block_offset b low) + + (** [alloc mem size] allocates a block of [size] bytes in the memory [mem]. It + returns the new memory and the address of the beginning of the newly + allocated area. *) + let alloc mem size = + if size = 0 then (mem, Value.null) + else alloc2 mem Offset.zero (Offset.of_int (size-1)) + + + (* The 'safe'-prefixed functions below raise an error when the argument is not + of the expected form. *) + + let safe_to_address msg vs = + if Value.is_mem_address vs then Value.to_mem_address vs + else error msg + + let safe_find not_found find a map = + try find a map + with Not_found -> not_found () + + let safe_find_err msg = safe_find (fun () -> error msg) + + let safe_find_block msg b mem = safe_find_err msg BlockMap.find b mem.blocks + + let safe_find_contents msg b mem = match safe_find_block msg b mem with + | Contents contents -> contents + | Fun_def _ -> error msg + + let safe_find_offset msg off contents = + if (Offset.leu contents.low off) && (Offset.leu off contents.high) then + safe_find (fun () -> Value.undef_byte) OffsetMap.find off contents.cells + else error msg + + let memory_find msg mem b off = + safe_find_offset msg off (safe_find_contents msg b mem) + + + (* Memory free *) + + let free mem vs = + let addr = safe_to_address "free: invalid memory address." vs in + let (b, _) = Value.decompose_mem_address addr in + { mem with blocks = BlockMap.remove b mem.blocks } + + + (* Memory load *) + + (** [load_bytes msg mem b off size] reads [size] bytes from the block [b] and + offset [off] in memory [mem] and returns the value found. If an error + occurs, [msg] will be printed. *) + let load_bytes msg mem b off size = + let shift_off n = Offset.add off (Offset.of_int n) in + let rec aux n = + if n >= size then [] + else (memory_find msg mem b (shift_off n)) :: (aux (n+1)) in + Value.merge (aux 0) + + (** [load mem size addr] reads [size] bytes from address [addr] in memory + [mem] and returns the value found. *) + let load mem size vs = + let msg = "load: invalid memory access." in + let addr = safe_to_address msg vs in + let (b, off) = Value.decompose_mem_address addr in + if not (is_aligned off size) then + error "Alignment constraint violated when loading value." + else load_bytes msg mem b off size + + let loadq mem q vs = load mem (size_of_quantity q) vs + + + (* Memory store *) + + (** [store_chunks msg mem size b off chunks] writes the [size] first chunks of + list [chunks] at the offset [off] of the block [b] in the memory [mem]. *) + let store_chunks msg mem size b off chunks = + let shift_off n = Offset.add off (Offset.of_int n) in + let f i contents chunk = + let off' = shift_off i in + if (Offset.leu contents.low off') && + (Offset.leu off' contents.high) then + if Value.is_undef_byte chunk then contents + else add_cells contents off' chunk + else error msg in + match safe_find_block msg b mem with + | Contents contents -> + let contents = MiscPottier.foldi_until size f contents chunks in + let blocks = BlockMap.add b (Contents contents) mem.blocks in + { mem with blocks = blocks } + | _ -> error msg + + (** [store mem size addr v] writes the [size] first bytes (little endian + representation) of value [v] at address [addr] in memory [mem]. *) + let store mem size vs v = + let msg = "store: invalid memory access." in + let addr = safe_to_address msg vs in + let (b, off) = Value.decompose_mem_address addr in + if not (is_aligned off size) then + error "Alignment constraint violated when storing value." + else store_chunks msg mem size b off (Value.break v) + + let storeq mem q vs v = store mem (size_of_quantity q) vs v + + + (* Data manipulation *) + + let value_of_data = function +(* + | AST.Data_reserve _ -> Value.undef +*) + | AST.Data_int8 i | AST.Data_int16 i | AST.Data_int32 i -> Value.of_int i + | AST.Data_float32 f | AST.Data_float64 f -> error "float not supported." + + type concrete_size = + | I of Offset.t + | C of concrete_size list + + let rec first_offset = function + | I off -> off + | C [] -> raise (Failure "Memory.first_offset") + | C (csize :: _) -> first_offset csize + + let first_offsets = function + | I off -> [off] + | C sizes -> List.map first_offset sizes + + let rec all_offsets = function + | I off -> [off] + | C sizes -> List.flatten (List.map all_offsets sizes) + + let rec full_align off = function + + | AST.SQ q -> + let size = size_of_quantity q in + let start_off = align_off off size in + let diff = Offset.to_int (Offset.sub start_off off) in + let full_size = size + diff in + (I start_off, full_size) + + | AST.SProd sizes -> + let f (l, off) size = + let (csize, added_size) = full_align off size in + (l @ [csize], Offset.add off (Offset.of_int added_size)) in + let start_off = pad off in + let (l, end_off) = List.fold_left f ([], start_off) sizes in + let end_off = pad end_off in + let full_size = Offset.to_int (Offset.sub end_off off) in + (C l, full_size) + + | AST.SSum sizes -> + let start_off = pad off in + let sizes = + List.map (fun size -> snd (full_align start_off size)) sizes in + let max = Offset.of_int (MiscPottier.max_list sizes) in + let end_off = pad (Offset.add start_off max) in + let full_size = Offset.to_int (Offset.sub end_off off) in + (I start_off, full_size) + + | AST.SArray (n, size) -> + let sizes = MiscPottier.make size n in + full_align off (AST.SProd sizes) + + let align off size = + let (offsets, full_size) = full_align (Offset.of_int off) size in + (List.map Offset.to_int (first_offsets offsets), full_size) + + let concrete_offsets_size = align 0 + + let concrete_offsets size = fst (concrete_offsets_size size) + + let concrete_size size = snd (concrete_offsets_size size) + + let concrete_offset (size, depth) = + let offsets = concrete_offsets size in + List.nth offsets depth + + + (* Globals manipulation *) + + let store_datas_opt mem addr offsets = function + | None -> mem + | Some datas -> + let f mem (offset, data) = + let addr = Value.add_address addr offset in + store mem (size_of_data data) addr (value_of_data data) in + let offsets = all_offsets offsets in + if List.length offsets <> List.length datas then + error "wrong sizes for global initializations (union type?)." + else + let offset_datas = List.combine offsets datas in + List.fold_left f mem offset_datas + + (** [add_var mem x size init_datas] stores the datas [init_datas] of offsets + [size] in a new block of memory [mem], and associates the global variable + [x] with the address of the block. *) + let add_var mem v_id size datas_opt = + let (offsets, size) = full_align Offset.zero size in + let (mem, addr) = alloc mem size in + let mem = store_datas_opt mem addr offsets datas_opt in + let addr_of_global = GlobalMap.add v_id addr mem.addr_of_global in + { mem with addr_of_global = addr_of_global } + + (** [add_fun_def mem f def] stores the function definition [def] in a new + block of memory [mem], and associates the function name [f] with the + address of the block. *) + let add_fun_def mem f_id f_def = + let b = mem.next_fun_block in + let next_fun_block = Block.pred mem.next_fun_block in + let vs = address_of_block_offset b Offset.zero in + let addr_of_global = GlobalMap.add f_id vs mem.addr_of_global in + let blocks = BlockMap.add b (Fun_def f_def) mem.blocks in + { mem with blocks = blocks ; + addr_of_global = addr_of_global ; + next_fun_block = next_fun_block } + + let mem_global mem id = GlobalMap.mem id mem.addr_of_global + + (** [find_global mem x] returns the address associated with the global symbol + [x] in memory [mem]. [x] may be a global variable or the name of a + function. *) + let find_global mem gid = + if GlobalMap.mem gid mem.addr_of_global then + GlobalMap.find gid mem.addr_of_global + else error ("Unknown global \"" ^ gid ^ "\"") + + (** [find_fun_def mem addr] returns the function definition found at address + [addr] in memory [mem]. Raises an error if no function definition is + found. *) + let find_fun_def mem vs = + let msg = "Invalid access to a function definition." in + let (b, _) = Value.decompose_mem_address (safe_to_address msg vs) in + match safe_find_block msg b mem with + | Contents _ -> error msg + | Fun_def def -> def + +end diff --git a/src/common/memory.mli b/src/common/memory.mli new file mode 100644 index 0000000..a3dab37 --- /dev/null +++ b/src/common/memory.mli @@ -0,0 +1,133 @@ + +(** This file gives a memory model that can be used by the interpreter + of various languages throughout the compilation process and + following the memory model of the CompCert compiler. *) + +(** In the module, every size is expressed in bytes. *) + + +val string_of_quantity : AST.quantity -> string + +val size_of_data : AST.data -> int + +val all_offsets : AST.abstract_size -> AST.abstract_offset list list + + +(** This is the signature of the parameter module of the functor. *) + +module type DATA_SIZE = +sig + val int_size : int + val ptr_size : int + val alignment : int option +end + + +(** This is the signature of the module that provides functions and types to + manipulate memories. *) + +module type S = +sig + + val int_size : int + val ptr_size : int + val alignment : int option + + val size_of_quantity : AST.quantity -> int + + module Value : Value.S + + (* Memory. A memory contains values and function definitions. Since the memory + module will be used by the interpreters of the various languages of the + compilation chain, the type of memory is polymorphic with the type of + function definitions. *) + + type 'fun_def memory + + (* Memory manipulation *) + + val empty : 'fun_def memory + + (** [alloc mem size] allocates a block of [size] bytes in the memory [mem]. It + returns the new memory and the address of the beginning of the newly + allocated area. *) + val alloc : 'fun_def memory -> int -> 'fun_def memory * Value.address + + (* Memory free *) + + val free : 'fun_def memory -> Value.address -> 'fun_def memory + + (* Memory load and store *) + + (** [load mem size addr] reads [size] bytes from address [addr] in memory + [mem] and returns the value found. *) + val load : 'fun_def memory -> int -> Value.address -> Value.t + val loadq : 'fun_def memory -> AST.quantity -> Value.address -> Value.t + + (** [store mem size addr v] writes the [size] first bytes (little endian + representation) of value [v] at address [addr] in memory [mem]. *) + val store : 'fun_def memory -> int -> Value.address -> Value.t -> + 'fun_def memory + val storeq : 'fun_def memory -> AST.quantity -> Value.address -> Value.t -> + 'fun_def memory + + (* Globals management *) + + (** [add_var mem x offsets init_datas] stores the datas [init_datas] of + offsets [offsets] in a new block of memory [mem], and associates the + global variable [x] with the address of the block. *) + val add_var : + 'fun_def memory -> AST.ident -> AST.abstract_size -> AST.data list option -> + 'fun_def memory + + (** [add_fun_def mem f def] stores the function definition [def] in a new + block of memory [mem], and associates the function name [f] with the + address of the block. *) + val add_fun_def : 'fun_def memory -> AST.ident -> 'fun_def -> 'fun_def memory + + val mem_global : 'fun_def memory -> AST.ident -> bool + + (** [find_global mem x] returns the address associated with the global symbol + [x] in memory [mem]. [x] may be a global variable or the name of a + function. *) + val find_global : 'fun_def memory -> AST.ident -> Value.address + + (** [find_fun_def mem addr] returns the function definition found at address + [addr] in memory [mem]. Raises an error if no function definition is + found. *) + val find_fun_def : 'fun_def memory -> Value.address -> 'fun_def + + + (** [align off size] returns the aligned offsets (starting at [off]) of datas + of size [size]. *) + val align : int (* starting offset *) -> AST.abstract_size (* sizes *) -> + (int list (* resulting offsets *) * int (* full size *)) + + val concrete_offsets_size : AST.abstract_size -> int list * int + + val concrete_offsets : AST.abstract_size -> int list + + val concrete_size : AST.abstract_size -> int + + val concrete_offset : AST.abstract_offset -> int + +(* + val size_of_datas : AST.data list -> int + + (** [offsets_of_datas datas] returns the aligned offsets for the datas + [datas], starting at offset 0. *) + val offsets_of_datas : AST.data list -> (AST.data * int (* offset *)) list + + val alloc_datas : 'fun_def memory -> AST.data list -> + ('fun_def memory * Value.address) +*) + + val to_string : 'fun_def memory -> string + val print : 'fun_def memory -> unit + +end + + +(** The functor to a memory module. *) + +module Make (D : DATA_SIZE) : S diff --git a/src/common/primitive.ml b/src/common/primitive.ml new file mode 100644 index 0000000..5ac9a4d --- /dev/null +++ b/src/common/primitive.ml @@ -0,0 +1,162 @@ + +(** These are the functions provided by the runtime system. *) + + +let error_prefix = "Primitives" +let error s = Error.global_error error_prefix s +let warning s = Error.warning error_prefix s + +let print_schar = + ("print_schar", "extern void print_schar(signed char);") +let print_uchar = + ("print_uchar", "extern void print_uchar(unsigned char);") +let print_sshort = + ("print_sshort", "extern void print_sshort(signed short);") +let print_ushort = + ("print_ushort", "extern void print_ushort(unsigned short);") +let print_sint = + ("print_sint", "extern void print_sint(signed int);") +let print_uint = + ("print_uint", "extern void print_uint(unsigned int);") +let scan_int = + ("scan_int", "extern int scan_int(void);") +let alloc = + ("alloc", "extern int* alloc(int);") +let newline = + ("newline", "extern void newline(void);") +let space = + ("space", "extern void space(void);") +let rand_bool = + ("rand_bool", "extern int rand_bool(void);") +let rand_int = + ("rand_int", "extern int rand_int(int);") + +let ident = fst + +let proto = snd + +let primitives_list = + [print_schar ; print_uchar ; print_sshort ; print_ushort ; + print_sint ; print_uint ; scan_int ; alloc ; newline ; space ; + rand_bool ; rand_int] + + +let args_byte_size = function + | s when s = ident print_schar || s = ident print_uchar -> AST.QInt 1 + | s when s = ident print_sshort || s = ident print_ushort -> AST.QInt 2 + | s when s = ident print_sint || s = ident print_uint || s = ident rand_int -> + AST.QInt 4 + | s when s = ident scan_int || s = ident newline || s = ident space || + s = ident rand_bool -> + AST.QInt 0 + | s when s = ident alloc -> AST.QPtr + | s -> error ("unknown primitive " ^ s ^ ".") + + +let primitives = + List.fold_left (fun res f -> StringTools.Set.add f res) StringTools.Set.empty + (List.map ident primitives_list) + +let is_primitive f = StringTools.Set.mem f primitives + + +module Interpret (M : Memory.S) = struct + + type res = V of M.Value.t list | A of M.Value.address + + let print_integer_primitives = + List.map ident + [print_schar ; print_uchar ; print_sshort ; print_ushort ; + print_sint ; print_uint] + + let is_print_integer_primitive f = List.mem f print_integer_primitives + + let print_integer_primitive_funs = function + | f when f = ident print_schar -> + (IntValue.Int8.cast, IntValue.Int8.to_signed_repr) + | f when f = ident print_uchar -> + (IntValue.Int8.cast, IntValue.Int8.to_unsigned_repr) + | f when f = ident print_sshort -> + (IntValue.Int16.cast, IntValue.Int16.to_signed_repr) + | f when f = ident print_ushort -> + (IntValue.Int16.cast, IntValue.Int16.to_unsigned_repr) + | f when f = ident print_sint -> + (IntValue.Int32.cast, IntValue.Int32.to_signed_repr) + | f when f = ident print_uint -> + (IntValue.Int32.cast, IntValue.Int32.to_unsigned_repr) + | f -> error ("unknown integer printing primitive " ^ f ^ ".") + + let make_int_value vs = IntValue.Int32.merge (List.map M.Value.to_int_repr vs) + + let print_integer f mem vs = + let (cast, to_int_repr) = print_integer_primitive_funs f in + let i = make_int_value vs in + let i = cast i in + let i = to_int_repr i in + Printf.printf "%s%!" (IntValue.print_int_repr i) ; + (mem, V []) + + let are_ints args = + let f res v = res && M.Value.is_int v in + List.fold_left f true args + + let res_of_int i = + let i = IntValue.Int32.of_int i in + let is = IntValue.Int32.break i (4 / M.Value.int_size) in + List.map M.Value.of_int_repr is + + let t mem f = function + | args when is_print_integer_primitive f && are_ints args -> + print_integer f mem args + | _ when f = ident scan_int -> + Printf.printf ": %!" ; + (mem, V (res_of_int (int_of_string (read_line ())))) + | args when f = ident alloc && are_ints args -> + let size = IntValue.Int32.to_int (make_int_value args) in + let (mem, addr) = M.alloc mem size in + (mem, A addr) + | _ when f = ident newline -> + Printf.printf "\n%!" ; + (mem, V []) + | _ when f = ident space -> + Printf.printf " %!" ; + (mem, V []) + | _ when f = ident rand_bool -> + (mem, V (res_of_int (Random.int 2))) + | args when f = ident rand_int && are_ints args -> + let i = IntValue.Int32.to_int (make_int_value args) in + (mem, V (res_of_int (Random.int i))) + | _ -> error ("unknown primitive " ^ f ^ " or bad arguments.") +end + + +let print_signedness = function + | AST.Signed -> "s" + | AST.Unsigned -> "u" + +let print_size = string_of_int + +let print_type = function + | AST.Sig_int (size, sign) -> + "int" ^ (print_size size) ^ (print_signedness sign) + | AST.Sig_float (size, sign) -> + "float" ^ (print_size size) ^ (print_signedness sign) + | AST.Sig_offset -> "offset" + | AST.Sig_ptr -> "ptr" + +let print_type_return = function + | AST.Type_ret t -> print_type t + | AST.Type_void -> "void" + +let rec print_arg_types = function + | [] -> "" + | t :: ts -> (print_type t) ^ " -> " ^ (print_arg_types ts) + +let print_sig sg = + Printf.sprintf "%s%s" + (print_arg_types sg.AST.args) + (print_type_return sg.AST.res) + +let prototypes = + let f res s = res ^ "\n" ^ s in + (List.fold_left f "" (List.map proto primitives_list)) ^ "\n\n" diff --git a/src/common/primitive.mli b/src/common/primitive.mli new file mode 100644 index 0000000..4d0dc8a --- /dev/null +++ b/src/common/primitive.mli @@ -0,0 +1,36 @@ + +(** These are the functions provided by the runtime system. *) + +val primitives : StringTools.Set.t + +val is_primitive : string -> bool + +(** Available primitives are : +extern void print_schar(signed char); +extern void print_uchar(unsigned char); +extern void print_sshort(signed short); +extern void print_ushort(unsigned short); +extern void print_sint(signed int); +extern void print_uint(unsigned int); +extern int scan_int(void); +extern int* alloc(int); +extern void newline(void); +extern void space(void); +(* The following functions only work from Clight to LIN (both included). *) +extern int rand_bool(); +extern int rand_int(int, int); *) + +val args_byte_size : string -> AST.quantity + +val print_type : AST.sig_type -> string +val print_type_return : AST.type_return -> string +val print_sig : AST.signature -> string +val print_signedness : AST.signedness -> string +val print_size : AST.size -> string + +module Interpret (M : Memory.S) : sig + type res = V of M.Value.t list | A of M.Value.address + val t : 'a M.memory -> string -> M.Value.t list -> 'a M.memory * res +end + +val prototypes : string diff --git a/src/common/register.ml b/src/common/register.ml new file mode 100644 index 0000000..0b0d171 --- /dev/null +++ b/src/common/register.ml @@ -0,0 +1,3 @@ +(* Pasted from Pottier's PP compiler *) + +include Atom diff --git a/src/common/register.mli b/src/common/register.mli new file mode 100644 index 0000000..721c0cb --- /dev/null +++ b/src/common/register.mli @@ -0,0 +1,11 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module offers an abstract type of pseudo-registers, used in + [RTL] and [ERTL]. + + This module really is a copy of module [Atom]. However, + [Register.t] is an abstract type -- it is not equal to [Atom.t] or + [Label.t]. *) + +include AtomSig.S + diff --git a/src/common/value.ml b/src/common/value.ml new file mode 100644 index 0000000..0e51ccf --- /dev/null +++ b/src/common/value.ml @@ -0,0 +1,583 @@ + +(** This module describes the values manipulated by high level + languages. *) + + +let error_prefix = "Value" +let error s = Error.global_error error_prefix s + +open IntValue + + +(** The representation of values depends on the size of integers and the size of + addresses. *) + +(** This is the signature of the parameter module. *) + +module type DATA_SIZE = +sig + val int_size : int + val ptr_size : int +end + +(** This is the signature of the module that provides types and functions to + manipulate values. *) + +module type S = +sig + + val int_size : int + val ptr_size : int + + (** The type of values. A value may be: a bounded integer, a chunk of an + address (exactly an address when they have the same size as a machine + register), or undefined. *) + type t + + val compare : t -> t -> int + val equal : t -> t -> bool + val eq : t -> t -> bool + val hash : t -> int + val to_string : t -> string + + (* The functions of this module may raise a Failure exception when + trying to convert them to their various representation. *) + + val is_int : t -> bool + val to_int : t -> int + val of_int : int -> t + + val of_int_repr : IntValue.int_repr -> t + val to_int_repr : t -> IntValue.int_repr + + val of_bool : bool -> t + val to_bool : t -> bool + + val zero : t + val val_true : t + val val_false : t + val is_true : t -> bool + val is_false : t -> bool + val undef : t + + (** The cast operations below returns the undefined value for non-integer + values. For integer values, it will return the integer value that + represents the same quantity, but using every bits (sign or zero + extension) of an integer value. For example, the function [cast8unsigned] + should be read as "cast from an 8 bits unsigned integer". *) + val cast8unsigned : t -> t + val cast8signed : t -> t + val cast16unsigned : t -> t + val cast16signed : t -> t + val cast32 : t -> t + + (** [zero_ext v n m] performs a zero extension on [v] where [n] bytes are + significant to a value where [m] bytes are significant. *) + val zero_ext : t -> int -> int -> t + (** [sign_ext v n m] performs a sign extension on [v] where [n] bytes are + significant to a value where [m] bytes are significant. *) + val sign_ext : t -> int -> int -> t + + (** Integer opposite *) + val negint : t -> t + (** Boolean negation *) + val notbool : t -> t + (** Bitwise not *) + val notint : t -> t + + val succ : t -> t + val pred : t -> t + val cmpl : t -> t + + (** [add_and_of v1 v2] returns the sum of [v1] and [v2], and whether this sum + overflows. *) + val add_and_of : t -> t -> (t * t) + val add : t -> t -> t + (** [add_of v1 v2] returns the [1] value if the sum of [v1] and [v2] + overflows, and [0] otherwise. *) + val add_of : t -> t -> t + (** [sub_and_uf v1 v2] returns the substraction of [v1] and [v2], and whether + this substraction underflows. *) + val sub_and_uf : t -> t -> (t * t) + val sub : t -> t -> t + (** [sub_uf v1 v2] returns the [1] value if the substraction of [v1] and [v2] + underflows, and [0] otherwise. *) + val sub_uf : t -> t -> t + val mul : t -> t -> t + val div : t -> t -> t + val divu : t -> t -> t + val modulo : t -> t -> t + val modulou : t -> t -> t + val and_op : t -> t -> t + val or_op : t -> t -> t + val xor : t -> t -> t + val shl : t -> t -> t + val shr : t -> t -> t + val shru : t -> t -> t + + (** Signed comparisions *) + val cmp_eq : t -> t -> t + val cmp_ne : t -> t -> t + val cmp_lt : t -> t -> t + val cmp_ge : t -> t -> t + val cmp_le : t -> t -> t + val cmp_gt : t -> t -> t + + (** Unsigned comparisions *) + val cmp_eq_u : t -> t -> t + val cmp_ne_u : t -> t -> t + val cmp_lt_u : t -> t -> t + val cmp_ge_u : t -> t -> t + val cmp_le_u : t -> t -> t + val cmp_gt_u : t -> t -> t + + (** A chunk is a part of a value that has the size of a memory cell. *) + + type chunk + val string_of_chunk : chunk -> string + val undef_byte : chunk + val is_undef_byte : chunk -> bool + + (** [break v] cuts [v] in chunks that each fits into a memory cell. In the + resulting list, the first element is the low bits, and the last is the + high bits (little endian representation). *) + val break : t -> chunk list + (** [merge l] creates the value where the first element of [l] is its low + bits, etc, and the last element of [l] is its high bits (little endian + representation). *) + val merge : chunk list -> t + + (** Addresses from the memory point of view. *) + + (** Some architectures have pointers bigger than integers. In this case, only + a chunk of pointer can fit into a machine register. Thus, an address is + represented by several values (little endian representation). *) + + type address = t list + val string_of_address : address -> string + val null : address + + (** Addresses from the memory point of view. Only use the functions below in + the Memory module.*) + + (** Addresses are represented by a block, i.e. a base address, and an offset + from this block. Both blocks and offsets are represented using bounded + integers. *) + module Block : IntValue.S + module Offset : IntValue.S + + type mem_address + val string_of_mem_address : mem_address -> string + + val is_mem_address : address -> bool + + val of_mem_address : mem_address -> address + val to_mem_address : address -> mem_address + val make_mem_address : Block.t -> Offset.t -> mem_address + val decompose_mem_address : mem_address -> Block.t * Offset.t + val block_of_address : address -> Block.t + val offset_of_address : address -> Offset.t + + val change_address_offset : address -> Offset.t -> address + val add_address : address -> Offset.t -> address + val eq_address : address -> address -> bool + +end + + +module Make (D : DATA_SIZE) = +struct + + let int_size = D.int_size + let ptr_size = D.ptr_size + + module BoundedInt = IntValue.Make (struct let size = D.int_size end) + + (* Integer values. *) + module ValInt = BoundedInt + + (* Addresses are represented by a block, i.e. a base address, and an offset + from this block. Both blocks and offsets are represented using bounded + integers. However, values must fit into a machine register. Some + architectures, like the 8051, have addresses bigger than registers. Pointer + values will only represent a part of a full pointer (or exactly a pointer + when addresses fit into a register). *) + + (* Blocks and offsets need [D.ptr_size] bits each to be represented. Indeed, + one may allocate 2^[D.ptr_size] blocks of size one byte, or one block of + size 2^[D.ptr_size] bytes. *) + + module ValBlock = BoundedInt + module ValOffset = BoundedInt + + type t = + | Val_int of ValInt.t + | Val_ptr of ValBlock.t * ValOffset.t + | Val_undef + + let compare a b = match a, b with + | Val_int i1, Val_int i2 -> ValInt.compare i1 i2 + | Val_ptr (b1, off1), Val_ptr (b2, off2) -> + let i1 = ValBlock.compare b1 b2 in + if i1 = 0 then ValOffset.compare off1 off2 + else i1 + | Val_undef, Val_undef -> 0 + | Val_int _, _ -> 1 + | _, Val_int _ -> -1 + | Val_ptr _, _ -> 1 + | _, Val_ptr _ -> -1 + + (* + let hash = function + | Val_int i -> ValInt.to_int i + | Val_float f -> int_of_float f + | Val_undef -> 0 + | Val_ptr (b,o) + | Val_ptrh (b,o) + | Val_ptrl (b,o) -> ValInt.to_int (ValInt.add b o) + *) + + let hash = Hashtbl.hash + + let equal a b = compare a b = 0 + let eq a b = compare a b = 0 + + let to_string = function + | Val_int i -> ValInt.to_string i + | Val_ptr (b, off) -> + "VPtr(" ^ (ValBlock.to_string b) ^ ", " ^ (ValOffset.to_string off) ^ ")" + | Val_undef -> "undef" + + let is_int = function + | Val_int _ -> true + | _ -> false + + let to_int = function + | Val_int i -> ValInt.to_int i + | _ -> raise (Failure "Value.to_int") + + let of_int i = Val_int (ValInt.of_int i) + let one = of_int 1 + + let of_int_repr i = Val_int i + + let to_int_repr = function + | Val_int i -> i + | _ -> raise (Failure "Value.to_int_repr") + + let zero = Val_int ValInt.zero + let val_true = Val_int ValInt.one + let val_false = Val_int ValInt.zero + + let is_true = function + | Val_int i -> ValInt.neq i ValInt.zero + | Val_ptr (b, off) -> + (ValBlock.neq b ValBlock.zero) || (ValOffset.neq off ValOffset.zero) + | _ -> false + + let is_false = function + | Val_int i -> ValInt.eq i ValInt.zero + | Val_ptr (b, off) -> + (ValBlock.eq b ValBlock.zero) && (ValOffset.eq off ValOffset.zero) + | _ -> false + + let of_bool = function + | true -> val_true + | false -> val_false + + let to_bool v = + if is_true v then true + else + if is_false v then false + else error "Undefined value." + + let undef = Val_undef + + let cast cast_fun = function + | Val_int i -> Val_int (cast_fun i) + | _ -> Val_undef + + (** Sign or 0 extensions from various bounded integers. *) + let cast8unsigned = cast (ValInt.zero_ext 8) + let cast8signed = cast (ValInt.sign_ext 8) + let cast16unsigned = cast (ValInt.zero_ext 16) + let cast16signed = cast (ValInt.sign_ext 16) + let cast32 = cast (ValInt.zero_ext 32) + + + let unary_int_op f = function + | Val_int i -> Val_int (f i) + | _ -> Val_undef + + let binary_int_op f v1 v2 = match v1, v2 with + | Val_int i1, Val_int i2 -> Val_int (f i1 i2) + | _ -> Val_undef + + let negint = unary_int_op ValInt.neg + + let notbool v = + if is_true v then val_false + else + if is_false v then val_true + else Val_undef + + let notint = unary_int_op ValInt.lognot + + let cmpl = unary_int_op ValInt.lognot + + (** [add_and_of v1 v2] returns the sum of [v1] and [v2], and whether this sum + overflows. *) + let add_and_of v1 v2 = match v1, v2 with + | Val_int i1, Val_int i2 -> + (Val_int (ValInt.add i1 i2), of_bool (ValInt.add_of i1 i2)) + | Val_int i, Val_ptr (b, off) + | Val_ptr (b, off), Val_int i -> + let i = ValOffset.cast i in + (Val_ptr (b, ValOffset.add off i), of_bool (ValOffset.add_of off i)) + | _, _ -> (Val_undef, Val_undef) + + let add v1 v2 = fst (add_and_of v1 v2) + let add_of v1 v2 = snd (add_and_of v1 v2) + + let succ v = add v (Val_int ValInt.one) + + (** [sub_and_uf v1 v2] returns the substraction of [v1] and [v2], and whether + this substraction underflows. *) + let sub_and_uf v1 v2 = match v1, v2 with + | Val_int i1, Val_int i2 -> + (Val_int (ValInt.sub i1 i2), of_bool (ValInt.sub_uf i1 i2)) + | Val_ptr (b, off), Val_int i -> + let i = ValOffset.cast i in + (Val_ptr (b, ValOffset.sub off i), of_bool (ValOffset.sub_uf off i)) + | Val_ptr (b1, off1), Val_ptr (b2, off2) when ValBlock.eq b1 b2 -> + (Val_int (ValInt.cast (ValOffset.sub off1 off2)), + of_bool (ValOffset.sub_uf off1 off2)) + | _, _ -> (Val_undef, Val_undef) + + let sub v1 v2 = fst (sub_and_uf v1 v2) + let sub_uf v1 v2 = snd (sub_and_uf v1 v2) + + let pred v = sub v (Val_int ValInt.one) + + let mul = binary_int_op ValInt.mul + + let is_zero = function + | Val_int i when ValInt.eq i ValInt.zero -> true + | _ -> false + + let error_if_zero op v1 v2 = + if is_zero v2 then error "Division by zero." + else binary_int_op op v1 v2 + + let div = error_if_zero ValInt.div + let divu = error_if_zero ValInt.divu + let modulo = error_if_zero ValInt.modulo + let modulou = error_if_zero ValInt.modulou + + let and_op = binary_int_op ValInt.logand + let or_op = binary_int_op ValInt.logor + let xor = binary_int_op ValInt.logxor + let shl = binary_int_op ValInt.shl + let shr = binary_int_op ValInt.shr + let shru = binary_int_op ValInt.shrl + + let ext sh v n m = + let n = n * 8 in + let m = m * 8 in + let real_size = D.int_size * 8 in + let int_sh sh v n = sh v (of_int n) in + if n >= m then + if m = real_size then v + else modulou v (shl one (of_int m)) + else + let v = int_sh shl v (real_size - n) in + let v = int_sh sh v (m - n) in + int_sh shru v (real_size - m) + + let zero_ext = ext shru + let sign_ext = ext shr + + let cmp f_int f_off v1 v2 = match v1, v2 with + | Val_int i1, Val_int i2 -> of_bool (f_int i1 i2) + | Val_ptr (b1, off1), Val_ptr (b2, off2) when ValBlock.eq b1 b2 -> + of_bool (f_off off1 off2) + | _ -> Val_undef + + let cmp_eq = cmp ValInt.eq ValOffset.eq + let cmp_ne = cmp ValInt.neq ValOffset.neq + let cmp_lt = cmp ValInt.lt ValOffset.lt + let cmp_ge = cmp ValInt.ge ValOffset.ge + let cmp_le = cmp ValInt.le ValOffset.le + let cmp_gt = cmp ValInt.gt ValOffset.gt + + let cmp_eq_u = cmp ValInt.eq ValOffset.eq + let cmp_ne_u = cmp ValInt.neq ValOffset.neq + let cmp_lt_u = cmp ValInt.ltu ValOffset.ltu + let cmp_ge_u = cmp ValInt.geu ValOffset.geu + let cmp_le_u = cmp ValInt.leu ValOffset.leu + let cmp_gt_u = cmp ValInt.gtu ValOffset.gtu + + + (* The memory is based on byte values. In order to be able to fit a bigger + integer or pointer value in memory, we need to be able to break this value + into several values of size a byte. An integer will be broken into multiple + 8 bits integers. A pointer will be broken into several couples of 8 bits + blocks and 8 bits offsets. *) + + module Int8 = IntValue.Int8 + + (* 8 bits integers *) + module IntChunk = Int8 + (* 8 bits blocks *) + module BlockChunk = Int8 + (* 8 bits offsets *) + module OffsetChunk = Int8 + + (** A chunk is a part of a value that has the size of a memory cell. *) + + type chunk = + | Byte_int of IntChunk.t + | Byte_ptr of BlockChunk.t * OffsetChunk.t + | Byte_undef + + let string_of_chunk = function + | Byte_int i -> IntChunk.to_string i + | Byte_ptr (b, off) -> + "BPtr(" ^ (BlockChunk.to_string b) ^ ", " ^ + (OffsetChunk.to_string off) ^ ")" + | Byte_undef -> "Bundef" + + let undef_byte = Byte_undef + + let is_undef_byte = function + | Byte_undef -> true + | _ -> false + + let break_and_cast break cast x n = + let ys = break x n in + List.map cast ys + + (** [break v] cuts [v] in chunks that each fits into a memory cell. In the + resulting list, the first element is the low bits, and the last is the + high bits (little endian representation). *) + let break v = + let nb_chunks = D.int_size in + match v with + | Val_ptr (b, off) -> + let bbs = break_and_cast ValBlock.break BlockChunk.cast b nb_chunks in + let boffs = + break_and_cast ValOffset.break OffsetChunk.cast off nb_chunks in + List.map2 (fun bb boff -> Byte_ptr (bb, boff)) bbs boffs + | Val_int i -> + let bis = break_and_cast ValInt.break IntChunk.cast i nb_chunks in + List.map (fun i' -> Byte_int i') bis + | _ -> MiscPottier.make Byte_undef nb_chunks + + (** [all_are_pointers l] returns [true] iff the values in the list [l] all are + pointers. *) + let all_are_pointers = + let f b v = b && (match v with Byte_ptr _ -> true | _ -> false) in + List.fold_left f true + + (** [all_are_integers l] returns [true] iff the values in the list [l] all are + integers. *) + let all_are_integers = + let f b v = b && (match v with Byte_int _ -> true | _ -> false) in + List.fold_left f true + + let bblock_of_chunk = function + | Byte_ptr (b, _) -> b + | _ -> assert false (* do not use on this argument *) + + let boffset_of_chunk = function + | Byte_ptr (_, off) -> off + | _ -> assert false (* do not use on this argument *) + + let bint_of_chunk = function + | Byte_int i -> i + | _ -> assert false (* do not use on this argument *) + + let cast_and_merge cast merge transform l = + merge (List.map (fun x -> cast (transform x)) l) + + (** [merge l] creates the value where the first element of [l] is its low + bits, etc, and the last element of [l] is its high bits (little endian + representation). *) + let merge = function + | l when all_are_pointers l -> + let b = cast_and_merge ValBlock.cast ValBlock.merge bblock_of_chunk l in + let off = + cast_and_merge ValOffset.cast ValOffset.merge boffset_of_chunk l in + Val_ptr (b, off) + | l when all_are_integers l -> + Val_int (cast_and_merge ValInt.cast ValInt.merge bint_of_chunk l) + | _ -> Val_undef + + + (** Addresses from the memory point of view. *) + + (** Some architectures have pointers bigger than integers. In this case, only + a chunk of pointer can fit into a machine register. Thus, an address is + represented by several values (little endian representation). *) + + type address = t list + + let string_of_address vs = + "[" ^ (MiscPottier.string_of_list " " to_string vs) ^ "]" + + + (** Addresses are represented by a block, i.e. a base address, and an offset + from this block. Both blocks and offsets are represented using bounded + integers. *) + + let ptr_int_size = max (D.ptr_size / D.int_size) 1 + + module Block = IntValue.Make (struct let size = D.ptr_size end) + module Offset = IntValue.Make (struct let size = D.ptr_size end) + + type mem_address = Block.t * Offset.t + + let string_of_mem_address (b, off) = + Printf.sprintf "(%s, %s)" (Block.to_string b) (Offset.to_string off) + + let is_mem_address = + let f b v = b && (match v with | Val_ptr _ -> true | _ -> false) in + List.fold_left f true + + let of_mem_address (b, off) = + let bs = Block.break b ptr_int_size in + let offs = Offset.break off ptr_int_size in + let f b off = Val_ptr (ValBlock.cast b, ValOffset.cast off) in + List.map2 f bs offs + + let decompose_Val_ptr = function + | Val_ptr (b, off) -> (b, off) + | _ -> error "Not an address." + + let to_mem_address vs = + let (bs, offs) = List.split (List.map decompose_Val_ptr vs) in + let b = Block.merge (List.map Block.cast bs) in + let off = Offset.merge (List.map Offset.cast offs) in + (b, off) + + let make_mem_address b off = (b, off) + let decompose_mem_address addr = addr + let block_of_address vs = fst (to_mem_address vs) + let offset_of_address vs = snd (to_mem_address vs) + + let null = of_mem_address (Block.zero, Offset.zero) + + let change_address_offset vs off = + let (b, _) = decompose_mem_address (to_mem_address vs) in + of_mem_address (make_mem_address b off) + + let add_address vs off' = + let (b, off) = decompose_mem_address (to_mem_address vs) in + let off = Offset.add off off' in + of_mem_address (make_mem_address b off) + + let eq_address addr1 addr2 = + let f b v1 v2 = b && (eq v1 v2) in + List.fold_left2 f true addr1 addr2 + +end diff --git a/src/common/value.mli b/src/common/value.mli new file mode 100644 index 0000000..e1b8cb8 --- /dev/null +++ b/src/common/value.mli @@ -0,0 +1,181 @@ + +(** This module describes the values manipulated by high level languages. *) + +(** The representation of values depends on the size of integers and the size of + addresses. *) + +(** This is the signature of the parameter module. *) + +module type DATA_SIZE = +sig + val int_size : int + val ptr_size : int +end + +(** This is the signature of the module that provides types and functions to + manipulate values. *) + +module type S = +sig + + val int_size : int + val ptr_size : int + + (** The type of values. A value may be: a bounded integer, a chunk of an + address (exactly an address when they have the same size as a machine + register), or undefined. *) + type t + + val compare : t -> t -> int + val equal : t -> t -> bool + val eq : t -> t -> bool + val hash : t -> int + val to_string : t -> string + + (* The functions of this module may raise a Failure exception when + trying to convert them to their various representation. *) + + val is_int : t -> bool + val to_int : t -> int + val of_int : int -> t + + val of_int_repr : IntValue.int_repr -> t + val to_int_repr : t -> IntValue.int_repr + + val of_bool : bool -> t + val to_bool : t -> bool + + val zero : t + val val_true : t + val val_false : t + val is_true : t -> bool + val is_false : t -> bool + val undef : t + + (** The cast operations below returns the undefined value for non-integer + values. For integer values, it will return the integer value that + represents the same quantity, but using every bits (sign or zero + extension) of an integer value. For example, the function [cast8unsigned] + should be read as "cast from an 8 bits unsigned integer". *) + val cast8unsigned : t -> t + val cast8signed : t -> t + val cast16unsigned : t -> t + val cast16signed : t -> t + val cast32 : t -> t + + (** [zero_ext v n m] performs a zero extension on [v] where [n] bytes are + significant to a value where [m] bytes are significant. *) + val zero_ext : t -> int -> int -> t + (** [sign_ext v n m] performs a sign extension on [v] where [n] bytes are + significant to a value where [m] bytes are significant. *) + val sign_ext : t -> int -> int -> t + + (** Integer opposite *) + val negint : t -> t + (** Boolean negation *) + val notbool : t -> t + (** Bitwise not *) + val notint : t -> t + + val succ : t -> t + val pred : t -> t + val cmpl : t -> t + + (** [add_and_of v1 v2] returns the sum of [v1] and [v2], and whether this sum + overflows. *) + val add_and_of : t -> t -> (t * t) + val add : t -> t -> t + (** [add_of v1 v2] returns the [1] value if the sum of [v1] and [v2] + overflows, and [0] otherwise. *) + val add_of : t -> t -> t + (** [sub_and_uf v1 v2] returns the substraction of [v1] and [v2], and whether + this substraction underflows. *) + val sub_and_uf : t -> t -> (t * t) + val sub : t -> t -> t + (** [sub_uf v1 v2] returns the [1] value if the substraction of [v1] and [v2] + underflows, and [0] otherwise. *) + val sub_uf : t -> t -> t + val mul : t -> t -> t + val div : t -> t -> t + val divu : t -> t -> t + val modulo : t -> t -> t + val modulou : t -> t -> t + val and_op : t -> t -> t + val or_op : t -> t -> t + val xor : t -> t -> t + val shl : t -> t -> t + val shr : t -> t -> t + val shru : t -> t -> t + + (** Signed comparisions *) + val cmp_eq : t -> t -> t + val cmp_ne : t -> t -> t + val cmp_lt : t -> t -> t + val cmp_ge : t -> t -> t + val cmp_le : t -> t -> t + val cmp_gt : t -> t -> t + + (** Unsigned comparisions *) + val cmp_eq_u : t -> t -> t + val cmp_ne_u : t -> t -> t + val cmp_lt_u : t -> t -> t + val cmp_ge_u : t -> t -> t + val cmp_le_u : t -> t -> t + val cmp_gt_u : t -> t -> t + + (** A chunk is a part of a value that has the size of a memory cell. *) + + type chunk + val string_of_chunk : chunk -> string + val undef_byte : chunk + val is_undef_byte : chunk -> bool + + (** [break v] cuts [v] in chunks that each fits into a memory cell. In the + resulting list, the first element is the low bits, and the last is the + high bits (little endian representation). *) + val break : t -> chunk list + (** [merge l] creates the value where the first element of [l] is its low + bits, etc, and the last element of [l] is its high bits (little endian + representation). *) + val merge : chunk list -> t + + (** Addresses from interpreters point of view. *) + + (** Some architectures have pointers bigger than integers. In this case, only + a chunk of pointer can fit into a machine register. Thus, an address is + represented by several values (little endian representation). *) + + type address = t list + val string_of_address : address -> string + val null : address + + (** Addresses from the memory point of view. *) + + (** Addresses are represented by a block, i.e. a base address, and an offset + from this block. Both blocks and offsets are represented using bounded + integers. *) + module Block : IntValue.S + module Offset : IntValue.S + + type mem_address + val string_of_mem_address : mem_address -> string + + val is_mem_address : address -> bool + + val of_mem_address : mem_address -> address + val to_mem_address : address -> mem_address + val make_mem_address : Block.t -> Offset.t -> mem_address + val decompose_mem_address : mem_address -> Block.t * Offset.t + val block_of_address : address -> Block.t + val offset_of_address : address -> Offset.t + + val change_address_offset : address -> Offset.t -> address + val add_address : address -> Offset.t -> address + val eq_address : address -> address -> bool + +end + + +(** The functor to create bounded values from a size and a signedness. *) + +module Make (D : DATA_SIZE) : S diff --git a/src/dev_test.ml b/src/dev_test.ml new file mode 100644 index 0000000..f0cd68d --- /dev/null +++ b/src/dev_test.ml @@ -0,0 +1,66 @@ + +(** A playground function for developers where they can test very specific + functionalities not available in the compiler. + It is called with the -dev option. + [filenames] are the file names given in the command line when calling + acc. *) + +let do_dev_test (filenames : string list) : unit = + + let main_lbl = "main" in + let exit_lbl = "exit" in + let lbl = "label" in + + let code = + [(* Prelude *) + `Call main_lbl ; (* call main *) + `Label exit_lbl ; (* when coming back from main, do an infinite + jump here *) + `Jmp exit_lbl ; + (* Main *) + `Label main_lbl ; + `Mov (`DPTR, lbl) ; (* fetch the address of lbl in DPTR *) + (* Push the address of lbl on the stack. *) + `PUSH (I8051.reg_addr I8051.dpl) ; (* low bytes first *) + `PUSH (I8051.reg_addr I8051.dph) ; (* then high bytes *) + `RET ; (* this should jump to lbl, i.e. right below *) + `Label lbl ; + `RET (* jump to the exit label *)] in + + (* Create a labelled ASM program with the code. *) + let prog = + { ASM.ppreamble = [] ; + ASM.pexit_label = exit_lbl ; + ASM.pcode = code ; + ASM.phas_main = true } in + + (* Assemble it. *) + let prog = Languages.AstASM (ASMInterpret.assembly prog) in + + (* Save the result in a fresh file prefixed by "yop" and whose extension is + "hex". *) + Languages.save false false "yop" "" prog + +(* + let f filename = + Printf.printf "Processing %s...\n%!" filename ; + let target = Languages.RTL in + let print = false in + let debug = true in + let interpret = true in + let p = Languages.parse Languages.Clight filename in + let p = Languages.add_runtime p in + let p = Languages.labelize p in + let ps = Languages.compile false Languages.Clight target p in + let f f' p = match Languages.language_of_ast p with + | l when l = target -> f' p + | _ -> () + in + let actions = + [(print, Languages.save false false filename "") ; + (interpret, (fun p -> ignore (Languages.interpret debug p)))] in + List.iter (fun (b, f') -> if b then List.iter (f f') ps else ()) actions + in + + List.iter f filenames +*) diff --git a/src/driver.ml b/src/driver.ml new file mode 100644 index 0000000..759eafd --- /dev/null +++ b/src/driver.ml @@ -0,0 +1,25 @@ + +(** This module defines the target architecture and instanciates the memory + functor for each intermediate language. *) + +module DataSize32 = +struct + let alignment = Some 4 + let int_size = 4 + let ptr_size = 4 +end + +(* The target architecture: the Intel 8051. *) + +module TargetArch = I8051 + +module Memory32 = Memory.Make (DataSize32) +module MemoryTarget = Memory.Make (TargetArch) + +module ClightMemory = Memory32 +module CminorMemory = Memory32 +module RTLabsMemory = Memory32 +module RTLMemory = MemoryTarget +module ERTLMemory = MemoryTarget +module LTLMemory = MemoryTarget +module LINMemory = MemoryTarget diff --git a/src/driver.mli b/src/driver.mli new file mode 100644 index 0000000..7b268a9 --- /dev/null +++ b/src/driver.mli @@ -0,0 +1,13 @@ + +(** This module defines the target architecture and instanciates the memory + functor for each intermediate language. *) + +module TargetArch : Arch.S + +module ClightMemory : Memory.S +module CminorMemory : Memory.S +module RTLabsMemory : Memory.S +module RTLMemory : Memory.S +module ERTLMemory : Memory.S +module LTLMemory : Memory.S +module LINMemory : Memory.S diff --git a/src/languages.ml b/src/languages.ml new file mode 100644 index 0000000..5dbb30a --- /dev/null +++ b/src/languages.ml @@ -0,0 +1,375 @@ +type name = + | Clight + | Cminor + | RTLabs + | RTL + | ERTL + | LTL + | LIN + | ASM + +let strings = [ + "Clight", Clight; + "Cminor", Cminor; + "RTLabs", RTLabs; + "RTL" , RTL; + "ERTL" , ERTL; + "LTL" , LTL; + "LIN" , LIN; + "ASM" , ASM; +] + +let from_string s = + List.assoc s strings + +let to_string l = + List.assoc l (Misc.ListExt.inv_assoc strings) + +type ast = + | AstClight of Clight.program + | AstCminor of Cminor.program + | AstRTLabs of RTLabs.program + | AstRTL of RTL.program + | AstERTL of ERTL.program + | AstLTL of LTL.program + | AstLIN of LIN.program + | AstASM of ASM.program + +let language_of_ast = function + | AstClight _ -> Clight + | AstCminor _ -> Cminor + | AstRTLabs _ -> RTLabs + | AstRTL _ -> RTL + | AstERTL _ -> ERTL + | AstLTL _ -> LTL + | AstLIN _ -> LIN + | AstASM _ -> ASM + +let extension = function + | ASM -> ["s" ; "hex"] + | Clight -> ["c"] + | language -> [to_string language] + +type source = [ + `Filename of string + | `Source of string * string +] + +let parse ?is_lustre_file ?remove_lustre_externals = function + | Clight -> + fun source -> + AstClight + (ClightParser.process ?is_lustre_file ?remove_lustre_externals source) + +(* + | Cminor -> + fun filename -> + AstCminor + (SyntacticAnalysis.process + ~lexer_init: (fun filename -> Lexing.from_channel (open_in filename)) + ~lexer_fun: CminorLexer.token + ~parser_fun: CminorParser.program + ~input: filename) +*) + + | _ -> + (* FIXME: Will be completed in the next commits. *) + assert false + +let print = function + | AstClight a -> ClightPrinter.print_program a + | AstCminor a -> CminorPrinter.print_program a + | AstRTLabs a -> RTLabsPrinter.print_program a + | AstRTL a -> RTLPrinter.print_program a + | AstERTL a -> ERTLPrinter.print_program a + | AstLTL a -> LTLPrinter.print_program a + | AstLIN a -> LINPrinter.print_program a + | AstASM a -> ASMPrinter.print_program a + +let labelize = function + | AstClight p -> + AstClight (ClightLabelling.add_cost_labels p) + +(* + | AstCminor p -> + AstCminor (CminorLabelling.add_cost_labels p) +*) + + | x -> + (* For the other languages, no labelling is defined. *) + x + + +let clight_to_cminor = function + | AstClight p -> + AstCminor (ClightToCminor.translate p) + | _ -> assert false + +let cminor_to_rtlabs = function + | AstCminor p -> + AstRTLabs (CminorToRTLabs.translate p) + | _ -> assert false + +let rtlabs_to_rtl = function + | AstRTLabs p -> + AstRTL (RTLabsToRTL.translate p) + | _ -> assert false + +let rtl_to_ertl = function + | AstRTL p -> + AstERTL (RTLToERTL.translate p) + | _ -> assert false + +let ertl_to_ltl = function + | AstERTL p -> + AstLTL (ERTLToLTL.translate p) + | _ -> assert false + +let ltl_to_lin = function + | AstLTL p -> + AstLIN (LTLToLIN.translate p) + | _ -> assert false + +let lin_to_asm = function + | AstLIN p -> + AstASM (LINToASM.translate p) + | _ -> assert false + +(* We explicitly denote the compilation chain as a list of + passes that must be composed to translate a program + from a source language to a target language. *) +let compilation_chain = [ + (* Source language | Target language | Compilation function *) + Clight, Cminor, clight_to_cminor; + Cminor, RTLabs, cminor_to_rtlabs; + RTLabs, RTL, rtlabs_to_rtl; + RTL, ERTL, rtl_to_ertl; + ERTL, LTL, ertl_to_ltl; + LTL, LIN, ltl_to_lin; + LIN, ASM, lin_to_asm; +] + +let compile debug src tgt = + (* Find the maximal suffix of the chain that starts with the + language [src]. *) + let rec subchain = function + | [] -> + (* The chain is assumed to be well-formed: such a suffix + exists. *) + assert false + | ((l, _, _) :: _) as chain when l = src -> chain + | _ :: chain -> subchain chain + in + (* Compose the atomic translations to build a compilation function + from [src] to [tgt]. Again, we assume that the compilation chain + is well-formed. Thus, if we cannot find [tgt] in the compilation + chain then the user must have made a mistake to ask for a + translation from [src] to [tgt]. *) + let rec compose iprogs src tgt chains ast = + if src = tgt then List.rev (ast :: iprogs) + else + match chains with + | [] -> + Error.global_error "During compilation configuration" + (Printf.sprintf "It is not possible to compile from `%s' to `%s'." + (to_string src) + (to_string tgt)) + + | (l1, l2, src_to_l2) :: chain -> + assert (l1 = src); + let l2_to_tgt = compose iprogs l2 tgt chain in + let iprog = + Misc.Timed.profile + (Printf.sprintf "%s -> %s" + (to_string l1) + (to_string l2)) + src_to_l2 ast + in + ast :: l2_to_tgt iprog + in + compose [] src tgt (subchain compilation_chain) + + +(** [add_runtime ast] adds runtime functions for the operations not supported by + the target processor. *) +let add_runtime = function + | AstClight p -> + AstClight (Runtime.replace_unsupported (ClightSwitch.simplify p)) + | x -> + (* For the other languages, no runtime functios are defined. *) + x + + +let compute_costs = function + | AstClight p -> + (* Computing costs on Clight programs cannot be done directly + because the control-flow is not explicit. Yet, for + incremental construction and test of the compiler, we + build a stupid mapping from labels to costs for a Clight + program that gives cost 1 to every label. *) + CostLabel.constant_map (ClightAnnotator.cost_labels p) 1 + + | AstCminor p -> + (* Computing costs on Cminor programs cannot be done directly + because the control-flow is not explicit. Yet, for + incremental construction and test of the compiler, we + build a stupid mapping from labels to costs for a Cminor + program that gives cost 1 to every label. *) + CostLabel.constant_map (CminorAnnotator.cost_labels p) 1 + + | AstASM p -> + ASMCosts.compute p + + | ast -> + Error.warning "during cost computing" + (Printf.sprintf + "Cost computing is not implemented for language `%s'. Please compile to ASM if you want to annotate the input." + (to_string (language_of_ast ast))) ; + CostLabel.Map.empty + + +(* FIXME *) +let instrument costs_mapping = function + | AstClight p -> + let (p', cost_id, cost_incr, extern_cost_variables) = + ClightAnnotator.instrument p costs_mapping in + (AstClight p', cost_id, cost_incr, extern_cost_variables) +(* + | AstCminor p -> + let (p', cost_id, cost_incr) = CminorAnnotator.instrument p costs_mapping in + (AstCminor p', cost_id, cost_incr) +*) + | p -> + Error.warning "during instrumentation" + (Printf.sprintf + "Instrumentation is not implemented for source language `%s'." + (to_string (language_of_ast p))); + (p, "", "", StringTools.Map.empty) + +let annotate input_ast final = + let costs_mapping = Misc.Timed.profile "Compute costs" compute_costs final in + Misc.Timed.profile "Instrument" (instrument costs_mapping) input_ast + +let string_output asm_pretty = function + | AstClight p -> + [ClightPrinter.print_program p] + | AstCminor p -> + [CminorPrinter.print_program p] + | AstRTLabs p -> + [RTLabsPrinter.print_program p] + | AstRTL p -> + [RTLPrinter.print_program p] + | AstERTL p -> + [ERTLPrinter.print_program p] + | AstLTL p -> + [LTLPrinter.print_program p] + | AstLIN p -> + [LINPrinter.print_program p] + | AstASM p -> + (if asm_pretty then [Pretty.print_program p] + else ["Pretty print not requested"]) @ + [ASMPrinter.print_program p] + +let save asm_pretty exact_output filename suffix ast = + let ext_chopped_filename = + if exact_output then filename + else + try Filename.chop_extension filename + with Invalid_argument ("Filename.chop_extension") -> filename in + let ext_chopped_filename = ext_chopped_filename ^ suffix in + let ext_filenames = + List.map (fun ext -> ext_chopped_filename ^ "." ^ ext) + (extension (language_of_ast ast)) in + let output_filenames = + if exact_output then ext_filenames + else List.map Misc.SysExt.alternative ext_filenames in + let output_strings = string_output asm_pretty ast in + let f filename s = + let cout = open_out filename in + output_string cout s; + flush cout; + close_out cout in + List.iter2 f output_filenames output_strings + +let save_cost exact_name filename cost_id cost_incr extern_cost_variables = + let filename = + if exact_name then filename + else + try Filename.chop_extension filename + with Invalid_argument ("Filename.chop_extension") -> filename in + let cout = open_out (filename ^ ".cerco") in + let f fun_name cost_var = + output_string cout (fun_name ^ " " ^ cost_var ^ "\n") in + output_string cout (cost_id ^ "\n"); + output_string cout (cost_incr ^ "\n"); + StringTools.Map.iter f extern_cost_variables; + flush cout; + close_out cout + +let save_stack exact_name filename stack_id + stack_max_id stack_incr extern_stack_variables = + let filename = + if exact_name then filename + else + try Filename.chop_extension filename + with Invalid_argument ("Filename.chop_extension") -> filename in + let cout = open_out (filename ^ ".stack_cerco") in + let f fun_name stack_var = + output_string cout (fun_name ^ " " ^ stack_var ^ "\n") in + output_string cout (stack_id ^ "\n"); + output_string cout (stack_max_id ^ "\n"); + output_string cout (stack_incr ^ "\n"); + StringTools.Map.iter f extern_stack_variables; + flush cout; + close_out cout + + +let interpret debug = function + | AstClight p -> + ClightInterpret.interpret debug p + | AstCminor p -> + CminorInterpret.interpret debug p + | AstRTLabs p -> + RTLabsInterpret.interpret debug p + | AstRTL p -> + RTLInterpret.interpret debug p + | AstERTL p -> + ERTLInterpret.interpret debug p + | AstLTL p -> + LTLInterpret.interpret debug p + | AstLIN p -> + LINInterpret.interpret debug p + | AstASM p -> + ASMInterpret.interpret debug p + +let add_lustre_main + lustre_test lustre_test_cases lustre_test_cycles + lustre_test_min_int lustre_test_max_int = function + | AstClight p -> + AstClight + (ClightLustreMain.add lustre_test lustre_test_cases lustre_test_cycles + lustre_test_min_int lustre_test_max_int p) + | _ -> + Error.global_error "during main generation" + "Lustre testing is only available with C programs." + + + + +(* FIXME *) +let annotate_stack_size cost_incr = function + | AstClight p -> + let (p', stack_id, stack_max_id, stack_incr, extern_stack_variables) = + AnnotStackSize.instrument cost_incr p in + (AstClight p', stack_id, stack_max_id, stack_incr, extern_stack_variables) +(* + | AstCminor p -> + let (p', stack_id, stack_incr) = CminorAnnotator.instrument p costs_mapping in + (AstCminor p', stack_id, stack_incr) +*) + | p -> + Error.warning "during instrumentation" + (Printf.sprintf + "Instrumentation is not implemented for source language `%s'." + (to_string (language_of_ast p))); + (p, "", "", "", StringTools.Map.empty) diff --git a/src/languages.mli b/src/languages.mli new file mode 100644 index 0000000..c1b047b --- /dev/null +++ b/src/languages.mli @@ -0,0 +1,126 @@ +(** This module defines the intermediate languages. + + This is a dispatching module that is aware of the whole + compilation chain. It can also be used as an homogeneous way to + deal with the intermediate languages functionalities. +*) + + +type name = + | Clight + | Cminor + | RTLabs + | RTL + | ERTL + | LTL + | LIN + | ASM + +(** {2 Abstract syntax trees} *) + +(** The types of abstract syntax trees of each language. *) +type ast = + | AstClight of Clight.program + | AstCminor of Cminor.program + | AstRTLabs of RTLabs.program + | AstRTL of RTL.program + | AstERTL of ERTL.program + | AstLTL of LTL.program + | AstLIN of LIN.program + | AstASM of ASM.program + +(** [language_of_ast ast] returns the programming language of the + abstract syntax tree [ast]. *) +val language_of_ast : ast -> name + +(** A source code can be loaded from a file or given in a string. *) +type source = [ + `Filename of string + | `Source of string * string +] + +(** [parse ?is_lustre_file ?remove_lustre_externals name] returns the parsing + function of the language [name]. *) +val parse : ?is_lustre_file:bool -> ?remove_lustre_externals:bool -> + name -> source -> ast + +(** [print a] pretty prints an AST. *) +val print : ast -> string + +(** {2 Compilation} *) + +(** [compile debug l1 l2] returns the compilation function that + translates the language [l1] to the language [l2]. This may be the + composition of several compilation functions. If [debug] is + [true], all the intermediate programs are inserted in the + output. *) +val compile : bool -> name -> name -> (ast -> ast list) + +(** [add_runtime ast] adds runtime functions for the operations not supported by + the target processor. *) +val add_runtime : ast -> ast + +(** {2 Annotation} + + Labelling consists in the insertion of so-called "cost labels" + which are useful control points in order to compute costs. + + The annotation process first computes cost of constant-time + execution path starting from each cost label on the lowest-level + language. Then, it instruments the (high-level) source code with + these computed costs. +*) + +(** [labelize ast] inserts cost labels in the program [ast]. *) +val labelize : ast -> ast + +(** [annotate input_ast target_ast] inserts cost annotations into the input AST + from the (final) target AST. It also returns the name of the cost variable, + the name of the cost increment function, and a the name of a fresh + uninitialized global variable for each external function. *) +val annotate : ast -> ast -> (ast * string * string * string StringTools.Map.t) + +val annotate_stack_size : + string -> ast -> (ast * string * string * string * string StringTools.Map.t) + +(** [interpret debug ast] runs the program [ast] from the default initial + configuration. This interpretation may emit some cost labels. *) +val interpret : bool -> ast -> AST.trace + +(** {2 Serialization} *) + +(** [save asm_pretty exact_output filename suffix input_ast] prints [input_ast] + in a file whose name is prefixed by [filename], suffixed by [suffix] and + whose extension is deduced from the language of the AST. If [exact_output] + is false then the written file will be fresh. If [asm_pretty] is true, then + an additional pretty-printed assembly file is output. *) +val save : bool -> bool -> string -> string -> ast -> unit + +(** [save_cost exact_name filename cost_id cost_incr extern_cost_variables] + prints the name [cost_id] of the cost variable, then the name [cost_incr] of + the cost increment function, and the entries of the mapping + [extern_cost_variables] (key first, then binding, seperated by a space) in a + separate line in the file prefixed by [filename] and extended with + ".cost". If the file already exists, it is overwritten. *) +val save_cost : bool -> string -> string -> string -> + string StringTools.Map.t -> unit + +val save_stack : bool -> string -> string -> string -> string -> + string StringTools.Map.t -> unit + + +(** [from_string s] parses [s] as an intermediate language name. *) +val from_string : string -> name + +(** [to_string n] prints [n] as a string. *) +val to_string : name -> string + +(** [add_lustre_main lustre_test lustre_test_cases lustre_test_cycles + lustre_test_min_int lustre_test_max_int ast] adds a main function that tests + a Lustre step function to a Clight AST. The file [lustre_test] contains + CerCo information (e.g. the name of the cost variable). The integer + [lustre_test_cases] is the number of test cases that are performed, and the + integer [lustre_test_cycles] is the number of cycles per test + case. [lustre_test_min_int] (resp. [lustre_test_max_int]) is the minimum + (resp. maximum) integer value randomly generated during testing, and. *) +val add_lustre_main : string -> int -> int -> int -> int -> ast -> ast diff --git a/src/options.ml b/src/options.ml new file mode 100644 index 0000000..0517883 --- /dev/null +++ b/src/options.ml @@ -0,0 +1,164 @@ +open Misc.ArgExt + +let web_mode = ref false +let is_web_mode () = !web_mode +let set_web_mode () = web_mode := true + +let default_choice = "default" +let option_settings_step = "during option settings" + +let language_from_string kind default s = + try + Languages.from_string s + with Not_found -> + if s = default_choice then + default + else + Error.global_error option_settings_step + (Printf.sprintf "`%s' is not a valid %s language." s kind) + +let source_language_of_string = language_from_string "source" Languages.Clight +let source_language = ref (source_language_of_string default_choice) +let set_source_language s = source_language := source_language_of_string s +let get_source_language () = !source_language + +let target_language_of_string = language_from_string "target" Languages.ASM +let target_language = ref (target_language_of_string default_choice) +let set_target_language s = target_language := target_language_of_string s +let get_target_language () = !target_language + +let input_files = ref [] +let add_input_file f = input_files := f :: !input_files +let input_files () = !input_files + +let output_files = ref None +let set_output_files s = output_files := Some s +let get_output_files () = !output_files + +let annotation_flag = ref false +let request_annotation = (:=) annotation_flag +let annotation_requested () = !annotation_flag + +let interpretation_flag = ref false +let request_interpretation = (:=) interpretation_flag +let interpretation_requested () = !interpretation_flag + +let interpretations_flag = ref false +let request_interpretations = (:=) interpretations_flag +let interpretations_requested () = !interpretations_flag + +let debug_flag = ref false +let set_debug = (:=) debug_flag +let is_debug_enabled () = !debug_flag + +let asm_pretty_flag = ref false +let set_asm_pretty = (:=) asm_pretty_flag +let is_asm_pretty () = !asm_pretty_flag + +let lustre_flag = ref false +let set_lustre_file = (:=) lustre_flag +let is_lustre_file () = !lustre_flag + +let remove_lustre_externals = ref false +let set_remove_lustre_externals = (:=) remove_lustre_externals +let is_remove_lustre_externals () = !remove_lustre_externals + +let lustre_test = ref None +let set_lustre_test s = lustre_test := Some s +let get_lustre_test () = !lustre_test + +let lustre_test_cases = ref 100 +let set_lustre_test_cases = (:=) lustre_test_cases +let get_lustre_test_cases () = !lustre_test_cases + +let lustre_test_cycles = ref 100 +let set_lustre_test_cycles = (:=) lustre_test_cycles +let get_lustre_test_cycles () = !lustre_test_cycles + +let lustre_test_min_int = ref (-1000) +let set_lustre_test_min_int = (:=) lustre_test_min_int +let get_lustre_test_min_int () = !lustre_test_min_int + +let lustre_test_max_int = ref 1000 +let set_lustre_test_max_int = (:=) lustre_test_max_int +let get_lustre_test_max_int () = !lustre_test_max_int + +(* +let print_result_flag = ref false +let set_print_result = (:=) print_result_flag +let is_print_result_enabled () = !print_result_flag +*) + +let dev_test = ref false +let set_dev_test = (:=) dev_test +let is_dev_test_enabled () = !dev_test + +let options = OptionsParsing.register [ +(* + "-s", Arg.String set_source_language, + " Choose the source language between:"; + extra_doc " Clight, Cminor"; + extra_doc " [default is C]"; +*) + + "-l", Arg.String set_target_language, + " Choose the target language between:"; + extra_doc " Clight, Cminor, RTLabs, RTL, ERTL, LTL, LIN, ASM"; + extra_doc " [default is ASM]"; + + "-a", Arg.Set annotation_flag, + " Add cost annotations on the source code."; + + "-i", Arg.Set interpretation_flag, + " Interpret the compiled code."; + + "-is", Arg.Set interpretations_flag, + " Interpret all the compilation passes."; + + "-d", Arg.Set debug_flag, + " Debug mode."; + extra_doc " Outputs all the passes up to the target language."; + extra_doc " Combined with an interpret option, shows the trace"; + extra_doc " of execution states."; + + "-o", Arg.String set_output_files, + " Prefix of the output files."; + + "-asm-pretty", Arg.Set asm_pretty_flag, + " Output a pretty-printed assembly file."; + + "-lustre", Arg.Set lustre_flag, + " Input file is a Lustre file."; + + "-remove-lustre-externals", Arg.Set remove_lustre_externals, + " Remove Lustre externals."; + + "-lustre-test", Arg.String set_lustre_test, + " Input file is a Lustre file, testing requested."; + + "-lustre-test-cases", Arg.Int set_lustre_test_cases, + " Set the number of test cases when testing a Lustre"; + extra_doc " file."; + extra_doc " [default is 100]"; + + "-lustre-test-cycles", Arg.Int set_lustre_test_cycles, + " Set the number of cycles for each case when testing"; + extra_doc " a Lustre file."; + extra_doc " [default is 100]"; + + "-lustre-test-min-int", Arg.Int set_lustre_test_min_int, + " Random int minimum value when testing a Lustre file."; + extra_doc " [default is -1000]"; + + "-lustre-test-max-int", Arg.Int set_lustre_test_max_int, + " Random int maximum value when testing a Lustre file."; + extra_doc " [default is 1000]"; + +(* + "-res", Arg.Set print_result_flag, + " Print the result of interpretations."; +*) + + "-dev", Arg.Set dev_test, + " Playground for developers."; +] diff --git a/src/options.mli b/src/options.mli new file mode 100644 index 0000000..c5a7b39 --- /dev/null +++ b/src/options.mli @@ -0,0 +1,76 @@ +(** This module defines the compiler general options. *) + +(** {2 Source language} *) +val set_source_language : string -> unit +val get_source_language : unit -> Languages.name + +(** {2 Target language} *) +val set_target_language : string -> unit +val get_target_language : unit -> Languages.name + +(** {2 Interpretation request} *) +val request_interpretation : bool -> unit +val interpretation_requested : unit -> bool + +(** {2 Interpretation requests} *) +val request_interpretations : bool -> unit +val interpretations_requested : unit -> bool + +(** {2 Annotation requests} *) +val request_annotation : bool -> unit +val annotation_requested : unit -> bool + +(** {2 Input files} *) +val add_input_file : string -> unit +val input_files : unit -> string list + +(** {2 Output files} *) +val set_output_files : string -> unit +val get_output_files : unit -> string option + +(** {2 Verbose mode} *) +val is_debug_enabled : unit -> bool + +(** {2 Assembly pretty print} *) +val set_asm_pretty : bool -> unit +val is_asm_pretty : unit -> bool + +(** {2 Lustre file} *) +val set_lustre_file : bool -> unit +val is_lustre_file : unit -> bool + +(** {2 Remove Lustre externals} *) +val set_remove_lustre_externals : bool -> unit +val is_remove_lustre_externals : unit -> bool + +(** {2 Lustre file and test requested} *) +val set_lustre_test : string -> unit +val get_lustre_test : unit -> string option + +(** {2 Lustre file: number of test cases} *) +val set_lustre_test_cases : int -> unit +val get_lustre_test_cases : unit -> int + +(** {2 Lustre file: number of cycles for each case} *) +val set_lustre_test_cycles : int -> unit +val get_lustre_test_cycles : unit -> int + +(** {2 Lustre file: random int minimum value} *) +val set_lustre_test_min_int : int -> unit +val get_lustre_test_min_int : unit -> int + +(** {2 Lustre file: random int maximum value} *) +val set_lustre_test_max_int : int -> unit +val get_lustre_test_max_int : unit -> int + +(* +(** {2 Print results requests} *) +val is_print_result_enabled : unit -> bool +*) + +(** {2 Developers' playground} *) +val is_dev_test_enabled : unit -> bool + +(** {2 Web application} *) +val set_web_mode : unit -> unit +val is_web_mode : unit -> bool diff --git a/src/utilities/Fix.ml b/src/utilities/Fix.ml new file mode 100644 index 0000000..29854b6 --- /dev/null +++ b/src/utilities/Fix.ml @@ -0,0 +1,529 @@ +(**************************************************************************) +(* *) +(* Fix *) +(* *) +(* Author: François Pottier, INRIA Paris-Rocquencourt *) +(* Version: 20091201 *) +(* *) +(* The copyright to this code is held by Institut National de Recherche *) +(* en Informatique et en Automatique (INRIA). All rights reserved. This *) +(* file is distributed under the license CeCILL-C (see file LICENSE). *) +(* *) +(**************************************************************************) + +(* -------------------------------------------------------------------------- *) + +(* Maps. *) + +(* We require imperative maps, that is, maps that can be updated in place. + An implementation of persistent maps, such as the one offered by ocaml's + standard library, can easily be turned into an implementation of imperative + maps, so this is a weak requirement. *) + +module type IMPERATIVE_MAPS = sig + type key + type 'data t + val create: unit -> 'data t + val clear: 'data t -> unit + val add: key -> 'data -> 'data t -> unit + val find: key -> 'data t -> 'data + val iter: (key -> 'data -> unit) -> 'data t -> unit +end + +(* -------------------------------------------------------------------------- *) + +(* Properties. *) + +(* Properties must form a partial order, equipped with a least element, and + must satisfy the ascending chain condition: every monotone sequence + eventually stabilizes. *) + +(* [is_maximal] determines whether a property [p] is maximal with respect to + the partial order. Only a conservative check is required: in any event, it + is permitted for [is_maximal p] to return [false]. If [is_maximal p] + returns [true], then [p] must have no upper bound other than itself. In + particular, if properties form a lattice, then [p] must be the top + element. This feature, not described in the paper, enables a couple of + minor optimizations. *) + +module type PROPERTY = sig + type property + val bottom: property + val equal: property -> property -> bool + val is_maximal: property -> bool +end + +(* -------------------------------------------------------------------------- *) + +(* The dynamic dependency graph. *) + +(* An edge from [node1] to [node2] means that [node1] depends on [node2], or + (equivalently) that [node1] observes [node2]. Then, an update of the + current property at [node2] causes a signal to be sent to [node1]. A node + can observe itself. *) + +(* This module could be placed in a separate file, but is included here in + order to make [Fix] self-contained. *) + +module Graph : sig + + (* This module provides a data structure for maintaining and modifying + a directed graph. Each node is allowed to carry a piece of client + data. There are functions for creating a new node, looking up a + node's data, looking up a node's predecessors, and setting or + clearing a node's successors (all at once). *) + type 'data node + + (* [create data] creates a new node, with no incident edges, with + client information [data]. Time complexity: constant. *) + val create: 'data -> 'data node + + (* [data node] returns the client information associated with + the node [node]. Time complexity: constant. *) + val data: 'data node -> 'data + + (* [predecessors node] returns a list of [node]'s predecessors. + Amortized time complexity: linear in the length of the output + list. *) + val predecessors: 'data node -> 'data node list + + (* [set_successors src dsts] creates an edge from the node [src] to + each of the nodes in the list [dsts]. Duplicate elements in the + list [dsts] are removed, so that no duplicate edges are created. It + is assumed that [src] initially has no successors. Time complexity: + linear in the length of the input list. *) + val set_successors: 'data node -> 'data node list -> unit + + (* [clear_successors node] removes all of [node]'s outgoing edges. + Time complexity: linear in the number of edges that are removed. *) + val clear_successors: 'data node -> unit + + (* That's it. *) +end += struct + + (* Using doubly-linked adjacency lists, one could implement [predecessors] + in worst-case linear time with respect to the length of the output list, + [set_successors] in worst-case linear time with respect to the length of + the input list, and [clear_successors] in worst-case linear time with + respect to the number of edges that are removed. We use a simpler + implementation, based on singly-linked adjacency lists, with deferred + removal of edges. It achieves the same complexity bounds, except + [predecessors] only offers an amortized complexity bound. This is good + enough for our purposes, and, in practice, is more efficient by a + constant factor. This simplification was suggested by Arthur + Charguéraud. *) + + type 'data node = { + + (* The client information associated with this node. *) + + data: 'data; + + (* This node's incoming and outgoing edges. *) + + mutable outgoing: 'data edge list; + mutable incoming: 'data edge list; + + (* A transient mark, always set to [false], except when checking + against duplicate elements in a successor list. *) + + mutable marked: bool; + + } + + and 'data edge = { + + (* This edge's nodes. Edges are symmetric: source and destination + are not distinguished. Thus, an edge appears both in the outgoing + edge list of its source node and in the incoming edge list of its + destination node. This allows edges to be easily marked as + destroyed. *) + + node1: 'data node; + node2: 'data node; + + (* Edges that are destroyed are marked as such, but are not + immediately removed from the adjacency lists. *) + + mutable destroyed: bool; + + } + + let create (data : 'data) : 'data node = { + data = data; + outgoing = []; + incoming = []; + marked = false; + } + + let data (node : 'data node) : 'data = + node.data + + (* [follow src edge] returns the node that is connected to [src] + by [edge]. Time complexity: constant. *) + + let follow src edge = + if edge.node1 == src then + edge.node2 + else begin + assert (edge.node2 == src); + edge.node1 + end + + (* The [predecessors] function removes edges that have been marked + destroyed. The cost of removing these has already been paid for, + so the amortized time complexity of [predecessors] is linear in + the length of the output list. *) + + let predecessors (node : 'data node) : 'data node list = + let predecessors = List.filter (fun edge -> not edge.destroyed) node.incoming in + node.incoming <- predecessors; + List.map (follow node) predecessors + + (* [link src dst] creates a new edge from [src] to [dst], together + with its reverse edge. Time complexity: constant. *) + + let link (src : 'data node) (dst : 'data node) : unit = + let edge = { + node1 = src; + node2 = dst; + destroyed = false; + } in + src.outgoing <- edge :: src.outgoing; + dst.incoming <- edge :: dst.incoming + + let set_successors (src : 'data node) (dsts : 'data node list) : unit = + assert (src.outgoing = []); + let rec loop = function + | [] -> + () + | dst :: dsts -> + if dst.marked then + loop dsts (* skip duplicate elements *) + else begin + dst.marked <- true; + link src dst; + loop dsts; + dst.marked <- false + end + in + loop dsts + + let clear_successors (node : 'data node) : unit = + List.iter (fun edge -> + assert (not edge.destroyed); + edge.destroyed <- true; + ) node.outgoing; + node.outgoing <- [] + +end + +(* -------------------------------------------------------------------------- *) + +(* The code is parametric in an implementation of maps over variables and in + an implementation of properties. *) + +module Make + (M : IMPERATIVE_MAPS) + (P : PROPERTY) += struct + +type variable = + M.key + +type property = + P.property + +type valuation = + variable -> property + +type rhs = + valuation -> property + +type equations = + variable -> rhs + +(* -------------------------------------------------------------------------- *) + +(* Data. *) + +(* Each node in the dependency graph carries information about a fixed + variable [v]. *) + +type node = + data Graph.node + +and data = { + + (* This is the result of the application of [rhs] to the variable [v]. It + must be stored in order to guarantee that this application is performed + at most once. *) + rhs: rhs; + + (* This is the current property at [v]. It evolves monotonically with + time. *) + mutable property: property; + + (* That's it! *) +} + +(* [property node] returns the current property at [node]. *) + +let property node = + (Graph.data node).property + +(* -------------------------------------------------------------------------- *) + +(* Many definitions must be made within the body of the function [lfp]. + For greater syntactic convenience, we place them in a local module. *) + +let lfp (eqs : equations) : valuation = + let module LFP = struct + +(* -------------------------------------------------------------------------- *) + +(* The workset. *) + +(* When the algorithm is inactive, the workset is empty. *) + +(* Our workset is based on a Queue, but it could just as well be based on a + Stack. A textual replacement is possible. It could also be based on a + priority queue, provided a sensible way of assigning priorities could + be found. *) + +module Workset : sig + + (* [insert node] inserts [node] into the workset. [node] must have no + successors. *) + val insert: node -> unit + + (* [repeat f] repeatedly applies [f] to a node extracted out of the + workset, until the workset becomes empty. [f] is allowed to use + [insert]. *) + val repeat: (node -> unit) -> unit + + (* That's it! *) +end += struct + + (* Initialize the workset. *) + + let workset = + Queue.create() + + let insert node = + Queue.push node workset + + let repeat f = + while not (Queue.is_empty workset) do + f (Queue.pop workset) + done + +end + +(* -------------------------------------------------------------------------- *) + +(* Signals. *) + +(* A node in the workset has no successors. (It can have predecessors.) In + other words, a predecessor (an observer) of some node is never in the + workset. Furthermore, a node never appears twice in the workset. *) + +(* When a variable broadcasts a signal, all of its predecessors (observers) + receive the signal. Any variable that receives the signal loses all of its + successors (that is, it ceases to observe anything) and is inserted into + the workset. This preserves the above invariant. *) + +let signal subject = + List.iter (fun observer -> + Graph.clear_successors observer; + Workset.insert observer + ) (Graph.predecessors subject) + (* At this point, [subject] has no predecessors. This plays no role in + the correctness proof, though. *) + +(* -------------------------------------------------------------------------- *) + +(* Tables. *) + +(* The permanent table maps variables that have reached a fixed point + to properties. It persists forever. *) + +let permanent : property M.t = + M.create() + +(* The transient table maps variables that have not yet reached a + fixed point to nodes. (A node contains not only a property, but + also a memoized right-hand side, and carries edges.) At the + beginning of a run, it is empty. It fills up during a run. At the + end of a run, it is copied into the permanent table and cleared. *) + +let transient : node M.t = + M.create() + +(* [freeze()] copies the transient table into the permanent table, and + empties the transient table. This allows all nodes to be reclaimed + by the garbage collector. *) + +let freeze () = + M.iter (fun v node -> + M.add v (property node) permanent + ) transient; + M.clear transient + +(* -------------------------------------------------------------------------- *) + +(* Workset processing. *) + + +(* [solve node] re-evaluates the right-hand side at [node]. If this leads to + a change, then the current property is updated, and [node] emits a signal + towards its observers. *) + +(* When [solve node] is invoked, [node] has no subjects. Indeed, when [solve] + is invoked by [node_for], [node] is newly created; when [solve] is invoked by + [Workset.repeat], [node] has just been extracted out of the workset, and a + node in the workset has no subjects. *) + +(* [node] must not be in the workset. *) + +(* In short, when [solve node] is invoked, [node] is neither awake nor asleep. + When [solve node] finishes, [node] is either awake or asleep again. (Chances + are, it is asleep, unless it is its own observer; then, it is awakened by the + final call to [signal node].) *) + +let rec solve (node : node) : unit = + + (* Retrieve the data record carried by this node. *) + let data = Graph.data node in + + (* Prepare to compute an updated value at this node. This is done by + invoking the client's right-hand side function. *) + + (* The flag [alive] is used to prevent the client from invoking [request] + after this interaction phase is over. In theory, this dynamic check seems + required in order to argue that [request] behaves like a pure function. + In practice, this check is not very useful: only a bizarre client would + store a [request] function and invoke it after it has become stale. *) + let alive = ref true + and subjects = ref [] in + + (* We supply the client with [request], a function that provides access to + the current valuation, and dynamically records dependencies. This yields + a set of dependencies that is correct by construction. *) + let request (v : variable) : property = + assert !alive; + try + M.find v permanent + with Not_found -> + let subject = node_for v in + let p = property subject in + if not (P.is_maximal p) then + subjects := subject :: !subjects; + p + in + + (* Give control to the client. *) + let new_property = data.rhs request in + + (* From now on, prevent any invocation of this instance of [request] + the client. *) + alive := false; + + (* At this point, [node] has no subjects, as noted above. Thus, the + precondition of [set_successors] is met. We can install [data.subjects] + as the new set of subjects for this node. *) + + (* If we have gathered no subjects in the list [data.subjects], then + this node must have stabilized. If [new_property] is maximal, + then this node must have stabilized. *) + + (* If this node has stabilized, then it need not observe any more, so the + call to [set_successors] is skipped. In practice, this seems to be a + minor optimization. In the particular case where every node stabilizes at + the very first call to [rhs], this means that no edges are ever + built. This particular case is unlikely, as it means that we are just + doing memoization, not a true fixed point computation. *) + + (* One could go further and note that, if this node has stabilized, then it + could immediately be taken out of the transient table and copied into the + permanent table. This would have the beneficial effect of allowing the + detection of further nodes that have stabilized. Furthermore, it would + enforce the property that no node in the transient table has a maximal + value, hence the call to [is_maximal] above would become useless. *) + + if not (!subjects = [] || P.is_maximal new_property) then + Graph.set_successors node !subjects; + + (* If the updated value differs from the previous value, record + the updated value and send a signal to all observers of [node]. *) + if not (P.equal data.property new_property) then begin + data.property <- new_property; + signal node + end + (* Note that equality of the two values does not imply that this node has + stabilized forever. *) + +(* -------------------------------------------------------------------------- *) + +(* [node_for v] returns the graph node associated with the variable [v]. It is + assumed that [v] does not appear in the permanent table. If [v] appears in + the transient table, the associated node is returned. Otherwise, [v] is a + newly discovered variable: a new node is created on the fly, and the + transient table is grown. The new node can either be inserted into the + workset (it is then awake) or handled immediately via a recursive call to + [solve] (it is then asleep, unless it observes itself). *) + +(* The recursive call to [solve node] can be replaced, if desired, by a call + to [Workset.insert node]. Using a recursive call to [solve] permits eager + top-down discovery of new nodes. This can save a constant factor, because + it allows new nodes to move directly from [bottom] to a good first + approximation, without sending any signals, since [node] has no observers + when [solve node] is invoked. In fact, if the dependency graph is acyclic, + the algorithm discovers nodes top-down, performs computation on the way + back up, and runs without ever inserting a node into the workset! + Unfortunately, this causes the stack to grow as deep as the longest path in + the dependency graph, which can blow up the stack. *) + +and node_for (v : variable) : node = + try + M.find v transient + with Not_found -> + let node = Graph.create { rhs = eqs v; property = P.bottom } in + (* Adding this node to the transient table prior to calling [solve] + recursively is mandatory, otherwise [solve] might loop, creating + an infinite number of nodes for the same variable. *) + M.add v node transient; + solve node; (* or: Workset.insert node *) + node + +(* -------------------------------------------------------------------------- *) + +(* Invocations of [get] trigger the fixed point computation. *) + +(* The flag [inactive] prevents reentrant calls by the client. *) + +let inactive = + ref true + +let get (v : variable) : property = + try + M.find v permanent + with Not_found -> + assert !inactive; + inactive := false; + let node = node_for v in + Workset.repeat solve; + freeze(); + inactive := true; + property node + +(* -------------------------------------------------------------------------- *) + +(* Close the local module [LFP]. *) + +end +in LFP.get + +end diff --git a/src/utilities/Fix.mli b/src/utilities/Fix.mli new file mode 100644 index 0000000..1d850b6 --- /dev/null +++ b/src/utilities/Fix.mli @@ -0,0 +1,102 @@ + +(** This module provides a generic algorithm to compute the least + solution of a system of monotonic equations. *) + +(**************************************************************************) +(* *) +(* Fix *) +(* *) +(* Author: François Pottier, INRIA Paris-Rocquencourt *) +(* Version: 20091201 *) +(* *) +(* The copyright to this code is held by Institut National de Recherche *) +(* en Informatique et en Automatique (INRIA). All rights reserved. This *) +(* file is distributed under the license CeCILL-C (see file LICENSE). *) +(* *) +(**************************************************************************) + +(* This code is described in the paper ``Lazy Least Fixed Points in ML''. *) + +(* -------------------------------------------------------------------------- *) + +(* Maps. *) + +(* We require imperative maps, that is, maps that can be updated in place. + An implementation of persistent maps, such as the one offered by ocaml's + standard library, can easily be turned into an implementation of imperative + maps, so this is a weak requirement. *) + +module type IMPERATIVE_MAPS = sig + type key + type 'data t + val create: unit -> 'data t + val clear: 'data t -> unit + val add: key -> 'data -> 'data t -> unit + val find: key -> 'data t -> 'data + val iter: (key -> 'data -> unit) -> 'data t -> unit +end + +(* -------------------------------------------------------------------------- *) + +(* Properties. *) + +(* Properties must form a partial order, equipped with a least element, and + must satisfy the ascending chain condition: every monotone sequence + eventually stabilizes. *) + +(* [is_maximal] determines whether a property [p] is maximal with respect to + the partial order. Only a conservative check is required: in any event, it + is permitted for [is_maximal p] to return [false]. If [is_maximal p] + returns [true], then [p] must have no upper bound other than itself. In + particular, if properties form a lattice, then [p] must be the top + element. This feature, not described in the paper, enables a couple of + minor optimizations. *) + +module type PROPERTY = sig + type property + val bottom: property + val equal: property -> property -> bool + val is_maximal: property -> bool +end + +(* -------------------------------------------------------------------------- *) + +(* The code is parametric in an implementation of maps over variables and in + an implementation of properties. *) + +module Make + (M : IMPERATIVE_MAPS) + (P : PROPERTY) + : sig + type variable = M.key + type property = P.property + + (* A valuation is a mapping of variables to properties. *) + type valuation = variable -> property + + (* A right-hand side, when supplied with a valuation that gives + meaning to its free variables, evaluates to a property. More + precisely, a right-hand side is a monotone function of + valuations to properties. *) + type rhs = valuation -> property + + (* A system of equations is a mapping of variables to right-hand + sides. *) + type equations = variable -> rhs + + (* [lfp eqs] produces the least solution of the system of monotone + equations [eqs]. *) + + (* It is guaranteed that, for each variable [v], the application [eqs v] is + performed at most once (whereas the right-hand side produced by this + application is, in general, evaluated multiple times). This guarantee can + be used to perform costly pre-computation, or memory allocation, when [eqs] + is applied to its first argument. *) + + (* When [lfp] is applied to a system of equations [eqs], it performs no + actual computation. It produces a valuation, [get], which represents + the least solution of the system of equations. The actual fixed point + computation takes place, on demand, when [get] is applied. *) + val lfp: equations -> valuation + end + diff --git a/src/utilities/bijection.ml b/src/utilities/bijection.ml new file mode 100644 index 0000000..acae94c --- /dev/null +++ b/src/utilities/bijection.ml @@ -0,0 +1,89 @@ + +module type OrderedType = sig + type t + val compare : t -> t -> int +end + + +module type S = sig + + type a + type b + type t + + val empty : t + val is_empty : t -> bool + + val add1 : a -> b -> t -> t + val add2 : b -> a -> t -> t + + val find1 : a -> t -> b + val find2 : b -> t -> a + + val remove1 : a -> t -> t + val remove2 : b -> t -> t + + val mem1 : a -> t -> bool + val mem2 : b -> t -> bool + + val iter1 : (a -> b -> unit) -> t -> unit + val iter2 : (b -> a -> unit) -> t -> unit + + val fold1 : (a -> b -> 'c -> 'c) -> t -> 'c -> 'c + val fold2 : (b -> a -> 'c -> 'c) -> t -> 'c -> 'c + + val compare1 : (b -> b -> int) -> t -> t -> int + val compare2 : (a -> a -> int) -> t -> t -> int + + val equal1 : (b -> b -> bool) -> t -> t -> bool + val equal2 : (a -> a -> bool) -> t -> t -> bool + +end + + +module Make (O1 : OrderedType) (O2 : OrderedType) : S + with type a = O1.t and type b = O2.t = struct + + module Map1 = Map.Make (O1) + module Map2 = Map.Make (O2) + + type a = O1.t + type b = O2.t + type t = O2.t Map1.t * O1.t Map2.t + + let eq1 a1 a2 = O1.compare a1 a2 = 0 + let eq2 b1 b2 = O2.compare b1 b2 = 0 + + let empty = (Map1.empty, Map2.empty) + let is_empty (a_b, _) = Map1.is_empty a_b + + let add1 a b (a_b, b_a) = (Map1.add a b a_b, Map2.add b a b_a) + let add2 b a (a_b, b_a) = (Map1.add a b a_b, Map2.add b a b_a) + + let find1 a (a_b, _) = Map1.find a a_b + let find2 b (_, b_a) = Map2.find b b_a + + let remove1 a (a_b, b_a) = + let f b' a' b_a' = if eq1 a' a then b_a' else Map2.add b' a' b_a' in + (Map1.remove a a_b, Map2.fold f b_a Map2.empty) + + let remove2 b (a_b, b_a) = + let f a' b' a_b' = if eq2 b' b then a_b' else Map1.add a' b' a_b' in + (Map1.fold f a_b Map1.empty, Map2.remove b b_a) + + let mem1 a (a_b, _) = Map1.mem a a_b + let mem2 b (_, b_a) = Map2.mem b b_a + + let iter1 f (a_b, _) = Map1.iter f a_b + let iter2 f (_, b_a) = Map2.iter f b_a + + let fold1 f (a_b, _) c = Map1.fold f a_b c + let fold2 f (_, b_a) c = Map2.fold f b_a c + + let compare1 f (a_b1, _) (a_b2, _) = Map1.compare f a_b1 a_b2 + let compare2 f (_, b_a1) (_, b_a2) = Map2.compare f b_a1 b_a2 + + let equal1 f (a_b1, _) (a_b2, _) = Map1.equal f a_b1 a_b2 + let equal2 f (_, b_a1) (_, b_a2) = Map2.equal f b_a1 b_a2 + +end diff --git a/src/utilities/bijection.mli b/src/utilities/bijection.mli new file mode 100644 index 0000000..401d0f2 --- /dev/null +++ b/src/utilities/bijection.mli @@ -0,0 +1,45 @@ +(** This module implements a bi-directional finite map. +*) + +module type OrderedType = sig + type t + val compare : t -> t -> int +end + +module type S = sig + + type a + type b + type t + + val empty : t + val is_empty : t -> bool + + val add1 : a -> b -> t -> t + val add2 : b -> a -> t -> t + + val find1 : a -> t -> b + val find2 : b -> t -> a + + val remove1 : a -> t -> t + val remove2 : b -> t -> t + + val mem1 : a -> t -> bool + val mem2 : b -> t -> bool + + val iter1 : (a -> b -> unit) -> t -> unit + val iter2 : (b -> a -> unit) -> t -> unit + + val fold1 : (a -> b -> 'c -> 'c) -> t -> 'c -> 'c + val fold2 : (b -> a -> 'c -> 'c) -> t -> 'c -> 'c + + val compare1 : (b -> b -> int) -> t -> t -> int + val compare2 : (a -> a -> int) -> t -> t -> int + + val equal1 : (b -> b -> bool) -> t -> t -> bool + val equal2 : (a -> a -> bool) -> t -> t -> bool + +end + +module Make (O1 : OrderedType) (O2 : OrderedType) : S with type a = O1.t and + type b = O2.t diff --git a/src/utilities/checkOClosure.ml b/src/utilities/checkOClosure.ml new file mode 100644 index 0000000..8c61c6c --- /dev/null +++ b/src/utilities/checkOClosure.ml @@ -0,0 +1 @@ +open Goog diff --git a/src/utilities/coloring.ml b/src/utilities/coloring.ml new file mode 100644 index 0000000..fe55e6c --- /dev/null +++ b/src/utilities/coloring.ml @@ -0,0 +1,360 @@ +(* Pasted from Pottier's PP compiler *) + +open ERTL +open Interference +open Printf + +(* ------------------------------------------------------------------------- *) +(* Decisions. *) + +(* A decision is of the form either [Spill] -- the vertex could + not be colored and should be spilled into a stack slot -- or + [Color] -- the vertex was assigned a hardware register. *) + +type decision = + | Spill + | Color of I8051.register + +(* [print_decision] turns a decision into a string. *) + +let print_decision = function + | Spill -> + "spilled" + | Color hwr -> + Printf.sprintf "colored $%s" (I8051.print_register hwr) + +(* ------------------------------------------------------------------------- *) +(* Colorings. *) + +(* A coloring is a partial function of graph vertices to decisions. + Vertices that are not in the domain of the coloring are waiting for + a decision to be made. *) + +type coloring = + decision Vertex.Map.t + +(* ------------------------------------------------------------------------- *) +(* Sets of colors. *) + +module ColorSet = + I8051.RegisterSet + +(* [add_color coloring r colors] returns the union of the set [colors] with + the element [color], if the vertex [r] was assigned color [color], and + returns [colors] if [r] was spilled. *) + +let add_color coloring r colors = + match Vertex.Map.find r coloring with + | Spill -> + colors + | Color color -> + ColorSet.add color colors + +(* These are the colors that we work with. *) + +let colors : ColorSet.t = + I8051.allocatable + +(* This is the number of available colors. *) + +let k : int = + ColorSet.cardinal colors + +(* ------------------------------------------------------------------------- *) +(* Choices of colors. *) + +(* [forbidden_colors graph coloring v] is the set of colors that cannot be + assigned to [v] considering [coloring], a coloring of every vertex in + [graph] except [v]. *) +(* This takes into account [v]'s possible interferences with hardware + registers, which are viewed as forbidden colors. *) + +let forbidden_colors graph coloring v = + Vertex.Set.fold (add_color coloring) (ipp graph v) (iph graph v) + +(* ------------------------------------------------------------------------- *) +(* Low and high vertices. *) + +(* A vertex is low (or insignificant) if its degree is less than [k]. + It is high (or significant) otherwise. *) + +let high graph v = + degree graph v >= k + +(* [high_neighbors graph v] is the set of all high neighbors of [v]. *) + +let high_neighbors graph v = + Vertex.Set.filter (high graph) (ipp graph v) + +(* ------------------------------------------------------------------------- *) +(* George's conservative coalescing criterion. *) + +(* According to this criterion, two vertices [a] and [b] can be + coalesced, suppressing [a] and keeping [b], if the following + two conditions hold: + + 1. (pseudo-registers) every high neighbor of [a] is a neighbor of [b]; + 2. (hardware registers) every hardware register that interferes with + [a] also interferes with [b]. + + This means that, after all low vertices have been removed, any color that + is suitable for [b] is also suitable for [a]. *) + +let georgepp graph (a, b) = + Vertex.Set.subset (high_neighbors graph a) (ipp graph b) && + I8051.RegisterSet.subset (iph graph a) (iph graph b) + +(* According to this criterion, a vertex [a] and a hardware register + [c] can be coalesced (that is, [a] can be assigned color [c]) if + every high neighbor of [a] interferes with [c]. *) + +let georgeph graph (a, c) = + Vertex.Set.fold (fun neighbor accu -> + accu && + I8051.RegisterSet.mem c (iph graph neighbor) + ) (high_neighbors graph a) true + +(* ------------------------------------------------------------------------- *) +(* Here is the coloring algorithm. *) + +module Color (G : sig + + val graph: graph + val uses: Register.t -> int + val verbose: bool + +end) = struct + + (* The cost function heuristically evaluates how much it might cost + to spill vertex [v]. Here, the cost is the ratio of the number of + uses of the pseudo-registers represented by [v] by the degree of + [v]. One could also take into account the number of nested loops + that the uses appear within, but that is not done here. *) + + let cost graph v = + let uses = + Register.Set.fold (fun r uses -> + G.uses r + uses + ) (registers graph v) 0 + in + (float_of_int uses) /. (float_of_int (degree graph v)) + + (* The algorithm maintains a transformed graph as it runs. It is + obtained from the original graph by removing, coalescing, and + freezing vertices. *) + + (* Each of the functions that follow returns a coloring of the graph + that it is passed. These functions correspond to the various + states of the algorithm (simplification, coalescing, freezing, + spilling, selection). The function [simplification] is the + initial state. *) + + (* [simplification] removes non-move-related nodes of low degree. *) + + let rec simplification graph : coloring = + + match lowest_non_move_related graph with + + | Some (v, d) when d < k -> + + (* We found a non-move-related node [v] of low degree. Color + the rest of the graph, then color [v]. This is what I call + selection. *) + + if G.verbose then + printf "Simplifying low vertex: %s.\n%!" (print_vertex graph v); + + selection graph v + + | _ -> + + (* There are no non-move-related nodes of low degree. + Could not simplify further. Start coalescing. *) + + coalescing graph + + (* [coalescing] looks for a preference edge that can be collapsed. + It is called after [simplification], so it is known, at this + point, that all nodes of low degree are move-related. *) + + and coalescing graph : coloring = + + (* Find a preference edge between two vertices that passes + George's criterion. + + [pppick] examines all preference edges in the graph, so its use + is inefficient. It would be more efficient instead to examine + only areas of the graph that have changed recently. More + precisely, it is useless to re-examine a preference edge that + did not pass George's criterion the last time it was examined + and whose neighborhood has not been modified by simplification, + coalescing or freezing. Indeed, in that case, and with a + sufficiently large definition of ``neighborhood'', this edge is + guaranteed to again fail George's criterion. It would be + possible to modify the [Interference.graph] data structure so + as to keep track of which neighborhoods have been modified and + provide a specialized, more efficient version of [pppick]. This + is not done here. *) + + match pppick graph (georgepp graph) with + + | Some (a, b) -> + + if G.verbose then + printf "Coalescing %s with %s.\n%!" (print_vertex graph a) (print_vertex graph b); + + (* Coalesce [a] with [b] and color the remaining graph. *) + + let coloring = simplification (coalesce graph a b) in + + (* Assign [a] the same color as [b]. *) + + Vertex.Map.add a (Vertex.Map.find b coloring) coloring + + | None -> + + (* Find a preference edge between a vertex and a hardware + register that passes George's criterion. Like [pppick], + [phpick] is slow. *) + + match phpick graph (georgeph graph) with + + | Some (a, c) -> + + if G.verbose then + printf "Coalescing %s with $%s.\n%!" (print_vertex graph a) (I8051.print_register c); + + (* Coalesce [a] with [c] and color the remaining graph. *) + + let coloring = simplification (coalesceh graph a c) in + + (* Assign [a] the color [c]. *) + + Vertex.Map.add a (Color c) coloring + + | None -> + + (* Could not coalesce further. Start freezing. *) + + freezing graph + + (* [freezing] begins after [simplification] and [coalescing] are + finished, so it is known, at this point, that all nodes of low + degree are move-related and no coalescing is possible. [freezing] + looks for a node of low degree (which must be move-related) and + removes the preference edges that it carries. This potentially + opens new opportunities for simplification and coalescing. *) + + and freezing graph : coloring = + + match lowest graph with + + | Some (v, d) when d < k -> + + (* We found a move-related node [v] of low degree. + Freeze it and start over. *) + + if G.verbose then + printf "Freezing low vertex: %s.\n%!" (print_vertex graph v); + + simplification (freeze graph v) + + | _ -> + + (* Could not freeze further. Start spilling. *) + + spilling graph + + (* [spilling] begins after [simplification], [coalescing], and + [freezing] are finished, so it is known, at this point, that + there are no nodes of low degree. + + Thus, we are facing a potential spill. However, we do optimistic + coloring: we do not spill a vertex right away, but proceed + normally, just as if we were doing simplification. So, we pick a + vertex [v], remove it, and check whether a color can be assigned + to [v] only after coloring what remains of the graph. + + It is crucial to pick a vertex that has few uses in the code. It + would also be good to pick one that has high degree, as this will + help color the rest of the graph. Thus, we pick a vertex that has + minimum cost, where the cost is obtained as the ratio of the + number of uses of the pseudo-registers represented by this vertex + in the code by the degree of the vertex. One could also take into + account the number of nested loops that the uses appear within, + but that is not done here. + + The use of [minimum] is inefficient, because this function + examines all vertices in the graph. It would be possible to + augment the [Interference.graph] data structure so as to keep + track of the cost associated with each vertex and provide + efficient access to a minimum cost vertex. This is not done + here. *) + + and spilling graph : coloring = + + match minimum (cost graph) graph with + | Some v -> + + if G.verbose then + printf "Spilling high vertex: %s.\n%!" (print_vertex graph v); + + selection graph v + + | None -> + + (* The graph is empty. Return an empty coloring. *) + + Vertex.Map.empty + + (* [selection] removes the vertex [v] from the graph, colors the + remaining graph, then selects a color for [v]. + + If [v] is low, that is, if [v] has degree less than [k], then at + least one color must still be available for [v], regardless of + how the remaining graph was colored. + + If [v] was a potential spill, then it is not certain that a color + is still available. If one is, though, then we are rewarded for + being optimistic. If none is, then [v] becomes an actual + spill. *) + + and selection graph v : coloring = + + (* Remove [v] from the graph and color what remains. *) + + let coloring = simplification (remove graph v) in + + (* Determine which colors are allowed. *) + + let allowed = ColorSet.diff colors (forbidden_colors graph coloring v) in + + (* Make a decision. + + We pick a color randomly among those that are allowed. One could + attempt to use biased coloring, that is, to pick a color that seems + desirable (or not undesirable) according to the preference edges + found in the initial graph. But that is probably not worth the + trouble. *) + + let decision = + try + Color (ColorSet.choose allowed) + with Not_found -> + Spill + in + + if G.verbose then + printf "Decision concerning %s: %s.\n%!" (print_vertex graph v) (print_decision decision); + + (* Record our decision and return. *) + + Vertex.Map.add v decision coloring + + (* Run the algorithm. *) + + let coloring = + simplification G.graph + +end + diff --git a/src/utilities/coloring.mli b/src/utilities/coloring.mli new file mode 100644 index 0000000..640080d --- /dev/null +++ b/src/utilities/coloring.mli @@ -0,0 +1,38 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module performs graph coloring. It is used for register + allocation. *) + +(* A coloring is a partial function of graph vertices to decisions, + where a decision is of the form either [Spill] -- the vertex could + not be colored and should be spilled into a stack slot -- or + [Color] -- the vertex was assigned a hardware register. Vertices + that are not in the domain of the coloring are waiting for a + decision to be made. *) + +type decision = + | Spill + | Color of I8051.register + +type coloring = + decision Interference.Vertex.Map.t + +(* Here is the coloring algorithm. Out of an interference graph, it + produces a coloring. The client should provide information about + the number of uses of each pseudo-register; the higher the number, + the more undesirable it is to spill that pseudo-register. If the + [verbose] flag is set, the algorithm prints information messages to + the standard output channel. *) + +module Color (G : sig + + val graph: Interference.graph + val uses: Register.t -> int + val verbose: bool + +end) : sig + + val coloring: coloring + +end + diff --git a/src/utilities/eformat.ml b/src/utilities/eformat.ml new file mode 100644 index 0000000..cfddb96 --- /dev/null +++ b/src/utilities/eformat.ml @@ -0,0 +1,18 @@ + +type t = { buffer : Buffer.t ; formatter : Format.formatter } + +let buffer eformat = eformat.buffer +let formatter eformat = eformat.formatter + +let make buffer formatter = { buffer ; formatter } + +let create () = + let buffer = Buffer.create 512 in + let formatter = Format.formatter_of_buffer buffer in + make buffer formatter + +let printf eformat = Format.fprintf (formatter eformat) + +let get eformat = + printf eformat "@?" ; + Buffer.contents (buffer eformat) diff --git a/src/utilities/eformat.mli b/src/utilities/eformat.mli new file mode 100644 index 0000000..77c11ce --- /dev/null +++ b/src/utilities/eformat.mli @@ -0,0 +1,6 @@ + +type t + +val create : unit -> t +val get : t -> string +val printf : t -> ('a, Format.formatter, unit) format -> 'a diff --git a/src/utilities/error.ml b/src/utilities/error.ml new file mode 100644 index 0000000..aef1266 --- /dev/null +++ b/src/utilities/error.ml @@ -0,0 +1,38 @@ +let exit_flag = ref true + +let exit_if_error () = exit_flag := true + +let resume_if_error () = exit_flag := false + +exception Error of Position.t list * string + +let print_error positions msg = + Printf.sprintf "%s%s" + (String.concat "\n" + (List.map (fun p -> Position.string_of_pos p ^": ") positions)) + msg + +let error_alert positions msg = + if !exit_flag then ( + output_string stderr (print_error positions msg); + exit 1 + ) + else raise (Error (positions, msg)) + +let global_error kind msg = + error_alert [] (Printf.sprintf "Global Error (%s):\n %s\n" kind msg) + +let error kind pos msg = + error_alert [pos] (Printf.sprintf "Error (%s):\n %s\n" kind msg) + +let error2 kind pos1 pos2 msg = + error_alert [pos1; pos2] (Printf.sprintf "Error (%s):\n %s\n" kind msg) + +let warning kind msg = + let mem_flag = !exit_flag in + exit_flag := false; + (try + error_alert [] (Printf.sprintf "Warning (%s):\n %s\n" kind msg) + with Error (positions, msg) -> + output_string stderr (print_error positions msg)); + exit_flag := mem_flag diff --git a/src/utilities/error.mli b/src/utilities/error.mli new file mode 100644 index 0000000..98b86c1 --- /dev/null +++ b/src/utilities/error.mli @@ -0,0 +1,29 @@ +(** This module provides a uniform way of reporting (located) error message. *) + +(** [exit_if_error ()] forces the program to stop if an error is encountered. + (This is the default behavior.) *) +val exit_if_error: unit -> unit + +(** [resume_if_error ()] makes the program throw the exception {!Error} + if an error is encountered. *) +val resume_if_error: unit -> unit + +exception Error of Position.t list * string + +(** [print_error positions msg] formats an error message. *) +val print_error : Position.t list -> string -> string + +(** [error k p msg] prints [msg] with [k] as a message prefix and stops + the program. *) +val error : string -> Position.t -> string -> 'a + +(** [error2 k p1 p2 msg] prints two positions instead of one. *) +val error2 : string -> Position.t -> Position.t -> string -> 'a + +(** [global_error k msg] prints [msg] with [k] as a message prefix and stops + the program. *) +val global_error : string -> string -> 'a + +(** [warning k msg] prints [msg] with [k] as a message prefix, but do + not stop the program. *) +val warning : string -> string -> unit diff --git a/src/utilities/interference.ml b/src/utilities/interference.ml new file mode 100644 index 0000000..4e1d061 --- /dev/null +++ b/src/utilities/interference.ml @@ -0,0 +1,861 @@ +(* Pasted from Pottier's PP compiler *) + +(* This module implements a data structure for interference graphs. + It provides functions that help construct, transform and inspect + interference graphs. *) + +(* ------------------------------------------------------------------------- *) + +(* Vertices are represented as integers. We need sets of vertices, maps over + vertices, maps of vertices to nonempty sets of vertices, maps of vertices + to nonempty sets of hardware registers, and priority sets over vertices. *) + +module Vertex = struct + + module V = struct + type t = int + let compare = compare + end + + include V + + module Set = Set.Make(V) + + module Map = MyMap.Make(V) + +end + +module VertexSetMap = + SetMap.MakeHomo(Vertex.Set)(Vertex.Map) + +module I8051RegisterSetMap = + SetMap.MakeHetero(I8051.RegisterSet)(Vertex.Map) + +module PrioritySet = + PrioritySet.Make(Vertex) + +(* ------------------------------------------------------------------------- *) + +(* Each vertex maps to a set of pseudo-registers, which initially is a + singleton set, but can grow due to coalescing. Conversely, each + pseudo-register maps to a single vertex. *) + +module RegMap : sig + + type t + + (* [empty] is the empty map. *) + + val empty: t + + (* [forward] maps a vertex to a set of pseudo-registers. *) + + val forward: Vertex.t -> t -> Register.Set.t + + (* [backward] maps a pseudo-register to a vertex. *) + + val backward: Register.t -> t -> Vertex.t + + (* [add r v m] adds a relation between pseudo-register [r] and + vertex [v], both of which are assumed fresh. *) + + val add: Register.t -> Vertex.t -> t -> t + + (* [fold f m accu] folds over all vertices. *) + + val fold: (Vertex.t -> Register.Set.t -> 'a -> 'a) -> t -> 'a -> 'a + + (* [coalesce x y m] coalesces vertices [x] and [y]. Vertex [x] is + removed and the pseudo-registers associated with it become + associated with [y] instead. *) + + val coalesce: Vertex.t -> Vertex.t -> t -> t + + (* [remove x m] removes vertex [x]. The pseudo-registers associated + with [x] disappear. *) + + val remove: Vertex.t -> t -> t + + (* [restrict] keeps only those vertices that satisfy predicate [p]. *) + + val restrict: (Vertex.t -> bool) -> t -> t + +end = struct + + type t = { + forward: Register.Set.t Vertex.Map.t; + backward: Vertex.t Register.Map.t + } + + let empty = { + forward = Vertex.Map.empty; + backward = Register.Map.empty + } + + let forward v m = + Vertex.Map.find v m.forward + + let backward r m = + try + Register.Map.find r m.backward + with Not_found -> + assert false (* bad pseudo-register *) + + let add r v m = { + forward = Vertex.Map.add v (Register.Set.singleton r) m.forward; + backward = Register.Map.add r v m.backward + } + + let fold f m accu = + Vertex.Map.fold f m.forward accu + + let coalesce x y m = + let rx, forward = Vertex.Map.find_remove x m.forward in + let forward = Vertex.Map.update y (Register.Set.union rx) forward in + let backward = + Register.Set.fold (fun r backward -> + Register.Map.add r y backward + ) rx m.backward + in + { + forward = forward; + backward = backward + } + + let remove x m = + let rx, forward = Vertex.Map.find_remove x m.forward in + let backward = Register.Set.fold Register.Map.remove rx m.backward in + { + forward = forward; + backward = backward + } + + let restrict p m = { + forward = Vertex.Map.restrict p m.forward; + backward = Register.Map.restrict (fun r -> p (backward r m)) m.backward + } + +end + +(* ------------------------------------------------------------------------- *) + +(* Graphs. *) + +type graph = { + + (* A two-way correspondence between vertices and pseudo-registers. + This data structure is also used to keep a record of the set of + all vertices. *) + + regmap: RegMap.t; + + (* Interference edges between two vertices: ``these two vertices + cannot receive the same color''. *) + + ivv: VertexSetMap.t; + + (* Interference edges between a vertex and a hardware register: + ``this vertex cannot receive this color''. *) + + ivh: I8051RegisterSetMap.t; + + (* Preference edges between two vertices: ``these two vertices + should preferably receive the same color''. *) + + pvv: VertexSetMap.t; + + (* Preference edges between a vertex and a hardware register: + ``this vertex should preferably receive this color''. *) + + pvh: I8051RegisterSetMap.t; + + (* The degree of each vertex [v], that is, the number of vertices + and hardware registers that [v] interferes with, is recorded at + all times. We use a ``priority set'' so as to be able to + efficiently find a vertex of minimum degree. *) + + degree: PrioritySet.t; + + (* The degree of each *non-move-related* vertex [v]. This + information is partially redundant with the [degree] field + above. It is nevertheless required in order to be able to + efficiently find a *non-move-related* vertex of minimum + degree. *) + + nmr: PrioritySet.t; + + } + +(* ------------------------------------------------------------------------- *) + +(* Our graphs are made up of two subgraphs: the subgraph formed by the + interference edges alone and the one formed by the preference edges + alone. + + In order to allow more code sharing, we define functions that allow + dealing with a single subgraph at a time. They provide operations + such as inspecting the neighbors of a vertex, adding edges, + removing edges, coalescing two vertices, removing a vertex, etc. + + We first define functions that deal with a ``generic'' subgraph, + then (via inheritance) specialize them to deal with the + interference subgraph and the preference subgraph with their + specific features. *) + +class virtual subgraph = object (self) + + (* These methods provide access to the fields of the [graph] data + structure that define the subgraph of interest. All data is + stored in the [graph] data structure. The object [self] has no + state and holds no data. *) + + method virtual getvv: graph -> VertexSetMap.t + method virtual setvv: graph -> VertexSetMap.t -> graph + method virtual getvh: graph -> I8051RegisterSetMap.t + method virtual setvh: graph -> I8051RegisterSetMap.t -> graph + + (* Accessing the neighbors of a vertex and testing whether edges + exist. *) + + method neighborsv graph v = + VertexSetMap.find v (self#getvv graph) + + method existsvv graph v1 v2 = + Vertex.Set.mem v1 (self#neighborsv graph v2) + + method neighborsh graph v = + I8051RegisterSetMap.find v (self#getvh graph) + + method existsvh graph v h = + I8051.RegisterSet.mem h (self#neighborsh graph v) + + (* [degree graph v] is the degree of vertex [v] with respect to the + subgraph. *) + + method degree graph v = + Vertex.Set.cardinal (self#neighborsv graph v) + I8051.RegisterSet.cardinal (self#neighborsh graph v) + + (* [hwregs graph] is the set of all hardware registers mentioned in + the subgraph. *) + + method hwregs graph = + let union _ = I8051.RegisterSet.union in + Vertex.Map.fold union (self#getvh graph) I8051.RegisterSet.empty + + (* [iter graph fvv fvh] iterates over all edges in the subgraph. + Vertex-to-vertex edges are presented only once. *) + + method iter graph fvv fvh = + Vertex.Map.iter (fun vertex neighbors -> + Vertex.Set.iter (fun neighbor -> + if vertex < neighbor then + fvv vertex neighbor + ) neighbors + ) (self#getvv graph); + Vertex.Map.iter (fun vertex neighbors -> + I8051.RegisterSet.iter (fun neighbor -> + fvh vertex neighbor + ) neighbors + ) (self#getvh graph) + + (* [mkvv graph v1 v2] adds an edge between vertices [v1] and [v2]. *) + + method mkvv graph v1 v2 = + if v1 = v2 then + graph (* avoid creating self-edge *) + else if self#existsvv graph v1 v2 then + graph (* avoid re-adding an existing edge *) + else + self#mkvvi graph v1 v2 + + method mkvvi graph v1 v2 = + self#setvv graph (VertexSetMap.mkbiedge v1 v2 (self#getvv graph)) + + (* [rmvv graph v1 v2] removes an edge between vertices [v1] and [v2]. + [rmvvifx] removes an edge if it exists. *) + + method rmvv graph v1 v2 = + assert (self#existsvv graph v1 v2); + self#setvv graph (VertexSetMap.rmbiedge v1 v2 (self#getvv graph)) + + method rmvvifx graph v1 v2 = + if self#existsvv graph v1 v2 then + self#rmvv graph v1 v2 + else + graph + + (* [mkvh graph v h] adds an edge between vertex [v] and hardware + register [h]. *) + + method mkvh graph v h = + if self#existsvh graph v h then + graph (* avoid re-adding an existing edge *) + else + self#mkvhi graph v h + + method mkvhi graph v h = + self#setvh graph (I8051RegisterSetMap.update v (I8051.RegisterSet.add h) (self#getvh graph)) + + (* [rmvh v h] removes an edge between vertex [v] and hardware + register [h]. [rmvhifx] removes an edge if it exists. *) + + method rmvh graph v h = + assert (self#existsvh graph v h); + self#setvh graph (I8051RegisterSetMap.update v (I8051.RegisterSet.remove h) (self#getvh graph)) + + method rmvhifx graph v h = + if self#existsvh graph v h then + self#rmvh graph v h + else + graph + + (* [coalesce graph x y] turns every neighbor [w] or [h] of [x] into + a neighbor of [y] instead. [w] ranges over both vertices and + hardware registers. *) + + method coalesce graph x y = + let graph = + Vertex.Set.fold (fun w graph -> + self#mkvv (self#rmvv graph x w) y w + ) (self#neighborsv graph x) graph + in + let graph = + I8051.RegisterSet.fold (fun h graph -> + self#mkvh (self#rmvh graph x h) y h + ) (self#neighborsh graph x) graph + in + graph + + (* [coalesceh graph x h] turns every neighbor [w] of [x] into a + neighbor of [h] instead. [w] ranges over both vertices and + hardware registers. Edges between two hardware registers are not + recorded. *) + + method coalesceh graph x h = + let graph = + Vertex.Set.fold (fun w graph -> + self#mkvh (self#rmvv graph x w) w h + ) (self#neighborsv graph x) graph + in + let graph = + I8051.RegisterSet.fold (fun k graph -> + self#rmvh graph x k + ) (self#neighborsh graph x) graph + in + graph + + (* [remove graph x] removes all edges carried by vertex [x]. *) + + method remove graph x = + let graph = + Vertex.Set.fold (fun w graph -> + self#rmvv graph x w + ) (self#neighborsv graph x) graph + in + let graph = + I8051.RegisterSet.fold (fun h graph -> + self#rmvh graph x h + ) (self#neighborsh graph x) graph + in + graph + +end + +(* ------------------------------------------------------------------------- *) + +(* The interference subgraph. + + This is a subgraph with the following specific features: (1) the + degree of every vertex is recorded in the [degree] field of the + [graph] data structure; (2) the degree of every non-move-related + vertex is recorded in the [nmr] field of the [graph] data + structure; (3) creating an edge in the interference subgraph + automatically destroys a corresponding edge in the preference + subgraph. *) + +class interference (preference : preference Lazy.t) = object (self) + + inherit subgraph as super + + method getvv graph = graph.ivv + method setvv graph m = { graph with ivv = m } + method getvh graph = graph.ivh + method setvh graph m = { graph with ivh = m } + + (* Override the edge creation and destruction methods. *) + + method mkvvi graph v1 v2 = + let graph = super#mkvvi graph v1 v2 in + let graph = (Lazy.force preference)#rmvvifx graph v1 v2 in (* do not constrain an existing preference edge *) + { graph with + degree = PrioritySet.increment v1 1 (PrioritySet.increment v2 1 graph.degree); + nmr = PrioritySet.incrementifx v1 1 (PrioritySet.incrementifx v2 1 graph.nmr); + } + + method rmvv graph v1 v2 = + let graph = super#rmvv graph v1 v2 in + { graph with + degree = PrioritySet.increment v1 (-1) (PrioritySet.increment v2 (-1) graph.degree); + nmr = PrioritySet.incrementifx v1 (-1) (PrioritySet.incrementifx v2 (-1) graph.nmr); + } + + method mkvhi graph v h = + let graph = super#mkvhi graph v h in + let graph = (Lazy.force preference)#rmvhifx graph v h in (* do not constrain an existing preference edge *) + { graph with + degree = PrioritySet.increment v 1 graph.degree; + nmr = PrioritySet.incrementifx v 1 graph.nmr; + } + + method rmvh graph v h = + let graph = super#rmvh graph v h in + { graph with + degree = PrioritySet.increment v (-1) graph.degree; + nmr = PrioritySet.incrementifx v (-1) graph.nmr; + } + +end + +(* ------------------------------------------------------------------------- *) + +(* The preference subgraph. + + This is a subgraph with the following specific features: (1) an + edge in the preference subgraph cannot be created if a + corresponding edge exists in the interference subgraph; (2) adding + an edge can make a vertex move-related, which requires taking that + vertex out of the [nmr] set; conversely, removing an edge can make + a vertex non-move-related, which requires adding that vertex to the + [nmr] set. *) + +and preference (interference : interference Lazy.t) = object (self) + + inherit subgraph as super + + method getvv graph = graph.pvv + method setvv graph m = { graph with pvv = m } + method getvh graph = graph.pvh + method setvh graph m = { graph with pvh = m } + + (* [nmr graph v] tells whether vertex [v] is non-move-related. *) + + method nmr graph v = + Vertex.Set.is_empty (self#neighborsv graph v) && + I8051.RegisterSet.is_empty (self#neighborsh graph v) + + (* [mkcheck graph v] moves [v] out of the [nmr] set if [v] is + non-move-related. *) + + method mkcheck graph v = + if self#nmr graph v then + { graph with + nmr = PrioritySet.remove v graph.nmr } + else + graph + + (* Override the edge creation methods. *) + + method mkvvi graph v1 v2 = + if (Lazy.force interference)#existsvv graph v1 v2 then + graph (* avoid creating constrained preference edge *) + else + let graph = self#mkcheck graph v1 in + let graph = self#mkcheck graph v2 in + super#mkvvi graph v1 v2 + + method mkvhi graph v h = + if (Lazy.force interference)#existsvh graph v h then + graph (* avoid creating constrained preference edge *) + else + let graph = self#mkcheck graph v in + super#mkvhi graph v h + + (* [rmcheck graph v] moves [v] into the [nmr] set if [v] is + non-move-related. *) + + method rmcheck graph v = + if self#nmr graph v then + { graph with + nmr = PrioritySet.add v (PrioritySet.priority v graph.degree) graph.nmr + } + else + graph + + (* Override the edge destruction methods. *) + + method rmvv graph v1 v2 = + let graph = super#rmvv graph v1 v2 in + let graph = self#rmcheck graph v1 in + let graph = self#rmcheck graph v2 in + graph + + method rmvh graph v h = + let graph = super#rmvh graph v h in + let graph = self#rmcheck graph v in + graph + +end + +(* ------------------------------------------------------------------------- *) + +(* Because the interference and preference subgraphs are mutually + referential, a recursive definition is required. It is made + somewhat inelegant by Objective Caml's insistence on using the + [Lazy] mechanism. *) + +let rec interference = lazy (new interference preference) + and preference = lazy (new preference interference) +let interference = Lazy.force interference +let preference = Lazy.force preference + +(* ------------------------------------------------------------------------- *) + +(* Inspecting interference graphs. *) + +(* [ipp graph v] is the set of vertices that the vertex [v] interferes + with. *) + +let ipp graph v = + interference#neighborsv graph v + +(* [iph graph v] is the set of hardware registers that the vertex [v] + interferes with. *) + +let iph graph v = + interference#neighborsh graph v + +(* [ppp graph v] is the set of vertices that should preferably be + assigned the same color as the vertex [v]. *) + +let ppp graph v = + preference#neighborsv graph v + +(* [pph graph v] is the set of hardware registers that [v] should + preferably be assigned. *) + +let pph graph v = + preference#neighborsh graph v + +(* [degree graph v] is the degree of the vertex [v], that is, the number + of vertices and hardware registers that [v] interferes with. *) + +let degree graph v = + PrioritySet.priority v graph.degree + +(* [lowest graph] returns [Some (v, d)], where the vertex [v] has + minimum degree [d], or returns [None] if the graph is empty. *) + +let lowest graph = + PrioritySet.lowest graph.degree + +(* [lowest_non_move_related graph] returns [Some (v, d)], where the + vertex [v] has minimum degree [d] among the vertices that are not + move-related, or returns [None] if all vertices are move-related. A + vertex is move-related if it carries a preference edge. *) + +let lowest_non_move_related graph = + PrioritySet.lowest graph.nmr + +(* [fold f graph accu] folds over all vertices. *) + +let fold f graph accu = + RegMap.fold (fun v _ accu -> f v accu) graph.regmap accu + +(* [minimum f graph] returns a vertex [v] such that the value of [f x] + is minimal. The values returned by [f] are compared using Objective + Caml's generic comparison operator [<]. If the graph is empty, + [None] is returned. *) + +let minimum f graph = + match + fold (fun w accu -> + let dw = f w in + match accu with + | None -> + Some (dw, w) + | Some (dv, v) -> + if dw < dv then + Some (dw, w) + else + accu + ) graph None + with + | None -> + None + | Some (_, v) -> + Some v + +(* [pppick graph p] returns an arbitrary preference edge that + satisfies the predicate [p], if the graph contains one. *) + +type ppedge = + Vertex.t * Vertex.t + +let pppick graph p = + VertexSetMap.pick graph.pvv p + +(* [phpick graph p] returns an arbitrary preference edge that + satisfies the predicate [p], if the graph contains one. *) + +type phedge = + Vertex.t * I8051.register + +let phpick graph p = + I8051RegisterSetMap.pick graph.pvh p + +(* ------------------------------------------------------------------------- *) + +(* Constructing interference graphs. *) + +(* [create regs] creates an interference graph whose vertices are + the pseudo-registers [regs] and that does not have any edges. *) + +let create regs = + let (_ : int), regmap, degree = + Register.Set.fold (fun r (v, regmap, degree) -> + v+1, + RegMap.add r v regmap, + PrioritySet.add v 0 degree + ) regs (0, RegMap.empty, PrioritySet.empty) + in + { + regmap = regmap; + ivv = Vertex.Map.empty; + ivh = Vertex.Map.empty; + pvv = Vertex.Map.empty; + pvh = Vertex.Map.empty; + degree = degree; + nmr = degree + } + +(* [lookup graph r] returns the graph vertex associated with + pseudo-register [r]. *) + +let lookup graph r = + RegMap.backward r graph.regmap + +(* Conversely, [registers graph v] returns the set of pseudo-registers + associated with vertex [v]. *) + +let registers graph v = + RegMap.forward v graph.regmap + +(* [mkipp graph regs1 regs2] adds interference edges between all pairs + of pseudo-registers [r1] and [r2], where [r1] ranges over [regs1], + [r2] ranges over [regs2], and [r1] and [r2] are distinct. *) + +let mkipp graph regs1 regs2 = + Register.Set.fold (fun r1 graph -> + let v1 = lookup graph r1 in + Register.Set.fold (fun r2 graph -> + interference#mkvv graph v1 (lookup graph r2) + ) regs2 graph + ) regs1 graph + +(* [mkiph graph regs hwregs] adds interference edges between all pairs + of a pseudo-register [r] and a hardware register [hwr], where [r] + ranges over [regs] and [hwr] ranges over [hwregs]. *) + +let mkiph graph regs hwregs = + Register.Set.fold (fun r graph -> + let v = lookup graph r in + I8051.RegisterSet.fold (fun h graph -> + interference#mkvh graph v h + ) hwregs graph + ) regs graph + +(* [mki graph regs1 regs2] adds interference edges between all pairs + of (pseudo- or hardware) registers [r1] and [r2], where [r1] ranges + over [regs1], [r2] ranges over [regs2], and [r1] and [r2] are + distinct. *) + +let mki graph (regs1, hwregs1) (regs2, hwregs2) = + let graph = mkipp graph regs1 regs2 in + let graph = mkiph graph regs1 hwregs2 in + let graph = mkiph graph regs2 hwregs1 in + graph + +(* [mkppp graph r1 r2] adds a preference edge between the + pseudo-registers [r1] and [r2]. *) + +let mkppp graph r1 r2 = + let v1 = lookup graph r1 + and v2 = lookup graph r2 in + let graph = preference#mkvv graph v1 v2 in + graph + +(* [mkpph graph r h] adds a preference edge between the + pseudo-register [r] and the hardware register [h]. *) + +let mkpph graph r h = + let v = lookup graph r in + let graph = preference#mkvh graph v h in + graph + +(* ------------------------------------------------------------------------- *) + +(* Displaying interference graphs. *) + +open Printf + +let hwregs graph = + I8051.RegisterSet.union (interference#hwregs graph) (preference#hwregs graph) + +let print_vertex graph v = + Register.Set.print (registers graph v) + +let print f graph = + + fprintf f "graph G {\n"; +(* fprintf f "size=\"6, 3\";\n"; (* in inches *)*) + fprintf f "orientation = landscape;\n"; + fprintf f "rankdir = LR;\n"; + fprintf f "ratio = compress;\n\n"; (* compress or fill or auto *) + + RegMap.fold (fun vertex regs () -> + fprintf f "r%d [ label=\"%s\" ] ;\n" vertex (Register.Set.print regs) + ) graph.regmap (); + + I8051.RegisterSet.iter (fun hwr -> + let name = I8051.print_register hwr in + fprintf f "hwr%s [ label=\"$%s\" ] ;\n" name name + ) (hwregs graph); + + interference#iter graph + (fun vertex neighbor -> + fprintf f "r%d -- r%d ;\n" vertex neighbor) + (fun vertex neighbor -> + fprintf f "r%d -- hwr%s ;\n" vertex (I8051.print_register neighbor)); + + preference#iter graph + (fun vertex neighbor -> + fprintf f "r%d -- r%d [ style = dashed ] ;\n" vertex neighbor) + (fun vertex neighbor -> + fprintf f "r%d -- hwr%s [ style = dashed ] ;\n" vertex (I8051.print_register neighbor)); + + fprintf f "\n}\n" + +(* ------------------------------------------------------------------------- *) + +(* Coalescing. *) + +(* [coalesce graph v1 v2] is a new graph where the vertices [v1] and [v2] + are coalesced. The new coalesced vertex is known under the name [v2]. *) + +let coalesce graph x y = + + assert (x <> y); (* attempt to coalesce one vertex with itself *) + assert (not (interference#existsvv graph x y)); (* attempt to coalesce two interfering vertices *) + + (* Perform coalescing in the two subgraphs. *) + + let graph = interference#coalesce graph x y in + let graph = preference#coalesce graph x y in + + (* Remove [x] from all tables. *) + + { + graph with + regmap = RegMap.coalesce x y graph.regmap; + ivh = Vertex.Map.remove x graph.ivh; + pvh = Vertex.Map.remove x graph.pvh; + degree = PrioritySet.remove x graph.degree; + nmr = PrioritySet.remove x graph.nmr; + } + +(* [coalesceh graph v h] coalesces the vertex [v] with the hardware register + [h]. This produces a new graph where [v] no longer exists and all edges + leading to [v] are replaced with edges leading to [h]. *) + +let coalesceh graph x h = + + assert (not (interference#existsvh graph x h)); (* attempt to coalesce interfering entities *) + + (* Perform coalescing in the two subgraphs. *) + + let graph = interference#coalesceh graph x h in + let graph = preference#coalesceh graph x h in + + (* Remove [x] from all tables. *) + + { + graph with + regmap = RegMap.remove x graph.regmap; + ivh = Vertex.Map.remove x graph.ivh; + pvh = Vertex.Map.remove x graph.pvh; + degree = PrioritySet.remove x graph.degree; + nmr = PrioritySet.remove x graph.nmr; + } + +(* ------------------------------------------------------------------------- *) + +(* [freeze graph x] is a new graph where all preference edges carried + by [x] are removed. *) + +let freeze graph x = + preference#remove graph x + +(* ------------------------------------------------------------------------- *) + +(* Removal. *) + +(* [remove graph v] is a new graph where vertex [v] is removed. *) + +let remove graph v = + + (* Remove all edges carried by [v]. *) + + let graph = interference#remove graph v in + let graph = preference#remove graph v in + + (* Remove [v] from all tables. *) + + { + graph with + regmap = RegMap.remove v graph.regmap; + degree = PrioritySet.remove v graph.degree; + nmr = PrioritySet.remove v graph.nmr; + } + +(* ------------------------------------------------------------------------- *) + +(* [mkdeg graph] recomputes degree information from scratch. *) + +let mkdeg graph = + let degree, nmr = + fold (fun v (degree, nmr) -> + let d = interference#degree graph v in + PrioritySet.add v d degree, + if preference#nmr graph v then PrioritySet.add v d nmr else nmr + ) graph (PrioritySet.empty, PrioritySet.empty) + in + { graph with + degree = degree; + nmr = nmr; + } + +(* [restrict graph p] is a new graph where only those vertices that + satisfy predicate [p] are kept. The same effect could be obtained + by repeated application of [remove], but [restrict] is likely to be + more efficient if many vertices are removed. *) + +let restrict graph p = + mkdeg { + graph with + regmap = RegMap.restrict p graph.regmap; + ivv = VertexSetMap.restrict p graph.ivv; + ivh = Vertex.Map.restrict p graph.ivh; + pvv = VertexSetMap.restrict p graph.pvv; + pvh = Vertex.Map.restrict p graph.pvh; + } + +(* [droph graph] is a new graph where all information concerning hardware + registers has been dropped. *) + +let droph graph = + mkdeg { + graph with + ivh = Vertex.Map.empty; + pvh = Vertex.Map.empty; + } + diff --git a/src/utilities/interference.mli b/src/utilities/interference.mli new file mode 100644 index 0000000..6e6c765 --- /dev/null +++ b/src/utilities/interference.mli @@ -0,0 +1,213 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module implements a data structure for interference graphs. + It provides functions that help construct, transform and inspect + interference graphs. *) + +(* Interference graphs record two kinds of edges: interference edges + (``these two vertices cannot receive the same color'') and + preference edges (``these two vertices should preferably receive + the same color''). Furthermore, each kind of edge can relate either + two pseudo-registers or one pseudo-register and one hardware + register. Thus, an interference graph keeps track of four kinds of + relationships. + + This module automatically maintains the invariant that two vertices + [x] and [y] cannot be related by both an interference edge and a + preference edge. When such a situation appears (for instance, + because of coalescing), the preference edge is automatically + removed. *) + +type graph + +(* The vertices of an interference graph initially correspond to + pseudo-registers. However, interference graphs support coalescing, + which means that a new graph can be constructed by coalescing two + vertices in an existing graph. As a result, in general, the vertices + of an interference graph correspond to sets of pseudo-registers. *) + +(* ------------------------------------------------------------------------- *) + +(* Operations over vertices: sets of vertices, maps over vertices. *) + +module Vertex : sig + + type t + + (* The usual operations on sets, see [Set.S] in Objective Caml's + documentation. *) + + module Set : Set.S with type elt = t + + (* The usual operations on maps, see [Map.S] in Objective Caml's + documentation. One slight difference is that [find] expects + the key to be present in the map -- it will fail otherwise. *) + + module Map : MyMap.S with type key = t + +end + +(* ------------------------------------------------------------------------- *) + +(* Building interference graphs. *) + +(* [create regs] creates an interference graph whose vertices are + the pseudo-registers [regs] and that does not have any edges. *) + +val create: Register.Set.t -> graph + +(* [mki graph regs1 regs2] adds interference edges between all pairs + of (pseudo- or hardware) registers [r1] and [r2], where [r1] ranges + over [regs1], [r2] ranges over [regs2], and [r1] and [r2] are + distinct. *) + +val mki: graph -> + Register.Set.t * I8051.RegisterSet.t -> + Register.Set.t * I8051.RegisterSet.t -> + graph + +(* [mkiph graph regs hwregs] adds interference edges between all pairs + of a pseudo-register [r] and a hardware register [hwr], where [r] + ranges over [regs] and [hwr] ranges over [hwregs]. *) + +val mkiph: graph -> Register.Set.t -> I8051.RegisterSet.t -> graph + +(* [mkppp graph r1 r2] adds a preference edge between the + pseudo-registers [r1] and [r2]. *) + +val mkppp: graph -> Register.t -> Register.t -> graph + +(* [mkpph graph r h] adds a preference edge between the + pseudo-register [r] and the hardware register [h]. *) + +val mkpph: graph -> Register.t -> I8051.register -> graph + +(* ------------------------------------------------------------------------- *) + +(* Transforming interference graphs. *) + +(* [coalesce graph v1 v2] is a new graph where the vertices [v1] and + [v2] are coalesced. [v1] and [v2] must not interfere. The new + coalesced vertex is known under the name [v2]. *) + +val coalesce: graph -> Vertex.t -> Vertex.t -> graph + +(* [coalesceh graph v h] coalesces the vertex [v] with the hardware register + [h]. This produces a new graph where [v] no longer exists and all edges + leading to [v] are replaced with edges leading to [h]. *) + +val coalesceh: graph -> Vertex.t -> I8051.register -> graph + +(* [remove graph v] is a new graph where vertex [v] is removed. *) + +val remove: graph -> Vertex.t -> graph + +(* [freeze graph x] is a new graph where all preference edges carried + by [x] are removed. *) + +val freeze: graph -> Vertex.t -> graph + +(* [restrict graph p] is a new graph where only those vertices that + satisfy predicate [p] are kept. *) + +val restrict: graph -> (Vertex.t -> bool) -> graph + +(* [droph graph] is a new graph where all information concerning hardware + registers has been dropped. *) + +val droph: graph -> graph + +(* ------------------------------------------------------------------------- *) + +(* Inspecting interference graphs. *) + +(* [lookup graph r] returns the graph vertex associated with + pseudo-register [r]. *) + +val lookup: graph -> Register.t -> Vertex.t + +(* Conversely, [registers graph v] returns the set of pseudo-registers + associated with vertex [v]. *) + +val registers: graph -> Vertex.t -> Register.Set.t + +(* [degree graph v] is the degree of the vertex [v], that is, the number + of vertices and hardware registers that [v] interferes with. *) + +val degree: graph -> Vertex.t -> int + +(* [lowest graph] returns [Some (v, d)], where the vertex [v] has + minimum degree [d], or returns [None] if the graph is empty. *) + +val lowest: graph -> (Vertex.t * int) option + +(* [lowest_non_move_related graph] returns [Some (v, d)], where the + vertex [v] has minimum degree [d] among the vertices that are not + move-related, or returns [None] if all vertices are move-related. A + vertex is move-related if it carries a preference edge. *) + +val lowest_non_move_related: graph -> (Vertex.t * int) option + +(* [minimum f graph] returns a vertex [v] such that the value of [f x] + is minimal. The values returned by [f] are compared using Objective + Caml's generic comparison operator [<]. If the graph is empty, + [None] is returned. *) + +val minimum: (Vertex.t -> 'a) -> graph -> Vertex.t option + +(* [fold f graph accu] folds over all vertices. *) + +val fold: (Vertex.t -> 'a -> 'a) -> graph -> 'a -> 'a + +(* [ipp graph v] is the set of vertices that the vertex [v] interferes + with. *) + +val ipp: graph -> Vertex.t -> Vertex.Set.t + +(* [iph graph v] is the set of hardware registers that the vertex [v] + interferes with. *) + +val iph: graph -> Vertex.t -> I8051.RegisterSet.t + +(* [ppp graph v] is the set of vertices that should preferably be + assigned the same color as the vertex [v]. *) + +val ppp: graph -> Vertex.t -> Vertex.Set.t + +(* [pph graph v] is the set of hardware registers that [v] should + preferably be assigned. *) + +val pph: graph -> Vertex.t -> I8051.RegisterSet.t + +(* [pppick graph p] returns an arbitrary preference edge that + satisfies the predicate [p], if the graph contains one. *) + +type ppedge = + Vertex.t * Vertex.t + +val pppick: graph -> (ppedge -> bool) -> ppedge option + +(* [phpick graph p] returns an arbitrary preference edge that + satisfies the predicate [p], if the graph contains one. *) + +type phedge = + Vertex.t * I8051.register + +val phpick: graph -> (phedge -> bool) -> phedge option + +(* ------------------------------------------------------------------------- *) + +(* Displaying interference graphs. *) + +(* [print_vertex graph v] produces a string representation of the + vertex [v]. *) + +val print_vertex: graph -> Vertex.t -> string + +(* [print f graph] prints a representation of the interference graph + [graph] in [dot] format to the output channel [f]. Interference + edges are drawn as plain lines; preference edges are drawn as + dotted lines. *) + +val print: out_channel -> graph -> unit + diff --git a/src/utilities/misc.ml b/src/utilities/misc.ml new file mode 100644 index 0000000..2fc3075 --- /dev/null +++ b/src/utilities/misc.ml @@ -0,0 +1,208 @@ +module LexingExt = struct + + open Lexing + + let new_line lexbuf = + lexbuf.lex_curr_p <- { + lexbuf.lex_curr_p with + pos_bol = 0; + pos_lnum = lexbuf.lex_curr_p.pos_lnum + 1 + } + + let lex_num s pos = + let rec num i = + if s.[i] >= '0' && s.[i] <= '9' then + num (i + 1) + else + i + in + let pos' = num pos in + if pos = pos' then + None + else + Some (pos, pos', int_of_string (String.sub s pos (pos' - pos))) + +end + +module ListExt = struct + + let inv_assoc l = List.map (fun (x, y) -> (y, x)) l + + exception EmptyList + + let last l = try List.hd (List.rev l) with _ -> raise EmptyList + + let cut_last l = + let rec aux l = function + | [] -> raise EmptyList + | [ x ] -> (x, List.rev l) + | x :: xs -> aux (x :: l) xs + in + aux [] l + + let multi_set_of_list l = + let h = Hashtbl.create 13 in + let incr_occ x = + let o = try Hashtbl.find h x with Not_found -> 0 in + Hashtbl.replace h x (o + 1) + in + List.iter incr_occ l; + Hashtbl.fold (fun k v accu -> (k, v) :: accu) h [] + + let hashtbl_of_assoc l = + let h = Hashtbl.create 13 in + List.iter (fun (k, v) -> Hashtbl.add h k v) l; + h + + exception Conflict + let assoc_union l1 l2 = + let h1 = hashtbl_of_assoc l1 in + l1 + @ List.filter + (fun (k, v1) -> + try + let v2 = Hashtbl.find h1 k in + if v1 <> v2 then raise Conflict; + false + with _ -> true) l2 + + let assoc_diff l1 l2 = + let h1 = hashtbl_of_assoc l1 in + let h2 = hashtbl_of_assoc l2 in + let diff h1 h2 f = + Hashtbl.fold + (fun k v1 accu -> + let v2 = + try Some (Hashtbl.find h2 k) + with Not_found -> None + in + if Some v1 <> v2 then + if f then + (k, (Some v1, v2)) :: accu + else + (k, (v2, Some v1)) :: accu + else + accu) + h1 [] + in + let d1 = diff h1 h2 true in + let d2 = diff h2 h1 false in + try assoc_union d1 d2 + with Conflict -> assert false + + let transitive_forall2 p l = + let rec aux = function + | [] -> None + | [x] -> None + | x1 :: ((x2 :: _) as xs) -> + if not (p x1 x2) then Some (x1, x2) else aux xs + in + aux l + + let repeat init n f = + let rec aux accu vs i = + if i = 0 then (accu, vs) else + let (accu, v) = f accu i in + aux accu (v :: vs) (pred i) + in + assert (n >= 0); + aux init [] n + +end + +module ArgExt = struct + + let extra_doc s = "", Arg.Unit ignore, s + +end + +module SysExt = struct + + let safe_remove name = + try Sys.remove name with Sys_error _ -> () + + let rec alternative name = + let split name = + match LexingExt.lex_num name 0 with + | None -> None + | Some (start, stop, num) -> + let len = String.length name in + Some (num, String.sub name (stop+1) (len - stop - 1)) + in + if not (Sys.file_exists name) then + name + else + let dirname = Filename.dirname name in + let filename = Filename.basename name in + let filename = + match split filename with + | None -> + "01-" ^ filename + | Some (i, name) -> + Printf.sprintf "%02d-%s" (i + 1) name + in + alternative (Filename.concat dirname filename) + +end + +module IOExt = struct + + let stdout_buffer = Buffer.create 13 + let stdout_formatter = Format.formatter_of_buffer stdout_buffer + let stderr_buffer = Buffer.create 13 + let stderr_formatter = Format.formatter_of_buffer stderr_buffer + let enable_buffering = ref false + + let printf fmt = + if !enable_buffering then + Format.fprintf stdout_formatter fmt + else + Format.printf fmt + + let eprintf fmt = + if !enable_buffering then + Format.fprintf stderr_formatter fmt + else + Format.eprintf fmt + + let get_buffers () = + let out = + (Buffer.contents stdout_buffer, Buffer.contents stderr_buffer) + in + Buffer.clear stdout_buffer; + Buffer.clear stderr_buffer; + out + + let set_buffered_mode () = + enable_buffering := true + +end + +module Timed = struct + + let time now print_date f = + fun x -> + let start_date = now () in + let y = f x in + let stop_date = now () in + print_date start_date stop_date; + y + + let get_now = ref (fun () -> 0.) + + let set_now now = get_now := now + + let enable_profiling = ref false + + let set_profiling_flag t = enable_profiling := t + + let profile title f = + let print_date start stop = + IOExt.eprintf "[%05.0fms] %s\n" (stop -. start) title + in + if !enable_profiling then + time !get_now print_date f + else + f + +end diff --git a/src/utilities/misc.mli b/src/utilities/misc.mli new file mode 100644 index 0000000..a3b41b8 --- /dev/null +++ b/src/utilities/misc.mli @@ -0,0 +1,96 @@ +(** This module extends the standard library of Objective Caml. *) + +module LexingExt : sig + + (** [new_line lexbuf] update lexbuf to increment its line + counter. *) + val new_line : Lexing.lexbuf -> unit + + val lex_num : string -> int -> (int * int * int) option + +end + +module ListExt : sig + + (** [inv_assoc l] inverses a bijective associative list [l]. *) + val inv_assoc : ('a * 'b) list -> ('b * 'a) list + + exception EmptyList + + (** [last l] returns the last element of a list. + Raise [EmptyList] if there is no such thing in [l]. *) + val last : 'a list -> 'a + + (** [cut_last l] returns the last element of a list [l] and the + elements that come before it in [l]. + Raise [EmptyList] if there is no such thing in [l]. *) + val cut_last : 'a list -> 'a * 'a list + + (** [multi_set_of_list l] returns an associative list that + relates every element of [l] to its frequency in [l]. *) + val multi_set_of_list : 'a list -> ('a * int) list + + (** [hashtbl_of_assoc l] converts an associative list into + an hash table. *) + val hashtbl_of_assoc : ('a * 'b) list -> ('a, 'b) Hashtbl.t + + (** [assoc_diff l1 l2] returns the difference between two + associative lists. *) + val assoc_diff : ('a * 'b) list -> ('a * 'b) list + -> ('a * ('b option * 'b option)) list + + (** [transitive_forall2 p l] checks that the binary predicate [p] is + true between each successive elements of [l]. If this is false, + the function returns the first pair of elements that falsify [p]. *) + val transitive_forall2 : ('a -> 'a -> bool) -> 'a list -> ('a * 'a) option + + (** [repeat init n f] computes [f 0; ...; f n] threading an + accumulator along the way from [n] to [0]. *) + val repeat : 'b -> int -> ('b -> int -> 'b * 'a) -> 'b * 'a list + +end + +module ArgExt : sig + + (** [extra_doc s] adds an extra line of documentation for an + Arg.spec row. *) + val extra_doc : string -> (Arg.key * Arg.spec * Arg.doc) + +end + +module SysExt : sig + + (** [safe_remove filename] deletes a file named [filename], + but do not crash if a system error happens. (For instance, + if the file does not exist.) *) + val safe_remove : string -> unit + + (** [alternative filename] finds an alternative name different + from [filename] that is not already used. *) + val alternative : string -> string + +end + +module IOExt : sig + + (** Buffered printf-based IO. *) + val printf : ('a, Format.formatter, unit) Pervasives.format -> 'a + val eprintf : ('a, Format.formatter, unit) Pervasives.format -> 'a + val set_buffered_mode : unit -> unit + val get_buffers : unit -> string * string + +end + +module Timed : sig + + val time : + (unit -> 'date) -> ('date -> 'date -> unit) + -> ('a -> 'b) -> ('a -> 'b) + + val set_now : (unit -> float) -> unit + + val set_profiling_flag : bool -> unit + + val profile : string -> ('a -> 'b) -> 'a -> 'b + +end diff --git a/src/utilities/miscPottier.ml b/src/utilities/miscPottier.ml new file mode 100644 index 0000000..e5ebe91 --- /dev/null +++ b/src/utilities/miscPottier.ml @@ -0,0 +1,160 @@ + +let rec map3 f al bl cl = + let f' ((a, b), c) = f a b c in + List.map f' (List.combine (List.combine al bl) cl) + +let rec max_list = function + | [] -> raise (Invalid_argument "MiscPottier.max_list") + | [a] -> a + | a :: l -> max a (max_list l) + +let rec reduce l1 l2 = match l1, l2 with + | [], _ -> (([], []), ([], l2)) + | _, [] -> (([], l1), ([], [])) + | a :: l1, b :: l2 -> + let ((common1, rest1), (common2, rest2)) = reduce l1 l2 in + ((a :: common1, rest1), (b :: common2, rest2)) + +let pow a b = + if b < 0 then raise (Invalid_argument "MiscPottier.pow2") + else + let rec aux = function + | 0 -> 1 + | i -> a * aux (i-1) in + aux b + +let rec make a n = + if n = 0 then [] + else a :: (make a (n-1)) + +let index_of x = + let rec aux i = function + | [] -> raise Not_found + | y :: l -> if y = x then i else aux (i+1) l + in + aux 0 + +let rec remove_n_first n = + let rec aux i = function + | [] -> [] + | l when i = n -> l + | _ :: l -> aux (i+1) l in + aux 0 + +let foldi_from_until n m f a l = + let rec aux i res = function + | [] -> res + | _ when i >= m -> res + | e :: l -> aux (i+1) (f i res e) l in + aux 0 a (remove_n_first n l) + +let foldi_from n f a l = foldi_from_until n (List.length l) f a l + +let foldi_until m f a l = foldi_from_until 0 m f a l + +let foldi f a l = foldi_from_until 0 (List.length l) f a l + +let pos e l = + let f i res e' = if e' = e then Some i else res in + match foldi f None l with + | None -> raise Not_found + | Some i -> i + +let iteri f l = + let rec aux i = function + | [] -> () + | e :: l -> f i e ; aux (i+1) l + in + aux 0 l + +let mapi f l = + let rec aux i = function + | [] -> [] + | e :: l -> (f i e) :: (aux (i+1) l) + in + aux 0 l + +let rec last = function + | [] -> raise Not_found + | [a] -> a + | _ :: l -> last l + +(* [split a i] splits the list a in two lists: one with the elements + up until the [i]th (exclusive) and one with the rest. *) + +let rec split l i = + if i = 0 then ([], l) + else + let (l1, l2) = split (List.tl l) (i-1) in + ((List.hd l) :: l1, l2) + +(* [split_last l] returns the list [l] without its last element and its last + element. Raises Invalid_argument "MiscPottier.split_last" if the list is + empty. *) + +let split_last l = match split l ((List.length l) - 1) with + | l', last :: _ -> (l', last) + | _ -> raise (Invalid_argument "MiscPottier.split_last") + +let rec update_list_assoc a b = function + | [] -> [] + | (a', b') :: l -> + if a' = a then (a, b) :: l else (a', b') :: (update_list_assoc a b l) + +(* Pasted from Pottier's PP compiler *) + +let rec combine xs1 xs2 = + match xs1, xs2 with + | [], _ + | _, [] -> + [] + | x1 :: xs1, x2 :: xs2 -> + (x1, x2) :: combine xs1 xs2 + +let rec subtract xs1 xs2 = + match xs1, xs2 with + | [], _ -> + [] + | _, [] -> + xs1 + | _ :: xs1, _ :: xs2 -> + subtract xs1 xs2 + +let mirror l = + List.map (fun (x, y) -> (y, x)) l + +let length l = + Int32.of_int (List.length l) + +let rec prefix k l = + match k, l with + | 0, _ + | _, [] -> + [] + | _, x :: xs -> + x :: prefix (k - 1) xs + +let memoize f = + let table = Hashtbl.create 131 in + fun key -> + try + Hashtbl.find table key + with Not_found -> + let data = f key in + Hashtbl.add table key data; + data + +let filter_map filter map = + let rec aux = function + | [] -> [] + | e :: l -> (if filter e then [map e] else []) @ (aux l) + in + aux + +let string_of_list sep f = + let rec aux = function + | [] -> "" + | [e] -> f e + | e :: l -> (f e) ^ sep ^ (aux l) + in + aux diff --git a/src/utilities/miscPottier.mli b/src/utilities/miscPottier.mli new file mode 100644 index 0000000..55f6cec --- /dev/null +++ b/src/utilities/miscPottier.mli @@ -0,0 +1,85 @@ + +(** This module provides some additional functions on lists or arithmetics. *) + +(* raises Not_found *) +val pos : 'a -> 'a list -> int + +val reduce : 'a list -> 'b list -> ('a list * 'a list) * ('b list * 'b list) + +(* raise Failure "MiscPottier.map3" if the list arguments are not of the same + size. *) +val map3 : ('a -> 'b -> 'c -> 'd) -> 'a list -> 'b list -> 'c list -> 'd list + +val max_list : 'a list -> 'a + +val pow : int -> int -> int + +val make: 'a -> int -> 'a list + +val index_of : 'a -> 'a list -> int + +val foldi_until : int -> (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a + +val foldi : (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a + +val iteri : (int -> 'a -> unit) -> 'a list -> unit + +val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list + +(* Raises Not_found if the list is empty. *) +val last : 'a list -> 'a + +(* [split l i] splits the list [l] in two lists: one with the elements + up until the [i]th (exclusive) and one with the rest. *) +val split: 'a list -> int -> ('a list * 'a list) + +(* [split_last l] returns the list [l] without its last element and its last + element. Raises Invalid_argument "MiscPottier.split_last" if the list is + empty. *) +val split_last : 'a list -> ('a list * 'a) + +val update_list_assoc: 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list + +(* Pasted from Pottier's PP compiler *) + +(* [combine] turns a pair of lists into a list of pairs. It never + fails: the length of the output list is the minimum of the lengths + of the input lists. *) + +val combine: 'a list -> 'b list -> ('a * 'b) list + +(* [subtract xs1 xs2] returns the list [xs1] deprived of as many + elements as there are in the list [xs2]. *) + +val subtract: 'a list -> 'b list -> 'a list + +(* [mirror] reverses the order of the pair components in a list + of pairs. *) + +val mirror: ('a * 'b) list -> ('b * 'a) list + +(* [length l] is the length of the list [l]. *) + +val length: 'a list -> int32 + +(* [prefix k xs] returns the prefix of length [k] of the list [xs]. + If [xs] has length less than [k], [xs] is returned. *) + +val prefix: int -> 'a list -> 'a list + +(* [memoize f] produces a memoizing version of the function [f]. + It requires the domain of [f] to support generic equality. *) + +val memoize: ('a -> 'b) -> ('a -> 'b) + +(* [filter_map filter map l] returns the list [l] where elements satisfying the + [filter] function have been replaced by their application to the [map] + function. Elements that do not satisfy [filter] are not in the result + list. *) + +val filter_map: ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list + +(* [string_of_list sep f l] returns the string obtained by applying [f] to each + element of [l] and separating their output with [sep]. *) + +val string_of_list: string -> ('a -> string) -> 'a list -> string diff --git a/src/utilities/myMap.ml b/src/utilities/myMap.ml new file mode 100644 index 0000000..b6bb364 --- /dev/null +++ b/src/utilities/myMap.ml @@ -0,0 +1,372 @@ +(***********************************************************************) +(* *) +(* Objective Caml *) +(* *) +(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) +(* *) +(* Copyright 1996 Institut National de Recherche en Informatique et *) +(* en Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU Library General Public License, with *) +(* the special exception on linking described in file ../LICENSE. *) +(* *) +(***********************************************************************) + +(* $Id: myMap.ml,v 1.3 2006/02/17 16:19:52 pottier Exp $ *) + +module type OrderedType = + sig + type t + val compare: t -> t -> int + end + +module type S = + sig + type key + type +'a t + val empty: 'a t + val is_empty: 'a t -> bool + val add: key -> 'a -> 'a t -> 'a t + val find: key -> 'a t -> 'a + val remove: key -> 'a t -> 'a t + val mem: key -> 'a t -> bool + val iter: (key -> 'a -> unit) -> 'a t -> unit + val map: ('a -> 'b) -> 'a t -> 'b t + val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + val compare: ('a -> 'a -> int) -> 'a t -> 'a t -> int + val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + type interval = key option * key option + val split: interval -> 'a t -> 'a t + val minimum: 'a t -> key * 'a + val find_remove: key -> 'a t -> 'a * 'a t + val update: key -> ('a -> 'a) -> 'a t -> 'a t + val restrict: (key -> bool) -> 'a t -> 'a t + end + +module Make(Ord: OrderedType) = struct + + type key = Ord.t + + type 'a t = + Empty + | Node of 'a t * key * 'a * 'a t * int + + let height = function + Empty -> 0 + | Node(_,_,_,_,h) -> h + + let create l x d r = + let hl = height l and hr = height r in + Node(l, x, d, r, (if hl >= hr then hl + 1 else hr + 1)) + + let bal l x d r = + let hl = match l with Empty -> 0 | Node(_,_,_,_,h) -> h in + let hr = match r with Empty -> 0 | Node(_,_,_,_,h) -> h in + if hl > hr + 2 then begin + match l with + Empty -> invalid_arg "Map.bal" + | Node(ll, lv, ld, lr, _) -> + if height ll >= height lr then + create ll lv ld (create lr x d r) + else begin + match lr with + Empty -> invalid_arg "Map.bal" + | Node(lrl, lrv, lrd, lrr, _)-> + create (create ll lv ld lrl) lrv lrd (create lrr x d r) + end + end else if hr > hl + 2 then begin + match r with + Empty -> invalid_arg "Map.bal" + | Node(rl, rv, rd, rr, _) -> + if height rr >= height rl then + create (create l x d rl) rv rd rr + else begin + match rl with + Empty -> invalid_arg "Map.bal" + | Node(rll, rlv, rld, rlr, _) -> + create (create l x d rll) rlv rld (create rlr rv rd rr) + end + end else + Node(l, x, d, r, (if hl >= hr then hl + 1 else hr + 1)) + + let empty = Empty + + let is_empty = function Empty -> true | _ -> false + + let rec add x data = function + Empty -> + Node(Empty, x, data, Empty, 1) + | Node(l, v, d, r, h) -> + let c = Ord.compare x v in + if c = 0 then + Node(l, x, data, r, h) + else if c < 0 then + bal (add x data l) v d r + else + bal l v d (add x data r) + + (* Same as create and bal, but no assumptions are made on the + relative heights of l and r. *) + + let rec join l v d r = + match (l, r) with + (Empty, _) -> add v d r + | (_, Empty) -> add v d l + | (Node(ll, lv, ld, lr, lh), Node(rl, rv, rd, rr, rh)) -> + if lh > rh + 2 then bal ll lv ld (join lr v d r) else + if rh > lh + 2 then bal (join l v d rl) rv rd rr else + create l v d r + + let rec find x = function + Empty -> + raise Not_found + | Node(l, v, d, r, _) -> + let c = Ord.compare x v in + if c = 0 then d + else find x (if c < 0 then l else r) + + let rec mem x = function + Empty -> + false + | Node(l, v, d, r, _) -> + let c = Ord.compare x v in + c = 0 || mem x (if c < 0 then l else r) + + let rec min_binding = function + Empty -> raise Not_found + | Node(Empty, x, d, r, _) -> (x, d) + | Node(l, x, d, r, _) -> min_binding l + + let rec remove_min_binding = function + Empty -> invalid_arg "Map.remove_min_elt" + | Node(Empty, x, d, r, _) -> r + | Node(l, x, d, r, _) -> bal (remove_min_binding l) x d r + + let merge t1 t2 = + match (t1, t2) with + (Empty, t) -> t + | (t, Empty) -> t + | (_, _) -> + let (x, d) = min_binding t2 in + bal t1 x d (remove_min_binding t2) + + let rec remove x = function + Empty -> + Empty + | Node(l, v, d, r, h) -> + let c = Ord.compare x v in + if c = 0 then + merge l r + else if c < 0 then + bal (remove x l) v d r + else + bal l v d (remove x r) + + let rec iter f = function + Empty -> () + | Node(l, v, d, r, _) -> + iter f l; f v d; iter f r + + let rec map f = function + Empty -> Empty + | Node(l, v, d, r, h) -> Node(map f l, v, f d, map f r, h) + + let rec mapi f = function + Empty -> Empty + | Node(l, v, d, r, h) -> Node(mapi f l, v, f v d, mapi f r, h) + + let rec fold f m accu = + match m with + Empty -> accu + | Node(l, v, d, r, _) -> + fold f r (f v d (fold f l accu)) + + type 'a enumeration = End | More of key * 'a * 'a t * 'a enumeration + + let rec cons_enum m e = + match m with + Empty -> e + | Node(l, v, d, r, _) -> cons_enum l (More(v, d, r, e)) + + let compare cmp m1 m2 = + let rec compare_aux e1 e2 = + match (e1, e2) with + (End, End) -> 0 + | (End, _) -> -1 + | (_, End) -> 1 + | (More(v1, d1, r1, e1), More(v2, d2, r2, e2)) -> + let c = Ord.compare v1 v2 in + if c <> 0 then c else + let c = cmp d1 d2 in + if c <> 0 then c else + compare_aux (cons_enum r1 e1) (cons_enum r2 e2) + in compare_aux (cons_enum m1 End) (cons_enum m2 End) + + let equal cmp m1 m2 = + let rec equal_aux e1 e2 = + match (e1, e2) with + (End, End) -> true + | (End, _) -> false + | (_, End) -> false + | (More(v1, d1, r1, e1), More(v2, d2, r2, e2)) -> + Ord.compare v1 v2 = 0 && cmp d1 d2 && + equal_aux (cons_enum r1 e1) (cons_enum r2 e2) + in equal_aux (cons_enum m1 End) (cons_enum m2 End) + + (* Intervals for splitting. An interval consists of a lower bound + and an upper bound, each of which can be absent. A key is + considered to lie within the interval if it is both greater than + (or equal to) the lower bound (if present) and less than (or + equal to) the upper bound (if present). *) + + type interval = + key option * key option + + (* Splitting. split interval m returns a new map consisting of + all bindings in m whose keys are within interval. *) + + let rec split ((lo, hi) as interval) = function + Empty -> + Empty + | Node(l, v, d, r, _) -> + let clo = Ord.compare v lo in + if clo < 0 then + (* v < lo *) + split interval r + else if clo = 0 then + (* v = lo *) + add v d (splithi hi r) + else + (* v > lo *) + let chi = Ord.compare v hi in + if chi < 0 then + (* v < hi *) + join (splitlo lo l) v d (splithi hi r) + else if chi = 0 then + (* v = hi *) + add v d (splitlo lo l) + else + (* v > hi *) + split interval l + + and splitlo lo = function + Empty -> + Empty + | Node(l, v, d, r, _) -> + let c = Ord.compare v lo in + if c < 0 then + (* v < lo *) + splitlo lo r + else if c = 0 then + (* v = lo *) + add v d r + else + (* v > lo *) + join (splitlo lo l) v d r + + and splithi hi = function + Empty -> + Empty + | Node(l, v, d, r, _) -> + let c = Ord.compare v hi in + if c < 0 then + (* v < hi *) + join l v d (splithi hi r) + else if c = 0 then + (* v = hi *) + add v d l + else + (* v > hi *) + splithi hi l + + (* Splitting. This is the public entry point. *) + + let split interval m = + match interval with + | None, None -> + m + | Some lo, None -> + splitlo lo m + | None, Some hi -> + splithi hi m + | Some lo, Some hi -> + split (lo, hi) m + + (* Finding the minimum key in a map. *) + + let rec minimum key data m = + match m with + | Empty -> + (key, data) + | Node (l, k, d, _, _) -> + minimum k d l + + let minimum = function + | Empty -> + raise Not_found + | Node (l, k, d, _, _) -> + minimum k d l + + (* Finding an element and removing it in one single traversal. *) + + let find_remove x m = + let data = ref None in + let rec remove = function + | Empty -> + raise Not_found + | Node(l, v, d, r, h) -> + let c = Ord.compare x v in + if c = 0 then begin + data := Some d; + merge l r + end + else if c < 0 then + bal (remove l) v d r + else + bal l v d (remove r) + in + let m = remove m in + match !data with + | None -> + assert false + | Some d -> + d, m + + (* Updating the data associated with an element in one single traversal. *) + + exception Unmodified + + let rec update x f m = + let rec update = function + | Empty -> + assert false + | Node(l, v, d, r, h) -> + let c = Ord.compare x v in + if c = 0 then + let d' = f d in + if d == d' then + raise Unmodified + else + Node (l, v, d', r, h) + else if c < 0 then + Node (update l, v, d, r, h) + else + Node (l, v, d, update r, h) + in + try + update m + with Unmodified -> + m + + (* Restricting the domain of a map. *) + + let restrict p m = + fold (fun x d m -> + if p x then + add x d m + else + m + ) m empty + + +end diff --git a/src/utilities/myMap.mli b/src/utilities/myMap.mli new file mode 100644 index 0000000..578bbc4 --- /dev/null +++ b/src/utilities/myMap.mli @@ -0,0 +1,143 @@ +(***********************************************************************) +(* *) +(* Objective Caml *) +(* *) +(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) +(* *) +(* Copyright 1996 Institut National de Recherche en Informatique et *) +(* en Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU Library General Public License, with *) +(* the special exception on linking described in file ../LICENSE. *) +(* *) +(***********************************************************************) + +(* $Id: myMap.mli,v 1.3 2006/02/17 16:19:52 pottier Exp $ *) + +(** Association tables over ordered types. + + This module implements applicative association tables, also known as + finite maps or dictionaries, given a total ordering function + over the keys. + All operations over maps are purely applicative (no side-effects). + The implementation uses balanced binary trees, and therefore searching + and insertion take time logarithmic in the size of the map. +*) + +module type OrderedType = + sig + type t + (** The type of the map keys. *) + val compare : t -> t -> int + (** A total ordering function over the keys. + This is a two-argument function [f] such that + [f e1 e2] is zero if the keys [e1] and [e2] are equal, + [f e1 e2] is strictly negative if [e1] is smaller than [e2], + and [f e1 e2] is strictly positive if [e1] is greater than [e2]. + Example: a suitable ordering function is the generic structural + comparison function {!Pervasives.compare}. *) + end +(** Input signature of the functor {!Map.Make}. *) + +module type S = + sig + type key + (** The type of the map keys. *) + + type (+'a) t + (** The type of maps from type [key] to type ['a]. *) + + val empty: 'a t + (** The empty map. *) + + val is_empty: 'a t -> bool + (** Test whether a map is empty or not. *) + + val add: key -> 'a -> 'a t -> 'a t + (** [add x y m] returns a map containing the same bindings as + [m], plus a binding of [x] to [y]. If [x] was already bound + in [m], its previous binding disappears. *) + + val find: key -> 'a t -> 'a + (** [find x m] returns the current binding of [x] in [m], + or raises [Not_found] if no such binding exists. *) + + val remove: key -> 'a t -> 'a t + (** [remove x m] returns a map containing the same bindings as + [m], except for [x] which is unbound in the returned map. *) + + val mem: key -> 'a t -> bool + (** [mem x m] returns [true] if [m] contains a binding for [x], + and [false] otherwise. *) + + val iter: (key -> 'a -> unit) -> 'a t -> unit + (** [iter f m] applies [f] to all bindings in map [m]. + [f] receives the key as first argument, and the associated value + as second argument. The bindings are passed to [f] in increasing + order with respect to the ordering over the type of the keys. + Only current bindings are presented to [f]: + bindings hidden by more recent bindings are not passed to [f]. *) + + val map: ('a -> 'b) -> 'a t -> 'b t + (** [map f m] returns a map with same domain as [m], where the + associated value [a] of all bindings of [m] has been + replaced by the result of the application of [f] to [a]. + The bindings are passed to [f] in increasing order + with respect to the ordering over the type of the keys. *) + + val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t + (** Same as {!Map.S.map}, but the function receives as arguments both the + key and the associated value for each binding of the map. *) + + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + (** [fold f m a] computes [(f kN dN ... (f k1 d1 a)...)], + where [k1 ... kN] are the keys of all bindings in [m] + (in increasing order), and [d1 ... dN] are the associated data. *) + + val compare: ('a -> 'a -> int) -> 'a t -> 'a t -> int + (** Total ordering between maps. The first argument is a total ordering + used to compare data associated with equal keys in the two maps. *) + + val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + (** [equal cmp m1 m2] tests whether the maps [m1] and [m2] are + equal, that is, contain equal keys and associate them with + equal data. [cmp] is the equality predicate used to compare + the data associated with the keys. *) + + type interval = + key option * key option + (** A type of key intervals. An interval consists of a lower bound + and an upper bound, each of which can be absent. A key is + considered to lie within the interval if it is both greater than + (or equal to) the lower bound (if present) and less than (or + equal to) the upper bound (if present). *) + + val split: interval -> 'a t -> 'a t + (* [split interval m] is a map that consists of all bindings in [m] + whose keys lie within [interval]. *) + + val minimum: 'a t -> key * 'a + (* [minimum m] returns the binding that corresponds to the minimum + (smallest) key within the map [m]. If [m] is empty, [Not_found] + is raised. *) + + val find_remove: key -> 'a t -> 'a * 'a t + (** [find_remove x m] returns a pair of the current binding of [x] + in [m], and a map containing the same bindings as [m], except + for [x] which is unbound in the returned map. [Not_found] is + raised if no binding for [x] exists. *) + + val update: key -> ('a -> 'a) -> 'a t -> 'a t + (** If [m] maps [x] to [d], then [update x f m] maps [x] to [f d] + and coincides with [m] elsewhere. A binding for [x] in [m] + must exist. *) + + val restrict: (key -> bool) -> 'a t -> 'a t + (** [restrict p m] is the restriction of the map [m] to only + the keys that satisfy predicate [p]. *) + + end +(** Output signature of the functor {!Map.Make}. *) + +module Make (Ord : OrderedType) : S with type key = Ord.t +(** Functor building an implementation of the map structure + given a totally ordered type. *) diff --git a/src/utilities/option.ml b/src/utilities/option.ml new file mode 100644 index 0000000..6cf7a83 --- /dev/null +++ b/src/utilities/option.ml @@ -0,0 +1,27 @@ +(* Pasted from Pottier's PP compiler *) + +let map f = function + | None -> + None + | Some x -> + Some (f x) + +let iter f = function + | None -> + () + | Some x -> + f x + +let fold f o accu = + match o with + | None -> + accu + | Some x -> + f x accu + +let print printer () = function + | None -> + "" + | Some x -> + printer () x + diff --git a/src/utilities/option.mli b/src/utilities/option.mli new file mode 100644 index 0000000..cbbe7b1 --- /dev/null +++ b/src/utilities/option.mli @@ -0,0 +1,12 @@ + +(** This module provides some functions to manipulate values of type + [option]. *) + +(* Pasted from Pottier's PP compiler *) + +open PrintPottier + +val map: ('a -> 'b) -> 'a option -> 'b option +val iter: ('a -> unit) -> 'a option -> unit +val fold: ('a -> 'b -> 'b) -> 'a option -> 'b -> 'b +val print: 'a printer -> 'a option printer diff --git a/src/utilities/optionsParsing.ml b/src/utilities/optionsParsing.ml new file mode 100644 index 0000000..9f46bc4 --- /dev/null +++ b/src/utilities/optionsParsing.ml @@ -0,0 +1,16 @@ +let options = ref [] + +let register o = + options := o @ !options + +let results () = + let usage_msg = + "Usage: " + ^ (Filename.basename Sys.executable_name) + ^ " [options] file..." + in + let extra_arguments = ref [] in + Arg.parse (Arg.align !options) + (fun s -> extra_arguments := s :: !extra_arguments) + usage_msg; + !extra_arguments diff --git a/src/utilities/position.ml b/src/utilities/position.ml new file mode 100644 index 0000000..228466e --- /dev/null +++ b/src/utilities/position.ml @@ -0,0 +1,134 @@ +open Lexing + +type t = + { + start_p : Lexing.position; + end_p : Lexing.position + } + +type position = t + +type 'a located = + { + value : 'a; + position : t; + } + +let value { value = v } = + v + +let position { position = p } = + p + +let destruct p = + (p.value, p.position) + +let with_pos p v = + { + value = v; + position = p; + } + +let with_poss p1 p2 v = + with_pos { start_p = p1; end_p = p2 } v + +let map f v = + { + value = f v.value; + position = v.position; + } + +let iter f { value = v } = + f v + +let mapd f v = + let w1, w2 = f v.value in + let pos = v.position in + ({ value = w1; position = pos }, { value = w2; position = pos }) + +let dummy = + { + start_p = Lexing.dummy_pos; + end_p = Lexing.dummy_pos + } + +let unknown_pos v = + { + value = v; + position = dummy + } + +let start_of_position p = p.start_p + +let end_of_position p = p.end_p + +let filename_of_position p = + p.start_p.Lexing.pos_fname + +let line p = + p.pos_lnum + +let column p = + p.pos_cnum - p.pos_bol + +let characters p1 p2 = + (column p1, p2.pos_cnum - p1.pos_bol) (* intentionally [p1.pos_bol] *) + +let join x1 x2 = + { + start_p = if x1 = dummy then x2.start_p else x1.start_p; + end_p = if x2 = dummy then x1.end_p else x2.end_p + } + +let lex_join x1 x2 = + { + start_p = x1; + end_p = x2 + } + +let join_located l1 l2 f = + { + value = f l1.value l2.value; + position = join l1.position l2.position; + } + +let string_of_lex_pos p = + let c = p.pos_cnum - p.pos_bol in + (string_of_int p.pos_lnum)^":"^(string_of_int c) + +let string_of_pos p = + let filename = filename_of_position p in + let l = line p.start_p in + let c1, c2 = characters p.start_p p.end_p in + if filename = "" then + Printf.sprintf "Line %d, characters %d-%d" l c1 c2 + else + Printf.sprintf "File \"%s\", line %d, characters %d-%d" filename l c1 c2 + +let pos_or_undef = function + | None -> dummy + | Some x -> x + +let cpos lexbuf = + { + start_p = Lexing.lexeme_start_p lexbuf; + end_p = Lexing.lexeme_end_p lexbuf; + } + +let with_cpos lexbuf v = + with_pos (cpos lexbuf) v + +let string_of_cpos lexbuf = + string_of_pos (cpos lexbuf) + +let joinf f t1 t2 = + join (f t1) (f t2) + +let ljoinf f = + List.fold_left (fun p t -> join p (f t)) dummy + +let join_located_list ls f = + { + value = f (List.map (fun l -> l.value) ls); + position = ljoinf (fun x -> x.position) ls + } diff --git a/src/utilities/position.mli b/src/utilities/position.mli new file mode 100644 index 0000000..ddb18d2 --- /dev/null +++ b/src/utilities/position.mli @@ -0,0 +1,106 @@ +(** Extension of standard library's positions. *) + +(** {2 Extended lexing positions} *) + +(** Abstract type for pairs of positions in the lexing stream. *) +type t +type position = t + +(** Decoration of a value with a position. *) +type 'a located = + { + value : 'a; + position : t; + } + +(** [value dv] returns the raw value that underlies the + decorated value [dv]. *) +val value: 'a located -> 'a + +(** [position dv] returns the position that decorates the + decorated value [dv]. *) +val position: 'a located -> t + +(** [destruct dv] returns the couple of position and value + of a decorated value [dv]. *) +val destruct: 'a located -> 'a * t + +(** [with_pos p v] decorates [v] with a position [p]. *) +val with_pos : t -> 'a -> 'a located + +(** [with_cpos p v] decorates [v] with a lexical position [p]. *) +val with_cpos: Lexing.lexbuf -> 'a -> 'a located + +(** [with_poss start stop v] decorates [v] with a position [(start, stop)]. *) +val with_poss : Lexing.position -> Lexing.position -> 'a -> 'a located + +(** [unknown_pos x] decorates [v] with an unknown position. *) +val unknown_pos : 'a -> 'a located + +(** This value is used when an object does not come from a particular + input location. *) +val dummy: t + +(** [map f v] extends the decoration from [v] to [f v]. *) +val map: ('a -> 'b) -> 'a located -> 'b located + +(** [iter f dv] applies [f] to the value inside [dv]. *) +val iter: ('a -> unit) -> 'a located -> unit + +(** [mapd f v] extends the decoration from [v] to both members of the pair + [f v]. *) +val mapd: ('a -> 'b1 * 'b2) -> 'a located -> 'b1 located * 'b2 located + +(** {2 Accessors} *) + +(** [column p] returns the number of characters from the + beginning of the line of the Lexing.position [p]. *) +val column : Lexing.position -> int + +(** [column p] returns the line number of to the Lexing.position [p]. *) +val line : Lexing.position -> int + +(** [characters p1 p2] returns the character interval + between [p1] and [p2] assuming they are located in the same + line. *) +val characters : Lexing.position -> Lexing.position -> int * int + +(** [start_of_position p] returns the beginning of a position [p]. *) +val start_of_position: t -> Lexing.position + +(** [end_of_position p] returns the end of a position [p]. *) +val end_of_position: t -> Lexing.position + +(** [filename_of_position p] returns the filename of a position [p]. *) +val filename_of_position: t -> string + +(** {2 Position handling} *) + +(** [join p1 p2] returns a position that starts where [p1] + starts and stops where [p2] stops. *) +val join : t -> t -> t + +(** [lex_join l1 l2] returns a position that starts at [l1] and stops + at [l2]. *) +val lex_join : Lexing.position -> Lexing.position -> t + +(** [string_of_lex_pos p] returns a string representation for + the lexing position [p]. *) +val string_of_lex_pos : Lexing.position -> string + +(** [string_of_pos p] returns the standard (Emacs-like) representation + of the position [p]. *) +val string_of_pos : t -> string + +(** [pos_or_undef po] is the identity function except if po = None, + in that case, it returns [undefined_position]. *) +val pos_or_undef : t option -> t + +(** {2 Interaction with the lexer runtime} *) + +(** [cpos lexbuf] returns the current position of the lexer. *) +val cpos : Lexing.lexbuf -> t + +(** [string_of_cpos p] returns a string representation of + the lexer's current position. *) +val string_of_cpos : Lexing.lexbuf -> string diff --git a/src/utilities/print.ml b/src/utilities/print.ml new file mode 100644 index 0000000..a7303d3 --- /dev/null +++ b/src/utilities/print.ml @@ -0,0 +1,172 @@ +(* Pasted from Pottier's PP compiler *) + +open Printf + +type punctuation = + unit -> string + +type 'a printer = + unit -> 'a -> string + +(* ------------------------------------------------------------------------- *) + +(* Newlines and indentation. *) + +let maxindent = + 120 + +let whitespace = + String.make maxindent ' ' + +let indentation = + ref 0 + +let nl () = + "\n" ^ String.sub whitespace 0 !indentation + +let indent ofs producer () x = + let old_indentation = !indentation in + let new_indentation = old_indentation + ofs in + if new_indentation <= maxindent then + indentation := new_indentation; + let result = sprintf "%t%a" nl producer x in + indentation := old_indentation; + result + +(* ------------------------------------------------------------------------- *) + +(* Lists. *) + +let rec list elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%a%a" elem x (list elem) xs + +let rec preclist delim elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%t%a%a" delim elem x (preclist delim elem) xs + +let rec termlist delim elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%a%t%a" elem x delim (termlist delim elem) xs + +let seplist sep elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%a%a" elem x (preclist sep elem) xs + +let annlist announcement list () xs = + match xs with + | [] -> + "" + | _ :: _ -> + sprintf "%t%a" announcement list xs + +(* ------------------------------------------------------------------------- *) + +(* Punctuation. *) + +let space () = + sprintf " " + +let comma () = + sprintf ", " + +let semicolon () = + sprintf "; " + +let var () = + sprintf "var " + +let seminl () = + sprintf "%t%t" semicolon nl + +let nlspace k () = + sprintf "%t%s" nl (String.make k ' ') + +let nlnl () = + sprintf "%t%t" nl nl + +(* ------------------------------------------------------------------------- *) + +(* [atmost n delimiter stop] normally prints a [delimiter], except that, + every [n] calls, it prints a [stop] in addition. *) + +let atmost n (delimiter : punctuation) (stop : punctuation) : punctuation = + let i = + ref 0 + in + function () -> + incr i; + delimiter() ^ + if !i = n then begin + i := 0; + stop() + end + else + "" + +(* ------------------------------------------------------------------------- *) + +(* Tables. *) + +let width column = + List.fold_left (fun width x -> + max width (String.length x) + ) 0 column + +let pad width x = + let y = String.make width ' ' in + String.blit x 0 y 0 (String.length x); + y + +let pad column = + List.map (pad (width column)) column + +let rec zipcat column1 column2 = + List.fold_right2 (fun x1 x2 column -> + (x1 ^ x2) :: column + ) column1 column2 [] + +let catenate columns = + match columns with + | [] -> + [] + | column :: columns -> + List.fold_left (fun table column -> + zipcat table (pad column) + ) (pad column) columns + +let transposerev lines = + match lines with + | [] -> + [] + | line :: lines -> + List.fold_left (fun columns line -> + List.fold_right2 (fun x column columns -> + (x :: column) :: columns + ) line columns [] + ) (List.map (fun x -> [ x ]) line) lines + +(* ------------------------------------------------------------------------- *) + +(* Conditional. *) + +let showif flag printer x = + if flag then begin + Printf.fprintf stdout "%s%!" (sprintf "%a" printer x); + x + end + else + x + diff --git a/src/utilities/print.mli b/src/utilities/print.mli new file mode 100644 index 0000000..ff95156 --- /dev/null +++ b/src/utilities/print.mli @@ -0,0 +1,73 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module provides printing utilities. *) + +type punctuation = + unit -> string + +type 'a printer = + unit -> 'a -> string + +(* [nl] prints a newline character and a certain amount of + whitespace that reflects the current indentation level. *) + +val nl: punctuation + +(* [indent ofs] transforms a printer into another printer + that indents material [ofs] characters to the right. *) + +val indent: int -> 'a printer -> 'a printer + +(* [list] prints a list without any delimiters. *) + +val list: 'a printer -> 'a list printer + +(* [preclist] prints a list where a delimiter precedes every + element. *) + +val preclist: punctuation -> 'a printer -> 'a list printer + +(* [termlist] prints a list where a delimiter terminates every + element. *) + +val termlist: punctuation -> 'a printer -> 'a list printer + +(* [seplist] prints a list where a separator separates every two + consecutive elements. *) + +val seplist: punctuation -> 'a printer -> 'a list printer + +(* [annlist] prints nothing if its list argument is empty, and prints + an announcement followed by the list if the list is nonempty. *) + +val annlist: punctuation -> 'a list printer -> 'a list printer + +(* Punctuation. *) + +val space: punctuation +val comma: punctuation +val semicolon: punctuation +val var: punctuation +val seminl: punctuation +val nlspace: int -> punctuation +val nlnl: punctuation + +(* [atmost n delimiter stop] normally prints a [delimiter], except that, + every [n] calls, it prints a [stop] in addition. *) + +val atmost: int -> punctuation -> punctuation -> punctuation + +(* [catenate] turns a list of columns into a single column, adding + padding (whitespace) to enforce alignment. *) + +val catenate: string list list -> string list + +(* [transposerev] turns a reversed list of lines into a list of columns. *) + +val transposerev: string list list -> string list list + +(* [showif flag printer x] displays [x] on standard output using + [printer] when [flag] is set. It returns [x]. *) + +val showif: bool -> 'a printer -> 'a -> 'a + diff --git a/src/utilities/printCFG.ml b/src/utilities/printCFG.ml new file mode 100644 index 0000000..37be7fb --- /dev/null +++ b/src/utilities/printCFG.ml @@ -0,0 +1,21 @@ +(* Pasted from Pottier's PP compiler *) + +open PrintPottier + +let print_graph instruction successors () (graph, entry) = + + (* Print instructions in depth-first order; this is a + rather natural and readable order. *) + + let rec visit (visited, lines) l = + if Label.Set.mem l visited then + visited, lines + else + let visited = Label.Set.add l visited in + let i = Label.Map.find l graph in + let lines = instruction l i :: lines in + List.fold_left visit (visited, lines) (successors i) + in + let _, lines = visit (Label.Set.empty, []) entry in + String.concat "\n" (catenate (transposerev lines)) + diff --git a/src/utilities/printCFG.mli b/src/utilities/printCFG.mli new file mode 100644 index 0000000..c49c334 --- /dev/null +++ b/src/utilities/printCFG.mli @@ -0,0 +1,12 @@ + +(** This module provides a function to print Control Flow Graphs. *) + +(* Pasted from Pottier's PP compiler *) + +open PrintPottier + +val print_graph: + (Label.t -> 'instruction -> string list) -> (* prints instruction [i] at label [l] *) + ('instruction -> Label.t list) -> (* provides succcessors of instruction [i] *) + ('instruction Label.Map.t * Label.t) printer (* control flow graph and entry point printer *) + diff --git a/src/utilities/printPottier.ml b/src/utilities/printPottier.ml new file mode 100644 index 0000000..a7303d3 --- /dev/null +++ b/src/utilities/printPottier.ml @@ -0,0 +1,172 @@ +(* Pasted from Pottier's PP compiler *) + +open Printf + +type punctuation = + unit -> string + +type 'a printer = + unit -> 'a -> string + +(* ------------------------------------------------------------------------- *) + +(* Newlines and indentation. *) + +let maxindent = + 120 + +let whitespace = + String.make maxindent ' ' + +let indentation = + ref 0 + +let nl () = + "\n" ^ String.sub whitespace 0 !indentation + +let indent ofs producer () x = + let old_indentation = !indentation in + let new_indentation = old_indentation + ofs in + if new_indentation <= maxindent then + indentation := new_indentation; + let result = sprintf "%t%a" nl producer x in + indentation := old_indentation; + result + +(* ------------------------------------------------------------------------- *) + +(* Lists. *) + +let rec list elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%a%a" elem x (list elem) xs + +let rec preclist delim elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%t%a%a" delim elem x (preclist delim elem) xs + +let rec termlist delim elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%a%t%a" elem x delim (termlist delim elem) xs + +let seplist sep elem () xs = + match xs with + | [] -> + "" + | x :: xs -> + sprintf "%a%a" elem x (preclist sep elem) xs + +let annlist announcement list () xs = + match xs with + | [] -> + "" + | _ :: _ -> + sprintf "%t%a" announcement list xs + +(* ------------------------------------------------------------------------- *) + +(* Punctuation. *) + +let space () = + sprintf " " + +let comma () = + sprintf ", " + +let semicolon () = + sprintf "; " + +let var () = + sprintf "var " + +let seminl () = + sprintf "%t%t" semicolon nl + +let nlspace k () = + sprintf "%t%s" nl (String.make k ' ') + +let nlnl () = + sprintf "%t%t" nl nl + +(* ------------------------------------------------------------------------- *) + +(* [atmost n delimiter stop] normally prints a [delimiter], except that, + every [n] calls, it prints a [stop] in addition. *) + +let atmost n (delimiter : punctuation) (stop : punctuation) : punctuation = + let i = + ref 0 + in + function () -> + incr i; + delimiter() ^ + if !i = n then begin + i := 0; + stop() + end + else + "" + +(* ------------------------------------------------------------------------- *) + +(* Tables. *) + +let width column = + List.fold_left (fun width x -> + max width (String.length x) + ) 0 column + +let pad width x = + let y = String.make width ' ' in + String.blit x 0 y 0 (String.length x); + y + +let pad column = + List.map (pad (width column)) column + +let rec zipcat column1 column2 = + List.fold_right2 (fun x1 x2 column -> + (x1 ^ x2) :: column + ) column1 column2 [] + +let catenate columns = + match columns with + | [] -> + [] + | column :: columns -> + List.fold_left (fun table column -> + zipcat table (pad column) + ) (pad column) columns + +let transposerev lines = + match lines with + | [] -> + [] + | line :: lines -> + List.fold_left (fun columns line -> + List.fold_right2 (fun x column columns -> + (x :: column) :: columns + ) line columns [] + ) (List.map (fun x -> [ x ]) line) lines + +(* ------------------------------------------------------------------------- *) + +(* Conditional. *) + +let showif flag printer x = + if flag then begin + Printf.fprintf stdout "%s%!" (sprintf "%a" printer x); + x + end + else + x + diff --git a/src/utilities/printPottier.mli b/src/utilities/printPottier.mli new file mode 100644 index 0000000..ff95156 --- /dev/null +++ b/src/utilities/printPottier.mli @@ -0,0 +1,73 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module provides printing utilities. *) + +type punctuation = + unit -> string + +type 'a printer = + unit -> 'a -> string + +(* [nl] prints a newline character and a certain amount of + whitespace that reflects the current indentation level. *) + +val nl: punctuation + +(* [indent ofs] transforms a printer into another printer + that indents material [ofs] characters to the right. *) + +val indent: int -> 'a printer -> 'a printer + +(* [list] prints a list without any delimiters. *) + +val list: 'a printer -> 'a list printer + +(* [preclist] prints a list where a delimiter precedes every + element. *) + +val preclist: punctuation -> 'a printer -> 'a list printer + +(* [termlist] prints a list where a delimiter terminates every + element. *) + +val termlist: punctuation -> 'a printer -> 'a list printer + +(* [seplist] prints a list where a separator separates every two + consecutive elements. *) + +val seplist: punctuation -> 'a printer -> 'a list printer + +(* [annlist] prints nothing if its list argument is empty, and prints + an announcement followed by the list if the list is nonempty. *) + +val annlist: punctuation -> 'a list printer -> 'a list printer + +(* Punctuation. *) + +val space: punctuation +val comma: punctuation +val semicolon: punctuation +val var: punctuation +val seminl: punctuation +val nlspace: int -> punctuation +val nlnl: punctuation + +(* [atmost n delimiter stop] normally prints a [delimiter], except that, + every [n] calls, it prints a [stop] in addition. *) + +val atmost: int -> punctuation -> punctuation -> punctuation + +(* [catenate] turns a list of columns into a single column, adding + padding (whitespace) to enforce alignment. *) + +val catenate: string list list -> string list + +(* [transposerev] turns a reversed list of lines into a list of columns. *) + +val transposerev: string list list -> string list list + +(* [showif flag printer x] displays [x] on standard output using + [printer] when [flag] is set. It returns [x]. *) + +val showif: bool -> 'a printer -> 'a -> 'a + diff --git a/src/utilities/prioritySet.ml b/src/utilities/prioritySet.ml new file mode 100644 index 0000000..7b8b560 --- /dev/null +++ b/src/utilities/prioritySet.ml @@ -0,0 +1,146 @@ +(* Pasted from Pottier's PP compiler *) + +(* This module offers sets of elements where each element carries an + integer priority. All operations execute in logarithmic time with + respect to the number of elements in the set. *) + +module Make (X : Set.OrderedType) += struct + + (* First, define normal sets and maps. *) + + module Set = Set.Make(X) + + module Map = MyMap.Make(X) + + (* Next, define maps of integers to nonempty sets of elements. *) + + module IntMap = struct + + module M = MyMap.Make (struct + type t = int + let compare = compare + end) + + include M + + module H = SetMap.MakeHetero(Set)(M) + + let update = H.update + + end + + (* Now, define priority sets. *) + + type t = { + + (* A mapping of elements to priorities. *) + + priority: int Map.t; + + (* A mapping of priorities to sets of elements. By convention, a + priority has no entry in this table if that entry would be an + empty set of elements. This allows finding the + lowest-priority element in logarithmic time. *) + + level: Set.t IntMap.t + + } + + (* [empty] is the empty set. *) + + let empty = + { + priority = Map.empty; + level = IntMap.empty + } + + (* [priority x s] looks up the priority of element [x]. *) + + let priority x s = + try + Map.find x s.priority + with Not_found -> + assert false + + (* [add x p s] inserts element [x] with priority [p]. *) + + let add x p s = + assert (not (Map.mem x s.priority)); + { + priority = Map.add x p s.priority; + level = IntMap.update p (Set.add x) s.level + } + + (* [remove x s] removes element [x]. *) + + let remove x s = + let p, priority = + try + Map.find_remove x s.priority + with Not_found -> + assert false + in + let level = + IntMap.update p (function xs -> + assert (Set.mem x xs); + Set.remove x xs + ) s.level + in + { + priority = priority; + level = level + } + + (* [change x p s] changes the priority of element [x] to [p]. *) + + let change x p1 s = + let p0 = priority x s in + if p0 = p1 then + s + else + { + priority = Map.add x p1 s.priority; (* overriding previous entry *) + level = IntMap.update p1 (Set.add x) (IntMap.update p0 (Set.remove x) s.level) + } + + (* [increment x d s] increases the priority of element [x] by [d]. *) + + let increment x d s = + change x (priority x s + d) s + + (* [incrementifx x p s] increases the priority of element [x] by [d] + if [x] is a member of the priority set. *) + + let incrementifx x d s = + if Map.mem x s.priority then + increment x d s + else + s + + (* [lowest s] returns [Some (x, p)], where element [x] has minimum + priority [p] among all elements of [s]. It returns [None] if [s] + is empty. *) + + let lowest s = + try + let p, xs = IntMap.minimum s.level in (* can fail if set is empty *) + try + Some (Set.choose xs, p) (* cannot fail *) + with Not_found -> + assert false + with Not_found -> + None + + (* [fold f s accu] fold over the set [s]. Elements are presented + to [f] in increasing order of priority. *) + + let fold f s accu = + IntMap.fold (fun p xs accu -> + Set.fold (fun x accu -> + f x p accu + ) xs accu + ) s.level accu + +end + diff --git a/src/utilities/prioritySet.mli b/src/utilities/prioritySet.mli new file mode 100644 index 0000000..def9028 --- /dev/null +++ b/src/utilities/prioritySet.mli @@ -0,0 +1,54 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module offers sets of elements where each element carries an + integer priority. All operations execute in logarithmic time with + respect to the number of elements in the set. *) + +module Make (X : Set.OrderedType) : sig + + (* This is the type of priority sets. *) + + type t + + (* [empty] is the empty set. *) + + val empty: t + + (* [add x p s] inserts element [x] with priority [p]. *) + + val add: X.t -> int -> t -> t + + (* [remove x s] removes element [x]. *) + + val remove: X.t -> t -> t + + (* [change x p s] changes the priority of element [x] to [p]. *) + + val change: X.t -> int -> t -> t + + (* [increment x d s] increases the priority of element [x] by [d]. *) + + val increment: X.t -> int -> t -> t + + (* [incrementifx x p s] increases the priority of element [x] by [d] + if [x] is a member of the priority set. *) + + val incrementifx: X.t -> int -> t -> t + + (* [priority x s] looks up the priority of element [x]. *) + + val priority: X.t -> t -> int + + (* [lowest s] returns [Some (x, p)], where element [x] has minimum + priority [p] among all elements of [s]. It returns [None] if [s] + is empty. *) + + val lowest: t -> (X.t * int) option + + (* [fold f s accu] fold over the set [s]. Elements are presented + to [f] in increasing order of priority. *) + + val fold: (X.t -> int -> 'a -> 'a) -> t -> 'a -> 'a + +end + diff --git a/src/utilities/setMap.ml b/src/utilities/setMap.ml new file mode 100644 index 0000000..1230080 --- /dev/null +++ b/src/utilities/setMap.ml @@ -0,0 +1,226 @@ +(* Pasted from Pottier's PP compiler *) + +(* This signature defines a few operations over maps of keys to + nonempty sets of items. Keys and items can have distinct types, + hence the name [Heterogeneous]. + + These maps can be used to represent directed bipartite graphs whose + source vertices are keys and whose target vertices are items. Each + key is mapped to the set of its successors. *) + +module type Heterogeneous = sig + + (* These are the types of keys, items, and sets of items. *) + + type key + type item + type itemset + + (* This is the type of maps of keys to sets of items. *) + + type t + + (* [find x m] is the item set associated with key [x] in map [m], if + such an association is defined; it is the empty set otherwise. *) + + val find: key -> t -> itemset + + (* [add x is m] extends [m] with a binding of [x] to the item set + [is], if [is] is nonempty. If [is] is empty, it removes [x] from + [m]. *) + + val add: key -> itemset -> t -> t + + (* [update x f m] is [add x (f (find x m)) m]. *) + + val update: key -> (itemset -> itemset) -> t -> t + + (* [mkedge x i m] extends [m] with a binding of [x] to the union of + the set [m x] and the singleton [i], where [m x] is taken to be + empty if undefined. In terms of graphs, [mkedge x i m] extends + the graph [m] with an edge of [x] to [i]. *) + + val mkedge: key -> item -> t -> t + + (* [rmedge x i m] extends [m] with a binding of [x] to the + difference of the set [m x] and the singleton [i], where the + binding is considered undefined if that difference is empty. In + terms of graphs, [rmedge x i m] removes an edge of [x] to [i] + to the graph [m]. *) + + val rmedge: key -> item -> t -> t + + (* [iter] and [fold] iterate over all edges in the graph. *) + + val iter: (key * item -> unit) -> t -> unit + val fold: (key * item -> 'a -> 'a) -> t -> 'a -> 'a + + (* [pick m p] returns an arbitrary edge that satisfies predicate + [p], if the graph contains one. *) + + val pick: t -> (key * item -> bool) -> (key * item) option + +end + +(* This functor offers an implementation of [Heterogeneous] out of + standard implementations of sets and maps. *) + +module MakeHetero + (Set : sig + type elt + type t + val empty: t + val is_empty: t -> bool + val add: elt -> t -> t + val remove: elt -> t -> t + val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a + end) + (Map : sig + type key + type 'a t + val add: key -> 'a -> 'a t -> 'a t + val find: key -> 'a t -> 'a + val remove: key -> 'a t -> 'a t + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + end) += struct + + type key = Map.key + type item = Set.elt + type itemset = Set.t + type t = Set.t Map.t + + let find x m = + try + Map.find x m + with Not_found -> + Set.empty + + let add x is m = + if Set.is_empty is then + Map.remove x m + else + Map.add x is m + + let update x f m = + add x (f (find x m)) m + + let mkedge x i m = + update x (Set.add i) m + + let rmedge x i m = + update x (Set.remove i) m + + let fold f m accu = + Map.fold (fun source targets accu -> + Set.fold (fun target accu -> + f (source, target) accu + ) targets accu + ) m accu + + let iter f m = + fold (fun edge () -> f edge) m () + + exception Picked of (key * item) + + let pick m p = + try + iter (fun edge -> + if p edge then + raise (Picked edge) + ) m; + None + with Picked edge -> + Some edge + +end + +(* This signature defines a few common operations over maps of keys + to sets of keys -- that is, keys and items have the same type, + hence the name [Homogeneous]. + + These maps can be used to represent general directed graphs. *) + +module type Homogeneous = sig + + include Heterogeneous (* [key] and [item] intended to be equal *) + + (* [mkbiedge x1 x2 m] is [mkedge x1 x2 (mkedge x2 x1 m)]. *) + + val mkbiedge: key -> key -> t -> t + + (* [rmbiedge x1 x2 m] is [rmedge x1 x2 (rmedge x2 x1 m)]. *) + + val rmbiedge: key -> key -> t -> t + + (* [reverse m] is the reverse of graph [m]. *) + + val reverse: t -> t + + (* [restrict m] is the graph obtained by keeping only the vertices + that satisfy predicate [p]. *) + + val restrict: (key -> bool) -> t -> t + +end + +module MakeHomo + (Set : sig + type elt + type t + val empty: t + val is_empty: t -> bool + val add: elt -> t -> t + val remove: elt -> t -> t + val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a + val filter: (elt -> bool) -> t -> t + end) + (Map : sig + type key = Set.elt + type 'a t + val empty: 'a t + val add: key -> 'a -> 'a t -> 'a t + val find: key -> 'a t -> 'a + val remove: key -> 'a t -> 'a t + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + end) += struct + + include MakeHetero(Set)(Map) + + let symmetric transform x1 x2 m = + transform x1 x2 (transform x2 x1 m) + + let mkbiedge = + symmetric mkedge + + let rmbiedge = + symmetric rmedge + + let reverse m = + Map.fold (fun source targets predecessors -> + Set.fold (fun target predecessors -> + + (* We have a direct edge from [source] to [target]. Thus, we + record the existence of a reverse edge from [target] to + [source]. *) + + mkedge target source predecessors + + ) targets predecessors + ) m Map.empty + + let restrict p m = + Map.fold (fun source targets m -> + if p source then + let targets = Set.filter p targets in + if Set.is_empty targets then + m + else + Map.add source targets m + else + m + ) m Map.empty + +end + diff --git a/src/utilities/setMap.mli b/src/utilities/setMap.mli new file mode 100644 index 0000000..136310a --- /dev/null +++ b/src/utilities/setMap.mli @@ -0,0 +1,144 @@ +(* Pasted from Pottier's PP compiler *) + +(** This signature defines a few operations over maps of keys to + nonempty sets of items. Keys and items can have distinct types, + hence the name [Heterogeneous]. + + These maps can be used to represent directed bipartite graphs whose + source vertices are keys and whose target vertices are items. Each + key is mapped to the set of its successors. *) + +module type Heterogeneous = sig + + (* These are the types of keys, items, and sets of items. *) + + type key + type item + type itemset + + (* This is the type of maps of keys to sets of items. *) + + type t + + (* [find x m] is the item set associated with key [x] in map [m], if + such an association is defined; it is the empty set otherwise. *) + + val find: key -> t -> itemset + + (* [add x is m] extends [m] with a binding of [x] to the item set + [is], if [is] is nonempty. If [is] is empty, it removes [x] from + [m]. *) + + val add: key -> itemset -> t -> t + + (* [update x f m] is [add x (f (find x m)) m]. *) + + val update: key -> (itemset -> itemset) -> t -> t + + (* [mkedge x i m] extends [m] with a binding of [x] to the union of + the set [m x] and the singleton [i], where [m x] is taken to be + empty if undefined. In terms of graphs, [mkedge x i m] extends + the graph [m] with an edge of [x] to [i]. *) + + val mkedge: key -> item -> t -> t + + (* [rmedge x i m] extends [m] with a binding of [x] to the + difference of the set [m x] and the singleton [i], where the + binding is considered undefined if that difference is empty. In + terms of graphs, [rmedge x i m] removes an edge of [x] to [i] + to the graph [m]. *) + + val rmedge: key -> item -> t -> t + + (* [iter] and [fold] iterate over all edges in the graph. *) + + val iter: (key * item -> unit) -> t -> unit + val fold: (key * item -> 'a -> 'a) -> t -> 'a -> 'a + + (* [pick m p] returns an arbitrary edge that satisfies predicate + [p], if the graph contains one. *) + + val pick: t -> (key * item -> bool) -> (key * item) option + +end + +(* This functor offers an implementation of [Heterogeneous] out of + standard implementations of sets and maps. *) + +module MakeHetero + (Set : sig + type elt + type t + val empty: t + val is_empty: t -> bool + val add: elt -> t -> t + val remove: elt -> t -> t + val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a + end) + (Map : sig + type key + type 'a t + val add: key -> 'a -> 'a t -> 'a t + val find: key -> 'a t -> 'a + val remove: key -> 'a t -> 'a t + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + end) + : Heterogeneous with type key = Map.key + and type item = Set.elt + and type itemset = Set.t + and type t = Set.t Map.t + +(* This signature defines a few common operations over maps of keys + to sets of keys -- that is, keys and items have the same type, + hence the name [Homogeneous]. + + These maps can be used to represent general directed graphs. *) + +module type Homogeneous = sig + + include Heterogeneous (* [key] and [item] intended to be equal *) + + (* [mkbiedge x1 x2 m] is [mkedge x1 x2 (mkedge x2 x1 m)]. *) + + val mkbiedge: key -> key -> t -> t + + (* [rmbiedge x1 x2 m] is [rmedge x1 x2 (rmedge x2 x1 m)]. *) + + val rmbiedge: key -> key -> t -> t + + (* [reverse m] is the reverse of graph [m]. *) + + val reverse: t -> t + + (* [restrict m] is the graph obtained by keeping only the vertices + that satisfy predicate [p]. *) + + val restrict: (key -> bool) -> t -> t + +end + +module MakeHomo + (Set : sig + type elt + type t + val empty: t + val is_empty: t -> bool + val add: elt -> t -> t + val remove: elt -> t -> t + val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a + val filter: (elt -> bool) -> t -> t + end) + (Map : sig + type key = Set.elt + type 'a t + val empty: 'a t + val add: key -> 'a -> 'a t -> 'a t + val find: key -> 'a t -> 'a + val remove: key -> 'a t -> 'a t + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + end) + : Homogeneous with type key = Set.elt + and type item = Set.elt + and type itemset = Set.t + and type t = Set.t Map.t + diff --git a/src/utilities/stringSig.mli b/src/utilities/stringSig.mli new file mode 100644 index 0000000..37d3630 --- /dev/null +++ b/src/utilities/stringSig.mli @@ -0,0 +1,31 @@ + +(** The module type declares functions to manipulate and create fresh + strings. *) + +module type S = sig + + type t = string + + val compare : t -> t -> int + + module Set : sig + include Set.S with type elt = t + val of_list : elt list -> t + val unionl : t list -> t + end + + module Map : Map.S with type key = t + + module Gen : sig + type universe + val fresh_prefix : Set.t -> string -> string + val new_universe : string -> universe + val fresh : universe -> string + end + + val make_unique : Set.t -> (string -> string) + val make_fresh : Set.t -> string -> (unit -> string) + + val dummy : t + +end diff --git a/src/utilities/stringTools.ml b/src/utilities/stringTools.ml new file mode 100644 index 0000000..61f5a0a --- /dev/null +++ b/src/utilities/stringTools.ml @@ -0,0 +1,64 @@ + +(** FIXME: document here *) + +type t = string + +let compare = String.compare + + +module Set = struct + include Set.Make (String) + let of_list l = + let f res e = add e res in + List.fold_left f empty l + let unionl l = List.fold_left union empty l +end + + +module Map = Map.Make (String) + + +module Gen = struct + + type universe = { prefix : string ; mutable next : int } + + let added_suffix = "_" + + let is_prefix prefix s = + let l = String.length prefix in + (String.length s >= l) && (String.sub s 0 l = prefix) + + let has_prefix set prefix = + let f s b = b || (is_prefix prefix s) in + Set.fold f set false + + let fresh_prefix set prefix = + let rec aux prefix = + if has_prefix set prefix then aux (prefix ^ added_suffix) + else prefix in + aux prefix + + + let new_universe s = { prefix = s ; next = 0 } + + let fresh u = + let s = u.prefix ^ (string_of_int u.next) in + u.next <- u.next + 1 ; + s + +end + +let make_unique set = + let set_ref = ref set in + let unique s = + let res = Gen.fresh_prefix !set_ref s in + set_ref := Set.add res !set_ref ; + res in + unique + +let make_fresh set prefix = + let fresh_prefix = Gen.fresh_prefix set prefix in + let universe = Gen.new_universe fresh_prefix in + (fun () -> Gen.fresh universe) + +let dummy = "" diff --git a/src/utilities/stringTools.mli b/src/utilities/stringTools.mli new file mode 100644 index 0000000..29a368c --- /dev/null +++ b/src/utilities/stringTools.mli @@ -0,0 +1,5 @@ + +(** This module provides functions to manipulate and create fresh + strings. *) + +include StringSig.S diff --git a/src/utilities/syntacticAnalysis.ml b/src/utilities/syntacticAnalysis.ml new file mode 100644 index 0000000..0744c61 --- /dev/null +++ b/src/utilities/syntacticAnalysis.ml @@ -0,0 +1,14 @@ +exception ParsingError + +type 'token with_pos = 'token * Lexing.position * Lexing.position + +let parsing_step = "during parsing" + +let process ~lexer_init ~lexer_fun ~parser_fun ~input = + parser_fun lexer_fun (lexer_init input) + +let process ~lexer_init ~lexer_fun ~parser_fun ~input = try + process ~lexer_init ~lexer_fun ~parser_fun ~input +with Sys_error msg -> + Error.global_error parsing_step msg + diff --git a/src/utilities/syntacticAnalysis.mli b/src/utilities/syntacticAnalysis.mli new file mode 100644 index 0000000..946d361 --- /dev/null +++ b/src/utilities/syntacticAnalysis.mli @@ -0,0 +1,12 @@ +(** This module provides a general gluing function between lexers and + parsers. *) + +(** [process init lex parse input] initialized a lexing buffer using + [init input] and make [lex] and [parse] communicate through it + to produce an abstract syntax tree. *) +val process : + lexer_init : ('a -> 'lexbuf) -> + lexer_fun : ('lexbuf -> 'token) -> + parser_fun : (('lexbuf -> 'token) -> 'lexbuf -> 'ast) -> + input : 'a -> + 'ast diff --git a/src/utilities/unionFind.ml b/src/utilities/unionFind.ml new file mode 100644 index 0000000..a747301 --- /dev/null +++ b/src/utilities/unionFind.ml @@ -0,0 +1,135 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module implements a simple and efficient union/find algorithm. + See Robert E. Tarjan, ``Efficiency of a Good But Not Linear Set + Union Algorithm'', JACM 22(2), 1975. *) + +(** The abstraction defined by this module is a set of points, + partitioned into equivalence classes. With each equivalence class, + a piece of information, of abstract type ['a], is associated; we + call it a descriptor. + + A point is implemented as a cell, whose (mutable) contents consist + of a single link to either information about the equivalence class, + or another point. Thus, points form a graph, which must be acyclic, + and whose connected components are the equivalence classes. In + every equivalence class, exactly one point has no outgoing edge, + and carries information about the class instead. It is the class's + representative element. + + Information about a class consists of an integer weight (the number + of elements in the class) and of the class's descriptor. *) +type 'a point = { + mutable link: 'a link + } + +and 'a link = + | Info of 'a info + | Link of 'a point + +and 'a info = { + mutable weight: int; + mutable descriptor: 'a + } + +(** [fresh desc] creates a fresh point and returns it. It forms an + equivalence class of its own, whose descriptor is [desc]. *) +let fresh desc = { + link = Info { weight = 1; descriptor = desc } +} + +(** [repr point] returns the representative element of [point]'s + equivalence class. It is found by starting at [point] and following + the links. For efficiency, the function performs path compression + at the same time. *) +let rec repr point = + match point.link with + | Link point' -> + let point'' = repr point' in + if point'' != point' then + + (* [point''] is [point']'s representative element. Because we + just invoked [repr point'], [point'.link] must be [Link + point'']. We write this value into [point.link], thus + performing path compression. Note that this function never + performs memory allocation. *) + + point.link <- point'.link; + point'' + | Info _ -> + point + +(** [find point] returns the descriptor associated with [point]'s + equivalence class. *) +let rec find point = + + (* By not calling [repr] immediately, we optimize the common cases + where the path starting at [point] has length 0 or 1, at the + expense of the general case. *) + + match point.link with + | Info info + | Link { link = Info info } -> + info.descriptor + | Link { link = Link _ } -> + find (repr point) + +let rec change point v = + match point.link with + | Info info + | Link { link = Info info } -> + info.descriptor <- v + | Link { link = Link _ } -> + change (repr point) v + +(** [union point1 point2] merges the equivalence classes associated + with [point1] and [point2] (which must be distinct) into a single + class whose descriptor is that originally associated with [point2]. + + The fact that [point1] and [point2] do not originally belong to the + same class guarantees that we do not create a cycle in the graph. + + The weights are used to determine whether [point1] should be made + to point to [point2], or vice-versa. By making the representative + of the smaller class point to that of the larger class, we + guarantee that paths remain of logarithmic length (not accounting + for path compression, which makes them yet smaller). *) +let union point1 point2 = + let point1 = repr point1 + and point2 = repr point2 in + assert (point1 != point2); + match point1.link, point2.link with + | Info info1, Info info2 -> + let weight1 = info1.weight + and weight2 = info2.weight in + if weight1 >= weight2 then begin + point2.link <- Link point1; + info1.weight <- weight1 + weight2; + info1.descriptor <- info2.descriptor + end + else begin + point1.link <- Link point2; + info2.weight <- weight1 + weight2 + end + | _, _ -> + assert false (* [repr] guarantees that [link] matches [Info _]. *) + +(** [equivalent point1 point2] tells whether [point1] and [point2] + belong to the same equivalence class. *) +let equivalent point1 point2 = + repr point1 == repr point2 + +(** [eunion point1 point2] is identical to [union], except it does + nothing if [point1] and [point2] are already equivalent. *) +let eunion point1 point2 = + if not (equivalent point1 point2) then + union point1 point2 + +(** [redundant] maps all members of an equivalence class, but one, to + [true]. *) +let redundant = function + | { link = Link _ } -> + true + | { link = Info _ } -> + false + diff --git a/src/utilities/unionFind.mli b/src/utilities/unionFind.mli new file mode 100644 index 0000000..a84ac7b --- /dev/null +++ b/src/utilities/unionFind.mli @@ -0,0 +1,39 @@ +(* Pasted from Pottier's PP compiler *) + +(** This module implements a simple and efficient union/find algorithm. + See Robert E. Tarjan, ``Efficiency of a Good But Not Linear Set + Union Algorithm'', JACM 22(2), 1975. *) + +(** The abstraction defined by this module is a set of points, + partitioned into equivalence classes. With each equivalence class, + a piece of information, of abstract type ['a], is associated; we + call it a descriptor. *) +type 'a point + +(** [fresh desc] creates a fresh point and returns it. It forms an + equivalence class of its own, whose descriptor is [desc]. *) +val fresh: 'a -> 'a point + +(** [find point] returns the descriptor associated with [point]'s + equivalence class. *) +val find: 'a point -> 'a + +(** [union point1 point2] merges the equivalence classes associated + with [point1] and [point2] (which must be distinct) into a single + class whose descriptor is that originally associated with [point2]. *) +val union: 'a point -> 'a point -> unit + +(** [equivalent point1 point2] tells whether [point1] and [point2] + belong to the same equivalence class. *) +val equivalent: 'a point -> 'a point -> bool + +(** [eunion point1 point2] is identical to [union], except it does + nothing if [point1] and [point2] are already equivalent. *) +val eunion: 'a point -> 'a point -> unit + +(** [redundant] maps all members of an equivalence class, but one, to + [true]. *) +val redundant: 'a point -> bool + +(** [change p d] updates the descriptor of [p] to [d]. *) +val change: 'a point -> 'a -> unit diff --git a/src/utilities/webify.ml b/src/utilities/webify.ml new file mode 100644 index 0000000..ac20013 --- /dev/null +++ b/src/utilities/webify.ml @@ -0,0 +1,444 @@ +open Dom +open Dom_html +open Js +open Firebug +open Goog + +let msgbox s = + console##log (s) + +type input = + | Direct of string * (unit -> string) + | Url of string + +let children_of_node node = + let c = ref [] in + for i = 0 to node##childNodes##length - 1 do + let node = Js.Opt.get (node##childNodes##item (i)) (fun _ -> assert false) in + match node##nodeType with + | Dom.DOCUMENT | Dom.DOCUMENT_FRAGMENT | Dom.ELEMENT | Dom.CDATA_SECTION -> + c := node :: !c + | _ -> () + done; + List.rev !c + +let contents_of_node (node : node Js.t) = + let c = ref [] in + match node##nodeType with + | Dom.CDATA_SECTION -> + let t = Js.Opt.get (Dom.CoerceTo.text (node :> node Js.t)) (fun _ -> assert false) in + t##data + | _ -> + for i = 0 to node##childNodes##length - 1 do + let node = Js.Opt.get (node##childNodes##item (i)) (fun _ -> assert false) in + match node##nodeType with + | Dom.TEXT | Dom.CDATA_SECTION -> + c := node :: !c + | _ -> () + done; + Js.Opt.get ((List.hd !c)##nodeValue) (fun _ -> Js.string "Error") + +let (>>=) = Lwt.bind + +let http_get url = + XmlHttpRequest.get url >>= fun r -> + let cod = r.XmlHttpRequest.code in + let msg = r.XmlHttpRequest.content_xml () in + if cod = 0 || cod = 200 + then Lwt.return msg + else fst (Lwt.wait ()) + +let load_input_from_url url = + let extract_inputs frame = + match frame with + | None -> + Dom_html.window##alert (Js.string "Loading of examples failed."); + [] + | Some inputs_doc -> + let inputs_root = List.hd (children_of_node inputs_doc) in + let inputs_nodes = children_of_node inputs_root in + let inputs = List.map (fun n -> + msgbox n; + let data = children_of_node n in + msgbox data; + let get i = Js.to_string (contents_of_node (List.nth data i)) in + (get 0, fun () -> get 1)) + inputs_nodes + in + inputs + in + Lwt.catch (fun () -> http_get url + >>= (fun frame -> + Lwt.return (extract_inputs frame))) + (function _ -> + Lwt.return [] + ) + +type output = (string * string) + +let impossible _ = assert false + +let ccs s = Goog.Ui.ControlContent.string (Js.string s) + +let add_item s (m : Goog.Ui.menu Js.t) = + m##addItem (Goog.Tools.Union.i1 jsnew Goog.Ui.menuItem (ccs s, Js.null, Js.null)) + +let get_element s = + Js.Opt.get + (Dom_html.document##getElementById (s)) + (fun _ -> Dom_html.window##alert (s); assert false) + +let new_tab tabbar label = + let tab = jsnew Ui.tab (Ui.ControlContent.string label, Js.null, Js.null) in + Ui.Component.addChild tabbar tab (Js.some Js._true); + tab + +let new_button toolbar label onclick = + let button = + jsnew Ui.toolbarButton + (Ui.ControlContent.string (Js.string label), + Js.null, + Js.null) + in + Ui.Component.addChild toolbar button (Js.some Js._true); + ignore + (Events.listen + (Tools.Union.i1 button) + (Js.string "action") + (Js.wrap_callback (fun _ -> onclick ())) + Js.null) + +let new_menu toolbar label entries onchange = + let menu = jsnew Goog.Ui.menu (Js.null, Js.null) in + List.iter (fun s -> add_item s menu) entries; + let menu_button = + jsnew Ui.toolbarMenuButton + (Ui.ControlContent.string (Js.string label), + Js.some menu, + Js.null, + Js.null) + in + ignore + (Events.listen + (Tools.Union.i1 menu_button) + (Js.string "action") + (Js.wrap_callback (fun e -> + let get x : Goog.Ui.menuItem Js.t = + Js.Unsafe.coerce (Js.Optdef.get x (fun _ -> assert false)) + in + onchange ((get (e##target))##getCaption ()))) + Js.null); + + Ui.Component.addChild toolbar menu_button (Js.some Js._true); + menu + +type input_interface = { + get_input : unit -> Js.js_string Js.t * Js.js_string Js.t; + new_output_tabs : (Js.js_string Js.t * Js.js_string Js.t) list -> unit; + clear_output_tabs : unit -> unit; + close : unit -> unit +} + +let input_interfaces : (Js.js_string Js.t, input_interface) Hashtbl.t = + Hashtbl.create 13 + +let fresh_name n = + let rec aux i = + let name = if i = 0 then n else (n##concat (Js.string (string_of_int i))) in + if Hashtbl.mem input_interfaces name then + aux (i + 1) + else + name + in + aux 0 + +let new_input (tabbar : Ui.tabBar Js.t) choice (contents : Js.js_string Js.t) = + + let choice = fresh_name choice in + + let tab_contents = get_element ((Js.string "maintabbar_content")) in + + let source_label = choice##concat (Js.string "_source") in + let content_label = choice##concat (Js.string "_contents") in + + let tab = new_tab tabbar choice in + let tab_frame = Dom_html.createDiv (Dom_html.document) in + let subtab_frame = Dom_html.createDiv (Dom_html.document) in + let contents_tab_frame = Dom_html.createDiv (Dom_html.document) in + let clear_tab_frame = Dom_html.createDiv (Dom_html.document) in + let subtabs = + jsnew Ui.tabBar ( + Js.some (Ui.TabBar.location_pre_of_location Ui.TabBar.BOTTOM), + Js.null, + Js.null) + in + contents_tab_frame##className <- Js.string "goog-tab-content"; + contents_tab_frame##id <- content_label; + subtab_frame##className + <- Js.string "goog-tab-bar goog-tab-bar-start"; + clear_tab_frame##className <- Js.string "goog-tab-bar-clear"; + + subtabs##decorate ((subtab_frame :> Dom_html.element Js.t)); + ignore (tab_frame##appendChild ((subtab_frame :> Dom.node Js.t))); + ignore (tab_frame##appendChild ((contents_tab_frame :> Dom.node Js.t))); + ignore (tab_frame##appendChild ((clear_tab_frame :> Dom.node Js.t))); + + (* Source code editor. *) + let text = Dom_html.createTextarea (Dom_html.document) in + text##className <- Js.string "editor"; + text##value <- contents; + + let change_tab_content node = + if contents_tab_frame##hasChildNodes () = _true then + ignore (contents_tab_frame##removeChild + (Js.Opt.get contents_tab_frame##firstChild impossible)); + ignore (contents_tab_frame##appendChild (node)) + in + + let input_tab = new_tab subtabs source_label in + ignore + (Events.listen + (Tools.Union.i1 input_tab) + (Js.string "select") + (Js.wrap_callback (fun e -> change_tab_content ((text :> Dom.node Js.t)))) + Js.null); + + ignore + (Events.listen + (Tools.Union.i1 tab) + (Js.string "select") + (Js.wrap_callback (fun e -> + if tab_contents##hasChildNodes () = _true then + ignore (tab_contents##removeChild + (Js.Opt.get tab_contents##firstChild impossible)); + ignore (tab_contents##appendChild ((tab_frame :> Dom.node Js.t))))) + Js.null); + + tabbar##setSelectedTab (Js.some tab); + subtabs##setSelectedTab (Js.some input_tab); + + let get_input () = + (choice, text##value) + in + + let output_tabs = ref [] in + + let new_output_tabs outputs = + let new_output_tab (title, value) = + let output_tab = new_tab subtabs (choice##concat (title)) in + let output_frame = Dom_html.createDiv (Dom_html.document) in + output_tabs := output_tab :: !output_tabs; + let text = Dom_html.createTextarea (Dom_html.document) in + text##className <- Js.string "editor"; + text##value <- value; + ignore (output_frame##appendChild ((text :> Dom.node Js.t))); + ignore + (Events.listen + (Tools.Union.i1 output_tab) + (Js.string "select") + (Js.wrap_callback (fun e -> + change_tab_content ((output_frame :> Dom.node Js.t)))) + Js.null) + in + List.iter new_output_tab outputs + in + + let clear_output_tabs () = + List.iter (fun tab -> + ignore (subtabs##removeChild (Goog.Tools.Union.i2 tab, Js.some Js._true))) + !output_tabs; + output_tabs := [] + in + + let close () = + Hashtbl.remove input_interfaces choice; + ignore (contents_tab_frame##removeChild ((text :> Dom.node Js.t))); + subtabs##disposeInternal (); + ignore (tabbar##removeChild (Goog.Tools.Union.i2 tab, Js.some Js._true)) + in + Hashtbl.add input_interfaces choice + { + get_input = get_input; + new_output_tabs = new_output_tabs; + clear_output_tabs = clear_output_tabs; + close = close; + } + +let help_message = +" +

+Please be aware of the limited computational power of JavaScript. Your O'Caml +program will run 10 times slower than a natively compiled one. +

+
    +
  • +Use Create from... to load +a predefined input. This should create a tab in the +interface for this specific instance of the input. You +can freely edit this input in the text area. +
  • +
  • +Use Run to process the input. This should create +a set of tabs to store the outputs. You can use +Run several times: the outputs will be refreshed +if the input has changed. +
  • +
  • +Use Close to dispose the input instance corresponding +to the selected tab. Be aware that you will lost your local modifications. +
  • +
  • +Use Help to open this dialog box. +
  • +
+" + +type processor_function = + (int -> int -> unit) -> (** Tick *) + (string * string) -> + output list + +let processing_queue_updated = Lwt_condition.create () +let q = Queue.create () +let push_processing f = + Queue.push f q; Lwt_condition.signal processing_queue_updated () +let next_processing () = (Queue.take q) () + +let make_layout, add_inputs, register_processor = + let menu_ref = ref (Obj.magic 0) in + let inputs_ref : (Js.js_string Js.t * (unit -> Js.js_string Js.t)) list ref = ref [] in + let processor_ref : processor_function ref = + ref (fun tick s -> []) + in + let make_layout () = + let pbar = jsnew Ui.progressBar () in + let elt = get_element (Js.string "progressbar") in + let elt_txt = get_element (Js.string "progressbarin") in + pbar##setMaximum (100.); + pbar##setMinimum (0.); + pbar##setValue (0.); + pbar##decorateInternal (elt); + + let toolbar = jsnew Ui.toolbar (Js.null, Js.null, Js.null) in + let tabbar = + jsnew Ui.tabBar (Js.some (Ui.TabBar.location_pre_of_location Ui.TabBar.START), Js.null, Js.null) + in + + let get_selected_input () = + try + let tab = (Js.Opt.get (tabbar##getSelectedTab ()) impossible) in + let caption = (Js.Opt.get (tab##getCaption ()) impossible) in + Some (caption) + with _ -> None + in + menu_ref := + new_menu toolbar " Create from ..." [] + (fun choice -> + try + let choice = Js.Opt.get choice (fun _ -> assert false) in + let contents = (List.assoc choice !inputs_ref) () in + new_input tabbar choice contents + with _ -> assert false); + + new_button toolbar "Run" (fun () -> + match get_selected_input () with + | None -> + Firebug.console##log (Js.string "Nothing to run!") + + | Some selected_input -> + let run () = + Firebug.console##log ((Js.string "Process the source named ")##concat (selected_input)); + + let interface = + try + Hashtbl.find input_interfaces selected_input + with Not_found -> assert false + in + interface.clear_output_tabs (); + let tick = + fun step over -> + let v = 100. *. float_of_int step /. float_of_int over in + Firebug.console##log ((Js.string ("Step " ^ string_of_int step ^ " " ^ string_of_float v))); + pbar##setValue (v); + elt_txt##innerHTML <- Js.string (string_of_float v ^ "%") + in + let outputs = + try + let title, contents = interface.get_input () in + !processor_ref tick (Js.to_string title, Js.to_string contents) + with exn -> + [("Error", Printexc.to_string exn)] + in + interface.new_output_tabs + (List.map (fun (t, o) -> (Js.string t, Js.string o)) outputs); + Lwt.return () + in + push_processing run + ); + + new_button toolbar "Close" (fun () -> + match get_selected_input () with + | None -> + Firebug.console##log (Js.string "Nothing to close!") + | Some selected_input -> + Firebug.console##log ((Js.string "Closing ")##concat (selected_input)); + let interface = + try + Hashtbl.find input_interfaces selected_input + with Not_found -> assert false + in + interface.close () + ); + + new_button toolbar "Help" (fun () -> + let dialog = jsnew Ui.dialog (Js.null, Js.null, Js.null) in + dialog##setContent (Js.string help_message); + dialog##setVisible (Js._true) + ); + + tabbar##decorate (get_element (Js.string "maintabbar")); + toolbar##render (Js.some (get_element (Js.string "maintoolbar"))) + in + let add_inputs inputs = + List.iter (fun (s, _) -> add_item s !menu_ref) inputs; + inputs_ref := List.map (fun (k, v) -> (Js.string k, fun () -> Js.string (v ()))) inputs + in + let register_processor p = + processor_ref := p + in + make_layout, add_inputs, register_processor + +let loaded = ref Js._false + +let rec load = function + | [] -> + Lwt.return [] + | Direct (title, contents) :: is -> + load is + >>= (fun is -> Lwt.return ((title, contents) :: is)) + | Url url :: is -> + load_input_from_url url + >>= (fun url_is -> + load is + >>= (fun is -> Lwt.return (url_is @ is))) + +let from_function inputs processor = + let start _ = + let rec wait_for_processing () = + Lwt_condition.wait processing_queue_updated + >>= next_processing + >>= wait_for_processing + in + Lwt_js.sleep 0.2 + >>= (fun () -> load inputs) + >>= fun inputs -> begin + make_layout (); + add_inputs inputs; + register_processor processor; + Firebug.console##log (Js.string "Loaded!"); + Lwt.return () + end + >>= wait_for_processing + in + Dom_html.window##onload <- Dom_html.handler (fun _ -> ignore (start ()); Js._false) + diff --git a/src/utilities/webify.mli b/src/utilities/webify.mli new file mode 100644 index 0000000..b1d7547 --- /dev/null +++ b/src/utilities/webify.mli @@ -0,0 +1,22 @@ +(** This module turns a function into a web application. *) + +(** An input is characterized by a title and a function that + returns the input contents if called. *) +type input = + | Direct of string * (unit -> string) + | Url of string + +(** An output is a title and some contents. *) +type output = (string * string) + +(** Given a list of input choices and a function that turns these + inputs into output, [from_function] produces an interactive + web application. *) +type processor_function = + (int -> int -> unit) -> (** Step n over m. *) + (string * string) -> + output list + +val from_function : input list -> processor_function -> unit + + diff --git a/tests/GCCTestSuite/920413-1.c b/tests/GCCTestSuite/920413-1.c new file mode 100644 index 0000000..6e8fff7 --- /dev/null +++ b/tests/GCCTestSuite/920413-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +int +x (b) +{ + return + 4294967295U /* { dg-warning "width of integer|traditional C rejects" } */ + / (unsigned long) b; +} diff --git a/tests/GCCTestSuite/920413-1.c.expected b/tests/GCCTestSuite/920413-1.c.expected new file mode 100644 index 0000000..6e8fff7 --- /dev/null +++ b/tests/GCCTestSuite/920413-1.c.expected @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +int +x (b) +{ + return + 4294967295U /* { dg-warning "width of integer|traditional C rejects" } */ + / (unsigned long) b; +} diff --git a/tests/GCCTestSuite/920413-1.hex.expected b/tests/GCCTestSuite/920413-1.hex.expected new file mode 100644 index 0000000..18f6081 --- /dev/null +++ b/tests/GCCTestSuite/920413-1.hex.expected @@ -0,0 +1,119 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758206C32F +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0012506F58275E0003507F583E5AC +:1006600008F0D0E0F50875E0002506F58275E00099 +:100670003507F583E508F0750A0175000075090076 +:10068000750100E50AF4F50AE500F4F500E509F462 +:10069000F509E501F4F501D3750B00E50BF5F0E57F +:1006A0000A35F0F50AE50BF5F0E50035F0F500E563 +:1006B0000BF5F0E50935F0F509E50BF5F0E5013549 +:1006C000F0F501E51FF51BE51EF51AE51DF519E529 +:1006D0001CF518E50AF51FE500F51EE509F51DE511 +:1006E00001F51C120000E582F502E583F503E50043 +:1006F000F504E501F505E502F500E503F501E5047E +:10070000F509E505F50AE500F502E501F503E5095A +:10071000F504E50AF50575E0002506F58275E000AB +:100720003507F583E0F508E508C0E075E00125062A +:10073000F58275E0003507F583E0F508E508C0E0CF +:1007400075E0062506F50675E0003507F507E502B4 +:10075000F582E503F583E504F500E505F5012200E2 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/920413-1.s.expected b/tests/GCCTestSuite/920413-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/920413-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/940409-1.c b/tests/GCCTestSuite/940409-1.c new file mode 100644 index 0000000..2d20b89 --- /dev/null +++ b/tests/GCCTestSuite/940409-1.c @@ -0,0 +1,6 @@ +/* GCC should allow struct S to be in a register. */ +/* { dg-do compile } */ + +struct S { volatile int field; }; +int f (register struct S arg); /* { dg-bogus "volatile field" "with arg" } */ +int g (register struct S); /* { dg-bogus "volatile field" "no arg" } */ diff --git a/tests/GCCTestSuite/940409-1.c.expected b/tests/GCCTestSuite/940409-1.c.expected new file mode 100644 index 0000000..2d20b89 --- /dev/null +++ b/tests/GCCTestSuite/940409-1.c.expected @@ -0,0 +1,6 @@ +/* GCC should allow struct S to be in a register. */ +/* { dg-do compile } */ + +struct S { volatile int field; }; +int f (register struct S arg); /* { dg-bogus "volatile field" "with arg" } */ +int g (register struct S); /* { dg-bogus "volatile field" "no arg" } */ diff --git a/tests/GCCTestSuite/940409-1.hex.expected b/tests/GCCTestSuite/940409-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/940409-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/940409-1.s.expected b/tests/GCCTestSuite/940409-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/940409-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/951130-1.c b/tests/GCCTestSuite/951130-1.c new file mode 100644 index 0000000..60013e2 --- /dev/null +++ b/tests/GCCTestSuite/951130-1.c @@ -0,0 +1,5 @@ +/* { dg-do compile } + { dg-options "-Werror" } */ + +unsigned long long x = -(unsigned long long)(-(long long) + (((unsigned long long)0 - 1) >> 1) - 1); diff --git a/tests/GCCTestSuite/951130-1.c.expected b/tests/GCCTestSuite/951130-1.c.expected new file mode 100644 index 0000000..60013e2 --- /dev/null +++ b/tests/GCCTestSuite/951130-1.c.expected @@ -0,0 +1,5 @@ +/* { dg-do compile } + { dg-options "-Werror" } */ + +unsigned long long x = -(unsigned long long)(-(long long) + (((unsigned long long)0 - 1) >> 1) - 1); diff --git a/tests/GCCTestSuite/951130-1.hex.expected b/tests/GCCTestSuite/951130-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/951130-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/951130-1.s.expected b/tests/GCCTestSuite/951130-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/951130-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/980502-1.c b/tests/GCCTestSuite/980502-1.c new file mode 100644 index 0000000..f06491c --- /dev/null +++ b/tests/GCCTestSuite/980502-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile }*/ +/* { dg-options "-O2" } */ + +char *const f(void) +{ + char *const line = "/dev/ptyXX"; + line[8] = 1; + return line; +} diff --git a/tests/GCCTestSuite/980502-1.c.expected b/tests/GCCTestSuite/980502-1.c.expected new file mode 100644 index 0000000..f06491c --- /dev/null +++ b/tests/GCCTestSuite/980502-1.c.expected @@ -0,0 +1,9 @@ +/* { dg-do compile }*/ +/* { dg-options "-O2" } */ + +char *const f(void) +{ + char *const line = "/dev/ptyXX"; + line[8] = 1; + return line; +} diff --git a/tests/GCCTestSuite/990213-1.c b/tests/GCCTestSuite/990213-1.c new file mode 100644 index 0000000..a7c9f24 --- /dev/null +++ b/tests/GCCTestSuite/990213-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-W -Wall -Werror" } */ + +static inline int unused_fn(int dummyarg) +{ + return dummyarg*dummyarg; +} + +int main() +{ + return 0; +} diff --git a/tests/GCCTestSuite/990213-1.c.expected b/tests/GCCTestSuite/990213-1.c.expected new file mode 100644 index 0000000..a7c9f24 --- /dev/null +++ b/tests/GCCTestSuite/990213-1.c.expected @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-W -Wall -Werror" } */ + +static inline int unused_fn(int dummyarg) +{ + return dummyarg*dummyarg; +} + +int main() +{ + return 0; +} diff --git a/tests/GCCTestSuite/990213-1.hex.expected b/tests/GCCTestSuite/990213-1.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/990213-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/990213-1.s.expected b/tests/GCCTestSuite/990213-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/990213-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/Makefile b/tests/GCCTestSuite/Makefile new file mode 100644 index 0000000..2cfb135 --- /dev/null +++ b/tests/GCCTestSuite/Makefile @@ -0,0 +1,73 @@ +# -*- Makefile -*- +.PHONY: prepare-check check clean prepare-expected expected all + +all-generic: check + +-include ../../Makefile.local + +IN_EXT=c +OUT_EXT=hex +OPTIONS=$(shell if test -f options; then cat options; else echo ""; fi) +PROGRAM=../../$(TARGET) -is $(OPTIONS) + +# Compute the set of input files. +INPUTS=$(shell find . -name "*.$(IN_EXT)" | sed "s/-annotated.c/.c/g" | uniq) + +OUTPUTS=$(INPUTS:$(IN_EXT)=$(OUT_EXT)) + +# We run the compiler in debugging mode on each input file. +# This will produce an $(OUTEXT) file as well as a lot of +# files that contain execution traces. We check that these +# traces are the ones that are expected. +%.$(OUT_EXT): %.$(IN_EXT) ../../$(TARGET) + @ echo ----------------------------------------\ + -------------------------------------- + @ echo -n Checking $* ... + @ (($(PROGRAM) $< 2> $*.log 1> $*.log && (echo OK | tee -a ok-counter)) \ + || (echo "KO"; echo " ($*.log for details)" | tee -a ko-counter)) + @ for i in `ls $** | grep -v expected | grep -v log`; do \ + if [ ! -e $$i.expected ]; then \ + echo No reference to compare to.; \ + if [ x`cat generate` = x1 ]; then \ + echo "Current output becomes expected behavior, as asked."; \ + cp $$i $$i.expected; \ + fi; \ + elif diff -u $$i $$i.expected 2> /dev/null 1> /dev/null; then \ + echo " [OK] $$i" | tee -a ok-counter; \ + else \ + echo " [KO] $$i" | tee -a ko-counter; \ + fi; \ + done + +prepare-check: + @ rm --force ok-counter ko-counter + @ touch ok-counter + @ touch ko-counter + +check: clean prepare-check $(OUTPUTS) + @ cat ok-counter ko-counter > total-counter + @ echo ----------------------------------------\ + -------------------------------------- + @ echo ----------------------------------------\ + -------------------------------------- + @ echo Total: \ + `wc -l ok-counter | cut -f1 -d' '` \ + /`wc -l total-counter | cut -f1 -d' '` + @ echo ----------------------------------------\ + -------------------------------------- + +prepare-expected: + @ GENERATE=1 + @ export GENERATE + @ echo You asked for overwriting of the expected outputs. + @ echo -n "Are you sure? [Y/N] " + @ read R; if [ $$R = "Y" ]; then \ + echo 1 > generate; \ + else \ + echo 0 > generate; \ + fi + +expected: clean prepare-expected check + +clean: + rm --force *.hex *.s *.cerco *.Clight *.Cminor *.RTLabs *.RTL *.ERTL *.LTL *.LIN *.log *-annotated.c diff --git a/tests/GCCTestSuite/alias-2.c b/tests/GCCTestSuite/alias-2.c new file mode 100644 index 0000000..d507416 --- /dev/null +++ b/tests/GCCTestSuite/alias-2.c @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" } + +struct foo { + char c; + char d; + short s; + int i; +} bar; + +int +sub1 (long long int foobar) +{ + struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer might" "" } + return tmp->i; +} diff --git a/tests/GCCTestSuite/alias-2.c.expected b/tests/GCCTestSuite/alias-2.c.expected new file mode 100644 index 0000000..d507416 --- /dev/null +++ b/tests/GCCTestSuite/alias-2.c.expected @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" } + +struct foo { + char c; + char d; + short s; + int i; +} bar; + +int +sub1 (long long int foobar) +{ + struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer might" "" } + return tmp->i; +} diff --git a/tests/GCCTestSuite/alias-2.hex.expected b/tests/GCCTestSuite/alias-2.hex.expected new file mode 100644 index 0000000..cdccd2b --- /dev/null +++ b/tests/GCCTestSuite/alias-2.hex.expected @@ -0,0 +1,36 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F518D0E0F519E512F50B5A +:10002000E511F50FE506F50AE507F501750900C3C9 +:10003000750000E509F5F0E50A35F0F509E500F58C +:10004000F0E50135F0F50A750100C3750000E50122 +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E51FF503E500F502E501F582E5027F +:10007000F583E503F0750101C3750000E501F5F0B6 +:10008000E50935F0F501E500F5F0E50A35F0F50094 +:10009000E51EF503E500F502E501F582E502F583CD +:1000A000E503F0750102C3750000E501F5F0E5090F +:1000B00035F0F501E500F5F0E50A35F0F500E51D50 +:1000C000F503E500F502E501F582E502F583E503B8 +:1000D000F0750103C3750000E501F5F0E50935F0A1 +:1000E000F501E500F5F0E50A35F0F500E51CF5034E +:1000F000E500F502E501F582E502F583E503F0E5AB +:1001000006F509E507F50A750100C3750000E5016C +:10011000F5F0E50935F0F501E500F5F0E50A35F013 +:10012000F50A750904C3750000E509F5F0E5013528 +:10013000F0F501E500F5F0E50A35F0F500E501F52B +:1001400009E500F50A750100C3750000E501F5F049 +:10015000E50935F0F501E500F5F0E50A35F0F500C3 +:10016000E500F502E501F582E502F583E0F50C75A1 +:100170000101C3750000E501F5F0E50935F0F50171 +:10018000E500F5F0E50A35F0F500E500F502E501DA +:10019000F582E502F583E0F50D750102C3750000F7 +:1001A000E501F5F0E50935F0F501E500F5F0E50AC2 +:1001B00035F0F500E500F502E501F582E502F5838D +:1001C000E0F50E750103C3750000E501F5F0E509E2 +:1001D00035F0F501E500F5F0E50A35F0F500E5004C +:1001E000F502E501F582E502F583E0F500E50CF5A1 +:1001F00002E50DF503E50EF504E500F505E50BF563 +:1002000012E50FF511E519C0E0E518C0E075E0084A +:100210002506F50675E0003507F507E502F582E5E8 +:1002200003F583E504F500E505F501220000000073 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/alias-2.s.expected b/tests/GCCTestSuite/alias-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/alias-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/alias-8.c b/tests/GCCTestSuite/alias-8.c new file mode 100644 index 0000000..690f1b6 --- /dev/null +++ b/tests/GCCTestSuite/alias-8.c @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" } + +struct s { + char *p; +}; + +void +func(struct s *ptr) +{ + *(void **)&ptr->p = 0; /* { dg-warning "type-punned pointer" } */ +} diff --git a/tests/GCCTestSuite/alias-8.c.expected b/tests/GCCTestSuite/alias-8.c.expected new file mode 100644 index 0000000..690f1b6 --- /dev/null +++ b/tests/GCCTestSuite/alias-8.c.expected @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" } + +struct s { + char *p; +}; + +void +func(struct s *ptr) +{ + *(void **)&ptr->p = 0; /* { dg-warning "type-punned pointer" } */ +} diff --git a/tests/GCCTestSuite/alias-8.hex.expected b/tests/GCCTestSuite/alias-8.hex.expected new file mode 100644 index 0000000..aa8e164 --- /dev/null +++ b/tests/GCCTestSuite/alias-8.hex.expected @@ -0,0 +1,15 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F50ED0E0F50FE510F50D6E +:10002000E51EF500750900C3750100E509F5F0E569 +:100030001F35F0F50BE501F5F0E50035F0F50C7531 +:100040000900750A00750100C3750000E501F5F0AF +:10005000E50B35F0F501E500F5F0E50C35F0F500C0 +:10006000E509F503E500F502E501F582E502F58312 +:10007000E503F0750101C3750000E501F5F0E50B3E +:1000800035F0F501E500F5F0E50C35F0F500E50A91 +:10009000F503E500F502E501F582E502F583E503E8 +:1000A000F0750000E500F502E500F503E500F50454 +:1000B000E500F505E50DF510E50FC0E0E50EC0E043 +:1000C00075E0022506F50675E0003507F507E5023F +:1000D000F582E503F583E504F500E505F501220069 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/alias-8.s.expected b/tests/GCCTestSuite/alias-8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/alias-8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/align-1.c b/tests/GCCTestSuite/align-1.c new file mode 100644 index 0000000..187eb52 --- /dev/null +++ b/tests/GCCTestSuite/align-1.c @@ -0,0 +1,28 @@ +/* PR java/10145 + Test that requesting an alignment of 1 does not increase the alignment + of a long long field. + + { dg-do run } + { dg-options "" } +*/ + +extern void abort (void); + +struct A +{ + char c; + long long i; +}; + +struct B +{ + char c; + long long i __attribute ((__aligned__ (1))); +}; + +int main () +{ + if (sizeof (struct A) != sizeof (struct B)) + abort (); + return 0; +} diff --git a/tests/GCCTestSuite/align-1.c.expected b/tests/GCCTestSuite/align-1.c.expected new file mode 100644 index 0000000..187eb52 --- /dev/null +++ b/tests/GCCTestSuite/align-1.c.expected @@ -0,0 +1,28 @@ +/* PR java/10145 + Test that requesting an alignment of 1 does not increase the alignment + of a long long field. + + { dg-do run } + { dg-options "" } +*/ + +extern void abort (void); + +struct A +{ + char c; + long long i; +}; + +struct B +{ + char c; + long long i __attribute ((__aligned__ (1))); +}; + +int main () +{ + if (sizeof (struct A) != sizeof (struct B)) + abort (); + return 0; +} diff --git a/tests/GCCTestSuite/align-1.hex.expected b/tests/GCCTestSuite/align-1.hex.expected new file mode 100644 index 0000000..9afae48 --- /dev/null +++ b/tests/GCCTestSuite/align-1.hex.expected @@ -0,0 +1,24 @@ +:1000000075812F7506FF7507FF12001002000C00A6 +:1000100000E506758202C39582F506E50775830043 +:100020009583F507D0E0F50875E0012506F58275A2 +:10003000E0003507F583E508F0D0E0F50875E0004D +:100040002506F58275E0003507F583E508F0750BA8 +:1000500005750C00750D00750E0075000575010025 +:10006000750900750A00750F00C3E500F5F0E50B92 +:1000700095F0F500E500F5F0E50F45F0F50FC3E567 +:1000800001F5F0E50C95F0F500E500F5F0E50F451C +:10009000F0F50FC3E509F5F0E50D95F0F500E50085 +:1000A000F5F0E50F45F0F50FC3E50AF5F0E50E951F +:1000B000F0F500E500F5F0E50F45F0F50F750100EE +:1000C000750900750A00750000E50FF5F0E50045BB +:1000D000F0F500E501F5F0E50045F0F500E509F57E +:1000E000F0E50045F0F500E50AF5F0E50045F0F52E +:1000F00000E50070028003020160007500007501D8 +:1001000000750900750A00E500F502E501F503E553 +:1001100009F504E50AF50575E0002506F58275E0A8 +:10012000003507F583E0F508E508C0E075E0012536 +:1001300006F58275E0003507F583E0F508E508C0AF +:10014000E075E0022506F50675E0003507F507E5E0 +:1001500002F582E503F583E504F500E505F50122E6 +:10016000000200FB00000000000000000000000092 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/align-1.s.expected b/tests/GCCTestSuite/align-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/align-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/always_inline2.c b/tests/GCCTestSuite/always_inline2.c new file mode 100644 index 0000000..fa6528d --- /dev/null +++ b/tests/GCCTestSuite/always_inline2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ +inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" "" } */ +void +q(void) +{ + t(); /* { dg-error "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/always_inline2.c.expected b/tests/GCCTestSuite/always_inline2.c.expected new file mode 100644 index 0000000..fa6528d --- /dev/null +++ b/tests/GCCTestSuite/always_inline2.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ +inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" "" } */ +void +q(void) +{ + t(); /* { dg-error "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/always_inline2.hex.expected b/tests/GCCTestSuite/always_inline2.hex.expected new file mode 100644 index 0000000..0680eba --- /dev/null +++ b/tests/GCCTestSuite/always_inline2.hex.expected @@ -0,0 +1,11 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040000000E500F502E500F503E500F504E50034 +:10005000F50575E0002506F58275E0003507F583A6 +:10006000E0F508E508C0E075E0012506F58275E0D9 +:10007000003507F583E0F508E508C0E075E00225E6 +:1000800006F50675E0003507F507E502F582E5039C +:10009000F583E504F500E505F50122000000000008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/always_inline2.s.expected b/tests/GCCTestSuite/always_inline2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/always_inline2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/always_inline3.c b/tests/GCCTestSuite/always_inline3.c new file mode 100644 index 0000000..b183770 --- /dev/null +++ b/tests/GCCTestSuite/always_inline3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ +inline __attribute__ ((always_inline)) void +q2(void) +{ /* { dg-error "recursive" "" } */ + q2(); /* { dg-error "called from here" "" } */ + q2(); /* { dg-error "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/always_inline3.c.expected b/tests/GCCTestSuite/always_inline3.c.expected new file mode 100644 index 0000000..b183770 --- /dev/null +++ b/tests/GCCTestSuite/always_inline3.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ +inline __attribute__ ((always_inline)) void +q2(void) +{ /* { dg-error "recursive" "" } */ + q2(); /* { dg-error "called from here" "" } */ + q2(); /* { dg-error "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/always_inline3.hex.expected b/tests/GCCTestSuite/always_inline3.hex.expected new file mode 100644 index 0000000..7d1a3f9 --- /dev/null +++ b/tests/GCCTestSuite/always_inline3.hex.expected @@ -0,0 +1,11 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0120026 +:1000400000120000750000E500F502E500F503E58B +:1000500000F504E500F50575E0002506F58275E07C +:10006000003507F583E0F508E508C0E075E00125F7 +:1000700006F58275E0003507F583E0F508E508C070 +:10008000E075E0022506F50675E0003507F507E5A1 +:1000900002F582E503F583E504F500E505F50122A7 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/always_inline3.s.expected b/tests/GCCTestSuite/always_inline3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/always_inline3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-3.c b/tests/GCCTestSuite/anon-struct-3.c new file mode 100644 index 0000000..3ed6e67 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-3.c @@ -0,0 +1,32 @@ +/* { dg-options "-std=gnu89 -fms-extensions" } */ +/* Enabling Microsoft mode makes all of the tests equivalent. Checked vs + Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86 + */ + +struct A { char a; }; + +struct B { + struct A; + char b; +}; +char testB[sizeof(struct B) == 2 * sizeof(struct A) ? 1 : -1]; + +struct C { + struct D { char d; }; + char c; +}; +char testC[sizeof(struct C) == 2 * sizeof(struct A) ? 1 : -1]; +char testD[sizeof(struct D) == sizeof(struct A) ? 1 : -1]; + +struct E { + struct { char z; }; + char e; +}; +char testE[sizeof(struct E) == 2 * sizeof(struct A) ? 1 : -1]; + +typedef struct A typedef_A; +struct F { + typedef_A; + char f; +}; +char testF[sizeof(struct F) == 2 * sizeof(struct A) ? 1 : -1]; diff --git a/tests/GCCTestSuite/anon-struct-3.c.expected b/tests/GCCTestSuite/anon-struct-3.c.expected new file mode 100644 index 0000000..3ed6e67 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-3.c.expected @@ -0,0 +1,32 @@ +/* { dg-options "-std=gnu89 -fms-extensions" } */ +/* Enabling Microsoft mode makes all of the tests equivalent. Checked vs + Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86 + */ + +struct A { char a; }; + +struct B { + struct A; + char b; +}; +char testB[sizeof(struct B) == 2 * sizeof(struct A) ? 1 : -1]; + +struct C { + struct D { char d; }; + char c; +}; +char testC[sizeof(struct C) == 2 * sizeof(struct A) ? 1 : -1]; +char testD[sizeof(struct D) == sizeof(struct A) ? 1 : -1]; + +struct E { + struct { char z; }; + char e; +}; +char testE[sizeof(struct E) == 2 * sizeof(struct A) ? 1 : -1]; + +typedef struct A typedef_A; +struct F { + typedef_A; + char f; +}; +char testF[sizeof(struct F) == 2 * sizeof(struct A) ? 1 : -1]; diff --git a/tests/GCCTestSuite/anon-struct-3.hex.expected b/tests/GCCTestSuite/anon-struct-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-3.s.expected b/tests/GCCTestSuite/anon-struct-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-4.c b/tests/GCCTestSuite/anon-struct-4.c new file mode 100644 index 0000000..dc30b0c --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-4.c @@ -0,0 +1,10 @@ +/* Test anonymous structures with type qualifiers. Bug 8420. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } */ + +struct s { + struct { int a; }; + const struct { int b; }; + struct { int c; } volatile; +}; diff --git a/tests/GCCTestSuite/anon-struct-4.c.expected b/tests/GCCTestSuite/anon-struct-4.c.expected new file mode 100644 index 0000000..dc30b0c --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-4.c.expected @@ -0,0 +1,10 @@ +/* Test anonymous structures with type qualifiers. Bug 8420. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } */ + +struct s { + struct { int a; }; + const struct { int b; }; + struct { int c; } volatile; +}; diff --git a/tests/GCCTestSuite/anon-struct-4.hex.expected b/tests/GCCTestSuite/anon-struct-4.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-4.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-4.s.expected b/tests/GCCTestSuite/anon-struct-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-5.c b/tests/GCCTestSuite/anon-struct-5.c new file mode 100644 index 0000000..f7d1278 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-5.c @@ -0,0 +1,7 @@ +/* Test bad warning for anonymous int in structure. Bug 17189. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +struct Foo { int; }; /* { dg-bogus "unnamed" } */ +/* { dg-error "error: declaration does not declare anything" "int;" { target *-*-* } 5 } */ +/* { dg-error "error: struct has no members" "no members" { target *-*-* } 5 } */ diff --git a/tests/GCCTestSuite/anon-struct-5.c.expected b/tests/GCCTestSuite/anon-struct-5.c.expected new file mode 100644 index 0000000..f7d1278 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-5.c.expected @@ -0,0 +1,7 @@ +/* Test bad warning for anonymous int in structure. Bug 17189. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +struct Foo { int; }; /* { dg-bogus "unnamed" } */ +/* { dg-error "error: declaration does not declare anything" "int;" { target *-*-* } 5 } */ +/* { dg-error "error: struct has no members" "no members" { target *-*-* } 5 } */ diff --git a/tests/GCCTestSuite/anon-struct-5.hex.expected b/tests/GCCTestSuite/anon-struct-5.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-5.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-5.s.expected b/tests/GCCTestSuite/anon-struct-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-6.c b/tests/GCCTestSuite/anon-struct-6.c new file mode 100644 index 0000000..ad961c6 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-6.c @@ -0,0 +1,12 @@ +/* Test diagnostics for structure member with no type specifier or + declarator. Test with no special options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s { + int a; + const; +}; +/* { dg-warning "warning: useless type qualifier in empty declaration" "empty" { target *-*-* } 9 } */ +/* { dg-warning "warning: empty declaration" "empty 2" { target *-*-* } 9 } */ diff --git a/tests/GCCTestSuite/anon-struct-6.c.expected b/tests/GCCTestSuite/anon-struct-6.c.expected new file mode 100644 index 0000000..ad961c6 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-6.c.expected @@ -0,0 +1,12 @@ +/* Test diagnostics for structure member with no type specifier or + declarator. Test with no special options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s { + int a; + const; +}; +/* { dg-warning "warning: useless type qualifier in empty declaration" "empty" { target *-*-* } 9 } */ +/* { dg-warning "warning: empty declaration" "empty 2" { target *-*-* } 9 } */ diff --git a/tests/GCCTestSuite/anon-struct-6.hex.expected b/tests/GCCTestSuite/anon-struct-6.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-6.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-6.s.expected b/tests/GCCTestSuite/anon-struct-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-7.c b/tests/GCCTestSuite/anon-struct-7.c new file mode 100644 index 0000000..1879079 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-7.c @@ -0,0 +1,10 @@ +/* Test diagnostics for structure member with no type specifier or + declarator. Test with -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +struct s { + int a; + const; /* { dg-warning "warning: ISO C forbids member declarations with no members" } */ +}; diff --git a/tests/GCCTestSuite/anon-struct-7.c.expected b/tests/GCCTestSuite/anon-struct-7.c.expected new file mode 100644 index 0000000..1879079 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-7.c.expected @@ -0,0 +1,10 @@ +/* Test diagnostics for structure member with no type specifier or + declarator. Test with -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +struct s { + int a; + const; /* { dg-warning "warning: ISO C forbids member declarations with no members" } */ +}; diff --git a/tests/GCCTestSuite/anon-struct-7.hex.expected b/tests/GCCTestSuite/anon-struct-7.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-7.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-7.s.expected b/tests/GCCTestSuite/anon-struct-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-8.c b/tests/GCCTestSuite/anon-struct-8.c new file mode 100644 index 0000000..c4beb80 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-8.c @@ -0,0 +1,10 @@ +/* Test diagnostics for structure member with no type specifier or + declarator. Test with -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +struct s { + int a; + const; /* { dg-error "error: ISO C forbids member declarations with no members" } */ +}; diff --git a/tests/GCCTestSuite/anon-struct-8.c.expected b/tests/GCCTestSuite/anon-struct-8.c.expected new file mode 100644 index 0000000..c4beb80 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-8.c.expected @@ -0,0 +1,10 @@ +/* Test diagnostics for structure member with no type specifier or + declarator. Test with -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +struct s { + int a; + const; /* { dg-error "error: ISO C forbids member declarations with no members" } */ +}; diff --git a/tests/GCCTestSuite/anon-struct-8.hex.expected b/tests/GCCTestSuite/anon-struct-8.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-8.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/anon-struct-8.s.expected b/tests/GCCTestSuite/anon-struct-8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/anon-struct-8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-g2.c b/tests/GCCTestSuite/arm-g2.c new file mode 100644 index 0000000..a15b280 --- /dev/null +++ b/tests/GCCTestSuite/arm-g2.c @@ -0,0 +1,19 @@ +/* Verify that hardware multiply is preferred on XScale. */ +/* { dg-do compile } */ +/* { dg-options "-mcpu=xscale -O2" } */ +/* { dg-require-effective-target arm32 } */ + +/* Brett Gaines' test case. */ +unsigned BCPL(unsigned) __attribute__ ((naked)); +unsigned BCPL(unsigned seed) +{ + /* Best code would be: + ldr r1, =2147001325 + ldr r2, =715136305 + mla r0, r1, r0, r2 + mov pc, lr */ + + return seed * 2147001325U + 715136305U; +} + +/* { dg-final { scan-assembler "mla\[ ].*" } } */ diff --git a/tests/GCCTestSuite/arm-g2.c.expected b/tests/GCCTestSuite/arm-g2.c.expected new file mode 100644 index 0000000..a15b280 --- /dev/null +++ b/tests/GCCTestSuite/arm-g2.c.expected @@ -0,0 +1,19 @@ +/* Verify that hardware multiply is preferred on XScale. */ +/* { dg-do compile } */ +/* { dg-options "-mcpu=xscale -O2" } */ +/* { dg-require-effective-target arm32 } */ + +/* Brett Gaines' test case. */ +unsigned BCPL(unsigned) __attribute__ ((naked)); +unsigned BCPL(unsigned seed) +{ + /* Best code would be: + ldr r1, =2147001325 + ldr r2, =715136305 + mla r0, r1, r0, r2 + mov pc, lr */ + + return seed * 2147001325U + 715136305U; +} + +/* { dg-final { scan-assembler "mla\[ ].*" } } */ diff --git a/tests/GCCTestSuite/arm-g2.hex.expected b/tests/GCCTestSuite/arm-g2.hex.expected new file mode 100644 index 0000000..ef5c86c --- /dev/null +++ b/tests/GCCTestSuite/arm-g2.hex.expected @@ -0,0 +1,64 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5173C +:10004000F518E516F519E515F51AE514F51B75E033 +:10005000052506F58275E0003507F583E513F07593 +:10006000E0042506F58275E0003507F583E512F01A +:1000700075E0032506F58275E0003507F583E51187 +:10008000F075E0022506F58275E0003507F583E599 +:1000900010F0E51FF500E51EF501E51DF509E51C6D +:1000A000F517750D13750C5C750B07750A00E50DDA +:1000B000F4F50DE50CF4F50EE50BF4F50FE50AF497 +:1000C000F514D3750A00E50AF5F0E50D35F0F50DE8 +:1000D000E50AF5F0E50E35F0F50EE50AF5F0E50F69 +:1000E00035F0F50FE50AF5F0E51435F0F514E50106 +:1000F000F515E509F51675100075110075120075F6 +:100100001300C3750100E500F5F0E50DA4F50CE55D +:1001100000F5F0E50DA4E5F0F509E50CF5F0E501D5 +:1001200035F0F501E515F5F0E50DA4F50CE515F54F +:10013000F0E50DA4E5F0F50AE50CF5F0E50935F07C +:10014000F509E516F5F0E50DA4F50CE516F5F0E575 +:100150000DA4E5F0F50BE50CF5F0E50A35F0F50A30 +:10016000E517F5F0E50DA4F50CE517F5F0E50DA4A0 +:10017000E5F0F50DE50CF5F0E50B35F0F50BC3C337 +:10018000750C00E501F5F0E51035F0F510E509F521 +:10019000F0E51135F0F511E50AF5F0E51235F0F569 +:1001A00012E50BF5F0E51335F0F513C3750900E51D +:1001B00000F5F0E50EA4F50CE500F5F0E50EA4E57C +:1001C000F0F50AE50CF5F0E50935F0F509E515F56A +:1001D000F0E50EA4F50CE515F5F0E50EA4E5F0F557 +:1001E0000BE50CF5F0E50A35F0F50AE516F5F0E556 +:1001F0000EA4F50CE516F5F0E50EA4E5F0F50DE519 +:100200000CF5F0E50B35F0F50B750100C3C3750C6B +:1002100000E501F5F0E51035F0F510E509F5F0E53C +:100220001135F0F511E50AF5F0E51235F0F512E5B6 +:100230000BF5F0E51335F0F513C3750A00E500F58D +:10024000F0E50FA4F50CE500F5F0E50FA4E5F0F5F9 +:100250000BE50CF5F0E50A35F0F50AE515F5F0E5E6 +:100260000FA4F50CE515F5F0E50FA4E5F0F50DE5A7 +:100270000CF5F0E50B35F0F50B750100750900C3C1 +:10028000C3750C00E501F5F0E51035F0F510E50952 +:10029000F5F0E51135F0F511E50AF5F0E51235F068 +:1002A000F512E50BF5F0E51335F0F513C3750B000A +:1002B000E500F5F0E514A4F50CE500F5F0E514A46F +:1002C000E5F0F50DE50CF5F0E50B35F0F50B7501F6 +:1002D00000750900750A00C3C3750000E501F5F05B +:1002E000E51035F0F510E509F5F0E51135F0F511FB +:1002F000E50AF5F0E51235F0F512E50BF5F0E5133A +:1003000035F0F51375013175091D750AA0750B2AB5 +:10031000C3750000E501F5F0E51035F0F500E509DD +:10032000F5F0E51135F0F501E50AF5F0E51235F0E7 +:10033000F509E50BF5F0E51335F0F50AE500F502F2 +:10034000E501F503E509F504E50AF505E518F517F6 +:10035000E519F516E51AF515E51BF51475E0052503 +:1003600006F58275E0003507F583E0F51375E004C6 +:100370002506F58275E0003507F583E0F51275E096 +:10038000032506F58275E0003507F583E0F5117564 +:10039000E0022506F58275E0003507F583E0F510EB +:1003A00075E0002506F58275E0003507F583E0F578 +:1003B00008E508C0E075E0012506F58275E0003526 +:1003C00007F583E0F508E508C0E075E00A2506F5C5 +:1003D0000675E0003507F507E502F582E503F583CC +:1003E000E504F500E505F50122000000000000002D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-g2.s.expected b/tests/GCCTestSuite/arm-g2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/arm-g2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-scd42-1.c b/tests/GCCTestSuite/arm-scd42-1.c new file mode 100644 index 0000000..70b34de --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-1.c @@ -0,0 +1,15 @@ +/* Verify that mov is preferred on XScale for loading a 1 byte constant. */ +/* { dg-do compile { target xscale-*-* } } */ +/* { dg-options "-mcpu=xscale -O" } */ + +unsigned load1(void) __attribute__ ((naked)); +unsigned load1(void) +{ + /* Best code would be: + mov r0, =17 + mov pc, lr */ + + return 17; +} + +/* { dg-final { scan-assembler "mov\[ ].*17" } } */ diff --git a/tests/GCCTestSuite/arm-scd42-1.c.expected b/tests/GCCTestSuite/arm-scd42-1.c.expected new file mode 100644 index 0000000..70b34de --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-1.c.expected @@ -0,0 +1,15 @@ +/* Verify that mov is preferred on XScale for loading a 1 byte constant. */ +/* { dg-do compile { target xscale-*-* } } */ +/* { dg-options "-mcpu=xscale -O" } */ + +unsigned load1(void) __attribute__ ((naked)); +unsigned load1(void) +{ + /* Best code would be: + mov r0, =17 + mov pc, lr */ + + return 17; +} + +/* { dg-final { scan-assembler "mov\[ ].*17" } } */ diff --git a/tests/GCCTestSuite/arm-scd42-1.hex.expected b/tests/GCCTestSuite/arm-scd42-1.hex.expected new file mode 100644 index 0000000..476c3bc --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750911750A007522 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F501220000FE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-scd42-1.s.expected b/tests/GCCTestSuite/arm-scd42-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-scd42-2.c b/tests/GCCTestSuite/arm-scd42-2.c new file mode 100644 index 0000000..1c257c1 --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-2.c @@ -0,0 +1,17 @@ +/* Verify that mov is preferred on XScale for loading a 2 byte constant. */ +/* { dg-do compile } */ +/* { dg-options "-mcpu=xscale -O" } */ +/* { dg-require-effective-target arm32 } */ + +unsigned load2(void) __attribute__ ((naked)); +unsigned load2(void) +{ + /* Best code would be: + mov r0, =272 + add r0, r0, =1 + mov pc, lr */ + + return 273; +} + +/* { dg-final { scan-assembler "mov\[ ].*272" } } */ diff --git a/tests/GCCTestSuite/arm-scd42-2.c.expected b/tests/GCCTestSuite/arm-scd42-2.c.expected new file mode 100644 index 0000000..1c257c1 --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-2.c.expected @@ -0,0 +1,17 @@ +/* Verify that mov is preferred on XScale for loading a 2 byte constant. */ +/* { dg-do compile } */ +/* { dg-options "-mcpu=xscale -O" } */ +/* { dg-require-effective-target arm32 } */ + +unsigned load2(void) __attribute__ ((naked)); +unsigned load2(void) +{ + /* Best code would be: + mov r0, =272 + add r0, r0, =1 + mov pc, lr */ + + return 273; +} + +/* { dg-final { scan-assembler "mov\[ ].*272" } } */ diff --git a/tests/GCCTestSuite/arm-scd42-2.hex.expected b/tests/GCCTestSuite/arm-scd42-2.hex.expected new file mode 100644 index 0000000..bbb1d52 --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750911750A017521 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F501220000FE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-scd42-2.s.expected b/tests/GCCTestSuite/arm-scd42-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-scd42-3.c b/tests/GCCTestSuite/arm-scd42-3.c new file mode 100644 index 0000000..80a4ba8 --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-3.c @@ -0,0 +1,15 @@ +/* Verify that ldr is preferred on XScale for loading a 3 or 4 byte constant. */ +/* { dg-do compile { target xscale-*-* } } */ +/* { dg-options "-mcpu=xscale -O" } */ + +unsigned load4(void) __attribute__ ((naked)); +unsigned load4(void) +{ + /* Best code would be: + ldr r0, =65809 + mov pc, lr */ + + return 65809; +} + +/* { dg-final { scan-assembler "ldr\[ ].*" } } */ diff --git a/tests/GCCTestSuite/arm-scd42-3.c.expected b/tests/GCCTestSuite/arm-scd42-3.c.expected new file mode 100644 index 0000000..80a4ba8 --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-3.c.expected @@ -0,0 +1,15 @@ +/* Verify that ldr is preferred on XScale for loading a 3 or 4 byte constant. */ +/* { dg-do compile { target xscale-*-* } } */ +/* { dg-options "-mcpu=xscale -O" } */ + +unsigned load4(void) __attribute__ ((naked)); +unsigned load4(void) +{ + /* Best code would be: + ldr r0, =65809 + mov pc, lr */ + + return 65809; +} + +/* { dg-final { scan-assembler "ldr\[ ].*" } } */ diff --git a/tests/GCCTestSuite/arm-scd42-3.hex.expected b/tests/GCCTestSuite/arm-scd42-3.hex.expected new file mode 100644 index 0000000..dd3b601 --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-3.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750911750A017521 +:100010000B01750C00E509F502E50AF503E50BF5A2 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F501220000FE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/arm-scd42-3.s.expected b/tests/GCCTestSuite/arm-scd42-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/arm-scd42-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/array-1.c b/tests/GCCTestSuite/array-1.c new file mode 100644 index 0000000..6d1e69a --- /dev/null +++ b/tests/GCCTestSuite/array-1.c @@ -0,0 +1,15 @@ +/* Simplified from ncurses 5.0's pad.c + by Alexandre Oliva + + Copyright (C) 1999 Free Software Foundation */ + +/* { dg-do compile } */ + +extern char foo[1]; +char foo[] = ""; + +int +bar() +{ + return foo[0]; +} diff --git a/tests/GCCTestSuite/array-1.c.expected b/tests/GCCTestSuite/array-1.c.expected new file mode 100644 index 0000000..6d1e69a --- /dev/null +++ b/tests/GCCTestSuite/array-1.c.expected @@ -0,0 +1,15 @@ +/* Simplified from ncurses 5.0's pad.c + by Alexandre Oliva + + Copyright (C) 1999 Free Software Foundation */ + +/* { dg-do compile } */ + +extern char foo[1]; +char foo[] = ""; + +int +bar() +{ + return foo[0]; +} diff --git a/tests/GCCTestSuite/array-1.hex.expected b/tests/GCCTestSuite/array-1.hex.expected new file mode 100644 index 0000000..7b7a970 --- /dev/null +++ b/tests/GCCTestSuite/array-1.hex.expected @@ -0,0 +1,26 @@ +:1000000000D0E0F51AD0E0F51BE511F518E510F584 +:1000100019900000E582F510900000E583F5117558 +:100020000000750100750C01750D00750E00750F4F +:1000300000C3750900E500F5F0E50CA4F50BE5003B +:10004000F5F0E50CA4E5F0F50AE50BF5F0E509356A +:10005000F0F509E501F5F0E50CA4F50BE501F5F087 +:10006000E50CA4E5F0F501E50BF5F0E50A35F0F552 +:100070000AC3C3750100E509F5F0E50E35F0F50E8C +:10008000E50AF5F0E50F35F0F50FC3750A00E50058 +:10009000F5F0E50DA4F50BE500F5F0E50DA4E5F0B0 +:1000A000F501E50BF5F0E50A35F0F50A750900C331 +:1000B000C3750000E509F5F0E50E35F0F50EE50A2B +:1000C000F5F0E50F35F0F50FC3750900750A00C3AB +:1000D000C3750000E509F5F0E50E35F0F50EE50A0B +:1000E000F5F0E50F35F0F50FC3750900750A00C38B +:1000F000C3750000E509F5F0E50E35F0F50EE50AEB +:10010000F5F0E50F35F0F50FC3750000E50EF5F0DD +:10011000E51035F0F500E50FF5F0E51135F0F501E6 +:10012000E500F509E501F50A750100C3750000E574 +:1001300001F5F0E50935F0F501E500F5F0E50A35E2 +:10014000F0F500E500F502E501F582E502F583E052 +:10015000F501750000E500F509E500F50AE501F592 +:1001600002E509F503E50AF504E500F505E518F5EE +:1001700011E519F510E51BC0E0E51AC0E0E502F550 +:1001800082E503F583E504F500E505F501220000AD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/array-1.s.expected b/tests/GCCTestSuite/array-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/array-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/array-quals-2.c b/tests/GCCTestSuite/array-quals-2.c new file mode 100644 index 0000000..5d20244 --- /dev/null +++ b/tests/GCCTestSuite/array-quals-2.c @@ -0,0 +1,14 @@ +/* Test that pointers to arrays of differently qualified types aren't + permitted in conditional expressions, and that qualifiers aren't + lost in forming composite types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ +typedef const char T[1]; +typedef const char T2[1]; +typedef volatile char U[1]; +T *p; +T2 *p2; +U *q; +void *f(void) { return 1 ? p : q; } /* { dg-warning "warning: pointer type mismatch in conditional expression" } */ +T *g(void) { return 1 ? p : p2; } diff --git a/tests/GCCTestSuite/array-quals-2.c.expected b/tests/GCCTestSuite/array-quals-2.c.expected new file mode 100644 index 0000000..5d20244 --- /dev/null +++ b/tests/GCCTestSuite/array-quals-2.c.expected @@ -0,0 +1,14 @@ +/* Test that pointers to arrays of differently qualified types aren't + permitted in conditional expressions, and that qualifiers aren't + lost in forming composite types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ +typedef const char T[1]; +typedef const char T2[1]; +typedef volatile char U[1]; +T *p; +T2 *p2; +U *q; +void *f(void) { return 1 ? p : q; } /* { dg-warning "warning: pointer type mismatch in conditional expression" } */ +T *g(void) { return 1 ? p : p2; } diff --git a/tests/GCCTestSuite/array-quals-2.hex.expected b/tests/GCCTestSuite/array-quals-2.hex.expected new file mode 100644 index 0000000..a707e76 --- /dev/null +++ b/tests/GCCTestSuite/array-quals-2.hex.expected @@ -0,0 +1,41 @@ +:1000000000D0E0F50CD0E0F50D7501017509007523 +:100010000A00750B00750000E501F5F0E50045F0FC +:10002000F500E509F5F0E50045F0F500E50AF5F025 +:10003000E50045F0F500E50BF5F0E50045F0F500CD +:10004000E500700280030200D800900004E582F50C +:1000500009900004E583F50A750100C3750000E509 +:1000600001F5F0E50935F0F501E500F5F0E50A35B3 +:10007000F0F500E500F502E501F582E502F583E023 +:10008000F50B750101C3750000E501F5F0E50935D3 +:10009000F0F501E500F5F0E50A35F0F500E500F5CD +:1000A00002E501F582E502F583E0F501750000E562 +:1000B0000BF502E501F503E500F504E500F505E5BE +:1000C0000DC0E0E50CC0E0E502F582E503F583E54F +:1000D00004F500E505F5012200900000E582F50930 +:1000E000900000E583F50A750100C3750000E50185 +:1000F000F5F0E50935F0F501E500F5F0E50A35F034 +:10010000F500E500F502E501F582E502F583E0F58D +:100110000B750101C3750000E501F5F0E50935F047 +:10012000F501E500F5F0E50A35F0F500E500F5022A +:10013000E501F582E502F583E0F5010200AC00D0AF +:10014000E0F50CD0E0F50D750101750900750A00A8 +:10015000750B00750000E501F5F0E50045F0F500D0 +:10016000E509F5F0E50045F0F500E50AF5F0E500F4 +:1001700045F0F500E50BF5F0E50045F0F500E5008C +:100180007002800302021600900002E582F50990D9 +:100190000002E583F50A750100C3750000E501F56D +:1001A000F0E50935F0F501E500F5F0E50A35F0F583 +:1001B00000E500F502E501F582E502F583E0F50BC7 +:1001C000750101C3750000E501F5F0E50935F0F5AD +:1001D00001E500F5F0E50A35F0F500E500F502E58A +:1001E00001F582E502F583E0F501750000E50BF508 +:1001F00002E501F503E500F504E500F505E50DC0B0 +:10020000E0E50CC0E0E502F582E503F583E504F5E1 +:1002100000E505F5012200900000E582F509900057 +:1002200000E583F50A750100C3750000E501F5F0EE +:10023000E50935F0F501E500F5F0E50A35F0F500E2 +:10024000E500F502E501F582E502F583E0F50B75C1 +:100250000101C3750000E501F5F0E50935F0F50190 +:10026000E500F5F0E50A35F0F500E500F502E501F9 +:10027000F582E502F583E0F5010201EA00000000E5 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/array-quals-2.s.expected b/tests/GCCTestSuite/array-quals-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/array-quals-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/asm-fs-1.c b/tests/GCCTestSuite/asm-fs-1.c new file mode 100644 index 0000000..f215ee8 --- /dev/null +++ b/tests/GCCTestSuite/asm-fs-1.c @@ -0,0 +1,14 @@ +/* Origin: + Make sure we do not get spurious '*' characters in section names or + elsewhere, with asm-specified names. */ +/* { dg-do compile } */ +/* { dg-options "-w -ffunction-sections -fdata-sections" } */ + +void foo (void) asm ("_bar"); +void foo (void) {} + +extern int foobar asm ("_baz"); +int foobar = 3; + +/* { dg-final { scan-assembler-not "\\*_bar" } } */ +/* { dg-final { scan-assembler-not "\\*_baz" } } */ diff --git a/tests/GCCTestSuite/asm-fs-1.c.expected b/tests/GCCTestSuite/asm-fs-1.c.expected new file mode 100644 index 0000000..f215ee8 --- /dev/null +++ b/tests/GCCTestSuite/asm-fs-1.c.expected @@ -0,0 +1,14 @@ +/* Origin: + Make sure we do not get spurious '*' characters in section names or + elsewhere, with asm-specified names. */ +/* { dg-do compile } */ +/* { dg-options "-w -ffunction-sections -fdata-sections" } */ + +void foo (void) asm ("_bar"); +void foo (void) {} + +extern int foobar asm ("_baz"); +int foobar = 3; + +/* { dg-final { scan-assembler-not "\\*_bar" } } */ +/* { dg-final { scan-assembler-not "\\*_baz" } } */ diff --git a/tests/GCCTestSuite/asm-fs-1.hex.expected b/tests/GCCTestSuite/asm-fs-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/asm-fs-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/asm-fs-1.s.expected b/tests/GCCTestSuite/asm-fs-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/asm-fs-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/assign-warn-3.c b/tests/GCCTestSuite/assign-warn-3.c new file mode 100644 index 0000000..4ff7b88 --- /dev/null +++ b/tests/GCCTestSuite/assign-warn-3.c @@ -0,0 +1,13 @@ +/* Test diagnostics for bad type conversion when inlining unprototyped + functions: should not be errors with -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-O3 -std=c99 -pedantic-errors" } */ + +/* This is valid to execute, so maybe shouldn't warn at all. */ +static inline void f0(x) signed char *x; { } +void g0(unsigned char *x) { f0(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f0' differ in signedness" } */ + +/* This is undefined on execution but still must compile. */ +static inline void f1(x) int *x; { } +void g1(unsigned int *x) { f1(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f1' differ in signedness" } */ diff --git a/tests/GCCTestSuite/assign-warn-3.c.expected b/tests/GCCTestSuite/assign-warn-3.c.expected new file mode 100644 index 0000000..4ff7b88 --- /dev/null +++ b/tests/GCCTestSuite/assign-warn-3.c.expected @@ -0,0 +1,13 @@ +/* Test diagnostics for bad type conversion when inlining unprototyped + functions: should not be errors with -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-O3 -std=c99 -pedantic-errors" } */ + +/* This is valid to execute, so maybe shouldn't warn at all. */ +static inline void f0(x) signed char *x; { } +void g0(unsigned char *x) { f0(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f0' differ in signedness" } */ + +/* This is undefined on execution but still must compile. */ +static inline void f1(x) int *x; { } +void g1(unsigned int *x) { f1(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f1' differ in signedness" } */ diff --git a/tests/GCCTestSuite/assign-warn-3.hex.expected b/tests/GCCTestSuite/assign-warn-3.hex.expected new file mode 100644 index 0000000..383c620 --- /dev/null +++ b/tests/GCCTestSuite/assign-warn-3.hex.expected @@ -0,0 +1,32 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0022506F50675E0C8 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F5012200E506758204C39582F5E9 +:1000600006E5077583009583F507D0E0F50875E090 +:10007000012506F58275E0003507F583E508F0D027 +:10008000E0F50875E0002506F58275E0003507F516 +:1000900083E508F0120000750000E500F502E500B8 +:1000A000F503E500F504E500F50575E0002506F526 +:1000B0008275E0003507F583E0F508E508C0E075D6 +:1000C000E0012506F58275E0003507F583E0F508C7 +:1000D000E508C0E075E0042506F50675E000350783 +:1000E000F507E502F582E503F583E504F500E5058E +:1000F000F5012200E506758202C39582F506E50743 +:100100007583009583F507D0E0F500D0E0F5017523 +:100110000900E509F502E509F503E509F504E50936 +:10012000F505E501C0E0E500C0E075E0022506F553 +:100130000675E0003507F507E502F582E503F5836E +:10014000E504F500E505F5012200E506758204C326 +:100150009582F506E5077583009583F507D0E0F5F0 +:100160000875E0012506F58275E0003507F583E5A1 +:1001700008F0D0E0F50875E0002506F58275E0008E +:100180003507F583E508F01200F3750000E500F58A +:1001900002E500F503E500F504E500F50575E0006E +:1001A0002506F58275E0003507F583E0F508E508DA +:1001B000C0E075E0012506F58275E0003507F5839E +:1001C000E0F508E508C0E075E0042506F50675E0F1 +:1001D000003507F507E502F582E503F583E504F54B +:1001E00000E505F50122000000000000000000000D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/assign-warn-3.s.expected b/tests/GCCTestSuite/assign-warn-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/assign-warn-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-alwaysinline.c b/tests/GCCTestSuite/attr-alwaysinline.c new file mode 100644 index 0000000..8ff92b2 --- /dev/null +++ b/tests/GCCTestSuite/attr-alwaysinline.c @@ -0,0 +1,19 @@ +/* Test always_inline attribute, which forces inlining of functions + even at no optimization. */ +/* Origin: Aldy Hernandez . */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +static inline int sabrina (void) __attribute__((always_inline)); + +static inline int sabrina (void) +{ + return 13; +} + +int bar (void) +{ + return sabrina () + 68; +} + +/* { dg-final { scan-assembler-not "sabrina" } } */ diff --git a/tests/GCCTestSuite/attr-alwaysinline.c.expected b/tests/GCCTestSuite/attr-alwaysinline.c.expected new file mode 100644 index 0000000..8ff92b2 --- /dev/null +++ b/tests/GCCTestSuite/attr-alwaysinline.c.expected @@ -0,0 +1,19 @@ +/* Test always_inline attribute, which forces inlining of functions + even at no optimization. */ +/* Origin: Aldy Hernandez . */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +static inline int sabrina (void) __attribute__((always_inline)); + +static inline int sabrina (void) +{ + return 13; +} + +int bar (void) +{ + return sabrina () + 68; +} + +/* { dg-final { scan-assembler-not "sabrina" } } */ diff --git a/tests/GCCTestSuite/attr-alwaysinline.hex.expected b/tests/GCCTestSuite/attr-alwaysinline.hex.expected new file mode 100644 index 0000000..15ba295 --- /dev/null +++ b/tests/GCCTestSuite/attr-alwaysinline.hex.expected @@ -0,0 +1,20 @@ +:1000000000D0E0F500D0E0F50175090D750A007526 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200E519 +:1000400006758202C39582F506E5077583009583E0 +:10005000F507D0E0F50875E0012506F58275E000AA +:100060003507F583E508F0D0E0F50875E0002506D2 +:10007000F58275E0003507F583E508F0120000E52C +:1000800082F502E583F503E500F504E501F505E5F4 +:1000900002F50BE503F50CE504F50DE505F50E7528 +:1000A0000044750100750900750A00C3750F00E56D +:1000B00000F5F0E50B35F0F500E501F5F0E50C3560 +:1000C000F0F501E509F5F0E50D35F0F509E50AF57E +:1000D000F0E50E35F0F50AE500F502E501F503E57A +:1000E00009F504E50AF50575E0002506F58275E0D9 +:1000F000003507F583E0F508E508C0E075E0012567 +:1001000006F58275E0003507F583E0F508E508C0DF +:10011000E075E0022506F50675E0003507F507E510 +:1001200002F582E503F583E504F500E505F5012216 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-alwaysinline.s.expected b/tests/GCCTestSuite/attr-alwaysinline.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-alwaysinline.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-invalid.c b/tests/GCCTestSuite/attr-invalid.c new file mode 100644 index 0000000..9cb6454 --- /dev/null +++ b/tests/GCCTestSuite/attr-invalid.c @@ -0,0 +1,58 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#define CONCAT_(A,B) A ## B +#define CONCAT(A,B) CONCAT_(A,B) + +#define ATTR __attribute__((AT)) +#define ATSYM(suf) CONCAT (AT, CONCAT_ (_, suf)) + +#define AT noinline + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; +} + + +#undef AT +#define AT used + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; +} diff --git a/tests/GCCTestSuite/attr-invalid.c.expected b/tests/GCCTestSuite/attr-invalid.c.expected new file mode 100644 index 0000000..9cb6454 --- /dev/null +++ b/tests/GCCTestSuite/attr-invalid.c.expected @@ -0,0 +1,58 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#define CONCAT_(A,B) A ## B +#define CONCAT(A,B) CONCAT_(A,B) + +#define ATTR __attribute__((AT)) +#define ATSYM(suf) CONCAT (AT, CONCAT_ (_, suf)) + +#define AT noinline + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; +} + + +#undef AT +#define AT used + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; +} diff --git a/tests/GCCTestSuite/attr-invalid.hex.expected b/tests/GCCTestSuite/attr-invalid.hex.expected new file mode 100644 index 0000000..b2b2cc9 --- /dev/null +++ b/tests/GCCTestSuite/attr-invalid.hex.expected @@ -0,0 +1,33 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900758E +:100020000A00750B00750C00E509F502E50AF503F9 +:10003000E50BF504E50CF505E501C0E0E500C0E0E1 +:1000400075E0042506F50675E0003507F507E502BD +:10005000F582E503F583E504F500E505F5012200E9 +:10006000E506758204C39582F506E507758300955C +:1000700083F507D0E0F500D0E0F501750900750AB9 +:1000800000750B00750C00E509F502E50AF503E5BE +:100090000BF504E50CF505E501C0E0E500C0E075F1 +:1000A000E0042506F50675E0003507F507E502F5DD +:1000B00082E503F583E504F500E505F5012200D0AE +:1000C000E0F500D0E0F501750900750A00750B0038 +:1000D000750C00E509F502E50AF503E50BF504E505 +:1000E0000CF505E501C0E0E500C0E0E502F582E5BC +:1000F00003F583E504F500E505F5012200E5067545 +:100100008204C39582F506E5077583009583F5079C +:10011000D0E0F500D0E0F501750900750A00750B17 +:1001200000750C00E509F502E50AF503E50BF50499 +:10013000E50CF505E501C0E0E500C0E075E004254B +:1001400006F50675E0003507F507E502F582E503DB +:10015000F583E504F500E505F5012200E506758265 +:1001600004C39582F506E5077583009583F507D0EE +:10017000E0F500D0E0F501750900750A00750B0087 +:10018000750C00E509F502E50AF503E50BF504E554 +:100190000CF505E501C0E0E500C0E075E0042506CA +:1001A000F50675E0003507F507E502F582E503F58C +:1001B00083E504F500E505F5012200D0E0F500D067 +:1001C000E0F501750900750A00750B00750C00E576 +:1001D00009F502E50AF503E50BF504E50CF505E57F +:1001E00001C0E0E500C0E0E502F582E503F583E546 +:1001F00004F500E505F50122000000000000000004 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-invalid.s.expected b/tests/GCCTestSuite/attr-invalid.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-invalid.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-isr-trap_exit.c b/tests/GCCTestSuite/attr-isr-trap_exit.c new file mode 100644 index 0000000..880db37 --- /dev/null +++ b/tests/GCCTestSuite/attr-isr-trap_exit.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target sh-*-* sh[1234ble]*-*-*} } */ +/* { dg-options "-O" } */ +/* Check that trapa / interrput_handler attributes can paired in + either order. */ +void h0() __attribute__ ((trap_exit (4))) __attribute__ ((interrupt_handler)); +void h1() __attribute__ ((interrupt_handler)) __attribute__ ((trap_exit (5))); + +void foo () +{ +} + +void h0 () {} +/* { dg-final { scan-assembler "trapa\[ \t\]\[ \t\]*#4"} } */ +/* { dg-final { scan-assembler-times "trapa" 1} } */ + +void delay(int a) +{ +} +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/attr-isr-trap_exit.c.expected b/tests/GCCTestSuite/attr-isr-trap_exit.c.expected new file mode 100644 index 0000000..880db37 --- /dev/null +++ b/tests/GCCTestSuite/attr-isr-trap_exit.c.expected @@ -0,0 +1,23 @@ +/* { dg-do compile { target sh-*-* sh[1234ble]*-*-*} } */ +/* { dg-options "-O" } */ +/* Check that trapa / interrput_handler attributes can paired in + either order. */ +void h0() __attribute__ ((trap_exit (4))) __attribute__ ((interrupt_handler)); +void h1() __attribute__ ((interrupt_handler)) __attribute__ ((trap_exit (5))); + +void foo () +{ +} + +void h0 () {} +/* { dg-final { scan-assembler "trapa\[ \t\]\[ \t\]*#4"} } */ +/* { dg-final { scan-assembler-times "trapa" 1} } */ + +void delay(int a) +{ +} +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/attr-isr-trap_exit.hex.expected b/tests/GCCTestSuite/attr-isr-trap_exit.hex.expected new file mode 100644 index 0000000..54a060f --- /dev/null +++ b/tests/GCCTestSuite/attr-isr-trap_exit.hex.expected @@ -0,0 +1,18 @@ +:1000000075812F7506FF7507FF1200CF02000C00E7 +:10001000D0E0F500D0E0F501750900E509F502E54D +:1000200009F503E509F504E509F505E501C0E0E595 +:1000300000C0E0E502F582E503F583E504F500E59F +:1000400005F5012200D0E0F500D0E0F501750900CA +:10005000E509F502E509F503E509F504E509F50506 +:10006000E501C0E0E500C0E0E502F582E503F583C7 +:10007000E504F500E505F5012200E506758204C3F7 +:100080009582F506E5077583009583F507D0E0F5C1 +:1000900000D0E0F501750900E509F502E509F50371 +:1000A000E509F504E509F505E501C0E0E500C0E076 +:1000B00075E0042506F50675E0003507F507E5024D +:1000C000F582E503F583E504F500E505F501220079 +:1000D000D0E0F500D0E0F501750900750A00750B58 +:1000E00000750C00E509F502E50AF503E50BF504DA +:1000F000E50CF505E501C0E0E500C0E0E502F582AC +:10010000E503F583E504F500E505F50122000000AF +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-isr-trap_exit.s.expected b/tests/GCCTestSuite/attr-isr-trap_exit.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-isr-trap_exit.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-mode-1.c b/tests/GCCTestSuite/attr-mode-1.c new file mode 100644 index 0000000..e60d01b --- /dev/null +++ b/tests/GCCTestSuite/attr-mode-1.c @@ -0,0 +1,13 @@ +/* PR c/17384 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef struct __attribute__((mode(SI))) { + unsigned INT0 :1, + RES0 :1, + :6, + INT1 :1, + RES1 :1, + :6, + :16; +} MCR; /* { dg-error "inappropriate type" } */ diff --git a/tests/GCCTestSuite/attr-mode-1.c.expected b/tests/GCCTestSuite/attr-mode-1.c.expected new file mode 100644 index 0000000..e60d01b --- /dev/null +++ b/tests/GCCTestSuite/attr-mode-1.c.expected @@ -0,0 +1,13 @@ +/* PR c/17384 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef struct __attribute__((mode(SI))) { + unsigned INT0 :1, + RES0 :1, + :6, + INT1 :1, + RES1 :1, + :6, + :16; +} MCR; /* { dg-error "inappropriate type" } */ diff --git a/tests/GCCTestSuite/attr-mode-1.hex.expected b/tests/GCCTestSuite/attr-mode-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/attr-mode-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-mode-1.s.expected b/tests/GCCTestSuite/attr-mode-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-mode-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-used-2.c b/tests/GCCTestSuite/attr-used-2.c new file mode 100644 index 0000000..f78b94b --- /dev/null +++ b/tests/GCCTestSuite/attr-used-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -O2" } */ + +static int xyzzy __attribute__((__used__)) = 1; + +void foo() +{ + int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */ +} + +/* { dg-final { scan-assembler "xyzzy" } } */ diff --git a/tests/GCCTestSuite/attr-used-2.c.expected b/tests/GCCTestSuite/attr-used-2.c.expected new file mode 100644 index 0000000..f78b94b --- /dev/null +++ b/tests/GCCTestSuite/attr-used-2.c.expected @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -O2" } */ + +static int xyzzy __attribute__((__used__)) = 1; + +void foo() +{ + int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */ +} + +/* { dg-final { scan-assembler "xyzzy" } } */ diff --git a/tests/GCCTestSuite/attr-used-2.hex.expected b/tests/GCCTestSuite/attr-used-2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/attr-used-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-used-2.s.expected b/tests/GCCTestSuite/attr-used-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-used-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-used.c b/tests/GCCTestSuite/attr-used.c new file mode 100644 index 0000000..ba7705a --- /dev/null +++ b/tests/GCCTestSuite/attr-used.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +static void function_declaration_before(void) __attribute__((__used__)); + +static void function_declaration_before(void) {} + +static void function_declaration_after(void) {} + +static void function_declaration_after(void) __attribute__((__used__)); + +/* { dg-final { scan-assembler "function_declaration_before" } } */ +/* { dg-final { scan-assembler "function_declaration_after" } } */ diff --git a/tests/GCCTestSuite/attr-used.c.expected b/tests/GCCTestSuite/attr-used.c.expected new file mode 100644 index 0000000..ba7705a --- /dev/null +++ b/tests/GCCTestSuite/attr-used.c.expected @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +static void function_declaration_before(void) __attribute__((__used__)); + +static void function_declaration_before(void) {} + +static void function_declaration_after(void) {} + +static void function_declaration_after(void) __attribute__((__used__)); + +/* { dg-final { scan-assembler "function_declaration_before" } } */ +/* { dg-final { scan-assembler "function_declaration_after" } } */ diff --git a/tests/GCCTestSuite/attr-used.hex.expected b/tests/GCCTestSuite/attr-used.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/attr-used.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-used.s.expected b/tests/GCCTestSuite/attr-used.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-used.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-weakref-1a.c b/tests/GCCTestSuite/attr-weakref-1a.c new file mode 100644 index 0000000..5ce1e4e --- /dev/null +++ b/tests/GCCTestSuite/attr-weakref-1a.c @@ -0,0 +1,8 @@ +int uv4; +int uv5; +int uv7; +int uv8; +void uf4 (void) {} +void uf5 (void) {} +void uf7 (void) {} +void uf8 (void) {} diff --git a/tests/GCCTestSuite/attr-weakref-1a.c.expected b/tests/GCCTestSuite/attr-weakref-1a.c.expected new file mode 100644 index 0000000..5ce1e4e --- /dev/null +++ b/tests/GCCTestSuite/attr-weakref-1a.c.expected @@ -0,0 +1,8 @@ +int uv4; +int uv5; +int uv7; +int uv8; +void uf4 (void) {} +void uf5 (void) {} +void uf7 (void) {} +void uf8 (void) {} diff --git a/tests/GCCTestSuite/attr-weakref-1a.hex.expected b/tests/GCCTestSuite/attr-weakref-1a.hex.expected new file mode 100644 index 0000000..745968a --- /dev/null +++ b/tests/GCCTestSuite/attr-weakref-1a.hex.expected @@ -0,0 +1,15 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F5012200D0E0F500D0B8 +:10007000E0F501750900E509F502E509F503E50973 +:10008000F504E509F505E501C0E0E500C0E0E5029D +:10009000F582E503F583E504F500E505F5012200A9 +:1000A000D0E0F500D0E0F501750900E509F502E5BD +:1000B00009F503E509F504E509F505E501C0E0E505 +:1000C00000C0E0E502F582E503F583E504F500E50F +:1000D00005F5012200000000000000000000000003 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/attr-weakref-1a.s.expected b/tests/GCCTestSuite/attr-weakref-1a.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/attr-weakref-1a.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-10.c b/tests/GCCTestSuite/bitfld-10.c new file mode 100644 index 0000000..156929f --- /dev/null +++ b/tests/GCCTestSuite/bitfld-10.c @@ -0,0 +1,8 @@ +/* Test for rejection of sizeof on bit-fields. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct { int a : 1; } x; + +int r = sizeof (x.a); /* { dg-error "error: 'sizeof' applied to a bit-field" } */ diff --git a/tests/GCCTestSuite/bitfld-10.c.expected b/tests/GCCTestSuite/bitfld-10.c.expected new file mode 100644 index 0000000..156929f --- /dev/null +++ b/tests/GCCTestSuite/bitfld-10.c.expected @@ -0,0 +1,8 @@ +/* Test for rejection of sizeof on bit-fields. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct { int a : 1; } x; + +int r = sizeof (x.a); /* { dg-error "error: 'sizeof' applied to a bit-field" } */ diff --git a/tests/GCCTestSuite/bitfld-10.hex.expected b/tests/GCCTestSuite/bitfld-10.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-10.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-10.s.expected b/tests/GCCTestSuite/bitfld-10.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/bitfld-10.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-14.c b/tests/GCCTestSuite/bitfld-14.c new file mode 100644 index 0000000..eca0b03 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-14.c @@ -0,0 +1,11 @@ +/* Test for non-integer bit-field widths. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +struct s { + int a : (void *)4; /* { dg-error "error: bit-field 'a' width not an integer constant" } */ + int b : (enum e)F; + int c : (_Bool)1; +}; diff --git a/tests/GCCTestSuite/bitfld-14.c.expected b/tests/GCCTestSuite/bitfld-14.c.expected new file mode 100644 index 0000000..eca0b03 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-14.c.expected @@ -0,0 +1,11 @@ +/* Test for non-integer bit-field widths. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +struct s { + int a : (void *)4; /* { dg-error "error: bit-field 'a' width not an integer constant" } */ + int b : (enum e)F; + int c : (_Bool)1; +}; diff --git a/tests/GCCTestSuite/bitfld-14.hex.expected b/tests/GCCTestSuite/bitfld-14.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-14.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-14.s.expected b/tests/GCCTestSuite/bitfld-14.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/bitfld-14.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-5.c b/tests/GCCTestSuite/bitfld-5.c new file mode 100644 index 0000000..835bbce --- /dev/null +++ b/tests/GCCTestSuite/bitfld-5.c @@ -0,0 +1,12 @@ +/* { dg-options "" } */ +#include + +struct s +{ + int i1 : sizeof (int) * CHAR_BIT; + int i2 : sizeof (int) * CHAR_BIT; + int i3 : sizeof (int) * CHAR_BIT; + int i4 : sizeof (int) * CHAR_BIT; +}; + +int f[sizeof (struct s) != sizeof (int) * 4 ? -1 : 1]; diff --git a/tests/GCCTestSuite/bitfld-5.c.expected b/tests/GCCTestSuite/bitfld-5.c.expected new file mode 100644 index 0000000..835bbce --- /dev/null +++ b/tests/GCCTestSuite/bitfld-5.c.expected @@ -0,0 +1,12 @@ +/* { dg-options "" } */ +#include + +struct s +{ + int i1 : sizeof (int) * CHAR_BIT; + int i2 : sizeof (int) * CHAR_BIT; + int i3 : sizeof (int) * CHAR_BIT; + int i4 : sizeof (int) * CHAR_BIT; +}; + +int f[sizeof (struct s) != sizeof (int) * 4 ? -1 : 1]; diff --git a/tests/GCCTestSuite/bitfld-5.hex.expected b/tests/GCCTestSuite/bitfld-5.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-5.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-5.s.expected b/tests/GCCTestSuite/bitfld-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/bitfld-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-6.c b/tests/GCCTestSuite/bitfld-6.c new file mode 100644 index 0000000..a9a7f40 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-6.c @@ -0,0 +1,16 @@ +/* { dg-options "" } */ +#include + +struct s +{ + int i1 : sizeof (int) * CHAR_BIT; + int i2 : sizeof (int) * CHAR_BIT; + int i3 : sizeof (int) * CHAR_BIT; + int i4 : sizeof (int) * CHAR_BIT; + int i5 : sizeof (int) * CHAR_BIT; + int i6 : sizeof (int) * CHAR_BIT; + int i7 : sizeof (int) * CHAR_BIT; + int i8 : sizeof (int) * CHAR_BIT; +}; + +int f[sizeof (struct s) != sizeof (int) * 8 ? -1 : 1]; diff --git a/tests/GCCTestSuite/bitfld-6.c.expected b/tests/GCCTestSuite/bitfld-6.c.expected new file mode 100644 index 0000000..a9a7f40 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-6.c.expected @@ -0,0 +1,16 @@ +/* { dg-options "" } */ +#include + +struct s +{ + int i1 : sizeof (int) * CHAR_BIT; + int i2 : sizeof (int) * CHAR_BIT; + int i3 : sizeof (int) * CHAR_BIT; + int i4 : sizeof (int) * CHAR_BIT; + int i5 : sizeof (int) * CHAR_BIT; + int i6 : sizeof (int) * CHAR_BIT; + int i7 : sizeof (int) * CHAR_BIT; + int i8 : sizeof (int) * CHAR_BIT; +}; + +int f[sizeof (struct s) != sizeof (int) * 8 ? -1 : 1]; diff --git a/tests/GCCTestSuite/bitfld-6.hex.expected b/tests/GCCTestSuite/bitfld-6.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/bitfld-6.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/bitfld-6.s.expected b/tests/GCCTestSuite/bitfld-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/bitfld-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/builtin-strstr.c b/tests/GCCTestSuite/builtin-strstr.c new file mode 100644 index 0000000..b8201f4 --- /dev/null +++ b/tests/GCCTestSuite/builtin-strstr.c @@ -0,0 +1,8 @@ +/* The strstr call is expanded to just "s", which should not result in a + warning about discarding qualifiers in an assignment. */ +/* { dg-do compile } */ +extern char * strstr (const char *s1, const char * s2); +void foo(const char *s){ + char * cp; + cp = strstr(s, ""); +} diff --git a/tests/GCCTestSuite/builtin-strstr.c.expected b/tests/GCCTestSuite/builtin-strstr.c.expected new file mode 100644 index 0000000..b8201f4 --- /dev/null +++ b/tests/GCCTestSuite/builtin-strstr.c.expected @@ -0,0 +1,8 @@ +/* The strstr call is expanded to just "s", which should not result in a + warning about discarding qualifiers in an assignment. */ +/* { dg-do compile } */ +extern char * strstr (const char *s1, const char * s2); +void foo(const char *s){ + char * cp; + cp = strstr(s, ""); +} diff --git a/tests/GCCTestSuite/builtin-strstr.hex.expected b/tests/GCCTestSuite/builtin-strstr.hex.expected new file mode 100644 index 0000000..38438af --- /dev/null +++ b/tests/GCCTestSuite/builtin-strstr.hex.expected @@ -0,0 +1,12 @@ +:100000000000E506758204C39582F506E507758351 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F090A8 +:100040000000E582F51D900000E583F51C750000B9 +:10005000E500F502E500F503E500F504E500F5052A +:1000600075E0002506F58275E0003507F583E0F5BB +:1000700008E508C0E075E0012506F58275E0003569 +:1000800007F583E0F508E508C0E075E0042506F50E +:100090000675E0003507F507E502F582E503F5830F +:1000A000E504F500E505F501220000000000000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/builtin-strstr.s.expected b/tests/GCCTestSuite/builtin-strstr.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/builtin-strstr.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/builtins-35.c b/tests/GCCTestSuite/builtins-35.c new file mode 100644 index 0000000..f898707 --- /dev/null +++ b/tests/GCCTestSuite/builtins-35.c @@ -0,0 +1,6 @@ +/* Test that nan functions are not built-in in C90 mode. Bug 14635. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ + +int nan, nanf, nanl, nans, nansf, nansl; diff --git a/tests/GCCTestSuite/builtins-35.c.expected b/tests/GCCTestSuite/builtins-35.c.expected new file mode 100644 index 0000000..f898707 --- /dev/null +++ b/tests/GCCTestSuite/builtins-35.c.expected @@ -0,0 +1,6 @@ +/* Test that nan functions are not built-in in C90 mode. Bug 14635. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ + +int nan, nanf, nanl, nans, nansf, nansl; diff --git a/tests/GCCTestSuite/builtins-35.hex.expected b/tests/GCCTestSuite/builtins-35.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/builtins-35.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/builtins-35.s.expected b/tests/GCCTestSuite/builtins-35.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/builtins-35.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-lval-5.c b/tests/GCCTestSuite/c90-array-lval-5.c new file mode 100644 index 0000000..c218a4d --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-5.c @@ -0,0 +1,26 @@ +/* Test for non-lvalue arrays: test that the unary '&' operator is not + allowed on them, for both C90 and C99. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct s { char c[1]; }; + +extern struct s foo (void); +struct s a, b, c; +int d; + +void +bar (void) +{ + &((foo ()).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d, b).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((a = b).c); /* { dg-bogus "warning" "warning in place of error" } */ +} +/* { dg-error "lvalue" "bad address-of" { target *-*-* } 17 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 18 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 19 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 20 } +*/ diff --git a/tests/GCCTestSuite/c90-array-lval-5.c.expected b/tests/GCCTestSuite/c90-array-lval-5.c.expected new file mode 100644 index 0000000..c218a4d --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-5.c.expected @@ -0,0 +1,26 @@ +/* Test for non-lvalue arrays: test that the unary '&' operator is not + allowed on them, for both C90 and C99. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct s { char c[1]; }; + +extern struct s foo (void); +struct s a, b, c; +int d; + +void +bar (void) +{ + &((foo ()).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d, b).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((a = b).c); /* { dg-bogus "warning" "warning in place of error" } */ +} +/* { dg-error "lvalue" "bad address-of" { target *-*-* } 17 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 18 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 19 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 20 } +*/ diff --git a/tests/GCCTestSuite/c90-array-lval-5.hex.expected b/tests/GCCTestSuite/c90-array-lval-5.hex.expected new file mode 100644 index 0000000..e65a10d --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-5.hex.expected @@ -0,0 +1,134 @@ +:100000000000E506758208C39582F506E50775834D +:10001000009583F507D0E0F50875E0032506F58225 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000022506F58275E0003507F583E508F075C1 +:10004000E0072506F58275E0003507F583E513F036 +:1000500075E0062506F58275E0003507F583E512A3 +:10006000F075E0052506F58275E0003507F583E5B6 +:1000700011F075E0042506F58275E0003507F5837B +:10008000E510F0E506F509E507F50A750101C37508 +:100090000000E501F5F0E50935F0F501E500F5F0C2 +:1000A000E50A35F0F500E501F51FE500F51EE5066A +:1000B000F509E507F50A750100C3750000E501F5CE +:1000C000F0E50935F0F501E500F5F0E50A35F0F564 +:1000D0000A750900C3750000E509F5F0E50135F082 +:1000E000F501E500F5F0E50A35F0F500E501F50963 +:1000F000E500F50A750100C3750000E501F5F0E5BE +:100100000935F0F501E500F5F0E50A35F0F500E513 +:1001100000F502E501F582E502F583E0F5117501D0 +:1001200001C3750000E501F5F0E50935F0F501E5DD +:1001300000F5F0E50A35F0F500E500F502E501F51A +:1001400082E502F583E0F501750900750A00750E78 +:1001500001750F00751000750000C3750B00E509EF +:10016000F5F0E50EA4F50DE509F5F0E50EA4E5F0D2 +:10017000F50CE50DF5F0E50B35F0F50BE50AF5F0BE +:10018000E50EA4F50DE50AF5F0E50EA4E5F0F50A97 +:10019000E50DF5F0E50C35F0F50CC3C3750A00E587 +:1001A0000BF5F0E51035F0F510E50CF5F0E5003550 +:1001B000F0F500C3750C00E509F5F0E50FA4F50DA9 +:1001C000E509F5F0E50FA4E5F0F50AE50DF5F0E534 +:1001D0000C35F0F50C750B00C3C3750900E50BF584 +:1001E000F0E51035F0F510E50CF5F0E50035F0F52B +:1001F00000C3750B00750C00C3C3750900E50BF552 +:10020000F0E51035F0F510E50CF5F0E50035F0F50A +:1002100000C3750B00750C00C3C3750900E50BF531 +:10022000F0E51035F0F510E50CF5F0E50035F0F5EA +:1002300000C3750900E510F5F0E51135F0F512E59C +:1002400000F5F0E50135F0F513900001E582F509C0 +:10025000900001E583F50A750100C3750000E50112 +:10026000F5F0E50935F0F501E500F5F0E50A35F0C2 +:10027000F500E501F509E500F50A750100C3750013 +:1002800000E501F5F0E50935F0F501E500F5F0E5EB +:100290000A35F0F500E500F502E501F582E502F525 +:1002A00083E0F510750101C3750000E501F5F0E587 +:1002B0000935F0F501E500F5F0E50A35F0F500E562 +:1002C00000F502E501F582E502F583E0F511750020 +:1002D00000750100750C01750D00750E00750F009D +:1002E000C3750900E500F5F0E50CA4F50BE500F594 +:1002F000F0E50CA4E5F0F50AE50BF5F0E50935F0BD +:10030000F509E501F5F0E50CA4F50BE501F5F0E5DF +:100310000CA4E5F0F501E50BF5F0E50A35F0F50A7A +:10032000C3C3750100E509F5F0E50E35F0F50EE5FE +:100330000AF5F0E50F35F0F50FC3750A00E500F595 +:10034000F0E50DA4F50BE500F5F0E50DA4E5F0F5FD +:1003500001E50BF5F0E50A35F0F50A750900C3C3B0 +:10036000750000E509F5F0E50E35F0F50EE50AF546 +:10037000F0E50F35F0F50FC3750900750A00C3C32A +:10038000750000E509F5F0E50E35F0F50EE50AF526 +:10039000F0E50F35F0F50FC3750900750A00C3C30A +:1003A000750000E509F5F0E50E35F0F50EE50AF506 +:1003B000F0E50F35F0F50FC3750000E50EF5F0E53B +:1003C0001035F0F500E50FF5F0E51135F0F501E534 +:1003D00000F509E501F50A750100C3750000E501A6 +:1003E000F5F0E50935F0F501E500F5F0E50A35F041 +:1003F000F500E500F502E501F582E502F583E0F59B +:1004000009750100C3750000E501F5F0E51235F04E +:10041000F501E500F5F0E51335F0F500E509F50324 +:10042000E500F502E501F582E502F583E503F090CC +:100430000000E582F509900000E583F50A750100EA +:10044000C3750000E501F5F0E50935F0F501E500BB +:10045000F5F0E50A35F0F500E501F509E500F50AE6 +:10046000750100C3750000E501F5F0E50935F0F50B +:1004700001E500F5F0E50A35F0F500E500F502E5E7 +:1004800001F582E502F583E0F511750101C3750000 +:1004900000E501F5F0E50935F0F501E500F5F0E5D9 +:1004A0000A35F0F500E500F502E501F582E502F513 +:1004B00083E0F501750900750A00750E01750F00DE +:1004C000751000750000C3750B00E509F5F0E50E29 +:1004D000A4F50DE509F5F0E50EA4E5F0F50CE50D44 +:1004E000F5F0E50B35F0F50BE50AF5F0E50EA4F5B2 +:1004F0000DE50AF5F0E50EA4E5F0F50AE50DF5F0D9 +:10050000E50C35F0F50CC3C3750A00E50BF5F0E515 +:100510001035F0F510E50CF5F0E50035F0F500C309 +:10052000750C00E509F5F0E50FA4F50DE509F5F00A +:10053000E50FA4E5F0F50AE50DF5F0E50C35F0F56D +:100540000C750B00C3C3750900E50BF5F0E510351C +:10055000F0F510E50CF5F0E50035F0F500C3750B8E +:1005600000750C00C3C3750900E50BF5F0E5103507 +:10057000F0F510E50CF5F0E50035F0F500C3750B6E +:1005800000750C00C3C3750900E50BF5F0E51035E7 +:10059000F0F510E50CF5F0E50035F0F500C3750950 +:1005A00000E510F5F0E51135F0F512E500F5F0E5A0 +:1005B0000135F0F513E506F509E507F50A750100C3 +:1005C000C3750000E501F5F0E50935F0F501E5003A +:1005D000F5F0E50A35F0F50A750900C3750000E588 +:1005E00009F5F0E50135F0F501E500F5F0E50A352E +:1005F000F0F500E501F509E500F50A750100C375A0 +:100600000000E501F5F0E50935F0F501E500F5F04C +:10061000E50A35F0F500E500F502E501F582E502B1 +:10062000F583E0F510750101C3750000E501F5F0F3 +:10063000E50935F0F501E500F5F0E50A35F0F500DE +:10064000E500F502E501F582E502F583E0F51175B7 +:100650000000750100750C01750D00750E00750F19 +:1006600000C3750900E500F5F0E50CA4F50BE50005 +:10067000F5F0E50CA4E5F0F50AE50BF5F0E5093534 +:10068000F0F509E501F5F0E50CA4F50BE501F5F051 +:10069000E50CA4E5F0F501E50BF5F0E50A35F0F51C +:1006A0000AC3C3750100E509F5F0E50E35F0F50E56 +:1006B000E50AF5F0E50F35F0F50FC3750A00E50022 +:1006C000F5F0E50DA4F50BE500F5F0E50DA4E5F07A +:1006D000F501E50BF5F0E50A35F0F50A750900C3FB +:1006E000C3750000E509F5F0E50E35F0F50EE50AF5 +:1006F000F5F0E50F35F0F50FC3750900750A00C375 +:10070000C3750000E509F5F0E50E35F0F50EE50AD4 +:10071000F5F0E50F35F0F50FC3750900750A00C354 +:10072000C3750000E509F5F0E50E35F0F50EE50AB4 +:10073000F5F0E50F35F0F50FC3750000E50EF5F0A7 +:10074000E51035F0F500E50FF5F0E51135F0F501B0 +:10075000E500F509E501F50A750100C3750000E53E +:1007600001F5F0E50935F0F501E500F5F0E50A35AC +:10077000F0F500E500F502E501F582E502F583E01C +:10078000F509750100C3750000E501F5F0E51235C6 +:10079000F0F501E500F5F0E51335F0F500E509F5B4 +:1007A00003E500F502E501F582E502F583E503F0D6 +:1007B000750000E500F502E500F503E500F504E548 +:1007C00000F50575E0072506F58275E0003507F5AB +:1007D00083E0F51375E0062506F58275E000350720 +:1007E000F583E0F51275E0052506F58275E0003524 +:1007F00007F583E0F51175E0042506F58275E00044 +:100800003507F583E0F51075E0022506F58275E001 +:10081000003507F583E0F508E508C0E075E003253D +:1008200006F58275E0003507F583E0F508E508C0B8 +:10083000E075E0082506F50675E0003507F507E5E3 +:1008400002F582E503F583E504F500E505F50122EF +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-lval-5.s.expected b/tests/GCCTestSuite/c90-array-lval-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-lval-6.c b/tests/GCCTestSuite/c90-array-lval-6.c new file mode 100644 index 0000000..f42ef52 --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-6.c @@ -0,0 +1,16 @@ +/* PR c/12446 */ +/* Origin: Keith Thompson */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + + +struct s { char c[1]; }; + +extern struct s foo(void); + +void bar(void) +{ + char *ptr = foo().c; /* { dg-bogus "warning" "warning in place of error" } */ +} +/* { dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } 14 } */ diff --git a/tests/GCCTestSuite/c90-array-lval-6.c.expected b/tests/GCCTestSuite/c90-array-lval-6.c.expected new file mode 100644 index 0000000..f42ef52 --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-6.c.expected @@ -0,0 +1,16 @@ +/* PR c/12446 */ +/* Origin: Keith Thompson */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + + +struct s { char c[1]; }; + +extern struct s foo(void); + +void bar(void) +{ + char *ptr = foo().c; /* { dg-bogus "warning" "warning in place of error" } */ +} +/* { dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } 14 } */ diff --git a/tests/GCCTestSuite/c90-array-lval-6.hex.expected b/tests/GCCTestSuite/c90-array-lval-6.hex.expected new file mode 100644 index 0000000..91c9bfd --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-6.hex.expected @@ -0,0 +1,14 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0022506F58226 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000012506F58275E0003507F583E508F0E552 +:1000400006F509E507F50A750100C3750000E5012D +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E501F51FE500F51EC3C3C3C3750028 +:1000700000E500F502E500F503E500F504E500F50F +:100080000575E0012506F58275E0003507F583E08A +:10009000F508E508C0E075E0022506F58275E00088 +:1000A0003507F583E0F508E508C0E075E0032506AF +:1000B000F50675E0003507F507E502F582E503F57D +:1000C00083E504F500E505F50122000000000000CD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-lval-6.s.expected b/tests/GCCTestSuite/c90-array-lval-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-lval-7.c b/tests/GCCTestSuite/c90-array-lval-7.c new file mode 100644 index 0000000..ee8da4c --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-7.c @@ -0,0 +1,23 @@ +/* Test for non-lvalue arrays: test that C90 does not allow them in + conditional expressions, while in C99 they decay and are + allowed. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct s { char c[1]; }; +struct s a, b, c; +int d; +int e; + +void +bar (void) +{ + /* In C90, the non-lvalue arrays do not decay to pointers, and + 6.3.15 does not permit conditional expressions between arrays. + In C99, they decay to pointers. */ + (e ? (d ? b : c).c : (e ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */ +} + +/* { dg-error "array" "bad conditional" { target *-*-* } 20 } */ diff --git a/tests/GCCTestSuite/c90-array-lval-7.c.expected b/tests/GCCTestSuite/c90-array-lval-7.c.expected new file mode 100644 index 0000000..ee8da4c --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-7.c.expected @@ -0,0 +1,23 @@ +/* Test for non-lvalue arrays: test that C90 does not allow them in + conditional expressions, while in C99 they decay and are + allowed. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct s { char c[1]; }; +struct s a, b, c; +int d; +int e; + +void +bar (void) +{ + /* In C90, the non-lvalue arrays do not decay to pointers, and + 6.3.15 does not permit conditional expressions between arrays. + In C99, they decay to pointers. */ + (e ? (d ? b : c).c : (e ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */ +} + +/* { dg-error "array" "bad conditional" { target *-*-* } 20 } */ diff --git a/tests/GCCTestSuite/c90-array-lval-7.hex.expected b/tests/GCCTestSuite/c90-array-lval-7.hex.expected new file mode 100644 index 0000000..0a5eadc --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-7.hex.expected @@ -0,0 +1,21 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F900007E582F509900007E583F50A7562 +:100020000100C3750000E501F5F0E50935F0F501C3 +:10003000E500F5F0E50A35F0F500E500F502E5012B +:10004000F582E502F583E0F50B750101C37500004B +:10005000E501F5F0E50935F0F501E500F5F0E50A13 +:1000600035F0F500E500F502E501F582E502F583DE +:10007000E0F50C750102C3750000E501F5F0E50936 +:1000800035F0F501E500F5F0E50A35F0F500E5009D +:10009000F502E501F582E502F583E0F50D75010352 +:1000A000C3750000E501F5F0E50935F0F501E5005F +:1000B000F5F0E50A35F0F500E500F502E501F58219 +:1000C000E502F583E0F501750000E50BF5F0E500CC +:1000D00045F0F500E50CF5F0E50045F0F500E50D1F +:1000E000F5F0E50045F0F500E501F5F0E50045F037 +:1000F000F500E5007002800302013000750000E5A4 +:1001000000F502E500F503E500F504E500F505E579 +:100110000EF511E50FF510E519C0E0E518C0E0E5B2 +:1001200002F582E503F583E504F500E505F5012216 +:10013000000200FC000000000000000000000000C1 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-lval-7.s.expected b/tests/GCCTestSuite/c90-array-lval-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-array-lval-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-quals-2.c b/tests/GCCTestSuite/c90-array-quals-2.c new file mode 100644 index 0000000..7cb68c8 --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals-2.c @@ -0,0 +1,3 @@ +extern const char *const a[]; +extern const char *const a[]; +extern const char *const a[]; diff --git a/tests/GCCTestSuite/c90-array-quals-2.c.expected b/tests/GCCTestSuite/c90-array-quals-2.c.expected new file mode 100644 index 0000000..7cb68c8 --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals-2.c.expected @@ -0,0 +1,3 @@ +extern const char *const a[]; +extern const char *const a[]; +extern const char *const a[]; diff --git a/tests/GCCTestSuite/c90-array-quals-2.hex.expected b/tests/GCCTestSuite/c90-array-quals-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-quals-2.s.expected b/tests/GCCTestSuite/c90-array-quals-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-quals.c b/tests/GCCTestSuite/c90-array-quals.c new file mode 100644 index 0000000..228e79f --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals.c @@ -0,0 +1,3 @@ +extern int (*const a)[]; +extern int (*const a)[10]; +extern int (*const a)[]; diff --git a/tests/GCCTestSuite/c90-array-quals.c.expected b/tests/GCCTestSuite/c90-array-quals.c.expected new file mode 100644 index 0000000..228e79f --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals.c.expected @@ -0,0 +1,3 @@ +extern int (*const a)[]; +extern int (*const a)[10]; +extern int (*const a)[]; diff --git a/tests/GCCTestSuite/c90-array-quals.hex.expected b/tests/GCCTestSuite/c90-array-quals.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-array-quals.s.expected b/tests/GCCTestSuite/c90-array-quals.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-array-quals.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-const-expr-1.c b/tests/GCCTestSuite/c90-const-expr-1.c new file mode 100644 index 0000000..96d19ee --- /dev/null +++ b/tests/GCCTestSuite/c90-const-expr-1.c @@ -0,0 +1,23 @@ +/* Test for constraints on constant expressions. In C90 it is clear that + certain constructs are not permitted in unevaluated parts of an + expression (except in sizeof); in C99 it might fall within implementation + latitude. +*/ +/* Origin: Joseph Myers ; inspired by + http://deja.com/getdoc.xp?AN=524271595&fmt=text by Peter Seebach. +*/ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +extern int bar (void); + +void +foo (void) +{ + int i; + static int j = (1 ? 0 : (i = 2)); /* { dg-error "initial" "assignment" { xfail *-*-* } } */ + static int k = (1 ? 0 : ++i); /* { dg-error "initial" "increment" { xfail *-*-* } } */ + static int l = (1 ? 0 : --i); /* { dg-error "initial" "decrement" { xfail *-*-* } } */ + static int m = (1 ? 0 : bar ()); /* { dg-error "initial" "function call" { xfail *-*-* } } */ + static int n = (1 ? 0 : (2, 3)); /* { dg-error "initial" "comma" { xfail *-*-* } } */ +} diff --git a/tests/GCCTestSuite/c90-const-expr-1.c.expected b/tests/GCCTestSuite/c90-const-expr-1.c.expected new file mode 100644 index 0000000..96d19ee --- /dev/null +++ b/tests/GCCTestSuite/c90-const-expr-1.c.expected @@ -0,0 +1,23 @@ +/* Test for constraints on constant expressions. In C90 it is clear that + certain constructs are not permitted in unevaluated parts of an + expression (except in sizeof); in C99 it might fall within implementation + latitude. +*/ +/* Origin: Joseph Myers ; inspired by + http://deja.com/getdoc.xp?AN=524271595&fmt=text by Peter Seebach. +*/ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +extern int bar (void); + +void +foo (void) +{ + int i; + static int j = (1 ? 0 : (i = 2)); /* { dg-error "initial" "assignment" { xfail *-*-* } } */ + static int k = (1 ? 0 : ++i); /* { dg-error "initial" "increment" { xfail *-*-* } } */ + static int l = (1 ? 0 : --i); /* { dg-error "initial" "decrement" { xfail *-*-* } } */ + static int m = (1 ? 0 : bar ()); /* { dg-error "initial" "function call" { xfail *-*-* } } */ + static int n = (1 ? 0 : (2, 3)); /* { dg-error "initial" "comma" { xfail *-*-* } } */ +} diff --git a/tests/GCCTestSuite/c90-const-expr-1.hex.expected b/tests/GCCTestSuite/c90-const-expr-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/c90-const-expr-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-const-expr-1.s.expected b/tests/GCCTestSuite/c90-const-expr-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-const-expr-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-dupqual-1.c b/tests/GCCTestSuite/c90-dupqual-1.c new file mode 100644 index 0000000..14838c7 --- /dev/null +++ b/tests/GCCTestSuite/c90-dupqual-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int CI; +const const int c1; /* { dg-error "duplicate" } */ +const CI c2; /* { dg-error "duplicate" } */ +const CI *c3; /* { dg-error "duplicate" } */ + +typedef volatile int VI; +volatile volatile int v1; /* { dg-error "duplicate" } */ +volatile VI v2; /* { dg-error "duplicate" } */ +volatile VI *v3; /* { dg-error "duplicate" } */ diff --git a/tests/GCCTestSuite/c90-dupqual-1.c.expected b/tests/GCCTestSuite/c90-dupqual-1.c.expected new file mode 100644 index 0000000..14838c7 --- /dev/null +++ b/tests/GCCTestSuite/c90-dupqual-1.c.expected @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int CI; +const const int c1; /* { dg-error "duplicate" } */ +const CI c2; /* { dg-error "duplicate" } */ +const CI *c3; /* { dg-error "duplicate" } */ + +typedef volatile int VI; +volatile volatile int v1; /* { dg-error "duplicate" } */ +volatile VI v2; /* { dg-error "duplicate" } */ +volatile VI *v3; /* { dg-error "duplicate" } */ diff --git a/tests/GCCTestSuite/c90-dupqual-1.hex.expected b/tests/GCCTestSuite/c90-dupqual-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-dupqual-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-dupqual-1.s.expected b/tests/GCCTestSuite/c90-dupqual-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-dupqual-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-enum-comma-1.c b/tests/GCCTestSuite/c90-enum-comma-1.c new file mode 100644 index 0000000..2029c92 --- /dev/null +++ b/tests/GCCTestSuite/c90-enum-comma-1.c @@ -0,0 +1,7 @@ +/* Test for commas at end of enums: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +enum foo { bar, }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "comma at end" "enum comma error" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-enum-comma-1.c.expected b/tests/GCCTestSuite/c90-enum-comma-1.c.expected new file mode 100644 index 0000000..2029c92 --- /dev/null +++ b/tests/GCCTestSuite/c90-enum-comma-1.c.expected @@ -0,0 +1,7 @@ +/* Test for commas at end of enums: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +enum foo { bar, }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "comma at end" "enum comma error" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-enum-comma-1.hex.expected b/tests/GCCTestSuite/c90-enum-comma-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-enum-comma-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-enum-comma-1.s.expected b/tests/GCCTestSuite/c90-enum-comma-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-enum-comma-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-flex-array-1.c b/tests/GCCTestSuite/c90-flex-array-1.c new file mode 100644 index 0000000..1eead19 --- /dev/null +++ b/tests/GCCTestSuite/c90-flex-array-1.c @@ -0,0 +1,7 @@ +/* Test for flexible array members. Test for rejection in C90 mode. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct flex { int a; int b[]; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "ISO C90" "flexible array members not in C90" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-flex-array-1.c.expected b/tests/GCCTestSuite/c90-flex-array-1.c.expected new file mode 100644 index 0000000..1eead19 --- /dev/null +++ b/tests/GCCTestSuite/c90-flex-array-1.c.expected @@ -0,0 +1,7 @@ +/* Test for flexible array members. Test for rejection in C90 mode. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct flex { int a; int b[]; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "ISO C90" "flexible array members not in C90" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-flex-array-1.hex.expected b/tests/GCCTestSuite/c90-flex-array-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-flex-array-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-flex-array-1.s.expected b/tests/GCCTestSuite/c90-flex-array-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-flex-array-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-idem-qual-1.c b/tests/GCCTestSuite/c90-idem-qual-1.c new file mode 100644 index 0000000..ee05a82 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-1.c @@ -0,0 +1,8 @@ +/* Test for idempotent type qualifiers: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int cint; +const cint foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 7 } */ diff --git a/tests/GCCTestSuite/c90-idem-qual-1.c.expected b/tests/GCCTestSuite/c90-idem-qual-1.c.expected new file mode 100644 index 0000000..ee05a82 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-1.c.expected @@ -0,0 +1,8 @@ +/* Test for idempotent type qualifiers: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int cint; +const cint foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 7 } */ diff --git a/tests/GCCTestSuite/c90-idem-qual-1.hex.expected b/tests/GCCTestSuite/c90-idem-qual-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-idem-qual-1.s.expected b/tests/GCCTestSuite/c90-idem-qual-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-idem-qual-2.c b/tests/GCCTestSuite/c90-idem-qual-2.c new file mode 100644 index 0000000..c9bb6f7 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-2.c @@ -0,0 +1,7 @@ +/* Test for idempotent type qualifiers: in C99 only. Test "const const". */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +const const int foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-idem-qual-2.c.expected b/tests/GCCTestSuite/c90-idem-qual-2.c.expected new file mode 100644 index 0000000..c9bb6f7 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-2.c.expected @@ -0,0 +1,7 @@ +/* Test for idempotent type qualifiers: in C99 only. Test "const const". */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +const const int foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-idem-qual-2.hex.expected b/tests/GCCTestSuite/c90-idem-qual-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-idem-qual-2.s.expected b/tests/GCCTestSuite/c90-idem-qual-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-idem-qual-3.c b/tests/GCCTestSuite/c90-idem-qual-3.c new file mode 100644 index 0000000..9976a08 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-3.c @@ -0,0 +1,11 @@ +/* Test for idempotent type qualifiers: in C99 only. Test duplicate + type qualifiers with array element types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int cia[2]; +const cia a; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 8 } */ +const cia b[2]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 10 } */ diff --git a/tests/GCCTestSuite/c90-idem-qual-3.c.expected b/tests/GCCTestSuite/c90-idem-qual-3.c.expected new file mode 100644 index 0000000..9976a08 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-3.c.expected @@ -0,0 +1,11 @@ +/* Test for idempotent type qualifiers: in C99 only. Test duplicate + type qualifiers with array element types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int cia[2]; +const cia a; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 8 } */ +const cia b[2]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 10 } */ diff --git a/tests/GCCTestSuite/c90-idem-qual-3.hex.expected b/tests/GCCTestSuite/c90-idem-qual-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-idem-qual-3.s.expected b/tests/GCCTestSuite/c90-idem-qual-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-idem-qual-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-impl-int-1.c b/tests/GCCTestSuite/c90-impl-int-1.c new file mode 100644 index 0000000..cd995c2 --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-1.c @@ -0,0 +1,8 @@ +/* Test for implicit int: in C90 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +extern foo; + +bar (void) { } diff --git a/tests/GCCTestSuite/c90-impl-int-1.c.expected b/tests/GCCTestSuite/c90-impl-int-1.c.expected new file mode 100644 index 0000000..cd995c2 --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-1.c.expected @@ -0,0 +1,8 @@ +/* Test for implicit int: in C90 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +extern foo; + +bar (void) { } diff --git a/tests/GCCTestSuite/c90-impl-int-1.hex.expected b/tests/GCCTestSuite/c90-impl-int-1.hex.expected new file mode 100644 index 0000000..16a396e --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501E509F502E509F5DD +:1000100003E509F504E509F505E501C0E0E500C0E3 +:10002000E0E502F582E503F583E504F500E505F575 +:10003000012200000000000000000000000000009D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-impl-int-1.s.expected b/tests/GCCTestSuite/c90-impl-int-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-impl-int-2.c b/tests/GCCTestSuite/c90-impl-int-2.c new file mode 100644 index 0000000..884c9d9 --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-2.c @@ -0,0 +1,8 @@ +/* Test for implicit int: in C90 only. Function parameters in old-style + function definition. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +void foo (a) { } diff --git a/tests/GCCTestSuite/c90-impl-int-2.c.expected b/tests/GCCTestSuite/c90-impl-int-2.c.expected new file mode 100644 index 0000000..884c9d9 --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-2.c.expected @@ -0,0 +1,8 @@ +/* Test for implicit int: in C90 only. Function parameters in old-style + function definition. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +void foo (a) { } diff --git a/tests/GCCTestSuite/c90-impl-int-2.hex.expected b/tests/GCCTestSuite/c90-impl-int-2.hex.expected new file mode 100644 index 0000000..7af2347 --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-2.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0042506F50675E0C6 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F50122000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-impl-int-2.s.expected b/tests/GCCTestSuite/c90-impl-int-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-impl-int-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-longlong-1.c b/tests/GCCTestSuite/c90-longlong-1.c new file mode 100644 index 0000000..e91e39e --- /dev/null +++ b/tests/GCCTestSuite/c90-longlong-1.c @@ -0,0 +1,7 @@ +/* Test for long long: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +long long foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "long long" "long long not in C90" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-longlong-1.c.expected b/tests/GCCTestSuite/c90-longlong-1.c.expected new file mode 100644 index 0000000..e91e39e --- /dev/null +++ b/tests/GCCTestSuite/c90-longlong-1.c.expected @@ -0,0 +1,7 @@ +/* Test for long long: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +long long foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "long long" "long long not in C90" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-longlong-1.hex.expected b/tests/GCCTestSuite/c90-longlong-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-longlong-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-longlong-1.s.expected b/tests/GCCTestSuite/c90-longlong-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-longlong-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-mixdecl-1.c b/tests/GCCTestSuite/c90-mixdecl-1.c new file mode 100644 index 0000000..b07ab26 --- /dev/null +++ b/tests/GCCTestSuite/c90-mixdecl-1.c @@ -0,0 +1,13 @@ +/* Test for C99 mixed declarations and code: not in C90. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +void +foo (void) +{ + int i; + i = 0; + int j; /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "mix|parse" "mixed declarations and code not in C90" { target *-*-* } 11 } */ +} diff --git a/tests/GCCTestSuite/c90-mixdecl-1.c.expected b/tests/GCCTestSuite/c90-mixdecl-1.c.expected new file mode 100644 index 0000000..b07ab26 --- /dev/null +++ b/tests/GCCTestSuite/c90-mixdecl-1.c.expected @@ -0,0 +1,13 @@ +/* Test for C99 mixed declarations and code: not in C90. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +void +foo (void) +{ + int i; + i = 0; + int j; /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "mix|parse" "mixed declarations and code not in C90" { target *-*-* } 11 } */ +} diff --git a/tests/GCCTestSuite/c90-mixdecl-1.hex.expected b/tests/GCCTestSuite/c90-mixdecl-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/c90-mixdecl-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-mixdecl-1.s.expected b/tests/GCCTestSuite/c90-mixdecl-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-mixdecl-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-restrict-1.c b/tests/GCCTestSuite/c90-restrict-1.c new file mode 100644 index 0000000..4820831 --- /dev/null +++ b/tests/GCCTestSuite/c90-restrict-1.c @@ -0,0 +1,7 @@ +/* Test for restrict: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +char *restrict foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "parse error|syntax error|expected|no type" "restrict not in C90" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-restrict-1.c.expected b/tests/GCCTestSuite/c90-restrict-1.c.expected new file mode 100644 index 0000000..4820831 --- /dev/null +++ b/tests/GCCTestSuite/c90-restrict-1.c.expected @@ -0,0 +1,7 @@ +/* Test for restrict: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +char *restrict foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "parse error|syntax error|expected|no type" "restrict not in C90" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/c90-restrict-1.hex.expected b/tests/GCCTestSuite/c90-restrict-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c90-restrict-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-restrict-1.s.expected b/tests/GCCTestSuite/c90-restrict-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-restrict-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-static-1.c b/tests/GCCTestSuite/c90-static-1.c new file mode 100644 index 0000000..cc6f320 --- /dev/null +++ b/tests/GCCTestSuite/c90-static-1.c @@ -0,0 +1,22 @@ +/* It is a constraint violation for a static function to be declared + but not defined if it is used except in a sizeof expression. The + use of the function simply being unevaluated is not enough. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=iso9899:1990 -pedantic-errors" } */ + +/* Constraint violation (trivial case, where function is used). */ +static void f0(void); /* { dg-error "used but never defined" } */ +void g0(void) { f0(); } + +/* Constraint violation. */ +static void f1(void); /* { dg-error "used but never defined" } */ +void g1(void) { if (0) { f1(); } } + +/* Constraint violation. */ +static int f2(void); /* { dg-error "used but never defined" } */ +void g2(void) { 0 ? f2() : 0; } + +/* OK. */ +static int f3(void); +void g3(void) { sizeof(f3()); } diff --git a/tests/GCCTestSuite/c90-static-1.c.expected b/tests/GCCTestSuite/c90-static-1.c.expected new file mode 100644 index 0000000..cc6f320 --- /dev/null +++ b/tests/GCCTestSuite/c90-static-1.c.expected @@ -0,0 +1,22 @@ +/* It is a constraint violation for a static function to be declared + but not defined if it is used except in a sizeof expression. The + use of the function simply being unevaluated is not enough. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=iso9899:1990 -pedantic-errors" } */ + +/* Constraint violation (trivial case, where function is used). */ +static void f0(void); /* { dg-error "used but never defined" } */ +void g0(void) { f0(); } + +/* Constraint violation. */ +static void f1(void); /* { dg-error "used but never defined" } */ +void g1(void) { if (0) { f1(); } } + +/* Constraint violation. */ +static int f2(void); /* { dg-error "used but never defined" } */ +void g2(void) { 0 ? f2() : 0; } + +/* OK. */ +static int f3(void); +void g3(void) { sizeof(f3()); } diff --git a/tests/GCCTestSuite/c90-static-1.hex.expected b/tests/GCCTestSuite/c90-static-1.hex.expected new file mode 100644 index 0000000..b27f726 --- /dev/null +++ b/tests/GCCTestSuite/c90-static-1.hex.expected @@ -0,0 +1,42 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040000000E500F502E500F503E500F504E50034 +:10005000F50575E0002506F58275E0003507F583A6 +:10006000E0F508E508C0E075E0012506F58275E0D9 +:10007000003507F583E0F508E508C0E075E00225E6 +:1000800006F50675E0003507F507E502F582E5039C +:10009000F583E504F500E505F501220000E50675A8 +:1000A0008202C39582F506E5077583009583F507FF +:1000B000D0E0F50875E0012506F58275E00035070A +:1000C000F583E508F0D0E0F50875E0002506F58237 +:1000D00075E0003507F583E508F075010075090046 +:1000E000750A00750B00750000E501F5F0E50045A7 +:1000F000F0F500E509F5F0E50045F0F500E50AF555 +:10010000F0E50045F0F500E50BF5F0E50045F0F50C +:1001100000E5007002800302017700750000E50031 +:10012000F502E500F503E500F504E500F50575E0E9 +:10013000002506F58275E0003507F583E0F508E552 +:1001400008C0E075E0012506F58275E0003507F589 +:1001500083E0F508E508C0E075E0022506F50675C0 +:10016000E0003507F507E502F582E503F583E504D0 +:10017000F500E505F501220002011B0000E506750A +:100180008202C39582F506E5077583009583F5071E +:10019000D0E0F50875E0012506F58275E000350729 +:1001A000F583E508F0D0E0F50875E0002506F58256 +:1001B00075E0003507F583E508F075010075090065 +:1001C000750A00750B00750000E501F5F0E50045C6 +:1001D000F0F500E509F5F0E50045F0F500E50AF574 +:1001E000F0E50045F0F500E50BF5F0E50045F0F52C +:1001F00000E5007002800302025700750000E50070 +:10020000F502E500F503E500F504E500F50575E008 +:10021000002506F58275E0003507F583E0F508E571 +:1002200008C0E075E0012506F58275E0003507F5A8 +:1002300083E0F508E508C0E075E0022506F50675DF +:10024000E0003507F507E502F582E503F583E504EF +:10025000F500E505F50122000201FB00D0E0F50004 +:10026000D0E0F501750900E509F502E509F503E5BA +:1002700009F504E509F505E501C0E0E500C0E0E5A4 +:1002800002F582E503F583E504F500E505F50122B5 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c90-static-1.s.expected b/tests/GCCTestSuite/c90-static-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c90-static-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-1.c b/tests/GCCTestSuite/c99-array-lval-1.c new file mode 100644 index 0000000..c0fccc8 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-1.c @@ -0,0 +1,17 @@ +/* Test for non-lvalue arrays decaying to pointers: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s { char c[1]; }; + +extern struct s foo (void); + +void +bar (void) +{ + char *t; + (foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ + t = (foo ()).c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ + (foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ +} diff --git a/tests/GCCTestSuite/c99-array-lval-1.c.expected b/tests/GCCTestSuite/c99-array-lval-1.c.expected new file mode 100644 index 0000000..c0fccc8 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-1.c.expected @@ -0,0 +1,17 @@ +/* Test for non-lvalue arrays decaying to pointers: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s { char c[1]; }; + +extern struct s foo (void); + +void +bar (void) +{ + char *t; + (foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ + t = (foo ()).c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ + (foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ +} diff --git a/tests/GCCTestSuite/c99-array-lval-1.hex.expected b/tests/GCCTestSuite/c99-array-lval-1.hex.expected new file mode 100644 index 0000000..ed6c94a --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-1.hex.expected @@ -0,0 +1,19 @@ +:100000000000E506758205C39582F506E507758350 +:10001000009583F507D0E0F50875E0042506F58224 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000032506F58275E0003507F583E508F0E550 +:1000400006F509E507F50A750102C3750000E5012B +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E501F51FE500F51EE506F509E507D4 +:10007000F50A750101C3750000E501F5F0E50935E4 +:10008000F0F501E500F5F0E50A35F0F500E501F5DC +:100090001FE500F51EC3C3C3C3E506F509E507F573 +:1000A0000A750100C3750000E501F5F0E50935F0BA +:1000B000F501E500F5F0E50A35F0F500E501F51F7D +:1000C000E500F51E750000E500F502E500F503E525 +:1000D00000F504E500F50575E0032506F58275E0F9 +:1000E000003507F583E0F508E508C0E075E0042574 +:1000F00006F58275E0003507F583E0F508E508C0F0 +:10010000E075E0052506F50675E0003507F507E51D +:1001100002F582E503F583E504F500E505F5012226 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-1.s.expected b/tests/GCCTestSuite/c99-array-lval-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-5.c b/tests/GCCTestSuite/c99-array-lval-5.c new file mode 100644 index 0000000..57e806d --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-5.c @@ -0,0 +1,26 @@ +/* Test for non-lvalue arrays: test that the unary '&' operator is not + allowed on them, for both C90 and C99. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s { char c[1]; }; + +extern struct s foo (void); +struct s a, b, c; +int d; + +void +bar (void) +{ + &((foo ()).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d, b).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((a = b).c); /* { dg-bogus "warning" "warning in place of error" } */ +} +/* { dg-error "lvalue" "bad address-of" { target *-*-* } 17 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 18 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 19 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 20 } +*/ diff --git a/tests/GCCTestSuite/c99-array-lval-5.c.expected b/tests/GCCTestSuite/c99-array-lval-5.c.expected new file mode 100644 index 0000000..57e806d --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-5.c.expected @@ -0,0 +1,26 @@ +/* Test for non-lvalue arrays: test that the unary '&' operator is not + allowed on them, for both C90 and C99. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s { char c[1]; }; + +extern struct s foo (void); +struct s a, b, c; +int d; + +void +bar (void) +{ + &((foo ()).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((d, b).c); /* { dg-bogus "warning" "warning in place of error" } */ + &((a = b).c); /* { dg-bogus "warning" "warning in place of error" } */ +} +/* { dg-error "lvalue" "bad address-of" { target *-*-* } 17 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 18 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 19 } + { dg-error "lvalue" "bad address-of" { target *-*-* } 20 } +*/ diff --git a/tests/GCCTestSuite/c99-array-lval-5.hex.expected b/tests/GCCTestSuite/c99-array-lval-5.hex.expected new file mode 100644 index 0000000..e65a10d --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-5.hex.expected @@ -0,0 +1,134 @@ +:100000000000E506758208C39582F506E50775834D +:10001000009583F507D0E0F50875E0032506F58225 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000022506F58275E0003507F583E508F075C1 +:10004000E0072506F58275E0003507F583E513F036 +:1000500075E0062506F58275E0003507F583E512A3 +:10006000F075E0052506F58275E0003507F583E5B6 +:1000700011F075E0042506F58275E0003507F5837B +:10008000E510F0E506F509E507F50A750101C37508 +:100090000000E501F5F0E50935F0F501E500F5F0C2 +:1000A000E50A35F0F500E501F51FE500F51EE5066A +:1000B000F509E507F50A750100C3750000E501F5CE +:1000C000F0E50935F0F501E500F5F0E50A35F0F564 +:1000D0000A750900C3750000E509F5F0E50135F082 +:1000E000F501E500F5F0E50A35F0F500E501F50963 +:1000F000E500F50A750100C3750000E501F5F0E5BE +:100100000935F0F501E500F5F0E50A35F0F500E513 +:1001100000F502E501F582E502F583E0F5117501D0 +:1001200001C3750000E501F5F0E50935F0F501E5DD +:1001300000F5F0E50A35F0F500E500F502E501F51A +:1001400082E502F583E0F501750900750A00750E78 +:1001500001750F00751000750000C3750B00E509EF +:10016000F5F0E50EA4F50DE509F5F0E50EA4E5F0D2 +:10017000F50CE50DF5F0E50B35F0F50BE50AF5F0BE +:10018000E50EA4F50DE50AF5F0E50EA4E5F0F50A97 +:10019000E50DF5F0E50C35F0F50CC3C3750A00E587 +:1001A0000BF5F0E51035F0F510E50CF5F0E5003550 +:1001B000F0F500C3750C00E509F5F0E50FA4F50DA9 +:1001C000E509F5F0E50FA4E5F0F50AE50DF5F0E534 +:1001D0000C35F0F50C750B00C3C3750900E50BF584 +:1001E000F0E51035F0F510E50CF5F0E50035F0F52B +:1001F00000C3750B00750C00C3C3750900E50BF552 +:10020000F0E51035F0F510E50CF5F0E50035F0F50A +:1002100000C3750B00750C00C3C3750900E50BF531 +:10022000F0E51035F0F510E50CF5F0E50035F0F5EA +:1002300000C3750900E510F5F0E51135F0F512E59C +:1002400000F5F0E50135F0F513900001E582F509C0 +:10025000900001E583F50A750100C3750000E50112 +:10026000F5F0E50935F0F501E500F5F0E50A35F0C2 +:10027000F500E501F509E500F50A750100C3750013 +:1002800000E501F5F0E50935F0F501E500F5F0E5EB +:100290000A35F0F500E500F502E501F582E502F525 +:1002A00083E0F510750101C3750000E501F5F0E587 +:1002B0000935F0F501E500F5F0E50A35F0F500E562 +:1002C00000F502E501F582E502F583E0F511750020 +:1002D00000750100750C01750D00750E00750F009D +:1002E000C3750900E500F5F0E50CA4F50BE500F594 +:1002F000F0E50CA4E5F0F50AE50BF5F0E50935F0BD +:10030000F509E501F5F0E50CA4F50BE501F5F0E5DF +:100310000CA4E5F0F501E50BF5F0E50A35F0F50A7A +:10032000C3C3750100E509F5F0E50E35F0F50EE5FE +:100330000AF5F0E50F35F0F50FC3750A00E500F595 +:10034000F0E50DA4F50BE500F5F0E50DA4E5F0F5FD +:1003500001E50BF5F0E50A35F0F50A750900C3C3B0 +:10036000750000E509F5F0E50E35F0F50EE50AF546 +:10037000F0E50F35F0F50FC3750900750A00C3C32A +:10038000750000E509F5F0E50E35F0F50EE50AF526 +:10039000F0E50F35F0F50FC3750900750A00C3C30A +:1003A000750000E509F5F0E50E35F0F50EE50AF506 +:1003B000F0E50F35F0F50FC3750000E50EF5F0E53B +:1003C0001035F0F500E50FF5F0E51135F0F501E534 +:1003D00000F509E501F50A750100C3750000E501A6 +:1003E000F5F0E50935F0F501E500F5F0E50A35F041 +:1003F000F500E500F502E501F582E502F583E0F59B +:1004000009750100C3750000E501F5F0E51235F04E +:10041000F501E500F5F0E51335F0F500E509F50324 +:10042000E500F502E501F582E502F583E503F090CC +:100430000000E582F509900000E583F50A750100EA +:10044000C3750000E501F5F0E50935F0F501E500BB +:10045000F5F0E50A35F0F500E501F509E500F50AE6 +:10046000750100C3750000E501F5F0E50935F0F50B +:1004700001E500F5F0E50A35F0F500E500F502E5E7 +:1004800001F582E502F583E0F511750101C3750000 +:1004900000E501F5F0E50935F0F501E500F5F0E5D9 +:1004A0000A35F0F500E500F502E501F582E502F513 +:1004B00083E0F501750900750A00750E01750F00DE +:1004C000751000750000C3750B00E509F5F0E50E29 +:1004D000A4F50DE509F5F0E50EA4E5F0F50CE50D44 +:1004E000F5F0E50B35F0F50BE50AF5F0E50EA4F5B2 +:1004F0000DE50AF5F0E50EA4E5F0F50AE50DF5F0D9 +:10050000E50C35F0F50CC3C3750A00E50BF5F0E515 +:100510001035F0F510E50CF5F0E50035F0F500C309 +:10052000750C00E509F5F0E50FA4F50DE509F5F00A +:10053000E50FA4E5F0F50AE50DF5F0E50C35F0F56D +:100540000C750B00C3C3750900E50BF5F0E510351C +:10055000F0F510E50CF5F0E50035F0F500C3750B8E +:1005600000750C00C3C3750900E50BF5F0E5103507 +:10057000F0F510E50CF5F0E50035F0F500C3750B6E +:1005800000750C00C3C3750900E50BF5F0E51035E7 +:10059000F0F510E50CF5F0E50035F0F500C3750950 +:1005A00000E510F5F0E51135F0F512E500F5F0E5A0 +:1005B0000135F0F513E506F509E507F50A750100C3 +:1005C000C3750000E501F5F0E50935F0F501E5003A +:1005D000F5F0E50A35F0F50A750900C3750000E588 +:1005E00009F5F0E50135F0F501E500F5F0E50A352E +:1005F000F0F500E501F509E500F50A750100C375A0 +:100600000000E501F5F0E50935F0F501E500F5F04C +:10061000E50A35F0F500E500F502E501F582E502B1 +:10062000F583E0F510750101C3750000E501F5F0F3 +:10063000E50935F0F501E500F5F0E50A35F0F500DE +:10064000E500F502E501F582E502F583E0F51175B7 +:100650000000750100750C01750D00750E00750F19 +:1006600000C3750900E500F5F0E50CA4F50BE50005 +:10067000F5F0E50CA4E5F0F50AE50BF5F0E5093534 +:10068000F0F509E501F5F0E50CA4F50BE501F5F051 +:10069000E50CA4E5F0F501E50BF5F0E50A35F0F51C +:1006A0000AC3C3750100E509F5F0E50E35F0F50E56 +:1006B000E50AF5F0E50F35F0F50FC3750A00E50022 +:1006C000F5F0E50DA4F50BE500F5F0E50DA4E5F07A +:1006D000F501E50BF5F0E50A35F0F50A750900C3FB +:1006E000C3750000E509F5F0E50E35F0F50EE50AF5 +:1006F000F5F0E50F35F0F50FC3750900750A00C375 +:10070000C3750000E509F5F0E50E35F0F50EE50AD4 +:10071000F5F0E50F35F0F50FC3750900750A00C354 +:10072000C3750000E509F5F0E50E35F0F50EE50AB4 +:10073000F5F0E50F35F0F50FC3750000E50EF5F0A7 +:10074000E51035F0F500E50FF5F0E51135F0F501B0 +:10075000E500F509E501F50A750100C3750000E53E +:1007600001F5F0E50935F0F501E500F5F0E50A35AC +:10077000F0F500E500F502E501F582E502F583E01C +:10078000F509750100C3750000E501F5F0E51235C6 +:10079000F0F501E500F5F0E51335F0F500E509F5B4 +:1007A00003E500F502E501F582E502F583E503F0D6 +:1007B000750000E500F502E500F503E500F504E548 +:1007C00000F50575E0072506F58275E0003507F5AB +:1007D00083E0F51375E0062506F58275E000350720 +:1007E000F583E0F51275E0052506F58275E0003524 +:1007F00007F583E0F51175E0042506F58275E00044 +:100800003507F583E0F51075E0022506F58275E001 +:10081000003507F583E0F508E508C0E075E003253D +:1008200006F58275E0003507F583E0F508E508C0B8 +:10083000E075E0082506F50675E0003507F507E5E3 +:1008400002F582E503F583E504F500E505F50122EF +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-5.s.expected b/tests/GCCTestSuite/c99-array-lval-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-6.c b/tests/GCCTestSuite/c99-array-lval-6.c new file mode 100644 index 0000000..426b3c7 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-6.c @@ -0,0 +1,15 @@ +/* PR c/12446 */ +/* Origin: Keith Thompson */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + + +struct s { char c[1]; }; + +extern struct s foo(void); + +void bar(void) +{ + char *ptr = foo().c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ +} diff --git a/tests/GCCTestSuite/c99-array-lval-6.c.expected b/tests/GCCTestSuite/c99-array-lval-6.c.expected new file mode 100644 index 0000000..426b3c7 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-6.c.expected @@ -0,0 +1,15 @@ +/* PR c/12446 */ +/* Origin: Keith Thompson */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + + +struct s { char c[1]; }; + +extern struct s foo(void); + +void bar(void) +{ + char *ptr = foo().c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */ +} diff --git a/tests/GCCTestSuite/c99-array-lval-6.hex.expected b/tests/GCCTestSuite/c99-array-lval-6.hex.expected new file mode 100644 index 0000000..91c9bfd --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-6.hex.expected @@ -0,0 +1,14 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0022506F58226 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000012506F58275E0003507F583E508F0E552 +:1000400006F509E507F50A750100C3750000E5012D +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E501F51FE500F51EC3C3C3C3750028 +:1000700000E500F502E500F503E500F504E500F50F +:100080000575E0012506F58275E0003507F583E08A +:10009000F508E508C0E075E0022506F58275E00088 +:1000A0003507F583E0F508E508C0E075E0032506AF +:1000B000F50675E0003507F507E502F582E503F57D +:1000C00083E504F500E505F50122000000000000CD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-6.s.expected b/tests/GCCTestSuite/c99-array-lval-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-7.c b/tests/GCCTestSuite/c99-array-lval-7.c new file mode 100644 index 0000000..3d70ed0 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-7.c @@ -0,0 +1,21 @@ +/* Test for non-lvalue arrays: test that C90 does not allow them in + conditional expressions, while in C99 they decay and are + allowed. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s { char c[1]; }; +struct s a, b, c; +int d; +int e; + +void +bar (void) +{ + /* In C90, the non-lvalue arrays do not decay to pointers, and + 6.3.15 does not permit conditional expressions between arrays. + In C99, they decay to pointers. */ + (e ? (d ? b : c).c : (e ? b : c).c); +} diff --git a/tests/GCCTestSuite/c99-array-lval-7.c.expected b/tests/GCCTestSuite/c99-array-lval-7.c.expected new file mode 100644 index 0000000..3d70ed0 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-7.c.expected @@ -0,0 +1,21 @@ +/* Test for non-lvalue arrays: test that C90 does not allow them in + conditional expressions, while in C99 they decay and are + allowed. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s { char c[1]; }; +struct s a, b, c; +int d; +int e; + +void +bar (void) +{ + /* In C90, the non-lvalue arrays do not decay to pointers, and + 6.3.15 does not permit conditional expressions between arrays. + In C99, they decay to pointers. */ + (e ? (d ? b : c).c : (e ? b : c).c); +} diff --git a/tests/GCCTestSuite/c99-array-lval-7.hex.expected b/tests/GCCTestSuite/c99-array-lval-7.hex.expected new file mode 100644 index 0000000..0a5eadc --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-7.hex.expected @@ -0,0 +1,21 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F900007E582F509900007E583F50A7562 +:100020000100C3750000E501F5F0E50935F0F501C3 +:10003000E500F5F0E50A35F0F500E500F502E5012B +:10004000F582E502F583E0F50B750101C37500004B +:10005000E501F5F0E50935F0F501E500F5F0E50A13 +:1000600035F0F500E500F502E501F582E502F583DE +:10007000E0F50C750102C3750000E501F5F0E50936 +:1000800035F0F501E500F5F0E50A35F0F500E5009D +:10009000F502E501F582E502F583E0F50D75010352 +:1000A000C3750000E501F5F0E50935F0F501E5005F +:1000B000F5F0E50A35F0F500E500F502E501F58219 +:1000C000E502F583E0F501750000E50BF5F0E500CC +:1000D00045F0F500E50CF5F0E50045F0F500E50D1F +:1000E000F5F0E50045F0F500E501F5F0E50045F037 +:1000F000F500E5007002800302013000750000E5A4 +:1001000000F502E500F503E500F504E500F505E579 +:100110000EF511E50FF510E519C0E0E518C0E0E5B2 +:1001200002F582E503F583E504F500E505F5012216 +:10013000000200FC000000000000000000000000C1 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-lval-7.s.expected b/tests/GCCTestSuite/c99-array-lval-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-array-lval-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-nonobj-1.c b/tests/GCCTestSuite/c99-array-nonobj-1.c new file mode 100644 index 0000000..45fc74c --- /dev/null +++ b/tests/GCCTestSuite/c99-array-nonobj-1.c @@ -0,0 +1,27 @@ +/* Test for arrays of incomplete and function types: a constraint violation + in C99 only, though undefined (DR#047) before. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef void func (void); +struct s; + +extern int a[][]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "\[\]\[\] var" { target *-*-* } 11 } */ + +void f (int [][]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "\[\]\[\] arg" { target *-*-* } 14 } */ + +extern struct s b[]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "struct \[\] var" { target *-*-* } 17 } */ + +void g (struct s []); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "struct \[\] arg" { target *-*-* } 20 } */ + +extern func c[]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "func \[\] var" { target *-*-* } 23 } */ + +void h (func []); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "func \[\] arg" { target *-*-* } 26 } */ diff --git a/tests/GCCTestSuite/c99-array-nonobj-1.c.expected b/tests/GCCTestSuite/c99-array-nonobj-1.c.expected new file mode 100644 index 0000000..45fc74c --- /dev/null +++ b/tests/GCCTestSuite/c99-array-nonobj-1.c.expected @@ -0,0 +1,27 @@ +/* Test for arrays of incomplete and function types: a constraint violation + in C99 only, though undefined (DR#047) before. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef void func (void); +struct s; + +extern int a[][]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "\[\]\[\] var" { target *-*-* } 11 } */ + +void f (int [][]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "\[\]\[\] arg" { target *-*-* } 14 } */ + +extern struct s b[]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "struct \[\] var" { target *-*-* } 17 } */ + +void g (struct s []); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "struct \[\] arg" { target *-*-* } 20 } */ + +extern func c[]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "func \[\] var" { target *-*-* } 23 } */ + +void h (func []); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "array" "func \[\] arg" { target *-*-* } 26 } */ diff --git a/tests/GCCTestSuite/c99-array-nonobj-1.hex.expected b/tests/GCCTestSuite/c99-array-nonobj-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-array-nonobj-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-array-nonobj-1.s.expected b/tests/GCCTestSuite/c99-array-nonobj-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-array-nonobj-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-const-expr-1.c b/tests/GCCTestSuite/c99-const-expr-1.c new file mode 100644 index 0000000..c3082ee --- /dev/null +++ b/tests/GCCTestSuite/c99-const-expr-1.c @@ -0,0 +1,16 @@ +/* Test for constraints on constant expressions. In C90 it is clear that + certain constructs are not permitted in unevaluated parts of an + expression (except in sizeof); in C99 it might fall within implementation + latitude; and if the operands are suitable, diagnostics should not be + issued. +*/ +/* Origin: Joseph Myers ; inspired by + http://deja.com/getdoc.xp?AN=524271595&fmt=text by Peter Seebach. +*/ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +/* The comma operator is in a subexpression that is not evaluated, so OK + by C99. In C90 a diagnostic is required since it is not in a sizeof. +*/ +int i = (1 ? 0 : (2, 3)); diff --git a/tests/GCCTestSuite/c99-const-expr-1.c.expected b/tests/GCCTestSuite/c99-const-expr-1.c.expected new file mode 100644 index 0000000..c3082ee --- /dev/null +++ b/tests/GCCTestSuite/c99-const-expr-1.c.expected @@ -0,0 +1,16 @@ +/* Test for constraints on constant expressions. In C90 it is clear that + certain constructs are not permitted in unevaluated parts of an + expression (except in sizeof); in C99 it might fall within implementation + latitude; and if the operands are suitable, diagnostics should not be + issued. +*/ +/* Origin: Joseph Myers ; inspired by + http://deja.com/getdoc.xp?AN=524271595&fmt=text by Peter Seebach. +*/ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +/* The comma operator is in a subexpression that is not evaluated, so OK + by C99. In C90 a diagnostic is required since it is not in a sizeof. +*/ +int i = (1 ? 0 : (2, 3)); diff --git a/tests/GCCTestSuite/c99-const-expr-1.hex.expected b/tests/GCCTestSuite/c99-const-expr-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-const-expr-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-const-expr-1.s.expected b/tests/GCCTestSuite/c99-const-expr-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-const-expr-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-dupqual-1.c b/tests/GCCTestSuite/c99-dupqual-1.c new file mode 100644 index 0000000..2e6d7e1 --- /dev/null +++ b/tests/GCCTestSuite/c99-dupqual-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int CI; +const const int c1; /* { dg-bogus "duplicate" } */ +const CI c2; /* { dg-bogus "duplicate" } */ +const CI *c3; /* { dg-bogus "duplicate" } */ + +typedef volatile int VI; +volatile volatile int v1; /* { dg-bogus "duplicate" } */ +volatile VI v2; /* { dg-bogus "duplicate" } */ +volatile VI *v3; /* { dg-bogus "duplicate" } */ diff --git a/tests/GCCTestSuite/c99-dupqual-1.c.expected b/tests/GCCTestSuite/c99-dupqual-1.c.expected new file mode 100644 index 0000000..2e6d7e1 --- /dev/null +++ b/tests/GCCTestSuite/c99-dupqual-1.c.expected @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int CI; +const const int c1; /* { dg-bogus "duplicate" } */ +const CI c2; /* { dg-bogus "duplicate" } */ +const CI *c3; /* { dg-bogus "duplicate" } */ + +typedef volatile int VI; +volatile volatile int v1; /* { dg-bogus "duplicate" } */ +volatile VI v2; /* { dg-bogus "duplicate" } */ +volatile VI *v3; /* { dg-bogus "duplicate" } */ diff --git a/tests/GCCTestSuite/c99-dupqual-1.hex.expected b/tests/GCCTestSuite/c99-dupqual-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-dupqual-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-dupqual-1.s.expected b/tests/GCCTestSuite/c99-dupqual-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-dupqual-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-enum-comma-1.c b/tests/GCCTestSuite/c99-enum-comma-1.c new file mode 100644 index 0000000..1b676a2 --- /dev/null +++ b/tests/GCCTestSuite/c99-enum-comma-1.c @@ -0,0 +1,6 @@ +/* Test for commas at end of enums: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +enum foo { bar, }; diff --git a/tests/GCCTestSuite/c99-enum-comma-1.c.expected b/tests/GCCTestSuite/c99-enum-comma-1.c.expected new file mode 100644 index 0000000..1b676a2 --- /dev/null +++ b/tests/GCCTestSuite/c99-enum-comma-1.c.expected @@ -0,0 +1,6 @@ +/* Test for commas at end of enums: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +enum foo { bar, }; diff --git a/tests/GCCTestSuite/c99-enum-comma-1.hex.expected b/tests/GCCTestSuite/c99-enum-comma-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-enum-comma-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-enum-comma-1.s.expected b/tests/GCCTestSuite/c99-enum-comma-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-enum-comma-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-flex-array-3.c b/tests/GCCTestSuite/c99-flex-array-3.c new file mode 100644 index 0000000..e8647f6 --- /dev/null +++ b/tests/GCCTestSuite/c99-flex-array-3.c @@ -0,0 +1,47 @@ +/* Test for flexible array members. Test for where structures with + such members may not occur. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct flex { int a; int b[]; }; +union rf1 { struct flex a; int b; }; +union rf2 { int a; struct flex b; }; +union rf3 { int a; union rf1 b; }; +union rf4 { union rf2 a; int b; }; + +/* The above structure and unions may not be members of structures or + elements of arrays (6.7.2.1#2). */ + +struct t0 { struct flex a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "struct in struct" { target *-*-* } 16 } */ +struct t1 { union rf1 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in struct" { target *-*-* } 18 } */ +struct t2 { union rf2 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in struct" { target *-*-* } 20 } */ +struct t3 { union rf3 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in struct" { target *-*-* } 22 } */ +struct t4 { union rf4 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in struct" { target *-*-* } 24 } */ + +void f0 (struct flex[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "struct in array" { target *-*-* } 27 } */ +void f1 (union rf1[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 29 } */ +void f2 (union rf2[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 31 } */ +void f3 (union rf3[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 33 } */ +void f4 (union rf4[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 35 } */ + +struct flex a0[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "struct in array" { target *-*-* } 38 } */ +union rf1 a1[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 40 } */ +union rf2 a2[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 42 } */ +union rf3 a3[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 44 } */ +union rf4 a4[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 46 } */ diff --git a/tests/GCCTestSuite/c99-flex-array-3.c.expected b/tests/GCCTestSuite/c99-flex-array-3.c.expected new file mode 100644 index 0000000..e8647f6 --- /dev/null +++ b/tests/GCCTestSuite/c99-flex-array-3.c.expected @@ -0,0 +1,47 @@ +/* Test for flexible array members. Test for where structures with + such members may not occur. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct flex { int a; int b[]; }; +union rf1 { struct flex a; int b; }; +union rf2 { int a; struct flex b; }; +union rf3 { int a; union rf1 b; }; +union rf4 { union rf2 a; int b; }; + +/* The above structure and unions may not be members of structures or + elements of arrays (6.7.2.1#2). */ + +struct t0 { struct flex a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "struct in struct" { target *-*-* } 16 } */ +struct t1 { union rf1 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in struct" { target *-*-* } 18 } */ +struct t2 { union rf2 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in struct" { target *-*-* } 20 } */ +struct t3 { union rf3 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in struct" { target *-*-* } 22 } */ +struct t4 { union rf4 a; }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in struct" { target *-*-* } 24 } */ + +void f0 (struct flex[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "struct in array" { target *-*-* } 27 } */ +void f1 (union rf1[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 29 } */ +void f2 (union rf2[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 31 } */ +void f3 (union rf3[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 33 } */ +void f4 (union rf4[]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 35 } */ + +struct flex a0[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "struct in array" { target *-*-* } 38 } */ +union rf1 a1[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 40 } */ +union rf2 a2[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "union in array" { target *-*-* } 42 } */ +union rf3 a3[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 44 } */ +union rf4 a4[1]; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "invalid use of structure" "recursive union in array" { target *-*-* } 46 } */ diff --git a/tests/GCCTestSuite/c99-flex-array-3.hex.expected b/tests/GCCTestSuite/c99-flex-array-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-flex-array-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-flex-array-3.s.expected b/tests/GCCTestSuite/c99-flex-array-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-flex-array-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-func-2.c b/tests/GCCTestSuite/c99-func-2.c new file mode 100644 index 0000000..f3eaaa1 --- /dev/null +++ b/tests/GCCTestSuite/c99-func-2.c @@ -0,0 +1,10 @@ +/* Test for C99 __func__: not a string constant. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +void +foo (void) +{ + __func__ "foo"; /* { dg-error "parse error|syntax error|expected" "before string constant" } */ +} diff --git a/tests/GCCTestSuite/c99-func-2.c.expected b/tests/GCCTestSuite/c99-func-2.c.expected new file mode 100644 index 0000000..f3eaaa1 --- /dev/null +++ b/tests/GCCTestSuite/c99-func-2.c.expected @@ -0,0 +1,10 @@ +/* Test for C99 __func__: not a string constant. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +void +foo (void) +{ + __func__ "foo"; /* { dg-error "parse error|syntax error|expected" "before string constant" } */ +} diff --git a/tests/GCCTestSuite/c99-func-2.hex.expected b/tests/GCCTestSuite/c99-func-2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/c99-func-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-func-2.s.expected b/tests/GCCTestSuite/c99-func-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-func-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-idem-qual-1.c b/tests/GCCTestSuite/c99-idem-qual-1.c new file mode 100644 index 0000000..c541d07 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-1.c @@ -0,0 +1,7 @@ +/* Test for idempotent type qualifiers: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int cint; +const cint foo; /* { dg-bogus "duplicate" "duplicate type qualifier error" } */ diff --git a/tests/GCCTestSuite/c99-idem-qual-1.c.expected b/tests/GCCTestSuite/c99-idem-qual-1.c.expected new file mode 100644 index 0000000..c541d07 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-1.c.expected @@ -0,0 +1,7 @@ +/* Test for idempotent type qualifiers: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int cint; +const cint foo; /* { dg-bogus "duplicate" "duplicate type qualifier error" } */ diff --git a/tests/GCCTestSuite/c99-idem-qual-1.hex.expected b/tests/GCCTestSuite/c99-idem-qual-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-idem-qual-1.s.expected b/tests/GCCTestSuite/c99-idem-qual-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-idem-qual-2.c b/tests/GCCTestSuite/c99-idem-qual-2.c new file mode 100644 index 0000000..dd9f932 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-2.c @@ -0,0 +1,6 @@ +/* Test for idempotent type qualifiers: in C99 only. Test "const const". */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +const const int foo; /* { dg-bogus "duplicate" "duplicate type qualifier error" } */ diff --git a/tests/GCCTestSuite/c99-idem-qual-2.c.expected b/tests/GCCTestSuite/c99-idem-qual-2.c.expected new file mode 100644 index 0000000..dd9f932 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-2.c.expected @@ -0,0 +1,6 @@ +/* Test for idempotent type qualifiers: in C99 only. Test "const const". */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +const const int foo; /* { dg-bogus "duplicate" "duplicate type qualifier error" } */ diff --git a/tests/GCCTestSuite/c99-idem-qual-2.hex.expected b/tests/GCCTestSuite/c99-idem-qual-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-idem-qual-2.s.expected b/tests/GCCTestSuite/c99-idem-qual-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-idem-qual-3.c b/tests/GCCTestSuite/c99-idem-qual-3.c new file mode 100644 index 0000000..0f34f83 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-3.c @@ -0,0 +1,9 @@ +/* Test for idempotent type qualifiers: in C99 only. Test duplicate + type qualifiers with array element types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int cia[2]; +const cia a; /* { dg-bogus "duplicate" "duplicate type qualifier warning" } */ +const cia b[2]; /* { dg-bogus "duplicate" "duplicate type qualifier warning" } */ diff --git a/tests/GCCTestSuite/c99-idem-qual-3.c.expected b/tests/GCCTestSuite/c99-idem-qual-3.c.expected new file mode 100644 index 0000000..0f34f83 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-3.c.expected @@ -0,0 +1,9 @@ +/* Test for idempotent type qualifiers: in C99 only. Test duplicate + type qualifiers with array element types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int cia[2]; +const cia a; /* { dg-bogus "duplicate" "duplicate type qualifier warning" } */ +const cia b[2]; /* { dg-bogus "duplicate" "duplicate type qualifier warning" } */ diff --git a/tests/GCCTestSuite/c99-idem-qual-3.hex.expected b/tests/GCCTestSuite/c99-idem-qual-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-idem-qual-3.s.expected b/tests/GCCTestSuite/c99-idem-qual-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-idem-qual-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-impl-int-1.c b/tests/GCCTestSuite/c99-impl-int-1.c new file mode 100644 index 0000000..dcc2520 --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-1.c @@ -0,0 +1,9 @@ +/* Test for implicit int: in C90 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +extern foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "type defaults" "C99 implicit int error" { target *-*-* } 6 } */ +bar (void) { } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "return type defaults" "C99 implicit int error" { target *-*-* } 8 } */ diff --git a/tests/GCCTestSuite/c99-impl-int-1.c.expected b/tests/GCCTestSuite/c99-impl-int-1.c.expected new file mode 100644 index 0000000..dcc2520 --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-1.c.expected @@ -0,0 +1,9 @@ +/* Test for implicit int: in C90 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +extern foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "type defaults" "C99 implicit int error" { target *-*-* } 6 } */ +bar (void) { } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "return type defaults" "C99 implicit int error" { target *-*-* } 8 } */ diff --git a/tests/GCCTestSuite/c99-impl-int-1.hex.expected b/tests/GCCTestSuite/c99-impl-int-1.hex.expected new file mode 100644 index 0000000..16a396e --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501E509F502E509F5DD +:1000100003E509F504E509F505E501C0E0E500C0E3 +:10002000E0E502F582E503F583E504F500E505F575 +:10003000012200000000000000000000000000009D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-impl-int-1.s.expected b/tests/GCCTestSuite/c99-impl-int-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-impl-int-2.c b/tests/GCCTestSuite/c99-impl-int-2.c new file mode 100644 index 0000000..e9e9747 --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-2.c @@ -0,0 +1,9 @@ +/* Test for implicit int: in C90 only. Function parameters in old-style + function definition. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +void foo (a) { } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "defaults" "C99 implicit int parameter error" { target *-*-* } 8 } */ diff --git a/tests/GCCTestSuite/c99-impl-int-2.c.expected b/tests/GCCTestSuite/c99-impl-int-2.c.expected new file mode 100644 index 0000000..e9e9747 --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-2.c.expected @@ -0,0 +1,9 @@ +/* Test for implicit int: in C90 only. Function parameters in old-style + function definition. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +void foo (a) { } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "defaults" "C99 implicit int parameter error" { target *-*-* } 8 } */ diff --git a/tests/GCCTestSuite/c99-impl-int-2.hex.expected b/tests/GCCTestSuite/c99-impl-int-2.hex.expected new file mode 100644 index 0000000..7af2347 --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-2.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0042506F50675E0C6 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F50122000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-impl-int-2.s.expected b/tests/GCCTestSuite/c99-impl-int-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-impl-int-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-longlong-1.c b/tests/GCCTestSuite/c99-longlong-1.c new file mode 100644 index 0000000..92d5e0e --- /dev/null +++ b/tests/GCCTestSuite/c99-longlong-1.c @@ -0,0 +1,6 @@ +/* Test for long long: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +long long foo; /* { dg-bogus "long long" "bogus long long error" } */ diff --git a/tests/GCCTestSuite/c99-longlong-1.c.expected b/tests/GCCTestSuite/c99-longlong-1.c.expected new file mode 100644 index 0000000..92d5e0e --- /dev/null +++ b/tests/GCCTestSuite/c99-longlong-1.c.expected @@ -0,0 +1,6 @@ +/* Test for long long: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +long long foo; /* { dg-bogus "long long" "bogus long long error" } */ diff --git a/tests/GCCTestSuite/c99-longlong-1.hex.expected b/tests/GCCTestSuite/c99-longlong-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-longlong-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-longlong-1.s.expected b/tests/GCCTestSuite/c99-longlong-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-longlong-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-main-1.c b/tests/GCCTestSuite/c99-main-1.c new file mode 100644 index 0000000..fdef9fd --- /dev/null +++ b/tests/GCCTestSuite/c99-main-1.c @@ -0,0 +1,9 @@ +/* Test for implicit return 0 from main in C99. */ +/* Origin: Joseph Myers */ +/* { dg-do run } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -Wreturn-type -O -fhosted" } */ + +int +main (void) +{ +} /* { dg-bogus "control reaches end" "missing implicit return" } */ diff --git a/tests/GCCTestSuite/c99-main-1.c.expected b/tests/GCCTestSuite/c99-main-1.c.expected new file mode 100644 index 0000000..fdef9fd --- /dev/null +++ b/tests/GCCTestSuite/c99-main-1.c.expected @@ -0,0 +1,9 @@ +/* Test for implicit return 0 from main in C99. */ +/* Origin: Joseph Myers */ +/* { dg-do run } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -Wreturn-type -O -fhosted" } */ + +int +main (void) +{ +} /* { dg-bogus "control reaches end" "missing implicit return" } */ diff --git a/tests/GCCTestSuite/c99-main-1.hex.expected b/tests/GCCTestSuite/c99-main-1.hex.expected new file mode 100644 index 0000000..923c6d3 --- /dev/null +++ b/tests/GCCTestSuite/c99-main-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501E509F502E509F503CA +:10002000E509F504E509F505E501C0E0E500C0E0F6 +:10003000E502F582E503F583E504F500E505F50144 +:10004000220000000000000000000000000000008E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-main-1.s.expected b/tests/GCCTestSuite/c99-main-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-main-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-restrict-1.c b/tests/GCCTestSuite/c99-restrict-1.c new file mode 100644 index 0000000..30ddd96 --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-1.c @@ -0,0 +1,19 @@ +/* Test for restrict: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +char *restrict foo; + +/* The following are constraint violations and should be rejected. */ + +int restrict bar; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 10 } */ + +typedef void (*fp) (void); + +fp restrict baz; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 15 } */ + +void quux (int restrict a[3]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 18 } */ diff --git a/tests/GCCTestSuite/c99-restrict-1.c.expected b/tests/GCCTestSuite/c99-restrict-1.c.expected new file mode 100644 index 0000000..30ddd96 --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-1.c.expected @@ -0,0 +1,19 @@ +/* Test for restrict: in C99 only. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +char *restrict foo; + +/* The following are constraint violations and should be rejected. */ + +int restrict bar; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 10 } */ + +typedef void (*fp) (void); + +fp restrict baz; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 15 } */ + +void quux (int restrict a[3]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 18 } */ diff --git a/tests/GCCTestSuite/c99-restrict-1.hex.expected b/tests/GCCTestSuite/c99-restrict-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-restrict-1.s.expected b/tests/GCCTestSuite/c99-restrict-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-restrict-2.c b/tests/GCCTestSuite/c99-restrict-2.c new file mode 100644 index 0000000..2adc5f2 --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-2.c @@ -0,0 +1,12 @@ +/* Test for restrict: in C99 only. Test handling of arrays of restricted + pointers. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef int *ipa[2]; + +int *restrict x[2]; +restrict ipa y; + +void f(int *restrict a[2], restrict ipa b, int *restrict c[restrict]); diff --git a/tests/GCCTestSuite/c99-restrict-2.c.expected b/tests/GCCTestSuite/c99-restrict-2.c.expected new file mode 100644 index 0000000..2adc5f2 --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-2.c.expected @@ -0,0 +1,12 @@ +/* Test for restrict: in C99 only. Test handling of arrays of restricted + pointers. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef int *ipa[2]; + +int *restrict x[2]; +restrict ipa y; + +void f(int *restrict a[2], restrict ipa b, int *restrict c[restrict]); diff --git a/tests/GCCTestSuite/c99-restrict-2.hex.expected b/tests/GCCTestSuite/c99-restrict-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-restrict-2.s.expected b/tests/GCCTestSuite/c99-restrict-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-restrict-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-tag-2.c b/tests/GCCTestSuite/c99-tag-2.c new file mode 100644 index 0000000..22cf90e --- /dev/null +++ b/tests/GCCTestSuite/c99-tag-2.c @@ -0,0 +1,16 @@ +/* Test for handling of tags. A struct defined in an inner scope does + not match one declared in an outer scope. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s; +struct t { struct s *p; } x; + +void +f (void) +{ + /* This is a different struct s from the outer one. */ + struct s { int a; } y; + x.p = &y; /* { dg-error "incompatible" } */ +} diff --git a/tests/GCCTestSuite/c99-tag-2.c.expected b/tests/GCCTestSuite/c99-tag-2.c.expected new file mode 100644 index 0000000..22cf90e --- /dev/null +++ b/tests/GCCTestSuite/c99-tag-2.c.expected @@ -0,0 +1,16 @@ +/* Test for handling of tags. A struct defined in an inner scope does + not match one declared in an outer scope. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s; +struct t { struct s *p; } x; + +void +f (void) +{ + /* This is a different struct s from the outer one. */ + struct s { int a; } y; + x.p = &y; /* { dg-error "incompatible" } */ +} diff --git a/tests/GCCTestSuite/c99-tag-2.hex.expected b/tests/GCCTestSuite/c99-tag-2.hex.expected new file mode 100644 index 0000000..54eff5b --- /dev/null +++ b/tests/GCCTestSuite/c99-tag-2.hex.expected @@ -0,0 +1,18 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F50ED0E0F50FE510F50D6E +:10002000900000E582F50A900000E583F50175096E +:1000300000C3750000E509F5F0E50A35F0F50BE5BC +:1000400000F5F0E50135F0F50CE506F50AE507F5F4 +:1000500001750900C3750000E509F5F0E50A35F002 +:10006000F509E500F5F0E50135F0F50A750100C385 +:10007000750000E501F5F0E50B35F0F501E500F55B +:10008000F0E50C35F0F500E509F503E500F502E5CE +:1000900001F582E502F583E503F0750101C3750002 +:1000A00000E501F5F0E50B35F0F501E500F5F0E5CB +:1000B0000C35F0F500E50AF503E500F502E501F57C +:1000C00082E502F583E503F0750000E500F502E541 +:1000D00000F503E500F504E500F505E50DF510E58F +:1000E0000FC0E0E50EC0E075E0042506F50675E0FA +:1000F000003507F507E502F582E503F583E504F52C +:1001000000E505F5012200000000000000000000ED +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/c99-tag-2.s.expected b/tests/GCCTestSuite/c99-tag-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/c99-tag-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/cast-qual-1.c b/tests/GCCTestSuite/cast-qual-1.c new file mode 100644 index 0000000..407d138 --- /dev/null +++ b/tests/GCCTestSuite/cast-qual-1.c @@ -0,0 +1,30 @@ +/* Incorrect `cast discards `const'' warnings. There should be warnings + in bad_cast and bad_assign; bad_assign gets the correct warning, but + good_cast may get the warning instead of bad_cast. + gcc 2.7.2.3 passes, egcs-1.1.2 and egcs-ss-19990428 fail. + http://gcc.gnu.org/ml/gcc-bugs/1998-08/msg00645.html */ +/* { dg-do compile } */ +/* { dg-options "-Wcast-qual" } */ +void +good_cast(const void *bar) +{ + (char *const *)bar; /* { dg-bogus "cast discards" "discarding `const' warning" } */ +} + +void +bad_cast(const void *bar) +{ + (const char **)bar; /* { dg-warning "cast discards" "discarding `const' warning" } */ +} + +void +good_assign(const void *bar) +{ + char *const *foo = bar; /* { dg-bogus "initialization discards" "discarding `const' warning" } */ +} + +void +bad_assign(const void *bar) +{ + const char **foo = bar; /* { dg-warning "initialization discards" "discarding `const' warning" } */ +} diff --git a/tests/GCCTestSuite/cast-qual-1.c.expected b/tests/GCCTestSuite/cast-qual-1.c.expected new file mode 100644 index 0000000..407d138 --- /dev/null +++ b/tests/GCCTestSuite/cast-qual-1.c.expected @@ -0,0 +1,30 @@ +/* Incorrect `cast discards `const'' warnings. There should be warnings + in bad_cast and bad_assign; bad_assign gets the correct warning, but + good_cast may get the warning instead of bad_cast. + gcc 2.7.2.3 passes, egcs-1.1.2 and egcs-ss-19990428 fail. + http://gcc.gnu.org/ml/gcc-bugs/1998-08/msg00645.html */ +/* { dg-do compile } */ +/* { dg-options "-Wcast-qual" } */ +void +good_cast(const void *bar) +{ + (char *const *)bar; /* { dg-bogus "cast discards" "discarding `const' warning" } */ +} + +void +bad_cast(const void *bar) +{ + (const char **)bar; /* { dg-warning "cast discards" "discarding `const' warning" } */ +} + +void +good_assign(const void *bar) +{ + char *const *foo = bar; /* { dg-bogus "initialization discards" "discarding `const' warning" } */ +} + +void +bad_assign(const void *bar) +{ + const char **foo = bar; /* { dg-warning "initialization discards" "discarding `const' warning" } */ +} diff --git a/tests/GCCTestSuite/cast-qual-1.hex.expected b/tests/GCCTestSuite/cast-qual-1.hex.expected new file mode 100644 index 0000000..b28b7f6 --- /dev/null +++ b/tests/GCCTestSuite/cast-qual-1.hex.expected @@ -0,0 +1,23 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0022506F50675E0C8 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F5012200E506758202C39582F5EB +:1000600006E5077583009583F507D0E0F500D0E03D +:10007000F501750900E509F502E509F503E509F55E +:1000800004E509F505E501C0E0E500C0E075E00222 +:100090002506F50675E0003507F507E502F582E56A +:1000A00003F583E504F500E505F5012200E5067595 +:1000B0008202C39582F506E5077583009583F507EF +:1000C000D0E0F500D0E0F501750900E509F502E59D +:1000D00009F503E509F504E509F505E501C0E0E5E5 +:1000E00000C0E075E0022506F50675E0003507F56D +:1000F00007E502F582E503F583E504F500E505F57E +:10010000012200E506758202C39582F506E50775B2 +:1001100083009583F507D0E0F500D0E0F50175097F +:1001200000E509F502E509F503E509F504E509F53A +:1001300005E501C0E0E500C0E075E0022506F50632 +:1001400075E0003507F507E502F582E503F583E57F +:1001500004F500E505F501220000000000000000A4 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/cast-qual-1.s.expected b/tests/GCCTestSuite/cast-qual-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/cast-qual-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/cleanup-3.c b/tests/GCCTestSuite/cleanup-3.c new file mode 100644 index 0000000..b5b01fd --- /dev/null +++ b/tests/GCCTestSuite/cleanup-3.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "" } */ +/* Verify that the cleanup handler receives the proper contents + of the variable. */ + +extern void exit(int); +extern void abort(void); + +static int expected; + +static void +handler(int *p) +{ + if (*p != expected) + abort (); +} + +static void __attribute__((noinline)) +bar(void) +{ +} + +static void doit(int x, int y) +{ + int r __attribute__((cleanup (handler))); + if (x < y) + { + r = 0; + return; + } + + bar(); + r = x + y; +} + +int main() +{ + expected = 0; + doit (1, 2); + + expected = 3; + doit (2, 1); + + return 0; +} diff --git a/tests/GCCTestSuite/cleanup-3.c.expected b/tests/GCCTestSuite/cleanup-3.c.expected new file mode 100644 index 0000000..b5b01fd --- /dev/null +++ b/tests/GCCTestSuite/cleanup-3.c.expected @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "" } */ +/* Verify that the cleanup handler receives the proper contents + of the variable. */ + +extern void exit(int); +extern void abort(void); + +static int expected; + +static void +handler(int *p) +{ + if (*p != expected) + abort (); +} + +static void __attribute__((noinline)) +bar(void) +{ +} + +static void doit(int x, int y) +{ + int r __attribute__((cleanup (handler))); + if (x < y) + { + r = 0; + return; + } + + bar(); + r = x + y; +} + +int main() +{ + expected = 0; + doit (1, 2); + + expected = 3; + doit (2, 1); + + return 0; +} diff --git a/tests/GCCTestSuite/cleanup-3.hex.expected b/tests/GCCTestSuite/cleanup-3.hex.expected new file mode 100644 index 0000000..ac87521 --- /dev/null +++ b/tests/GCCTestSuite/cleanup-3.hex.expected @@ -0,0 +1,120 @@ +:1000000075812F7506FF7507FF1204E602000C00CC +:10001000D0E0F500D0E0F501750900E509F502E54D +:1000200009F503E509F504E509F505E501C0E0E595 +:1000300000C0E0E502F582E503F583E504F500E59F +:1000400005F5012200E506758212C39582F506E5E5 +:10005000077583009583F507D0E0F50875E0012565 +:1000600006F58275E0003507F583E508F0D0E0F588 +:100070000875E0002506F58275E0003507F583E593 +:1000800008F075E0092506F58275E0003507F5836F +:10009000E517F075E0082506F58275E0003507F5EF +:1000A00083E516F075E0072506F58275E000350753 +:1000B000F583E515F075E0062506F58275E0003557 +:1000C00007F583E514F075E0052506F58275E00077 +:1000D0003507F583E513F075E0042506F58275E034 +:1000E000003507F583E512F075E0032506F5827506 +:1000F000E0003507F583E511F075E0022506F5828D +:1001000075E0003507F583E510F0E51DF50BE51CFE +:10011000F50CE51BF500E51AF501E519F509E518FB +:10012000F50AE51FF517E51EF515E50BF512E50CCB +:10013000F513E500F516E501F514E509F510E50AF6 +:10014000F511750080E500F5F0E51325F0F513E5F0 +:1001500000F5F0E51125F0F511750C00750D007531 +:100160000E00750F00750B00750A01750001C3E5DF +:1001700011F5F0E51395F0F509E50BF5F0E50B3514 +:10018000F0F509E509F5F0E50055F0F500E500F5B5 +:10019000F0E50C45F0F50C750001C3E511F5F0E54F +:1001A0001395F0F509E50BF5F0E50B35F0F509E5EC +:1001B00013F5F0E51195F0F501E50BF5F0E50B35DC +:1001C000F0F501E501F5F0E50945F0F509E50AF579 +:1001D000F0E50965F0F509E509F5F0E50055F0F5FC +:1001E00000C3E510F5F0E51295F0F509E50BF5F023 +:1001F000E50B35F0F509E509F5F0E50055F0F500FA +:10020000E500F5F0E50C45F0F50C750001C3E511CE +:10021000F5F0E51395F0F509E50BF5F0E50B35F094 +:10022000F509E513F5F0E51195F0F501E50BF5F0AD +:10023000E50B35F0F501E501F5F0E50945F0F509C7 +:10024000E50AF5F0E50965F0F509E509F5F0E500E1 +:1002500055F0F500C3E510F5F0E51295F0F509E568 +:100260000BF5F0E50B35F0F509E512F5F0E5109525 +:10027000F0F501E50BF5F0E50B35F0F501E501F5DD +:10028000F0E50945F0F509E50AF5F0E50965F0F551 +:1002900009E509F5F0E50055F0F500C3E514F5F0C2 +:1002A000E51595F0F509E50BF5F0E50B35F0F509E9 +:1002B000E509F5F0E50055F0F500E500F5F0E50C91 +:1002C00045F0F50C750001C3E511F5F0E51395F067 +:1002D000F509E50BF5F0E50B35F0F509E513F5F05B +:1002E000E51195F0F501E50BF5F0E50B35F0F501BD +:1002F000E501F5F0E50945F0F509E50AF5F0E50950 +:1003000065F0F509E509F5F0E50055F0F500C3E500 +:1003100010F5F0E51295F0F509E50BF5F0E50B3574 +:10032000F0F509E512F5F0E51095F0F501E50BF5AE +:10033000F0E50B35F0F501E501F5F0E50945F0F5DF +:1003400009E50AF5F0E50965F0F509E509F5F0E5D7 +:100350000055F0F500C3E514F5F0E51595F0F50945 +:10036000E50BF5F0E50B35F0F509E515F5F0E514CD +:1003700095F0F501E50BF5F0E50B35F0F501E5013C +:10038000F5F0E50945F0F509E50AF5F0E50965F050 +:10039000F509E509F5F0E50055F0F500C3E516F5BA +:1003A000F0E51795F0F509E50BF5F0E50B35F0F5FF +:1003B00009E509F5F0E50055F0F500E500F5F0E593 +:1003C0000C45F0F50C750000E50CF5F0E50045F086 +:1003D000F500E50DF5F0E50045F0F500E50EF5F06A +:1003E000E50045F0F500E50FF5F0E50045F0F50016 +:1003F000E500700280030204E20012000FC37500E2 +:1004000000E500F502E500F503E500F504E500F57B +:100410000575E0092506F58275E0003507F583E0EE +:10042000F51775E0082506F58275E0003507F583B8 +:10043000E0F51675E0072506F58275E0003507F54D +:1004400083E0F51575E0062506F58275E0003507B1 +:10045000F583E0F51475E0052506F58275E00035B5 +:1004600007F583E0F51375E0042506F58275E000D5 +:100470003507F583E0F51275E0032506F58275E092 +:10048000003507F583E0F51175E0022506F5827564 +:10049000E0003507F583E0F51075E0002506F582EC +:1004A00075E0003507F583E0F508E508C0E075E084 +:1004B000012506F58275E0003507F583E0F508E5CE +:1004C00008C0E075E0122506F50675E0003507F571 +:1004D00007E502F582E503F583E504F500E505F59A +:1004E0000122000203FE00E506758202C39582F533 +:1004F00006E5077583009583F507D0E0F50875E0FC +:10050000012506F58275E0003507F583E508F0D092 +:10051000E0F50875E0002506F58275E0003507F581 +:1005200083E508F0900000E582F50D900000E5837A +:10053000F50E750900750A00750B00750C00750144 +:1005400000C3750000E501F5F0E50D35F0F501E5B6 +:1005500000F5F0E50E35F0F500E509F503E500F5E9 +:1005600002E501F582E502F583E503F0750101C3BB +:10057000750000E501F5F0E50D35F0F501E500F554 +:10058000F0E50E35F0F500E50AF503E500F502E5C6 +:1005900001F582E502F583E503F0750102C37500FC +:1005A00000E501F5F0E50D35F0F501E500F5F0E5C4 +:1005B0000E35F0F500E50BF503E500F502E501F574 +:1005C00082E502F583E503F0750103C3750000E5DC +:1005D00001F5F0E50D35F0F501E500F5F0E50E3536 +:1005E000F0F500E50CF503E500F502E501F582E51F +:1005F00002F583E503F0751F01751E00751D00757A +:100600001C00751B02751A00751900751800120080 +:1006100044900000E582F50D900000E583F50E752D +:100620000903750A00750B00750C00750100C37590 +:100630000000E501F5F0E50D35F0F501E500F5F018 +:10064000E50E35F0F500E509F503E500F502E501F5 +:10065000F582E502F583E503F0750101C37500003D +:10066000E501F5F0E50D35F0F501E500F5F0E50EF5 +:1006700035F0F500E50AF503E500F502E501F58240 +:10068000E502F583E503F0750102C3750000E5019D +:10069000F5F0E50D35F0F501E500F5F0E50E35F086 +:1006A000F500E50BF503E500F502E501F582E5024D +:1006B000F583E503F0750103C3750000E501F5F06E +:1006C000E50D35F0F501E500F5F0E50E35F0F50046 +:1006D000E50CF503E500F502E501F582E502F58399 +:1006E000E503F0751F02751E00751D00751C007571 +:1006F0001B01751A00751900751800120044750069 +:1007000000750100750900750A00E500F502E501B4 +:10071000F503E509F504E50AF50575E0002506F59C +:100720008275E0003507F583E0F508E508C0E0755F +:10073000E0012506F58275E0003507F583E0F50850 +:10074000E508C0E075E0022506F50675E00035070E +:10075000F507E502F582E503F583E504F500E50517 +:10076000F501220000000000000000000000000071 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/cleanup-3.s.expected b/tests/GCCTestSuite/cleanup-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/cleanup-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/cleanup-6.c b/tests/GCCTestSuite/cleanup-6.c new file mode 100644 index 0000000..4e3d538 --- /dev/null +++ b/tests/GCCTestSuite/cleanup-6.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ +/* Verify that a cleanup marked "inline" gets inlined. */ + +static inline void xyzzy(void *p __attribute__((unused))) +{ +} + +void doit(void) +{ + int x __attribute__((cleanup (xyzzy))); +} + +/* { dg-final { scan-assembler-not "xyzzy" } } */ diff --git a/tests/GCCTestSuite/cleanup-6.c.expected b/tests/GCCTestSuite/cleanup-6.c.expected new file mode 100644 index 0000000..4e3d538 --- /dev/null +++ b/tests/GCCTestSuite/cleanup-6.c.expected @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ +/* Verify that a cleanup marked "inline" gets inlined. */ + +static inline void xyzzy(void *p __attribute__((unused))) +{ +} + +void doit(void) +{ + int x __attribute__((cleanup (xyzzy))); +} + +/* { dg-final { scan-assembler-not "xyzzy" } } */ diff --git a/tests/GCCTestSuite/cleanup-6.hex.expected b/tests/GCCTestSuite/cleanup-6.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/cleanup-6.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/cleanup-6.s.expected b/tests/GCCTestSuite/cleanup-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/cleanup-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/comp-return-1.c b/tests/GCCTestSuite/comp-return-1.c new file mode 100644 index 0000000..82c3983 --- /dev/null +++ b/tests/GCCTestSuite/comp-return-1.c @@ -0,0 +1,31 @@ +/* When merging a nonprototype definition of a function with a prior + prototype declaration, the composite type of the return types must + be formed rather than just copying the function type. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ + +typedef int a[]; +typedef int a5[5]; +typedef int a10[10]; + +a *f1 (); +a5 *f1 () { return 0; } + +a *f2 (void); +a5 *f2 () { return 0; } + +a *f3 (); +a5 *f3 (void) { return 0; } + +a *f4 (void); +a5 *f4 (void) { return 0; } + +void +g (void) +{ + a10 *x; + x = f1 (); /* { dg-error "incompatible" "f1" } */ + x = f2 (); /* { dg-error "incompatible" "f2" } */ + x = f3 (); /* { dg-error "incompatible" "f3" } */ + x = f4 (); /* { dg-error "incompatible" "f4" } */ +} diff --git a/tests/GCCTestSuite/comp-return-1.c.expected b/tests/GCCTestSuite/comp-return-1.c.expected new file mode 100644 index 0000000..82c3983 --- /dev/null +++ b/tests/GCCTestSuite/comp-return-1.c.expected @@ -0,0 +1,31 @@ +/* When merging a nonprototype definition of a function with a prior + prototype declaration, the composite type of the return types must + be formed rather than just copying the function type. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ + +typedef int a[]; +typedef int a5[5]; +typedef int a10[10]; + +a *f1 (); +a5 *f1 () { return 0; } + +a *f2 (void); +a5 *f2 () { return 0; } + +a *f3 (); +a5 *f3 (void) { return 0; } + +a *f4 (void); +a5 *f4 (void) { return 0; } + +void +g (void) +{ + a10 *x; + x = f1 (); /* { dg-error "incompatible" "f1" } */ + x = f2 (); /* { dg-error "incompatible" "f2" } */ + x = f3 (); /* { dg-error "incompatible" "f3" } */ + x = f4 (); /* { dg-error "incompatible" "f4" } */ +} diff --git a/tests/GCCTestSuite/comp-return-1.hex.expected b/tests/GCCTestSuite/comp-return-1.hex.expected new file mode 100644 index 0000000..0de153d --- /dev/null +++ b/tests/GCCTestSuite/comp-return-1.hex.expected @@ -0,0 +1,27 @@ +:1000000000D0E0F500D0E0F501750900750A007533 +:100010000B00E509F502E50AF503E50BF504E50B30 +:10002000F505E501C0E0E500C0E0E502F582E50385 +:10003000F583E504F500E505F5012200D0E0F500C3 +:10004000D0E0F501750900750A00750B00E509F5AA +:1000500002E50AF503E50BF504E50BF505E501C03E +:10006000E0E500C0E0E502F582E503F583E504F58F +:1000700000E505F5012200D0E0F500D0E0F50175BE +:100080000900750A00750B00E509F502E50AF5039C +:10009000E50BF504E50BF505E501C0E0E500C0E082 +:1000A000E502F582E503F583E504F500E505F501D4 +:1000B0002200D0E0F500D0E0F501750900750A00D6 +:1000C000750B00E509F502E50AF503E50BF504E516 +:1000D0000BF505E501C0E0E500C0E0E502F582E5CD +:1000E00003F583E504F500E505F5012200E5067555 +:1000F0008202C39582F506E5077583009583F507AF +:10010000D0E0F50875E0012506F58275E0003507B9 +:10011000F583E508F0D0E0F50875E0002506F582E6 +:1001200075E0003507F583E508F012000012003B8A +:100130001200761200B1750000E500F502E500F549 +:1001400003E500F504E500F50575E0002506F582F8 +:1001500075E0003507F583E0F508E508C0E075E0D7 +:10016000012506F58275E0003507F583E0F508E521 +:1001700008C0E075E0022506F50675E0003507F5D4 +:1001800007E502F582E503F583E504F500E505F5ED +:10019000012200000000000000000000000000003C +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/comp-return-1.s.expected b/tests/GCCTestSuite/comp-return-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/comp-return-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare1.c b/tests/GCCTestSuite/compare1.c new file mode 100644 index 0000000..17ba3ee --- /dev/null +++ b/tests/GCCTestSuite/compare1.c @@ -0,0 +1,41 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + This was inspired by code in gcc. This testcase is identical to + compare9.c except that we use -fno-short-enums here and expect a + warning from case 4. */ + +/* { dg-do compile } */ +/* { dg-options "-fno-short-enums -Wsign-compare" } */ + +int tf = 1; + +/* This enumeration has an explicit negative value and is therefore signed. */ +enum mm1 +{ + VOID, SI, DI, MAX = -1 +}; + +/* This enumeration fits entirely in a signed int, but is unsigned anyway. */ +enum mm2 +{ + VOID2, SI2, DI2, MAX2 +}; + +int f(enum mm1 x) +{ + return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */ +} + +int g(enum mm1 x) +{ + return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */ +} + +int h(enum mm2 x) +{ + return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */ +} + +int i(enum mm2 x) +{ + return x == (tf?DI2:-1); /* { dg-warning "signed and unsigned" "case 4" } */ +} diff --git a/tests/GCCTestSuite/compare1.c.expected b/tests/GCCTestSuite/compare1.c.expected new file mode 100644 index 0000000..17ba3ee --- /dev/null +++ b/tests/GCCTestSuite/compare1.c.expected @@ -0,0 +1,41 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + This was inspired by code in gcc. This testcase is identical to + compare9.c except that we use -fno-short-enums here and expect a + warning from case 4. */ + +/* { dg-do compile } */ +/* { dg-options "-fno-short-enums -Wsign-compare" } */ + +int tf = 1; + +/* This enumeration has an explicit negative value and is therefore signed. */ +enum mm1 +{ + VOID, SI, DI, MAX = -1 +}; + +/* This enumeration fits entirely in a signed int, but is unsigned anyway. */ +enum mm2 +{ + VOID2, SI2, DI2, MAX2 +}; + +int f(enum mm1 x) +{ + return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */ +} + +int g(enum mm1 x) +{ + return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */ +} + +int h(enum mm2 x) +{ + return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */ +} + +int i(enum mm2 x) +{ + return x == (tf?DI2:-1); /* { dg-warning "signed and unsigned" "case 4" } */ +} diff --git a/tests/GCCTestSuite/compare1.hex.expected b/tests/GCCTestSuite/compare1.hex.expected new file mode 100644 index 0000000..df37c63 --- /dev/null +++ b/tests/GCCTestSuite/compare1.hex.expected @@ -0,0 +1,165 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F518D0E0F519E515F50E54 +:10002000E514F50F900000E582F509900000E583E6 +:10003000F50A750100C3750000E501F5F0E5093525 +:10004000F0F501E500F5F0E50A35F0F500E500F51D +:1000500002E501F582E502F583E0F50B750101C3C8 +:10006000750000E501F5F0E50935F0F501E500F56D +:10007000F0E50A35F0F500E500F502E501F582E569 +:1000800002F583E0F50C750102C3750000E501F58A +:10009000F0E50935F0F501E500F5F0E50A35F0F594 +:1000A00000E500F502E501F582E502F583E0F50DD6 +:1000B000750103C3750000E501F5F0E50935F0F5BC +:1000C00001E500F5F0E50A35F0F500E500F502E59B +:1000D00001F582E502F583E0F501750000E50BF519 +:1000E000F0E50045F0F500E50CF5F0E50045F0F52C +:1000F00000E50DF5F0E50045F0F500E501F5F0E56A +:100100000045F0F500E5007002800302025E007514 +:100110000001750100750900750A00750B00C3E543 +:1001200000F5F0E51F95F0F500E500F5F0E50B456D +:10013000F0F50BC3E501F5F0E51E95F0F500E500DF +:10014000F5F0E50B45F0F50BC3E509F5F0E51D9578 +:10015000F0F500E500F5F0E50B45F0F50BC3E50A19 +:10016000F5F0E51C95F0F500E500F5F0E50B45F040 +:10017000F50B750100750900750A00E50BF50075B2 +:100180000B01C3750C00E500F5F0E50C95F0F50CDE +:10019000750C00E50CF5F0E50C35F0F50CE50CF50B +:1001A000F0E50B65F0F50BC3750C00E501F5F0E526 +:1001B0000C95F0F50C750C00E50CF5F0E50C35F040 +:1001C000F50CE50CF5F0E50B65F0F50BC3750C00CF +:1001D000E509F5F0E50C95F0F50C750C00E50CF56E +:1001E000F0E50C35F0F50CE50CF5F0E50B65F0F5F8 +:1001F0000BC3750C00E50AF5F0E50C95F0F50C75F0 +:100200000C00E50CF5F0E50C35F0F50CE50CF5F01F +:10021000E50B65F0F50B750100750900750A00E541 +:100220000BF502E501F503E509F504E50AF505E539 +:100230000EF515E50FF514E519C0E0E518C0E075F9 +:10024000E0042506F50675E0003507F507E502F53B +:1002500082E503F583E504F500E505F50122007567 +:100260000002750100750900750A0002011B00E516 +:1002700006758204C39582F506E5077583009583AC +:10028000F507D0E0F518D0E0F519E515F50EE51401 +:10029000F50F900000E582F509900000E583F50A6E +:1002A000750100C3750000E501F5F0E50935F0F5CD +:1002B00001E500F5F0E50A35F0F500E500F502E5A9 +:1002C00001F582E502F583E0F50B750101C37500C8 +:1002D00000E501F5F0E50935F0F501E500F5F0E59B +:1002E0000A35F0F500E500F502E501F582E502F5D5 +:1002F00083E0F50C750102C3750000E501F5F0E53A +:100300000935F0F501E500F5F0E50A35F0F500E511 +:1003100000F502E501F582E502F583E0F50D7501D2 +:1003200003C3750000E501F5F0E50935F0F501E5D9 +:1003300000F5F0E50A35F0F500E500F502E501F518 +:1003400082E502F583E0F501750000E50BF5F0E5C7 +:100350000045F0F500E50CF5F0E50045F0F500E5A9 +:100360000DF5F0E50045F0F500E501F5F0E5004597 +:10037000F0F500E5007002800302050C0075000135 +:10038000750100750900750A00E500F4F500E50146 +:10039000F4F501E509F4F509E50AF4F50AD3750B5E +:1003A00000E50BF5F0E50035F0F500E50BF5F0E5BF +:1003B0000135F0F501E50BF5F0E50935F0F509E556 +:1003C0000BF5F0E50A35F0F50A750B00C3E500F50D +:1003D000F0E51F95F0F500E500F5F0E50B45F0F5CB +:1003E0000BC3E501F5F0E51E95F0F500E500F5F02D +:1003F000E50B45F0F50BC3E509F5F0E51D95F0F5C6 +:1004000000E500F5F0E50B45F0F50BC3E50AF5F066 +:10041000E51C95F0F500E500F5F0E50B45F0F50B72 +:10042000750100750900750A00E50BF500750B01F3 +:10043000C3750C00E500F5F0E50C95F0F50C750CB6 +:1004400000E50CF5F0E50C35F0F50CE50CF5F0E504 +:100450000B65F0F50BC3750C00E501F5F0E50C95A7 +:10046000F0F50C750C00E50CF5F0E50C35F0F50C2D +:10047000E50CF5F0E50B65F0F50BC3750C00E5092F +:10048000F5F0E50C95F0F50C750C00E50CF5F0E5D4 +:100490000C35F0F50CE50CF5F0E50B65F0F50BC34C +:1004A000750C00E50AF5F0E50C95F0F50C750C00FF +:1004B000E50CF5F0E50C35F0F50CE50CF5F0E50B89 +:1004C00065F0F50B750100750900750A00E50BF57F +:1004D00002E501F503E509F504E50AF505E50EF584 +:1004E00015E50FF514E519C0E0E518C0E075E00466 +:1004F0002506F50675E0003507F507E502F582E506 +:1005000003F583E504F500E505F501220075000219 +:10051000750100750900750A000203C900E506753A +:100520008204C39582F506E5077583009583F50778 +:10053000D0E0F518D0E0F519E515F50EE514F50F46 +:10054000900000E582F509900000E583F50A750149 +:1005500000C3750000E501F5F0E50935F0F501E5AA +:1005600000F5F0E50A35F0F500E500F502E501F5E6 +:1005700082E502F583E0F50B750101C3750000E526 +:1005800001F5F0E50935F0F501E500F5F0E50A358E +:10059000F0F500E500F502E501F582E502F583E0FE +:1005A000F50C750102C3750000E501F5F0E50935AC +:1005B000F0F501E500F5F0E50A35F0F500E500F5A8 +:1005C00002E501F582E502F583E0F50D750103C34F +:1005D000750000E501F5F0E50935F0F501E500F5F8 +:1005E000F0E50A35F0F500E500F502E501F582E5F4 +:1005F00002F583E0F501750000E50BF5F0E5004537 +:10060000F0F500E50CF5F0E50045F0F500E50DF539 +:10061000F0E50045F0F500E501F5F0E50045F0F501 +:1006200000E5007002800302077A00750001750181 +:1006300000750900750A00750B00C3E500F5F0E5CB +:100640001F95F0F500E500F5F0E50B45F0F50BC35F +:10065000E501F5F0E51E95F0F500E500F5F0E50B98 +:1006600045F0F50BC3E509F5F0E51D95F0F500E55E +:1006700000F5F0E50B45F0F50BC3E50AF5F0E51CD8 +:1006800095F0F500E500F5F0E50B45F0F50B75018B +:1006900000750900750A00E50BF500750B01C375BF +:1006A0000C00E500F5F0E50C95F0F50C750C00E597 +:1006B0000CF5F0E50C35F0F50CE50CF5F0E50B6507 +:1006C000F0F50BC3750C00E501F5F0E50C95F0F5C0 +:1006D0000C750C00E50CF5F0E50C35F0F50CE50CAF +:1006E000F5F0E50B65F0F50BC3750C00E509F5F0C9 +:1006F000E50C95F0F50C750C00E50CF5F0E50C3506 +:10070000F0F50CE50CF5F0E50B65F0F50BC3750C99 +:1007100000E50AF5F0E50C95F0F50C750C00E50C1C +:10072000F5F0E50C35F0F50CE50CF5F0E50B65F0B2 +:10073000F50B750100750900750A00E50BF502E57A +:1007400001F503E509F504E50AF505E50EF515E5FE +:100750000FF514E519C0E0E518C0E075E0042506C2 +:10076000F50675E0003507F507E502F582E503F5C6 +:1007700083E504F500E505F5012200750002750129 +:1007800000750900750A0002063700E50675820447 +:10079000C39582F506E5077583009583F507D0E0DC +:1007A000F518D0E0F519E515F50EE514F50F9000F4 +:1007B00000E582F509900000E583F50A750100C3A4 +:1007C000750000E501F5F0E50935F0F501E500F506 +:1007D000F0E50A35F0F500E500F502E501F582E502 +:1007E00002F583E0F50B750101C3750000E501F525 +:1007F000F0E50935F0F501E500F5F0E50A35F0F52D +:1008000000E500F502E501F582E502F583E0F50C6F +:10081000750102C3750000E501F5F0E50935F0F555 +:1008200001E500F5F0E50A35F0F500E500F502E533 +:1008300001F582E502F583E0F50D750103C375004E +:1008400000E501F5F0E50935F0F501E500F5F0E525 +:100850000A35F0F500E500F502E501F582E502F55F +:1008600083E0F501750000E50BF5F0E50045F0F5D6 +:1008700000E50CF5F0E50045F0F500E50DF5F0E5D7 +:100880000045F0F500E501F5F0E50045F0F500E57F +:100890000070028003020A280075000175010075CE +:1008A0000900750A00E500F4F500E501F4F501E53D +:1008B00009F4F509E50AF4F50AD3750B00E50BF523 +:1008C000F0E50035F0F500E50BF5F0E50135F0F564 +:1008D00001E50BF5F0E50935F0F509E50BF5F0E577 +:1008E0000A35F0F50A750B00C3E500F5F0E51F9534 +:1008F000F0F500E500F5F0E50B45F0F50BC3E5017B +:10090000F5F0E51E95F0F500E500F5F0E50B45F096 +:10091000F50BC3E509F5F0E51D95F0F500E500F5EB +:10092000F0E50B45F0F50BC3E50AF5F0E51C95F095 +:10093000F500E500F5F0E50B45F0F50B75010075E8 +:100940000900750A00E50BF500750B01C3750C0075 +:10095000E500F5F0E50C95F0F50C750C00E50CF5EF +:10096000F0E50C35F0F50CE50CF5F0E50B65F0F570 +:100970000BC3750C00E501F5F0E50C95F0F50C7571 +:100980000C00E50CF5F0E50C35F0F50CE50CF5F098 +:10099000E50B65F0F50BC3750C00E509F5F0E50C0A +:1009A00095F0F50C750C00E50CF5F0E50C35F0F55F +:1009B0000CE50CF5F0E50B65F0F50BC3750C00E5E7 +:1009C0000AF5F0E50C95F0F50C750C00E50CF5F06A +:1009D000E50C35F0F50CE50CF5F0E50B65F0F50BE5 +:1009E000750100750900750A00E50BF502E501F5D2 +:1009F00003E509F504E50AF505E50EF515E50FF53E +:100A000014E519C0E0E518C0E075E0042506F50618 +:100A100075E0003507F507E502F582E503F583E5A6 +:100A200004F500E505F50122007500027501007569 +:100A30000900750A000208E500000000000000003F +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare1.s.expected b/tests/GCCTestSuite/compare1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare3.c b/tests/GCCTestSuite/compare3.c new file mode 100644 index 0000000..eda3faf --- /dev/null +++ b/tests/GCCTestSuite/compare3.c @@ -0,0 +1,59 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + This was inspired by code in gcc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +int tf = 1; + +void f(int x, unsigned int y) +{ + /* Test comparing conditional expressions containing truth values. + This can occur explicitly, or e.g. when (foo?2:(bar?1:0)) is + optimized into (foo?2:(bar!=0)). */ + x > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 1" } */ + y > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 2" } */ + x > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 3" } */ + y > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 4" } */ + + x > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 5" } */ + y > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 6" } */ + x > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 7" } */ + y > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 8" } */ + + x > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 9" } */ + y > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 10" } */ + x > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 11" } */ + y > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 12" } */ + + x < (tf?64:(tf (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 17" } */ + y > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 18" } */ + x > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 19" } */ + y > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 20" } */ + + x > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 21" } */ + y > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 22" } */ + x > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 23" } */ + y > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 24" } */ + + x > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 25" } */ + y > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 26" } */ + x > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 27" } */ + y > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 28" } */ + + x > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 29" } */ + y > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 30" } */ + x > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 31" } */ + y > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 32" } */ + + x > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 33" } */ + y > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 34" } */ + x > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 35" } */ + y > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 36" } */ + +} diff --git a/tests/GCCTestSuite/compare3.c.expected b/tests/GCCTestSuite/compare3.c.expected new file mode 100644 index 0000000..eda3faf --- /dev/null +++ b/tests/GCCTestSuite/compare3.c.expected @@ -0,0 +1,59 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + This was inspired by code in gcc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +int tf = 1; + +void f(int x, unsigned int y) +{ + /* Test comparing conditional expressions containing truth values. + This can occur explicitly, or e.g. when (foo?2:(bar?1:0)) is + optimized into (foo?2:(bar!=0)). */ + x > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 1" } */ + y > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 2" } */ + x > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 3" } */ + y > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 4" } */ + + x > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 5" } */ + y > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 6" } */ + x > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 7" } */ + y > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 8" } */ + + x > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 9" } */ + y > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 10" } */ + x > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 11" } */ + y > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 12" } */ + + x < (tf?64:(tf (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 17" } */ + y > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 18" } */ + x > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 19" } */ + y > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 20" } */ + + x > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 21" } */ + y > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 22" } */ + x > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 23" } */ + y > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 24" } */ + + x > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 25" } */ + y > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 26" } */ + x > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 27" } */ + y > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 28" } */ + + x > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 29" } */ + y > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 30" } */ + x > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 31" } */ + y > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 32" } */ + + x > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 33" } */ + y > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 34" } */ + x > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 35" } */ + y > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 36" } */ + +} diff --git a/tests/GCCTestSuite/compare3.hex.expected b/tests/GCCTestSuite/compare3.hex.expected new file mode 100644 index 0000000..c0498b1 --- /dev/null +++ b/tests/GCCTestSuite/compare3.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0082506F50675E0C2 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F50122000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare3.s.expected b/tests/GCCTestSuite/compare3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare5.c b/tests/GCCTestSuite/compare5.c new file mode 100644 index 0000000..f19c575 --- /dev/null +++ b/tests/GCCTestSuite/compare5.c @@ -0,0 +1,41 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + Origin: Kaveh R. Ghazi 8/21/2001. */ + +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +extern void bar(void); + +int foo(int x, int y, unsigned u) +{ + /* A *_DIV_EXPR is non-negative if both operands are. */ + + if (u < ((x=-22)/33)) /* { dg-warning "signed and unsigned" "DIV_EXPR" } */ + return x; + + if (u < ((x=22)/33)) + return x; + + if (u < ((x=22)/(y=33))) + return x; + + if (u < (((x&0x10000)?128:64) / ((y&0x10000)?8:4))) + return x; + + + /* A *_MOD_EXPR is non-negative if the first operand is. */ + + if (u < ((x=-22)%33)) /* { dg-warning "signed and unsigned" "MOD_EXPR" } */ + return x; + + if (u < ((x=22)%-33)) + return x; + + if (u < ((x==y)%-33)) + return x; + + if (u < (((x=22)/33)%-33)) + return x; + + return 0; +} diff --git a/tests/GCCTestSuite/compare5.c.expected b/tests/GCCTestSuite/compare5.c.expected new file mode 100644 index 0000000..f19c575 --- /dev/null +++ b/tests/GCCTestSuite/compare5.c.expected @@ -0,0 +1,41 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + Origin: Kaveh R. Ghazi 8/21/2001. */ + +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +extern void bar(void); + +int foo(int x, int y, unsigned u) +{ + /* A *_DIV_EXPR is non-negative if both operands are. */ + + if (u < ((x=-22)/33)) /* { dg-warning "signed and unsigned" "DIV_EXPR" } */ + return x; + + if (u < ((x=22)/33)) + return x; + + if (u < ((x=22)/(y=33))) + return x; + + if (u < (((x&0x10000)?128:64) / ((y&0x10000)?8:4))) + return x; + + + /* A *_MOD_EXPR is non-negative if the first operand is. */ + + if (u < ((x=-22)%33)) /* { dg-warning "signed and unsigned" "MOD_EXPR" } */ + return x; + + if (u < ((x=22)%-33)) + return x; + + if (u < ((x==y)%-33)) + return x; + + if (u < (((x=22)/33)%-33)) + return x; + + return 0; +} diff --git a/tests/GCCTestSuite/compare5.hex.expected b/tests/GCCTestSuite/compare5.hex.expected new file mode 100644 index 0000000..143609c --- /dev/null +++ b/tests/GCCTestSuite/compare5.hex.expected @@ -0,0 +1,874 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758217C31E +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0062506F58275E0003507F583E5A7 +:1006600008F0D0E0F50875E0052506F58275E00094 +:100670003507F583E508F075E00E2506F58275E08F +:10068000003507F583E517F075E00D2506F5827551 +:10069000E0003507F583E516F075E00C2506F582D8 +:1006A00075E0003507F583E515F075E00B2506F5D7 +:1006B0008275E0003507F583E514F075E00A25063C +:1006C000F58275E0003507F583E513F075E009253F +:1006D00006F58275E0003507F583E512F075E00850 +:1006E0002506F58275E0003507F583E511F075E024 +:1006F000072506F58275E0003507F583E510F0E57E +:100700001FF511E51BF512E51AF513E519F514753A +:10071000E0042506F58275E0003507F583E511F064 +:1007200075E0032506F58275E0003507F583E51EC3 +:10073000F075E0022506F58275E0003507F583E5E2 +:100740001DF075E0012506F58275E0003507F5839B +:10075000E51CF07515017516007517007508007514 +:10076000E0002506F58275E0003507F583E508F021 +:10077000751900750D00750E00750F00E51CF5105C +:10078000750080E500F5F0E51025F0F510E500F5C1 +:10079000F0E50F25F0F50F750C00751A00751B00BC +:1007A000751F00750B00750A01750001C3E50FF593 +:1007B000F0E51095F0F509E50BF5F0E50B35F0F5F2 +:1007C00009E509F5F0E50055F0F500E500F5F0E57F +:1007D0000C45F0F50C750001C3E50FF5F0E510953B +:1007E000F0F509E50BF5F0E50B35F0F509E510F549 +:1007F000F0E50F95F0F501E50BF5F0E50B35F0F5BB +:1008000001E501F5F0E50945F0F509E50AF5F0E542 +:100810000965F0F509E509F5F0E50055F0F500C3C7 +:10082000E50EF5F0E51D95F0F509E50BF5F0E50BA6 +:1008300035F0F509E509F5F0E50055F0F500E500BE +:10084000F5F0E50C45F0F50C750001C3E50FF5F08A +:10085000E51095F0F509E50BF5F0E50B35F0F50938 +:10086000E510F5F0E50F95F0F501E50BF5F0E50B7A +:1008700035F0F501E501F5F0E50945F0F509E50A82 +:10088000F5F0E50965F0F509E509F5F0E50055F045 +:10089000F500C3E50EF5F0E51D95F0F509E50BF55E +:1008A000F0E50B35F0F509E51DF5F0E50E95F0F5F1 +:1008B00001E50BF5F0E50B35F0F501E501F5F0E5A7 +:1008C0000945F0F509E50AF5F0E50965F0F509E5F2 +:1008D00009F5F0E50055F0F500C3E50DF5F0E51E6E +:1008E00095F0F509E50BF5F0E50B35F0F509E509AF +:1008F000F5F0E50055F0F500E500F5F0E50C45F004 +:10090000F50C750001C3E50FF5F0E51095F0F5095C +:10091000E50BF5F0E50B35F0F509E510F5F0E50F21 +:1009200095F0F501E50BF5F0E50B35F0F501E50186 +:10093000F5F0E50945F0F509E50AF5F0E50965F09A +:10094000F509E509F5F0E50055F0F500C3E50EF50C +:10095000F0E51D95F0F509E50BF5F0E50B35F0F543 +:1009600009E51DF5F0E50E95F0F501E50BF5F0E56F +:100970000B35F0F501E501F5F0E50945F0F509E580 +:100980000AF5F0E50965F0F509E509F5F0E500552A +:10099000F0F500C3E50DF5F0E51E95F0F509E50B62 +:1009A000F5F0E50B35F0F509E51EF5F0E50D95F0F0 +:1009B000F501E50BF5F0E50B35F0F501E501F5F096 +:1009C000E50945F0F509E50AF5F0E50965F0F509F1 +:1009D000E509F5F0E50055F0F500C3E519F5F0E59A +:1009E0001195F0F509E50BF5F0E50B35F0F509E5A6 +:1009F00009F5F0E50055F0F500E500F5F0E50C45EA +:100A0000F0F50CE51AF501E51BF509E51FF50A758A +:100A10000000E50CF5F0E50045F0F500E501F5F026 +:100A2000E50045F0F500E509F5F0E50045F0F500D5 +:100A3000E50AF5F0E50045F0F500E50070028003F9 +:100A400002116B00751900750D00750E00750F0011 +:100A5000E512F51BE513F51AE514F510E518F51187 +:100A6000750080E500F5F0E51125F0F511E500F5DC +:100A7000F0E50F25F0F50F750C00751C00751D00D5 +:100A8000751E00750B00750A01750001C3E50FF5B1 +:100A9000F0E51195F0F509E50BF5F0E50B35F0F50E +:100AA00009E509F5F0E50055F0F500E500F5F0E59C +:100AB0000C45F0F50C750001C3E50FF5F0E5119557 +:100AC000F0F509E50BF5F0E50B35F0F509E511F565 +:100AD000F0E50F95F0F501E50BF5F0E50B35F0F5D8 +:100AE00001E501F5F0E50945F0F509E50AF5F0E560 +:100AF0000965F0F509E509F5F0E50055F0F500C3E5 +:100B0000E50EF5F0E51095F0F509E50BF5F0E50BD0 +:100B100035F0F509E509F5F0E50055F0F500E500DB +:100B2000F5F0E50C45F0F50C750001C3E50FF5F0A7 +:100B3000E51195F0F509E50BF5F0E50B35F0F50954 +:100B4000E511F5F0E50F95F0F501E50BF5F0E50B96 +:100B500035F0F501E501F5F0E50945F0F509E50A9F +:100B6000F5F0E50965F0F509E509F5F0E50055F062 +:100B7000F500C3E50EF5F0E51095F0F509E50BF588 +:100B8000F0E50B35F0F509E510F5F0E50E95F0F51B +:100B900001E50BF5F0E50B35F0F501E501F5F0E5C4 +:100BA0000945F0F509E50AF5F0E50965F0F509E50F +:100BB00009F5F0E50055F0F500C3E50DF5F0E51A8F +:100BC00095F0F509E50BF5F0E50B35F0F509E509CC +:100BD000F5F0E50055F0F500E500F5F0E50C45F021 +:100BE000F50C750001C3E50FF5F0E51195F0F50979 +:100BF000E50BF5F0E50B35F0F509E511F5F0E50F3E +:100C000095F0F501E50BF5F0E50B35F0F501E501A3 +:100C1000F5F0E50945F0F509E50AF5F0E50965F0B7 +:100C2000F509E509F5F0E50055F0F500C3E50EF529 +:100C3000F0E51095F0F509E50BF5F0E50B35F0F56D +:100C400009E510F5F0E50E95F0F501E50BF5F0E599 +:100C50000B35F0F501E501F5F0E50945F0F509E59D +:100C60000AF5F0E50965F0F509E509F5F0E5005547 +:100C7000F0F500C3E50DF5F0E51A95F0F509E50B83 +:100C8000F5F0E50B35F0F509E51AF5F0E50D95F011 +:100C9000F501E50BF5F0E50B35F0F501E501F5F0B3 +:100CA000E50945F0F509E50AF5F0E50965F0F5090E +:100CB000E509F5F0E50055F0F500C3E519F5F0E5B7 +:100CC0001B95F0F509E50BF5F0E50B35F0F509E5B9 +:100CD00009F5F0E50055F0F500E500F5F0E50C4507 +:100CE000F0F50CE51CF501E51DF509E51EF50A75A5 +:100CF0000000E50CF5F0E50045F0F500E501F5F044 +:100D0000E50045F0F500E509F5F0E50045F0F500F2 +:100D1000E50AF5F0E50045F0F500E5007002800316 +:100D20000210A30075E0042506F58275E000350782 +:100D3000F583E0F51F75E0032506F58275E00035C3 +:100D400007F583E0F51E75E0022506F58275E000E3 +:100D50003507F583E0F51D75E0012506F58275E0A0 +:100D6000003507F583E0F51CE512F51BE513F51AD0 +:100D7000E514F519120000E582F502E583F503E5B7 +:100D800000F504E501F505E502F511E503F512E5C9 +:100D900004F513E505F514E515F500E516F515E57B +:100DA00017F51675E0002506F58275E0003507F5A4 +:100DB00083E0F517750D00750E00750F00751000B6 +:100DC000C3750100E500F5F0E511A4F50CE500F5AB +:100DD000F0E511A4E5F0F509E50CF5F0E50135F0D5 +:100DE000F501E515F5F0E511A4F50CE515F5F0E5CF +:100DF00011A4E5F0F50AE50CF5F0E50935F0F50983 +:100E0000E516F5F0E511A4F50CE516F5F0E511A4ED +:100E1000E5F0F50BE50CF5F0E50A35F0F50AE51718 +:100E2000F5F0E511A4F50CE517F5F0E511A4E5F0F2 +:100E3000F511E50CF5F0E50B35F0F50BC3C3750CBA +:100E400000E501F5F0E50D35F0F50DE509F5F0E506 +:100E50000E35F0F50EE50AF5F0E50F35F0F50FE586 +:100E60000BF5F0E51035F0F510C3750900E500F558 +:100E7000F0E512A4F50CE500F5F0E512A4E5F0F5B7 +:100E80000AE50CF5F0E50935F0F509E515F5F0E5AD +:100E900012A4F50CE515F5F0E512A4E5F0F50BE567 +:100EA0000CF5F0E50A35F0F50AE516F5F0E512A4C3 +:100EB000F50CE516F5F0E512A4E5F0F511E50CF5F5 +:100EC000F0E50B35F0F50B750100C3C3750C00E5BB +:100ED00001F5F0E50D35F0F50DE509F5F0E50E3518 +:100EE000F0F50EE50AF5F0E50F35F0F50FE50BF539 +:100EF000F0E51035F0F510C3750A00E500F5F0E5F2 +:100F000013A4F50CE500F5F0E513A4E5F0F50BE509 +:100F10000CF5F0E50A35F0F50AE515F5F0E513A452 +:100F2000F50CE515F5F0E513A4E5F0F511E50CF584 +:100F3000F0E50B35F0F50B750100750900C3C375BD +:100F40000C00E501F5F0E50D35F0F50DE509F5F0DE +:100F5000E50E35F0F50EE50AF5F0E50F35F0F50F85 +:100F6000E50BF5F0E51035F0F510C3750B00E50065 +:100F7000F5F0E514A4F50CE500F5F0E514A4E5F0B2 +:100F8000F511E50CF5F0E50B35F0F50B7501007585 +:100F90000900750A00C3C3750000E501F5F0E50D11 +:100FA00035F0F50DE509F5F0E50E35F0F50EE50A3D +:100FB000F5F0E50F35F0F50FE50BF5F0E51035F040 +:100FC000F510E50DF502E50EF503E50FF504E51066 +:100FD000F50575E00E2506F58275E0003507F58309 +:100FE000E0F51775E00D2506F58275E0003507F58B +:100FF00083E0F51675E00C2506F58275E0003507EF +:10100000F583E0F51575E00B2506F58275E00035F2 +:1010100007F583E0F51475E00A2506F58275E00012 +:101020003507F583E0F51375E0092506F58275E0CF +:10103000003507F583E0F51275E0082506F58275A1 +:10104000E0003507F583E0F51175E0072506F58228 +:1010500075E0003507F583E0F51075E0052506F528 +:101060008275E0003507F583E0F508E508C0E07516 +:10107000E0062506F58275E0003507F583E0F50802 +:10108000E508C0E075E0172506F50675E0003507B0 +:10109000F507E502F582E503F583E504F500E505CE +:1010A000F5012200E512F4F512E513F4F513E51449 +:1010B000F4F514E518F4F518D3750000E500F5F023 +:1010C000E51235F0F512E500F5F0E51335F0F5130E +:1010D000E500F5F0E51435F0F514E500F5F0E51858 +:1010E00035F0F518E515F4F515E516F4F516E517E0 +:1010F000F4F51775E0002506F58275E0003507F573 +:1011000083E0F508E508F4F50875E0002506F582AA +:1011100075E0003507F583E508F0D3750000E500BC +:10112000F5F0E51535F0F515E500F5F0E51635F0C7 +:10113000F516E500F5F0E51735F0F517E500F5F0E3 +:1011400075E0002506F58275E0003507F583E0F5CA +:1011500008E50835F0F50875E0002506F58275E02C +:10116000003507F583E508F0020D2400E511F4F5DC +:1011700000E51EF4F501E51DF4F509E51CF4F50B99 +:10118000D3750A00E50AF5F0E50035F0F500E50A4B +:10119000F5F0E50135F0F501E50AF5F0E50935F082 +:1011A000F509E50AF5F0E50B35F0F50B75E00425DA +:1011B00006F58275E0003507F583E500F075E0037C +:1011C0002506F58275E0003507F583E501F075E049 +:1011D000022506F58275E0003507F583E509F0750F +:1011E000E0012506F58275E0003507F583E50BF093 +:1011F000E515F4F515E516F4F516E517F4F517758C +:10120000E0002506F58275E0003507F583E0F50876 +:10121000E508F4F50875E0002506F58275E000356F +:1012200007F583E508F0D3750000E500F5F0E51556 +:1012300035F0F515E500F5F0E51635F0F516E500A5 +:10124000F5F0E51735F0F517E500F5F075E0002548 +:1012500006F58275E0003507F583E0F508E5083509 +:10126000F0F50875E0002506F58275E0003507F514 +:1012700083E508F0020A4400E506758216C39582EC +:10128000F506E5077583009583F507D0E0F5087549 +:10129000E0052506F58275E0003507F583E508F0E1 +:1012A000D0E0F50875E0042506F58275E000350705 +:1012B000F583E508F075E00D2506F58275E000354B +:1012C00007F583E517F075E00C2506F58275E0005B +:1012D0003507F583E516F075E00B2506F58275E018 +:1012E000003507F583E515F075E00A2506F58275EA +:1012F000E0003507F583E514F075E0092506F58271 +:1013000075E0003507F583E513F075E0082506F56F +:101310008275E0003507F583E512F075E0072506D4 +:10132000F58275E0003507F583E511F075E00625D7 +:1013300006F58275E0003507F583E510F075E003EA +:101340002506F58275E0003507F583E51FF075E0A9 +:10135000022506F58275E0003507F583E51EF07578 +:10136000E0012506F58275E0003507F583E51DF0FF +:1013700075E0002506F58275E0003507F583E51C6C +:10138000F0E51BF514E51AF515E519F516E518F560 +:101390001775E0032506F58275E0003507F583E053 +:1013A000F51F75E0022506F58275E0003507F58327 +:1013B000E0F51E75E0012506F58275E0003507F5BC +:1013C00083E0F51D75E0002506F58275E000350720 +:1013D000F583E0F51CE514F51BE515F51AE516F5A2 +:1013E00019E517F518120639E582F502E583F503CC +:1013F000E500F504E501F505E502F500E503F50175 +:10140000E504F509E505F50A75100075110075127A +:1014100000751300C3750B00E500F5F0E514A4F5A5 +:101420000FE500F5F0E514A4E5F0F50CE50FF5F097 +:10143000E50B35F0F50BE501F5F0E514A4F50FE546 +:1014400001F5F0E514A4E5F0F50DE50FF5F0E50C78 +:1014500035F0F50CE509F5F0E514A4F50FE509F50F +:10146000F0E514A4E5F0F50EE50FF5F0E50D35F027 +:10147000F50DE50AF5F0E514A4F50FE50AF5F0E53C +:1014800014A4E5F0F50AE50FF5F0E50E35F0F50EDC +:10149000C3C3750A00E50BF5F0E51035F0F510E56E +:1014A0000CF5F0E51135F0F511E50DF5F0E5123527 +:1014B000F0F512E50EF5F0E51335F0F513C3750CF4 +:1014C00000E500F5F0E515A4F50FE500F5F0E515EC +:1014D000A4E5F0F50DE50FF5F0E50C35F0F50CE5BC +:1014E00001F5F0E515A4F50FE501F5F0E515A4E526 +:1014F000F0F50EE50FF5F0E50D35F0F50DE509F524 +:10150000F0E515A4F50FE509F5F0E515A4E5F0F50E +:101510000AE50FF5F0E50E35F0F50E750B00C3C3C7 +:10152000750900E50BF5F0E51035F0F510E50CF563 +:10153000F0E51135F0F511E50DF5F0E51235F0F5B2 +:1015400012E50EF5F0E51335F0F513C3750D00E562 +:1015500000F5F0E516A4F50FE500F5F0E516A4E5B5 +:10156000F0F50EE50FF5F0E50D35F0F50DE501F5BB +:10157000F0E516A4F50FE501F5F0E516A4E5F0F5A4 +:101580000AE50FF5F0E50E35F0F50E750B00750C5C +:1015900000C3C3750100E50BF5F0E51035F0F5105B +:1015A000E50CF5F0E51135F0F511E50DF5F0E51276 +:1015B00035F0F512E50EF5F0E51335F0F513C375CA +:1015C0000E00E500F5F0E517A4F50FE500F5F0E5F0 +:1015D00017A4E5F0F50AE50FF5F0E50E35F0F50E88 +:1015E000750B00750C00750D00C3C3750000E50B8D +:1015F000F5F0E51035F0F510E50CF5F0E51135F0F6 +:10160000F511E50DF5F0E51235F0F512E50EF5F002 +:10161000E51335F0F513C3E510F5F075E003250685 +:10162000F58275E0003507F583E0F508E50895F0EB +:10163000F500E511F5F075E0022506F58275E0008C +:101640003507F583E0F508E50895F0F501E512F5B5 +:10165000F075E0012506F58275E0003507F583E0B9 +:10166000F508E50895F0F509E513F5F075E00025B6 +:1016700006F58275E0003507F583E0F508E5089585 +:10168000F0F50AE500F502E501F503E509F504E5E5 +:101690000AF50575E00D2506F58275E0003507F5BC +:1016A00083E0F51775E00C2506F58275E000350737 +:1016B000F583E0F51675E00B2506F58275E000353B +:1016C00007F583E0F51575E00A2506F58275E0005B +:1016D0003507F583E0F51475E0092506F58275E018 +:1016E000003507F583E0F51375E0082506F58275EA +:1016F000E0003507F583E0F51275E0072506F58271 +:1017000075E0003507F583E0F51175E0062506F56F +:101710008275E0003507F583E0F51075E0042506D5 +:10172000F58275E0003507F583E0F508E508C0E0CF +:1017300075E0052506F58275E0003507F583E0F5CF +:1017400008E508C0E075E0162506F50675E00035E9 +:1017500007F507E502F582E503F583E504F500E505 +:1017600005F5012200E50675821FC39582F506E5A1 +:10177000077583009583F507D0E0F50875E00A2525 +:1017800006F58275E0003507F583E508F0D0E0F551 +:101790000875E0092506F58275E0003507F583E553 +:1017A00008F075E0122506F58275E0003507F5832F +:1017B000E517F075E0112506F58275E0003507F5AF +:1017C00083E516F075E0102506F58275E000350713 +:1017D000F583E515F075E00F2506F58275E0003517 +:1017E00007F583E514F075E00E2506F58275E00037 +:1017F0003507F583E513F075E00D2506F58275E0F4 +:10180000003507F583E512F075E00C2506F58275C5 +:10181000E0003507F583E511F075E00B2506F5824C +:1018200075E0003507F583E510F075091F750001B7 +:10183000E500F5F0E50995F0F509E506F500E500A8 +:10184000F5F0E50925F0F509750100E507F500E576 +:1018500000F5F0E50135F0F501E501F502E509F5E2 +:1018600082E502F583E0F50875E0042506F582754A +:10187000E0003507F583E508F075091F750002E5FE +:1018800000F5F0E50995F0F509E506F500E500F548 +:10189000F0E50925F0F509750100E507F500E5001B +:1018A000F5F0E50135F0F501E501F502E509F58210 +:1018B000E502F583E0F51675091F750003E500F5EF +:1018C000F0E50995F0F509E506F500E500F5F0E528 +:1018D0000925F0F509750100E507F500E500F5F0CB +:1018E000E50135F0F501E501F502E509F582E502CE +:1018F000F583E0F51575091F750004E500F5F0E5C1 +:101900000995F0F509E506F500E500F5F0E509258E +:10191000F0F509750100E507F500E500F5F0E501D2 +:1019200035F0F501E501F502E509F582E502F583FB +:10193000E0F510750A16750900750100750000E5DF +:101940000AF4F511E509F4F512E501F4F513E500E3 +:10195000F4F514D3750000E500F5F0E51135F0F568 +:1019600011E500F5F0E51235F0F512E500F5F0E5CA +:101970001335F0F513E500F5F0E51435F0F51475C1 +:101980001B21751A00751900751800E511F51FE582 +:1019900012F51EE513F51DE514F51C120639E58256 +:1019A000F502E583F503E500F504E501F505E5023B +:1019B000F517E503F50EE504F50CE505F50D750BDA +:1019C00000751800751900751A00750A00750F0169 +:1019D000750001C3E50DF5F0E51095F0F509E50A90 +:1019E000F5F0E50A35F0F509E509F5F0E50055F003 +:1019F000F500E500F5F0E50B45F0F50B750001C3CA +:101A0000E50DF5F0E51095F0F509E50AF5F0E50AC4 +:101A100035F0F509E510F5F0E50D95F0F501E50A6D +:101A2000F5F0E50A35F0F501E501F5F0E50945F0D9 +:101A3000F509E50FF5F0E50965F0F509E509F5F0BB +:101A4000E50055F0F500C3E50CF5F0E51595F0F56A +:101A500009E50AF5F0E50A35F0F509E509F5F0E5DF +:101A60000055F0F500E500F5F0E50B45F0F50B75D8 +:101A70000001C3E50DF5F0E51095F0F509E50AF56F +:101A8000F0E50A35F0F509E510F5F0E50D95F0F50E +:101A900001E50AF5F0E50A35F0F501E501F5F0E5B7 +:101AA0000945F0F509E50FF5F0E50965F0F509E5FB +:101AB00009F5F0E50055F0F500C3E50CF5F0E51586 +:101AC00095F0F509E50AF5F0E50A35F0F509E515B3 +:101AD000F5F0E50C95F0F501E50AF5F0E50A35F0CD +:101AE000F501E501F5F0E50945F0F509E50FF5F03B +:101AF000E50965F0F509E509F5F0E50055F0F500B3 +:101B0000C3E50EF5F0E51695F0F509E50AF5F0E503 +:101B10000A35F0F509E509F5F0E50055F0F500E5C1 +:101B200000F5F0E50B45F0F50B750001C3E50DF58B +:101B3000F0E51095F0F509E50AF5F0E50A35F0F560 +:101B400009E510F5F0E50D95F0F501E50AF5F0E58C +:101B50000A35F0F501E501F5F0E50945F0F509E58F +:101B60000FF5F0E50965F0F509E509F5F0E5005533 +:101B7000F0F500C3E50CF5F0E51595F0F509E50A7B +:101B8000F5F0E50A35F0F509E515F5F0E50C95F009 +:101B9000F501E50AF5F0E50A35F0F501E501F5F0A6 +:101BA000E50945F0F509E50FF5F0E50965F0F509FA +:101BB000E509F5F0E50055F0F500C3E50EF5F0E5B3 +:101BC0001695F0F509E50AF5F0E50A35F0F509E5B1 +:101BD00016F5F0E50E95F0F501E50AF5F0E50A35A4 +:101BE000F0F501E501F5F0E50945F0F509E50FF53A +:101BF000F0E50965F0F509E509F5F0E50055F0F5C2 +:101C000000C3E517F5F075E0042506F58275E000E0 +:101C10003507F583E0F508E50895F0F509E50AF5DF +:101C2000F0E50A35F0F509E509F5F0E50055F0F5C0 +:101C300000E500F5F0E50B45F0F50B750000E50B50 +:101C4000F5F0E50045F0F500E518F5F0E50045F0A4 +:101C5000F500E519F5F0E50045F0F500E51AF5F0B9 +:101C6000E50045F0F500E5007002800302368700CC +:101C7000751116751200751300751400751B21750A +:101C80001A00751900751800E511F51FE512F51E0B +:101C9000E513F51DE514F51C120639E582F502E59C +:101CA00083F503E500F504E501F505E502F517E523 +:101CB00003F50EE504F50CE505F50D750B0075183B +:101CC00000751900751A00750A00750F017500017D +:101CD000C3E50DF5F0E51095F0F509E50AF5F0E539 +:101CE0000A35F0F509E509F5F0E50055F0F500E5F0 +:101CF00000F5F0E50B45F0F50B750001C3E50DF5BA +:101D0000F0E51095F0F509E50AF5F0E50A35F0F58E +:101D100009E510F5F0E50D95F0F501E50AF5F0E5BA +:101D20000A35F0F501E501F5F0E50945F0F509E5BD +:101D30000FF5F0E50965F0F509E509F5F0E5005561 +:101D4000F0F500C3E50CF5F0E51595F0F509E50AA9 +:101D5000F5F0E50A35F0F509E509F5F0E50055F08F +:101D6000F500E500F5F0E50B45F0F50B750001C356 +:101D7000E50DF5F0E51095F0F509E50AF5F0E50A51 +:101D800035F0F509E510F5F0E50D95F0F501E50AFA +:101D9000F5F0E50A35F0F501E501F5F0E50945F066 +:101DA000F509E50FF5F0E50965F0F509E509F5F048 +:101DB000E50055F0F500C3E50CF5F0E51595F0F5F7 +:101DC00009E50AF5F0E50A35F0F509E515F5F0E560 +:101DD0000C95F0F501E50AF5F0E50A35F0F501E5B9 +:101DE00001F5F0E50945F0F509E50FF5F0E50965C0 +:101DF000F0F509E509F5F0E50055F0F500C3E50E4D +:101E0000F5F0E51695F0F509E50AF5F0E50A35F087 +:101E1000F509E509F5F0E50055F0F500E500F5F008 +:101E2000E50B45F0F50B750001C3E50DF5F0E51088 +:101E300095F0F509E50AF5F0E50A35F0F509E51044 +:101E4000F5F0E50D95F0F501E50AF5F0E50A35F058 +:101E5000F501E501F5F0E50945F0F509E50FF5F0C7 +:101E6000E50965F0F509E509F5F0E50055F0F5003F +:101E7000C3E50CF5F0E51595F0F509E50AF5F0E593 +:101E80000A35F0F509E515F5F0E50C95F0F501E5F5 +:101E90000AF5F0E50A35F0F501E501F5F0E509454B +:101EA000F0F509E50FF5F0E50965F0F509E509F547 +:101EB000F0E50055F0F500C3E50EF5F0E51695F0F8 +:101EC000F509E50AF5F0E50A35F0F509E516F5F04E +:101ED000E50E95F0F501E50AF5F0E50A35F0F501B6 +:101EE000E501F5F0E50945F0F509E50FF5F0E5093F +:101EF00065F0F509E509F5F0E50055F0F500C3E5F5 +:101F000017F5F075E0042506F58275E0003507F554 +:101F100083E0F508E50895F0F509E50AF5F0E50A2E +:101F200035F0F509E509F5F0E50055F0F500E500B7 +:101F3000F5F0E50B45F0F50B750000E50BF5F0E568 +:101F40000045F0F500E518F5F0E50045F0F500E591 +:101F500019F5F0E50045F0F500E51AF5F0E5004566 +:101F6000F0F500E50070028003023683007511165B +:101F700075120075130075140075082175E00825A9 +:101F800006F58275E0003507F583E508F075080071 +:101F900075E0072506F58275E0003507F583E5084D +:101FA000F075080075E0062506F58275E000350736 +:101FB000F583E508F075080075E0052506F58275DE +:101FC000E0003507F583E508F0E511F51FE512F5AA +:101FD0001EE513F51DE514F51C75E0082506F582D0 +:101FE00075E0003507F583E0F51B75E0072506F57C +:101FF0008275E0003507F583E0F51A75E0062506E1 +:10200000F58275E0003507F583E0F51975E00525E3 +:1020100006F58275E0003507F583E0F518120639FC +:10202000E582F502E583F503E500F504E501F50534 +:10203000E502F517E503F50EE504F50CE505F50DEC +:10204000750B00751800751900751A00750A007572 +:102050000F01750001C3E50DF5F0E51095F0F509E8 +:10206000E50AF5F0E50A35F0F509E509F5F0E500D2 +:1020700055F0F500E500F5F0E50B45F0F50B7500C2 +:1020800001C3E50DF5F0E51095F0F509E50AF5F069 +:10209000E50A35F0F509E510F5F0E50D95F0F501E7 +:1020A000E50AF5F0E50A35F0F501E501F5F0E50999 +:1020B00045F0F509E50FF5F0E50965F0F509E509E5 +:1020C000F5F0E50055F0F500C3E50CF5F0E51595E4 +:1020D000F0F509E50AF5F0E50A35F0F509E509F549 +:1020E000F0E50055F0F500E500F5F0E50B45F0F5FD +:1020F0000B750001C3E50DF5F0E51095F0F509E568 +:102100000AF5F0E50A35F0F509E510F5F0E50D956D +:10211000F0F501E50AF5F0E50A35F0F501E501F520 +:10212000F0E50945F0F509E50FF5F0E50965F0F58D +:1021300009E509F5F0E50055F0F500C3E50CF5F00B +:10214000E51595F0F509E50AF5F0E50A35F0F5092C +:10215000E515F5F0E50C95F0F501E50AF5F0E50A71 +:1021600035F0F501E501F5F0E50945F0F509E50F74 +:10217000F5F0E50965F0F509E509F5F0E50055F03C +:10218000F500C3E50EF5F0E51695F0F509E50AF55D +:10219000F0E50A35F0F509E509F5F0E50055F0F54B +:1021A00000E500F5F0E50B45F0F50B750001C3E522 +:1021B0000DF5F0E51095F0F509E50AF5F0E50A35BD +:1021C000F0F509E510F5F0E50D95F0F501E50AF5F6 +:1021D000F0E50A35F0F501E501F5F0E50945F0F522 +:1021E00009E50FF5F0E50965F0F509E509F5F0E514 +:1021F0000055F0F500C3E50CF5F0E51595F0F5098F +:10220000E50AF5F0E50A35F0F509E515F5F0E50C18 +:1022100095F0F501E50AF5F0E50A35F0F501E5017F +:10222000F5F0E50945F0F509E50FF5F0E50965F08C +:10223000F509E509F5F0E50055F0F500C3E50EF503 +:10224000F0E51695F0F509E50AF5F0E50A35F0F543 +:1022500009E516F5F0E50E95F0F501E50AF5F0E56E +:102260000A35F0F501E501F5F0E50945F0F509E578 +:102270000FF5F0E50965F0F509E509F5F0E500551C +:10228000F0F500C3E517F5F075E0042506F5827555 +:10229000E0003507F583E0F508E50895F0F509E578 +:1022A0000AF5F0E50A35F0F509E509F5F0E5005520 +:1022B000F0F500E500F5F0E50B45F0F50B750000D5 +:1022C000E50BF5F0E50045F0F500E518F5F0E50063 +:1022D00045F0F500E519F5F0E50045F0F500E51AE3 +:1022E000F5F0E50045F0F500E500700280030236E8 +:1022F0007F00750000750100750901750A00C3E5CE +:1023000000F5F0E51155F0F500E501F5F0E51255A1 +:10231000F0F501E509F5F0E51355F0F509E50AF5E5 +:10232000F0E51455F0F50B750A00E500F5F0E50A47 +:1023300045F0F50AE501F5F0E50A45F0F50AE5098D +:10234000F5F0E50A45F0F50AE50BF5F0E50A45F08C +:10235000F50AE50A7002800302366F00751F4075AA +:102360001E00751D00751C007500007501007509C3 +:1023700001750B00C3E500F5F075E0082506F58250 +:1023800075E0003507F583E0F508E50855F0F50C34 +:10239000E501F5F075E0072506F58275E0003507E3 +:1023A000F583E0F508E50855F0F50AE509F5F0755F +:1023B000E0062506F58275E0003507F583E0F508AF +:1023C000E50855F0F501E50BF5F075E0052506F596 +:1023D0008275E0003507F583E0F508E50855F0F56E +:1023E00009750000E50CF5F0E50045F0F500E50A9B +:1023F000F5F0E50045F0F500E501F5F0E50045F004 +:10240000F500E509F5F0E50045F0F500E50070029E +:10241000800302365F00751B04751A00751900757C +:102420001800120639E582F502E583F503E500F5AB +:1024300004E501F505E502F517E503F50EE504F5FC +:102440000CE505F50D750B00751800751900751A6A +:1024500000750A00750F01750001C3E50DF5F0E583 +:102460001095F0F509E50AF5F0E50A35F0F509E50E +:1024700009F5F0E50055F0F500E500F5F0E50B4550 +:10248000F0F50B750001C3E50DF5F0E51095F0F5DD +:1024900009E50AF5F0E50A35F0F509E510F5F0E58E +:1024A0000D95F0F501E50AF5F0E50A35F0F501E5E1 +:1024B00001F5F0E50945F0F509E50FF5F0E50965E9 +:1024C000F0F509E509F5F0E50055F0F500C3E50C78 +:1024D000F5F0E51595F0F509E50AF5F0E50A35F0B2 +:1024E000F509E509F5F0E50055F0F500E500F5F032 +:1024F000E50B45F0F50B750001C3E50DF5F0E510B2 +:1025000095F0F509E50AF5F0E50A35F0F509E5106D +:10251000F5F0E50D95F0F501E50AF5F0E50A35F081 +:10252000F501E501F5F0E50945F0F509E50FF5F0F0 +:10253000E50965F0F509E509F5F0E50055F0F50068 +:10254000C3E50CF5F0E51595F0F509E50AF5F0E5BC +:102550000A35F0F509E515F5F0E50C95F0F501E51E +:102560000AF5F0E50A35F0F501E501F5F0E5094574 +:10257000F0F509E50FF5F0E50965F0F509E509F570 +:10258000F0E50055F0F500C3E50EF5F0E51695F021 +:10259000F509E50AF5F0E50A35F0F509E509F5F084 +:1025A000E50055F0F500E500F5F0E50B45F0F50B1D +:1025B000750001C3E50DF5F0E51095F0F509E50AA4 +:1025C000F5F0E50A35F0F509E510F5F0E50D95F0C3 +:1025D000F501E50AF5F0E50A35F0F501E501F5F05C +:1025E000E50945F0F509E50FF5F0E50965F0F509B0 +:1025F000E509F5F0E50055F0F500C3E50CF5F0E56B +:102600001595F0F509E50AF5F0E50A35F0F509E567 +:1026100015F5F0E50C95F0F501E50AF5F0E50A355C +:10262000F0F501E501F5F0E50945F0F509E50FF5EF +:10263000F0E50965F0F509E509F5F0E50055F0F577 +:1026400000C3E50EF5F0E51695F0F509E50AF5F09D +:10265000E50A35F0F509E516F5F0E50E95F0F5011A +:10266000E50AF5F0E50A35F0F501E501F5F0E509D3 +:1026700045F0F509E50FF5F0E50965F0F509E5091F +:10268000F5F0E50055F0F500C3E517F5F075E00449 +:102690002506F58275E0003507F583E0F508E508C5 +:1026A00095F0F509E50AF5F0E50A35F0F509E509D3 +:1026B000F5F0E50055F0F500E500F5F0E50B45F027 +:1026C000F50B750000E50BF5F0E50045F0F500E5CC +:1026D00018F5F0E50045F0F500E519F5F0E50045E1 +:1026E000F0F500E51AF5F0E50045F0F500E50070BD +:1026F00002800302365B00750A1675090075010039 +:10270000750000E50AF4F511E509F4F512E501F4A8 +:10271000F513E500F4F514D3750000E500F5F0E5D8 +:102720001135F0F511E500F5F0E51235F0F512E59B +:1027300000F5F0E51335F0F513E500F5F0E5143597 +:10274000F0F514751B21751A00751900751800E550 +:1027500011F51FE512F51EE513F51DE514F51C1224 +:102760001277E582F502E583F503E500F504E5015E +:10277000F505E502F517E503F50EE504F50CE505AD +:10278000F50D750B00751800751900751A00750A9E +:1027900000750F01750001C3E50DF5F0E51095F02A +:1027A000F509E50AF5F0E50A35F0F509E509F5F072 +:1027B000E50055F0F500E500F5F0E50B45F0F50B0B +:1027C000750001C3E50DF5F0E51095F0F509E50A92 +:1027D000F5F0E50A35F0F509E510F5F0E50D95F0B1 +:1027E000F501E50AF5F0E50A35F0F501E501F5F04A +:1027F000E50945F0F509E50FF5F0E50965F0F5099E +:10280000E509F5F0E50055F0F500C3E50CF5F0E558 +:102810001595F0F509E50AF5F0E50A35F0F509E555 +:1028200009F5F0E50055F0F500E500F5F0E50B459C +:10283000F0F50B750001C3E50DF5F0E51095F0F529 +:1028400009E50AF5F0E50A35F0F509E510F5F0E5DA +:102850000D95F0F501E50AF5F0E50A35F0F501E52D +:1028600001F5F0E50945F0F509E50FF5F0E5096535 +:10287000F0F509E509F5F0E50055F0F500C3E50CC4 +:10288000F5F0E51595F0F509E50AF5F0E50A35F0FE +:10289000F509E515F5F0E50C95F0F501E50AF5F01B +:1028A000E50A35F0F501E501F5F0E50945F0F50932 +:1028B000E50FF5F0E50965F0F509E509F5F0E50046 +:1028C00055F0F500C3E50EF5F0E51695F0F509E5D0 +:1028D0000AF5F0E50A35F0F509E509F5F0E50055EA +:1028E000F0F500E500F5F0E50B45F0F50B7500019E +:1028F000C3E50DF5F0E51095F0F509E50AF5F0E50D +:102900000A35F0F509E510F5F0E50D95F0F501E56E +:102910000AF5F0E50A35F0F501E501F5F0E50945C0 +:10292000F0F509E50FF5F0E50965F0F509E509F5BC +:10293000F0E50055F0F500C3E50CF5F0E51595F070 +:10294000F509E50AF5F0E50A35F0F509E515F5F0C4 +:10295000E50C95F0F501E50AF5F0E50A35F0F5012D +:10296000E501F5F0E50945F0F509E50FF5F0E509B4 +:1029700065F0F509E509F5F0E50055F0F500C3E56A +:102980000EF5F0E51695F0F509E50AF5F0E50A35DE +:10299000F0F509E516F5F0E50E95F0F501E50AF517 +:1029A000F0E50A35F0F501E501F5F0E50945F0F54A +:1029B00009E50FF5F0E50965F0F509E509F5F0E53C +:1029C0000055F0F500C3E517F5F075E0042506F5B0 +:1029D0008275E0003507F583E0F508E50895F0F528 +:1029E00009E50AF5F0E50A35F0F509E509F5F0E540 +:1029F0000055F0F500E500F5F0E50B45F0F50B7539 +:102A00000000E50BF5F0E50045F0F500E518F5F000 +:102A1000E50045F0F500E519F5F0E50045F0F500B5 +:102A2000E51AF5F0E50045F0F500E50070028003D9 +:102A300002365700751116751200751300751400D3 +:102A4000750A21750900750100750000E50AF4F5A5 +:102A50001BE509F4F51AE501F4F519E500F4F5189C +:102A6000D3750000E500F5F0E51B35F0F51BE5003A +:102A7000F5F0E51A35F0F51AE500F5F0E51935F051 +:102A8000F519E500F5F0E51835F0F518E511F51F35 +:102A9000E512F51EE513F51DE514F51C121277E598 +:102AA00082F502E583F503E500F504E501F505E5AA +:102AB00002F517E503F50EE504F50CE505F50D75D2 +:102AC0000B00751800751900751A00750A00750F4E +:102AD00001750001C3E50DF5F0E51095F0F509E588 +:102AE0000AF5F0E50A35F0F509E509F5F0E50055D8 +:102AF000F0F500E500F5F0E50B45F0F50B7500018C +:102B0000C3E50DF5F0E51095F0F509E50AF5F0E5FA +:102B10000A35F0F509E510F5F0E50D95F0F501E55C +:102B20000AF5F0E50A35F0F501E501F5F0E50945AE +:102B3000F0F509E50FF5F0E50965F0F509E509F5AA +:102B4000F0E50055F0F500C3E50CF5F0E51595F05E +:102B5000F509E50AF5F0E50A35F0F509E509F5F0BE +:102B6000E50055F0F500E500F5F0E50B45F0F50B57 +:102B7000750001C3E50DF5F0E51095F0F509E50ADE +:102B8000F5F0E50A35F0F509E510F5F0E50D95F0FD +:102B9000F501E50AF5F0E50A35F0F501E501F5F096 +:102BA000E50945F0F509E50FF5F0E50965F0F509EA +:102BB000E509F5F0E50055F0F500C3E50CF5F0E5A5 +:102BC0001595F0F509E50AF5F0E50A35F0F509E5A2 +:102BD00015F5F0E50C95F0F501E50AF5F0E50A3597 +:102BE000F0F501E501F5F0E50945F0F509E50FF52A +:102BF000F0E50965F0F509E509F5F0E50055F0F5B2 +:102C000000C3E50EF5F0E51695F0F509E50AF5F0D7 +:102C1000E50A35F0F509E509F5F0E50055F0F500B0 +:102C2000E500F5F0E50B45F0F50B750001C3E50D8A +:102C3000F5F0E51095F0F509E50AF5F0E50A35F04F +:102C4000F509E510F5F0E50D95F0F501E50AF5F06B +:102C5000E50A35F0F501E501F5F0E50945F0F5097E +:102C6000E50FF5F0E50965F0F509E509F5F0E50092 +:102C700055F0F500C3E50CF5F0E51595F0F509E51F +:102C80000AF5F0E50A35F0F509E515F5F0E50C95DE +:102C9000F0F501E50AF5F0E50A35F0F501E501F595 +:102CA000F0E50945F0F509E50FF5F0E50965F0F502 +:102CB00009E509F5F0E50055F0F500C3E50EF5F07E +:102CC000E51695F0F509E50AF5F0E50A35F0F509A0 +:102CD000E516F5F0E50E95F0F501E50AF5F0E50AE3 +:102CE00035F0F501E501F5F0E50945F0F509E50FE9 +:102CF000F5F0E50965F0F509E509F5F0E50055F0B1 +:102D0000F500C3E517F5F075E0042506F58275E0DA +:102D1000003507F583E0F508E50895F0F509E50AC3 +:102D2000F5F0E50A35F0F509E509F5F0E50055F0AF +:102D3000F500E500F5F0E50B45F0F50B750000E555 +:102D40000BF5F0E50045F0F500E518F5F0E5004578 +:102D5000F0F500E519F5F0E50045F0F500E51AF5A8 +:102D6000F0E50045F0F500E50070028003023653FF +:102D70000075E0082506F58275E0003507F583E06B +:102D8000F50075E0072506F58275E0003507F58347 +:102D9000E0F50175E0062506F58275E0003507F5DA +:102DA00083E0F50975E0052506F58275E000350735 +:102DB000F583E0F50A751F00C3E500F5F0E5119510 +:102DC000F0F500E500F5F0E51F45F0F51FC3E5015E +:102DD000F5F0E51295F0F500E500F5F0E51F45F09A +:102DE000F51FC3E509F5F0E51395F0F500E500F5ED +:102DF000F0E51F45F0F51FC3E50AF5F0E51495F081 +:102E0000F500E500F5F0E51F45F0F51F751E0075AE +:102E10001D00751C00E51FF500751F01C37501003D +:102E2000E500F5F0E50195F0F501750100E501F526 +:102E3000F0E50135F0F501E501F5F0E51F65F0F588 +:102E40001FC3750100E51EF5F0E50195F0F501756C +:102E50000100E501F5F0E50135F0F501E501F5F0DA +:102E6000E51F65F0F51FC3750100E51DF5F0E501EF +:102E700095F0F501750100E501F5F0E50135F0F596 +:102E800001E501F5F0E51F65F0F51FC3750100E5EB +:102E90001CF5F0E50195F0F501750100E501F5F08F +:102EA000E50135F0F501E501F5F0E51F65F0F51FE9 +:102EB000751E00751D00751C0075092175010075D2 +:102EC0000000750A00E509F4F51BE501F4F501E5DC +:102ED00000F4F509E50AF4F50AD3750000E500F5FC +:102EE000F0E51B35F0F51BE500F5F0E50135F0F5F3 +:102EF00001E500F5F0E50935F0F509E500F5F0E547 +:102F00000A35F0F50AE501F51AE509F519E50AF5BE +:102F100018121277E582F502E583F503E500F50462 +:102F2000E501F505E502F517E503F50EE504F50CF9 +:102F3000E505F50D750B00751800751900751A007B +:102F4000750A00750F01750001C3E50DF5F0E51078 +:102F500095F0F509E50AF5F0E50A35F0F509E5091A +:102F6000F5F0E50055F0F500E500F5F0E50B45F06E +:102F7000F50B750001C3E50DF5F0E51095F0F509C9 +:102F8000E50AF5F0E50A35F0F509E510F5F0E50D8F +:102F900095F0F501E50AF5F0E50A35F0F501E501F2 +:102FA000F5F0E50945F0F509E50FF5F0E50965F0FF +:102FB000F509E509F5F0E50055F0F500C3E50CF578 +:102FC000F0E51595F0F509E50AF5F0E50A35F0F5B7 +:102FD00009E509F5F0E50055F0F500E500F5F0E547 +:102FE0000B45F0F50B750001C3E50DF5F0E5109507 +:102FF000F0F509E50AF5F0E50A35F0F509E510F513 +:10300000F0E50D95F0F501E50AF5F0E50A35F0F586 +:1030100001E501F5F0E50945F0F509E50FF5F0E505 +:103020000965F0F509E509F5F0E50055F0F500C38F +:10303000E50CF5F0E51595F0F509E50AF5F0E50A7A +:1030400035F0F509E515F5F0E50C95F0F501E50A23 +:10305000F5F0E50A35F0F501E501F5F0E50945F093 +:10306000F509E50FF5F0E50965F0F509E509F5F075 +:10307000E50055F0F500C3E50EF5F0E51695F0F521 +:1030800009E50AF5F0E50A35F0F509E509F5F0E599 +:103090000055F0F500E500F5F0E50B45F0F50B7592 +:1030A0000001C3E50DF5F0E51095F0F509E50AF529 +:1030B000F0E50A35F0F509E510F5F0E50D95F0F5C8 +:1030C00001E50AF5F0E50A35F0F501E501F5F0E571 +:1030D0000945F0F509E50FF5F0E50965F0F509E5B5 +:1030E00009F5F0E50055F0F500C3E50CF5F0E51540 +:1030F00095F0F509E50AF5F0E50A35F0F509E5156D +:10310000F5F0E50C95F0F501E50AF5F0E50A35F086 +:10311000F501E501F5F0E50945F0F509E50FF5F0F4 +:10312000E50965F0F509E509F5F0E50055F0F5006C +:10313000C3E50EF5F0E51695F0F509E50AF5F0E5BD +:103140000A35F0F509E516F5F0E50E95F0F501E51F +:103150000AF5F0E50A35F0F501E501F5F0E5094578 +:10316000F0F509E50FF5F0E50965F0F509E509F574 +:10317000F0E50055F0F500C3E517F5F075E004251E +:1031800006F58275E0003507F583E0F508E508955A +:10319000F0F509E50AF5F0E50A35F0F509E509F578 +:1031A000F0E50055F0F500E500F5F0E50B45F0F52C +:1031B0000B750000E50BF5F0E50045F0F500E518AE +:1031C000F5F0E50045F0F500E519F5F0E50045F00E +:1031D000F500E51AF5F0E50045F0F500E5007002B0 +:1031E000800302364F0075111675120075130075B5 +:1031F0001400751B21751A00751900751800E5116A +:10320000F51FE512F51EE513F51DE514F51C120674 +:1032100039E582F502E583F503E500F504E501F5FE +:1032200005E502F51FE503F51EE504F51DE505F5C9 +:103230001C750921750100750000750A00E509F487 +:10324000F51BE501F4F501E500F4F509E50AF4F5EF +:103250000AD3750000E500F5F0E51B35F0F51BE538 +:1032600000F5F0E50135F0F501E500F5F0E509358B +:10327000F0F509E500F5F0E50A35F0F50AE501F5A8 +:103280001AE509F519E50AF518121277E582F50233 +:10329000E583F503E500F504E501F505E502F5171D +:1032A000E503F50EE504F50CE505F50D750B007568 +:1032B0001800751900751A00750A00750F01750060 +:1032C00001C3E50DF5F0E51095F0F509E50AF5F017 +:1032D000E50A35F0F509E509F5F0E50055F0F500EA +:1032E000E500F5F0E50B45F0F50B750001C3E50DC4 +:1032F000F5F0E51095F0F509E50AF5F0E50A35F089 +:10330000F509E510F5F0E50D95F0F501E50AF5F0A4 +:10331000E50A35F0F501E501F5F0E50945F0F509B7 +:10332000E50FF5F0E50965F0F509E509F5F0E500CB +:1033300055F0F500C3E50CF5F0E51595F0F509E558 +:103340000AF5F0E50A35F0F509E509F5F0E500556F +:10335000F0F500E500F5F0E50B45F0F50B75000123 +:10336000C3E50DF5F0E51095F0F509E50AF5F0E592 +:103370000A35F0F509E510F5F0E50D95F0F501E5F4 +:103380000AF5F0E50A35F0F501E501F5F0E5094546 +:10339000F0F509E50FF5F0E50965F0F509E509F542 +:1033A000F0E50055F0F500C3E50CF5F0E51595F0F6 +:1033B000F509E50AF5F0E50A35F0F509E515F5F04A +:1033C000E50C95F0F501E50AF5F0E50A35F0F501B3 +:1033D000E501F5F0E50945F0F509E50FF5F0E5093A +:1033E00065F0F509E509F5F0E50055F0F500C3E5F0 +:1033F0000EF5F0E51695F0F509E50AF5F0E50A3564 +:10340000F0F509E509F5F0E50055F0F500E500F502 +:10341000F0E50B45F0F50B750001C3E50DF5F0E5A2 +:103420001095F0F509E50AF5F0E50A35F0F509E53E +:1034300010F5F0E50D95F0F501E50AF5F0E50A3532 +:10344000F0F501E501F5F0E50945F0F509E50FF5C1 +:10345000F0E50965F0F509E509F5F0E50055F0F549 +:1034600000C3E50CF5F0E51595F0F509E50AF5F072 +:10347000E50A35F0F509E515F5F0E50C95F0F501EF +:10348000E50AF5F0E50A35F0F501E501F5F0E509A5 +:1034900045F0F509E50FF5F0E50965F0F509E509F1 +:1034A000F5F0E50055F0F500C3E50EF5F0E51695ED +:1034B000F0F509E50AF5F0E50A35F0F509E516F548 +:1034C000F0E50E95F0F501E50AF5F0E50A35F0F5C1 +:1034D00001E501F5F0E50945F0F509E50FF5F0E541 +:1034E0000965F0F509E509F5F0E50055F0F500C3CB +:1034F000E517F5F075E0042506F58275E00035075F +:10350000F583E0F508E50895F0F509E50AF5F0E53D +:103510000A35F0F509E509F5F0E50055F0F500E5A7 +:1035200000F5F0E50B45F0F50B750000E50BF5F047 +:10353000E50045F0F500E518F5F0E50045F0F5008B +:10354000E519F5F0E50045F0F500E51AF5F0E500C0 +:1035500045F0F500E5007002800302364B0075115E +:1035600000751200751300751400E511F502E512DF +:10357000F503E513F504E514F50575E0122506F5E8 +:103580008275E0003507F583E0F51775E011250633 +:10359000F58275E0003507F583E0F51675E0102536 +:1035A00006F58275E0003507F583E0F51575E00F47 +:1035B0002506F58275E0003507F583E0F51475E022 +:1035C0000E2506F58275E0003507F583E0F51375E5 +:1035D000E00D2506F58275E0003507F583E0F5126C +:1035E00075E00C2506F58275E0003507F583E0F5FA +:1035F0001175E00B2506F58275E0003507F583E0CF +:10360000F51075E0092506F58275E0003507F583AC +:10361000E0F508E508C0E075E00A2506F58275E0EA +:10362000003507F583E0F508E508C0E075E01F25E3 +:1036300006F50675E0003507F507E502F582E503B6 +:10364000F583E504F500E505F501220002356A0081 +:1036500002356A0002356A0002356A0002356A00E6 +:10366000751B08751A0075190075180002242200D0 +:10367000751F80751E00751D00751C0002236800F3 +:1036800002356A0002356A0002356A000000000057 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare5.s.expected b/tests/GCCTestSuite/compare5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare6.c b/tests/GCCTestSuite/compare6.c new file mode 100644 index 0000000..fbeb6a0 --- /dev/null +++ b/tests/GCCTestSuite/compare6.c @@ -0,0 +1,13 @@ +/* PR c/2098 */ +/* Test for a warning on comparison on out-of-range data. */ +/* { dg-do compile { xfail c4x-*-* } } */ +/* { dg-options "-Wall" } */ + +signed char sc; +unsigned char uc; + +void foo() +{ + if (sc == 10000) return; /* { dg-warning "always false" "signed" } */ + if (uc == 10000) return; /* { dg-warning "always false" "unsigned" } */ +} diff --git a/tests/GCCTestSuite/compare6.c.expected b/tests/GCCTestSuite/compare6.c.expected new file mode 100644 index 0000000..fbeb6a0 --- /dev/null +++ b/tests/GCCTestSuite/compare6.c.expected @@ -0,0 +1,13 @@ +/* PR c/2098 */ +/* Test for a warning on comparison on out-of-range data. */ +/* { dg-do compile { xfail c4x-*-* } } */ +/* { dg-options "-Wall" } */ + +signed char sc; +unsigned char uc; + +void foo() +{ + if (sc == 10000) return; /* { dg-warning "always false" "signed" } */ + if (uc == 10000) return; /* { dg-warning "always false" "unsigned" } */ +} diff --git a/tests/GCCTestSuite/compare6.hex.expected b/tests/GCCTestSuite/compare6.hex.expected new file mode 100644 index 0000000..25941e3 --- /dev/null +++ b/tests/GCCTestSuite/compare6.hex.expected @@ -0,0 +1,56 @@ +:1000000000D0E0F518D0E0F519900000E582F50980 +:10001000900000E583F50A750100C3750000E50155 +:10002000F5F0E50935F0F501E500F5F0E50A35F004 +:10003000F500E500F502E501F582E502F583E0F55E +:100040000B750080E50BF5F0E50055F0F50EE500C9 +:10005000F5F0E50E84F50E7500FFE500F5F0E50E10 +:10006000A4F50EE50EF50CE50EF50D750010750105 +:1000700027750900750A00750F00C3E500F5F0E566 +:100080000B95F0F500E500F5F0E50F45F0F50FC331 +:10009000E501F5F0E50C95F0F500E500F5F0E50F6C +:1000A00045F0F50FC3E509F5F0E50D95F0F500E530 +:1000B00000F5F0E50F45F0F50FC3E50AF5F0E50EA4 +:1000C00095F0F500E500F5F0E50F45F0F50F750149 +:1000D00000750900750A00E50FF500750F01C3757D +:1000E0000B00E500F5F0E50B95F0F50B750B00E561 +:1000F0000BF5F0E50B35F0F50BE50BF5F0E50F65CD +:10010000F0F50FC3750B00E501F5F0E50B95F0F583 +:100110000B750B00E50BF5F0E50B35F0F50BE50B7A +:10012000F5F0E50F65F0F50FC3750B00E509F5F087 +:10013000E50B95F0F50B750B00E50BF5F0E50B35D0 +:10014000F0F50BE50BF5F0E50F65F0F50FC3750B5A +:1001500000E50AF5F0E50B95F0F50B750B00E50BE6 +:10016000F5F0E50B35F0F50BE50BF5F0E50F65F077 +:10017000F50F750100750900750A00750000E50F9F +:10018000F5F0E50045F0F500E501F5F0E50045F096 +:10019000F500E509F5F0E50045F0F500E50AF5F0B4 +:1001A000E50045F0F500E5007002800302036800F9 +:1001B000900001E582F509900001E583F50A7501DB +:1001C00000C3750000E501F5F0E50935F0F501E53E +:1001D00000F5F0E50A35F0F500E500F502E501F57A +:1001E00082E502F583E0F50B750E00E50EF50CE5F2 +:1001F0000EF50D750010750127750900750A00755B +:100200000F00C3E500F5F0E50B95F0F500E500F50E +:10021000F0E50F45F0F50FC3E501F5F0E50C95F0BD +:10022000F500E500F5F0E50F45F0F50FC3E509F53C +:10023000F0E50D95F0F500E500F5F0E50F45F0F57A +:100240000FC3E50AF5F0E50E95F0F500E500F5F0D1 +:10025000E50F45F0F50F750100750900750A00E519 +:100260000FF500750F01C3750B00E500F5F0E50B08 +:1002700095F0F50B750B00E50BF5F0E50B35F0F59A +:100280000BE50BF5F0E50F65F0F50FC3750B00E519 +:1002900001F5F0E50B95F0F50B750B00E50BF5F0AE +:1002A000E50B35F0F50BE50BF5F0E50F65F0F50F17 +:1002B000C3750B00E509F5F0E50B95F0F50B750B33 +:1002C00000E50BF5F0E50B35F0F50BE50BF5F0E58A +:1002D0000F65F0F50FC3750B00E50AF5F0E50B951A +:1002E000F0F50B750B00E50BF5F0E50B35F0F50BB4 +:1002F000E50BF5F0E50F65F0F50F750100750900E8 +:10030000750A00750000E50FF5F0E50045F0F50011 +:10031000E501F5F0E50045F0F500E509F5F0E5004B +:1003200045F0F500E50AF5F0E50045F0F500E500DB +:100330007002800302036400750000E500F502E529 +:1003400000F503E500F504E500F505E519C0E0E575 +:1003500018C0E0E502F582E503F583E504F500E564 +:1003600005F50122000203380002033800000000F6 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare6.s.expected b/tests/GCCTestSuite/compare6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare7.c b/tests/GCCTestSuite/compare7.c new file mode 100644 index 0000000..e2fbc04 --- /dev/null +++ b/tests/GCCTestSuite/compare7.c @@ -0,0 +1,10 @@ +/* -Wall is not supposed to trigger -Wsign-compare for C. PR 10604. + See also g++.dg/warn/compare1.C. */ + +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int f(unsigned a, int b) +{ + return a < b; /* { dg-bogus "signed and unsigned" } */ +} diff --git a/tests/GCCTestSuite/compare7.c.expected b/tests/GCCTestSuite/compare7.c.expected new file mode 100644 index 0000000..e2fbc04 --- /dev/null +++ b/tests/GCCTestSuite/compare7.c.expected @@ -0,0 +1,10 @@ +/* -Wall is not supposed to trigger -Wsign-compare for C. PR 10604. + See also g++.dg/warn/compare1.C. */ + +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int f(unsigned a, int b) +{ + return a < b; /* { dg-bogus "signed and unsigned" } */ +} diff --git a/tests/GCCTestSuite/compare7.hex.expected b/tests/GCCTestSuite/compare7.hex.expected new file mode 100644 index 0000000..342978d --- /dev/null +++ b/tests/GCCTestSuite/compare7.hex.expected @@ -0,0 +1,62 @@ +:1000000000E50675820FC39582F506E50775830046 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000062506F58275E0003507F583E514F075A1 +:10005000E0052506F58275E0003507F583E513F028 +:1000600075E0042506F58275E0003507F583E51295 +:10007000F075E0032506F58275E0003507F583E5A8 +:1000800011F075E0022506F58275E0003507F5836D +:10009000E510F0E51FF514E51EF512E51BF500E58A +:1000A0001AF501E519F509E500F513E501F511E586 +:1000B00009F510750C00750D00750E00750F0075B3 +:1000C0000B00750A01750001C3E518F5F0E51C95F4 +:1000D000F0F509E50BF5F0E50B35F0F509E509F567 +:1000E000F0E50055F0F500E500F5F0E50C45F0F51C +:1000F0000C750001C3E518F5F0E51C95F0F509E570 +:100100000BF5F0E50B35F0F509E51CF5F0E5189574 +:10011000F0F501E50BF5F0E50B35F0F501E501F53E +:10012000F0E50945F0F509E50AF5F0E50965F0F5B2 +:1001300009E509F5F0E50055F0F500C3E510F5F027 +:10014000E51D95F0F509E50BF5F0E50B35F0F50942 +:10015000E509F5F0E50055F0F500E500F5F0E50CF2 +:1001600045F0F50C750001C3E518F5F0E51C95F0B8 +:10017000F509E50BF5F0E50B35F0F509E51CF5F0B3 +:10018000E51895F0F501E50BF5F0E50B35F0F50117 +:10019000E501F5F0E50945F0F509E50AF5F0E509B1 +:1001A00065F0F509E509F5F0E50055F0F500C3E562 +:1001B00010F5F0E51D95F0F509E50BF5F0E50B35CB +:1001C000F0F509E51DF5F0E51095F0F501E50BF505 +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E511F5F0E51295F0F509AD +:10020000E50BF5F0E50B35F0F509E509F5F0E5004E +:1002100055F0F500E500F5F0E50C45F0F50C75003E +:1002200001C3E518F5F0E51C95F0F509E50BF5F0CF +:10023000E50B35F0F509E51CF5F0E51895F0F5014D +:10024000E50BF5F0E50B35F0F501E501F5F0E50915 +:1002500045F0F509E50AF5F0E50965F0F509E50968 +:10026000F5F0E50055F0F500C3E510F5F0E51D9556 +:10027000F0F509E50BF5F0E50B35F0F509E51DF5B1 +:10028000F0E51095F0F501E50BF5F0E50B35F0F52F +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E511F5F0E51295F0F509E50BF5F0E50B24 +:1002C00035F0F509E512F5F0E51195F0F501E50BCE +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E513F5F0E51495F0F5CC +:1003000009E50BF5F0E50B35F0F509E509F5F0E544 +:100310000055F0F500E500F5F0E50C45F0F50CE5CD +:100320000CF502E50DF503E50EF504E50FF5057591 +:10033000E0062506F58275E0003507F583E0F51443 +:1003400075E0052506F58275E0003507F583E0F5D3 +:100350001375E0042506F58275E0003507F583E0A6 +:10036000F51275E0032506F58275E0003507F58383 +:10037000E0F51175E0022506F58275E0003507F518 +:1003800083E0F51075E0002506F58275E00035077D +:10039000F583E0F508E508C0E075E0012506F58283 +:1003A00075E0003507F583E0F508E508C0E075E085 +:1003B0000F2506F50675E0003507F507E502F5821D +:1003C000E503F583E504F500E505F50122000000ED +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare7.s.expected b/tests/GCCTestSuite/compare7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare8.c b/tests/GCCTestSuite/compare8.c new file mode 100644 index 0000000..d723c45 --- /dev/null +++ b/tests/GCCTestSuite/compare8.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +int +f(unsigned short a1, unsigned short a2, unsigned int b) +{ + return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */ +} + +int +g(unsigned short a1, unsigned short a2, unsigned int b) +{ + return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */ +} + +int +h(unsigned short a1, unsigned short a2, unsigned int b) +{ + return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */ +} + diff --git a/tests/GCCTestSuite/compare8.c.expected b/tests/GCCTestSuite/compare8.c.expected new file mode 100644 index 0000000..d723c45 --- /dev/null +++ b/tests/GCCTestSuite/compare8.c.expected @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +int +f(unsigned short a1, unsigned short a2, unsigned int b) +{ + return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */ +} + +int +g(unsigned short a1, unsigned short a2, unsigned int b) +{ + return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */ +} + +int +h(unsigned short a1, unsigned short a2, unsigned int b) +{ + return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */ +} + diff --git a/tests/GCCTestSuite/compare8.hex.expected b/tests/GCCTestSuite/compare8.hex.expected new file mode 100644 index 0000000..160800b --- /dev/null +++ b/tests/GCCTestSuite/compare8.hex.expected @@ -0,0 +1,228 @@ +:1000000000E506758210C39582F506E50775830045 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000072506F58275E0003507F583E515F0759F +:10005000E0062506F58275E0003507F583E514F026 +:1000600075E0052506F58275E0003507F583E51393 +:10007000F075E0042506F58275E0003507F583E5A7 +:1000800012F075E0032506F58275E0003507F5836B +:10009000E511F075E0022506F58275E0003507F5FB +:1000A00083E510F0E51FF500E51EF501E51DF509F6 +:1000B000E51CF50AE51BF515E51AF513750C00E5C9 +:1000C0000CF50B750F00E50FF50EC3750D00E50976 +:1000D000F5F0E50035F0F500E50AF5F0E50135F05D +:1000E000F501E50EF5F0E50B35F0F509E50FF5F056 +:1000F000E50C35F0F50E750A05750B00750C0075ED +:100100000D00C3E50AF5F0E50045F0F500E50BF557 +:10011000F0E50145F0F501E50CF5F0E50945F0F5F0 +:1001200009E50DF5F0E50E45F0F50AE500F514E5F5 +:1001300001F512E509F510E50AF511750C00750DCC +:1001400000750E00750F00750B00750A0175000132 +:10015000C3E511F5F0E51895F0F509E50BF5F0E5C7 +:100160000B35F0F509E509F5F0E50055F0F500E58A +:1001700000F5F0E50C45F0F50C750001C3E511F54F +:10018000F0E51895F0F509E50BF5F0E50B35F0F520 +:1001900009E518F5F0E51195F0F501E50BF5F0E549 +:1001A0000B35F0F501E501F5F0E50945F0F509E558 +:1001B0000AF5F0E50965F0F509E509F5F0E5005502 +:1001C000F0F500C3E510F5F0E51995F0F509E50B3C +:1001D000F5F0E50B35F0F509E509F5F0E50055F02A +:1001E000F500E500F5F0E50C45F0F50C750001C3F0 +:1001F000E511F5F0E51895F0F509E50BF5F0E50BDF +:1002000035F0F509E518F5F0E51195F0F501E50B88 +:10021000F5F0E50B35F0F501E501F5F0E50945F000 +:10022000F509E50AF5F0E50965F0F509E509F5F0E8 +:10023000E50055F0F500C3E510F5F0E51995F0F58A +:1002400009E50BF5F0E50B35F0F509E519F5F0E5F5 +:100250001095F0F501E50BF5F0E50B35F0F501E54E +:1002600001F5F0E50945F0F509E50AF5F0E5096560 +:10027000F0F509E509F5F0E50055F0F500C3E512E4 +:10028000F5F0E51395F0F509E50BF5F0E50B35F024 +:10029000F509E509F5F0E50055F0F500E500F5F0A4 +:1002A000E50C45F0F50C750001C3E511F5F0E51816 +:1002B00095F0F509E50BF5F0E50B35F0F509E518D6 +:1002C000F5F0E51195F0F501E50BF5F0E50B35F0EE +:1002D000F501E501F5F0E50945F0F509E50AF5F068 +:1002E000E50965F0F509E509F5F0E50055F0F500DB +:1002F000C3E510F5F0E51995F0F509E50BF5F0E526 +:100300000B35F0F509E519F5F0E51095F0F501E587 +:100310000BF5F0E50B35F0F501E501F5F0E50945E4 +:10032000F0F509E50AF5F0E50965F0F509E509F5E7 +:10033000F0E50055F0F500C3E512F5F0E51395F092 +:10034000F509E50BF5F0E50B35F0F509E513F5F0EA +:10035000E51295F0F501E50BF5F0E50B35F0F5014B +:10036000E501F5F0E50945F0F509E50AF5F0E509DF +:1003700065F0F509E509F5F0E50055F0F500C3E590 +:1003800014F5F0E51595F0F509E50BF5F0E50B35FD +:10039000F0F509E509F5F0E50055F0F500E500F5A3 +:1003A000F0E50C45F0F50C750000E50CF5F0E50006 +:1003B00045F0F500E50DF5F0E50045F0F500E50E3A +:1003C000F5F0E50045F0F500E50FF5F0E50045F046 +:1003D000F500E500700280030204A70075000375B4 +:1003E0000100750900750A00E500F502E501F50355 +:1003F000E509F504E50AF50575E0072506F58275BA +:10040000E0003507F583E0F51575E0062506F58271 +:1004100075E0003507F583E0F51475E0052506F570 +:100420008275E0003507F583E0F51375E0042506D5 +:10043000F58275E0003507F583E0F51275E00325D8 +:1004400006F58275E0003507F583E0F51175E002E9 +:100450002506F58275E0003507F583E0F51075E0B7 +:10046000002506F58275E0003507F583E0F508E51F +:1004700008C0E075E0012506F58275E0003507F556 +:1004800083E0F508E508C0E075E0102506F506757F +:10049000E0003507F507E502F582E503F583E5049D +:1004A000F500E505F50122007500027501007509EA +:1004B00000750A000203E800E506758210C3958204 +:1004C000F506E5077583009583F507D0E0F5087517 +:1004D000E0012506F58275E0003507F583E508F0B3 +:1004E000D0E0F50875E0002506F58275E0003507D7 +:1004F000F583E508F075E0072506F58275E000351F +:1005000007F583E515F075E0062506F58275E00030 +:100510003507F583E514F075E0052506F58275E0ED +:10052000003507F583E513F075E0042506F58275BF +:10053000E0003507F583E512F075E0032506F58246 +:1005400075E0003507F583E511F075E0022506F545 +:100550008275E0003507F583E510F0E51FF500E54D +:100560001EF501E51DF509E51CF50AE51BF515E588 +:100570001AF513750C00E50CF50B750F00E50FF57A +:100580000EC3750D00E509F5F0E50035F0F500E561 +:100590000AF5F0E50135F0F501E50EF5F0E50B356E +:1005A000F0F509E50FF5F0E50C35F0F50E750A05E7 +:1005B000750B00750C00750D00C3E50AF5F0E5003C +:1005C00055F0F500E50BF5F0E50155F0F501E50C0A +:1005D000F5F0E50955F0F509E50DF5F0E50E55F0F6 +:1005E000F50AE500F514E501F512E509F510E50A4F +:1005F000F511750C00750D00750E00750F00750B6B +:1006000000750A01750001C3E511F5F0E51895F0D4 +:10061000F509E50BF5F0E50B35F0F509E509F5F021 +:10062000E50055F0F500E500F5F0E50C45F0F50CBA +:10063000750001C3E511F5F0E51895F0F509E50B36 +:10064000F5F0E50B35F0F509E518F5F0E51195F055 +:10065000F501E50BF5F0E50B35F0F501E501F5F0F9 +:10066000E50945F0F509E50AF5F0E50965F0F50954 +:10067000E509F5F0E50055F0F500C3E510F5F0E506 +:100680001995F0F509E50BF5F0E50B35F0F509E501 +:1006900009F5F0E50055F0F500E500F5F0E50C454D +:1006A000F0F50C750001C3E511F5F0E51895F0F5CE +:1006B00009E50BF5F0E50B35F0F509E518F5F0E582 +:1006C0001195F0F501E50BF5F0E50B35F0F501E5D9 +:1006D00001F5F0E50945F0F509E50AF5F0E50965EC +:1006E000F0F509E509F5F0E50055F0F500C3E51072 +:1006F000F5F0E51995F0F509E50BF5F0E50B35F0AA +:10070000F509E519F5F0E51095F0F501E50BF5F0C3 +:10071000E50B35F0F501E501F5F0E50945F0F509E2 +:10072000E50AF5F0E50965F0F509E509F5F0E500FC +:1007300055F0F500C3E512F5F0E51395F0F509E580 +:100740000BF5F0E50B35F0F509E509F5F0E5005599 +:10075000F0F500E500F5F0E50C45F0F50C7500014D +:10076000C3E511F5F0E51895F0F509E50BF5F0E5B1 +:100770000B35F0F509E518F5F0E51195F0F501E513 +:100780000BF5F0E50B35F0F501E501F5F0E5094570 +:10079000F0F509E50AF5F0E50965F0F509E509F573 +:1007A000F0E50055F0F500C3E510F5F0E51995F01A +:1007B000F509E50BF5F0E50B35F0F509E519F5F070 +:1007C000E51095F0F501E50BF5F0E50B35F0F501D9 +:1007D000E501F5F0E50945F0F509E50AF5F0E5096B +:1007E00065F0F509E509F5F0E50055F0F500C3E51C +:1007F00012F5F0E51395F0F509E50BF5F0E50B358D +:10080000F0F509E513F5F0E51295F0F501E50BF5C6 +:10081000F0E50B35F0F501E501F5F0E50945F0F5FA +:1008200009E50AF5F0E50965F0F509E509F5F0E5F2 +:100830000055F0F500C3E514F5F0E51595F0F50960 +:10084000E50BF5F0E50B35F0F509E509F5F0E50008 +:1008500055F0F500E500F5F0E50C45F0F50C7500F8 +:1008600000E50CF5F0E50045F0F500E50DF5F0E5E7 +:100870000045F0F500E50EF5F0E50045F0F500E582 +:100880000FF5F0E50045F0F500E500700280030289 +:10089000095E00750003750100750900750A00E521 +:1008A00000F502E501F503E509F504E50AF505752E +:1008B000E0072506F58275E0003507F583E0F515BC +:1008C00075E0062506F58275E0003507F583E0F54D +:1008D0001475E0052506F58275E0003507F583E01F +:1008E000F51375E0042506F58275E0003507F583FC +:1008F000E0F51275E0032506F58275E0003507F591 +:1009000083E0F51175E0022506F58275E0003507F4 +:10091000F583E0F51075E0002506F58275E00035F9 +:1009200007F583E0F508E508C0E075E0012506F568 +:100930008275E0003507F583E0F508E508C0E0754D +:10094000E0102506F50675E0003507F507E502F528 +:1009500082E503F583E504F500E505F50122007560 +:100960000002750100750900750A0002089F00E584 +:1009700006758210C39582F506E507758300958399 +:10098000F507D0E0F50875E0012506F58275E00071 +:100990003507F583E508F0D0E0F50875E000250699 +:1009A000F58275E0003507F583E508F075E0072569 +:1009B00006F58275E0003507F583E515F075E0066C +:1009C0002506F58275E0003507F583E514F075E03E +:1009D000052506F58275E0003507F583E513F0750A +:1009E000E0042506F58275E0003507F583E512F091 +:1009F00075E0032506F58275E0003507F583E511FE +:100A0000F075E0022506F58275E0003507F583E50F +:100A100010F0E51FF500E51EF501E51DF509E51CE3 +:100A2000F50AE51BF515E51AF513750C00E50CF54F +:100A30000B750F00E50FF50EC3750D00E509F5F018 +:100A4000E50035F0F500E50AF5F0E50135F0F501D2 +:100A5000E50EF5F0E50B35F0F509E50FF5F0E50CE1 +:100A600035F0F50E750A05750B00750C00750D0057 +:100A7000C3E50AF5F0E50065F0F500E50BF5F0E5F6 +:100A80000165F0F501E50CF5F0E50965F0F509E51E +:100A90000DF5F0E50E65F0F50AE500F514E501F554 +:100AA00012E509F510E50AF511750C00750D0075D4 +:100AB0000E00750F00750B00750A01750001C3E586 +:100AC00011F5F0E51895F0F509E50BF5F0E50B35B6 +:100AD000F0F509E509F5F0E50055F0F500E500F55C +:100AE000F0E50C45F0F50C750001C3E511F5F0E5F6 +:100AF0001895F0F509E50BF5F0E50B35F0F509E58E +:100B000018F5F0E51195F0F501E50BF5F0E50B357D +:100B1000F0F501E501F5F0E50945F0F509E50AF51F +:100B2000F0E50965F0F509E509F5F0E50055F0F5A2 +:100B300000C3E510F5F0E51995F0F509E50BF5F0C2 +:100B4000E50B35F0F509E509F5F0E50055F0F500A0 +:100B5000E500F5F0E50C45F0F50C750001C3E51175 +:100B6000F5F0E51895F0F509E50BF5F0E50B35F036 +:100B7000F509E518F5F0E51195F0F501E50BF5F04F +:100B8000E50B35F0F501E501F5F0E50945F0F5096E +:100B9000E50AF5F0E50965F0F509E509F5F0E50088 +:100BA00055F0F500C3E510F5F0E51995F0F509E508 +:100BB0000BF5F0E50B35F0F509E519F5F0E51095C5 +:100BC000F0F501E50BF5F0E50B35F0F501E501F584 +:100BD000F0E50945F0F509E50AF5F0E50965F0F5F8 +:100BE00009E509F5F0E50055F0F500C3E512F5F06B +:100BF000E51395F0F509E50BF5F0E50B35F0F50992 +:100C0000E509F5F0E50055F0F500E500F5F0E50C37 +:100C100045F0F50C750001C3E511F5F0E51895F008 +:100C2000F509E50BF5F0E50B35F0F509E518F5F0FC +:100C3000E51195F0F501E50BF5F0E50B35F0F50163 +:100C4000E501F5F0E50945F0F509E50AF5F0E509F6 +:100C500065F0F509E509F5F0E50055F0F500C3E5A7 +:100C600010F5F0E51995F0F509E50BF5F0E50B3514 +:100C7000F0F509E519F5F0E51095F0F501E50BF54E +:100C8000F0E50B35F0F501E501F5F0E50945F0F586 +:100C900009E50AF5F0E50965F0F509E509F5F0E57E +:100CA0000055F0F500C3E512F5F0E51395F0F509F0 +:100CB000E50BF5F0E50B35F0F509E513F5F0E51278 +:100CC00095F0F501E50BF5F0E50B35F0F501E501E3 +:100CD000F5F0E50945F0F509E50AF5F0E50965F0F7 +:100CE000F509E509F5F0E50055F0F500C3E514F563 +:100CF000F0E51595F0F509E50BF5F0E50B35F0F5A8 +:100D000009E509F5F0E50055F0F500E500F5F0E539 +:100D10000C45F0F50C750000E50CF5F0E50045F02C +:100D2000F500E50DF5F0E50045F0F500E50EF5F010 +:100D3000E50045F0F500E50FF5F0E50045F0F500BC +:100D4000E50070028003020E1500750003750100B6 +:100D5000750900750A00E500F502E501F503E509EE +:100D6000F504E50AF50575E0072506F58275E0004E +:100D70003507F583E0F51575E0062506F58275E083 +:100D8000003507F583E0F51475E0052506F5827555 +:100D9000E0003507F583E0F51375E0042506F582DC +:100DA00075E0003507F583E0F51275E0032506F5DB +:100DB0008275E0003507F583E0F51175E002250640 +:100DC000F58275E0003507F583E0F51075E0002544 +:100DD00006F58275E0003507F583E0F508E508C003 +:100DE000E075E0012506F58275E0003507F583E042 +:100DF000F508E508C0E075E0102506F50675E00089 +:100E00003507F507E502F582E503F583E504F5000E +:100E1000E505F501220075000275010075090075F0 +:100E20000A00020D56000000000000000000000053 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare8.s.expected b/tests/GCCTestSuite/compare8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/compare9.c b/tests/GCCTestSuite/compare9.c new file mode 100644 index 0000000..02150cb --- /dev/null +++ b/tests/GCCTestSuite/compare9.c @@ -0,0 +1,41 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + This was inspired by code in gcc. This testcase is identical to + compare1.c except that we use -fshort-enums here and do not expect + a warning from case 4. */ + +/* { dg-do compile } */ +/* { dg-options "-fshort-enums -Wsign-compare" } */ + +int tf = 1; + +/* This enumeration has an explicit negative value and is therefore signed. */ +enum mm1 +{ + VOID, SI, DI, MAX = -1 +}; + +/* This enumeration fits entirely in a signed int, but is unsigned anyway. */ +enum mm2 +{ + VOID2, SI2, DI2, MAX2 +}; + +int f(enum mm1 x) +{ + return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */ +} + +int g(enum mm1 x) +{ + return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */ +} + +int h(enum mm2 x) +{ + return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */ +} + +int i(enum mm2 x) +{ + return x == (tf?DI2:-1); /* { dg-bogus "signed and unsigned" "case 4" } */ +} diff --git a/tests/GCCTestSuite/compare9.c.expected b/tests/GCCTestSuite/compare9.c.expected new file mode 100644 index 0000000..02150cb --- /dev/null +++ b/tests/GCCTestSuite/compare9.c.expected @@ -0,0 +1,41 @@ +/* Test for a bogus warning on comparison between signed and unsigned. + This was inspired by code in gcc. This testcase is identical to + compare1.c except that we use -fshort-enums here and do not expect + a warning from case 4. */ + +/* { dg-do compile } */ +/* { dg-options "-fshort-enums -Wsign-compare" } */ + +int tf = 1; + +/* This enumeration has an explicit negative value and is therefore signed. */ +enum mm1 +{ + VOID, SI, DI, MAX = -1 +}; + +/* This enumeration fits entirely in a signed int, but is unsigned anyway. */ +enum mm2 +{ + VOID2, SI2, DI2, MAX2 +}; + +int f(enum mm1 x) +{ + return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */ +} + +int g(enum mm1 x) +{ + return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */ +} + +int h(enum mm2 x) +{ + return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */ +} + +int i(enum mm2 x) +{ + return x == (tf?DI2:-1); /* { dg-bogus "signed and unsigned" "case 4" } */ +} diff --git a/tests/GCCTestSuite/compare9.hex.expected b/tests/GCCTestSuite/compare9.hex.expected new file mode 100644 index 0000000..df37c63 --- /dev/null +++ b/tests/GCCTestSuite/compare9.hex.expected @@ -0,0 +1,165 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F518D0E0F519E515F50E54 +:10002000E514F50F900000E582F509900000E583E6 +:10003000F50A750100C3750000E501F5F0E5093525 +:10004000F0F501E500F5F0E50A35F0F500E500F51D +:1000500002E501F582E502F583E0F50B750101C3C8 +:10006000750000E501F5F0E50935F0F501E500F56D +:10007000F0E50A35F0F500E500F502E501F582E569 +:1000800002F583E0F50C750102C3750000E501F58A +:10009000F0E50935F0F501E500F5F0E50A35F0F594 +:1000A00000E500F502E501F582E502F583E0F50DD6 +:1000B000750103C3750000E501F5F0E50935F0F5BC +:1000C00001E500F5F0E50A35F0F500E500F502E59B +:1000D00001F582E502F583E0F501750000E50BF519 +:1000E000F0E50045F0F500E50CF5F0E50045F0F52C +:1000F00000E50DF5F0E50045F0F500E501F5F0E56A +:100100000045F0F500E5007002800302025E007514 +:100110000001750100750900750A00750B00C3E543 +:1001200000F5F0E51F95F0F500E500F5F0E50B456D +:10013000F0F50BC3E501F5F0E51E95F0F500E500DF +:10014000F5F0E50B45F0F50BC3E509F5F0E51D9578 +:10015000F0F500E500F5F0E50B45F0F50BC3E50A19 +:10016000F5F0E51C95F0F500E500F5F0E50B45F040 +:10017000F50B750100750900750A00E50BF50075B2 +:100180000B01C3750C00E500F5F0E50C95F0F50CDE +:10019000750C00E50CF5F0E50C35F0F50CE50CF50B +:1001A000F0E50B65F0F50BC3750C00E501F5F0E526 +:1001B0000C95F0F50C750C00E50CF5F0E50C35F040 +:1001C000F50CE50CF5F0E50B65F0F50BC3750C00CF +:1001D000E509F5F0E50C95F0F50C750C00E50CF56E +:1001E000F0E50C35F0F50CE50CF5F0E50B65F0F5F8 +:1001F0000BC3750C00E50AF5F0E50C95F0F50C75F0 +:100200000C00E50CF5F0E50C35F0F50CE50CF5F01F +:10021000E50B65F0F50B750100750900750A00E541 +:100220000BF502E501F503E509F504E50AF505E539 +:100230000EF515E50FF514E519C0E0E518C0E075F9 +:10024000E0042506F50675E0003507F507E502F53B +:1002500082E503F583E504F500E505F50122007567 +:100260000002750100750900750A0002011B00E516 +:1002700006758204C39582F506E5077583009583AC +:10028000F507D0E0F518D0E0F519E515F50EE51401 +:10029000F50F900000E582F509900000E583F50A6E +:1002A000750100C3750000E501F5F0E50935F0F5CD +:1002B00001E500F5F0E50A35F0F500E500F502E5A9 +:1002C00001F582E502F583E0F50B750101C37500C8 +:1002D00000E501F5F0E50935F0F501E500F5F0E59B +:1002E0000A35F0F500E500F502E501F582E502F5D5 +:1002F00083E0F50C750102C3750000E501F5F0E53A +:100300000935F0F501E500F5F0E50A35F0F500E511 +:1003100000F502E501F582E502F583E0F50D7501D2 +:1003200003C3750000E501F5F0E50935F0F501E5D9 +:1003300000F5F0E50A35F0F500E500F502E501F518 +:1003400082E502F583E0F501750000E50BF5F0E5C7 +:100350000045F0F500E50CF5F0E50045F0F500E5A9 +:100360000DF5F0E50045F0F500E501F5F0E5004597 +:10037000F0F500E5007002800302050C0075000135 +:10038000750100750900750A00E500F4F500E50146 +:10039000F4F501E509F4F509E50AF4F50AD3750B5E +:1003A00000E50BF5F0E50035F0F500E50BF5F0E5BF +:1003B0000135F0F501E50BF5F0E50935F0F509E556 +:1003C0000BF5F0E50A35F0F50A750B00C3E500F50D +:1003D000F0E51F95F0F500E500F5F0E50B45F0F5CB +:1003E0000BC3E501F5F0E51E95F0F500E500F5F02D +:1003F000E50B45F0F50BC3E509F5F0E51D95F0F5C6 +:1004000000E500F5F0E50B45F0F50BC3E50AF5F066 +:10041000E51C95F0F500E500F5F0E50B45F0F50B72 +:10042000750100750900750A00E50BF500750B01F3 +:10043000C3750C00E500F5F0E50C95F0F50C750CB6 +:1004400000E50CF5F0E50C35F0F50CE50CF5F0E504 +:100450000B65F0F50BC3750C00E501F5F0E50C95A7 +:10046000F0F50C750C00E50CF5F0E50C35F0F50C2D +:10047000E50CF5F0E50B65F0F50BC3750C00E5092F +:10048000F5F0E50C95F0F50C750C00E50CF5F0E5D4 +:100490000C35F0F50CE50CF5F0E50B65F0F50BC34C +:1004A000750C00E50AF5F0E50C95F0F50C750C00FF +:1004B000E50CF5F0E50C35F0F50CE50CF5F0E50B89 +:1004C00065F0F50B750100750900750A00E50BF57F +:1004D00002E501F503E509F504E50AF505E50EF584 +:1004E00015E50FF514E519C0E0E518C0E075E00466 +:1004F0002506F50675E0003507F507E502F582E506 +:1005000003F583E504F500E505F501220075000219 +:10051000750100750900750A000203C900E506753A +:100520008204C39582F506E5077583009583F50778 +:10053000D0E0F518D0E0F519E515F50EE514F50F46 +:10054000900000E582F509900000E583F50A750149 +:1005500000C3750000E501F5F0E50935F0F501E5AA +:1005600000F5F0E50A35F0F500E500F502E501F5E6 +:1005700082E502F583E0F50B750101C3750000E526 +:1005800001F5F0E50935F0F501E500F5F0E50A358E +:10059000F0F500E500F502E501F582E502F583E0FE +:1005A000F50C750102C3750000E501F5F0E50935AC +:1005B000F0F501E500F5F0E50A35F0F500E500F5A8 +:1005C00002E501F582E502F583E0F50D750103C34F +:1005D000750000E501F5F0E50935F0F501E500F5F8 +:1005E000F0E50A35F0F500E500F502E501F582E5F4 +:1005F00002F583E0F501750000E50BF5F0E5004537 +:10060000F0F500E50CF5F0E50045F0F500E50DF539 +:10061000F0E50045F0F500E501F5F0E50045F0F501 +:1006200000E5007002800302077A00750001750181 +:1006300000750900750A00750B00C3E500F5F0E5CB +:100640001F95F0F500E500F5F0E50B45F0F50BC35F +:10065000E501F5F0E51E95F0F500E500F5F0E50B98 +:1006600045F0F50BC3E509F5F0E51D95F0F500E55E +:1006700000F5F0E50B45F0F50BC3E50AF5F0E51CD8 +:1006800095F0F500E500F5F0E50B45F0F50B75018B +:1006900000750900750A00E50BF500750B01C375BF +:1006A0000C00E500F5F0E50C95F0F50C750C00E597 +:1006B0000CF5F0E50C35F0F50CE50CF5F0E50B6507 +:1006C000F0F50BC3750C00E501F5F0E50C95F0F5C0 +:1006D0000C750C00E50CF5F0E50C35F0F50CE50CAF +:1006E000F5F0E50B65F0F50BC3750C00E509F5F0C9 +:1006F000E50C95F0F50C750C00E50CF5F0E50C3506 +:10070000F0F50CE50CF5F0E50B65F0F50BC3750C99 +:1007100000E50AF5F0E50C95F0F50C750C00E50C1C +:10072000F5F0E50C35F0F50CE50CF5F0E50B65F0B2 +:10073000F50B750100750900750A00E50BF502E57A +:1007400001F503E509F504E50AF505E50EF515E5FE +:100750000FF514E519C0E0E518C0E075E0042506C2 +:10076000F50675E0003507F507E502F582E503F5C6 +:1007700083E504F500E505F5012200750002750129 +:1007800000750900750A0002063700E50675820447 +:10079000C39582F506E5077583009583F507D0E0DC +:1007A000F518D0E0F519E515F50EE514F50F9000F4 +:1007B00000E582F509900000E583F50A750100C3A4 +:1007C000750000E501F5F0E50935F0F501E500F506 +:1007D000F0E50A35F0F500E500F502E501F582E502 +:1007E00002F583E0F50B750101C3750000E501F525 +:1007F000F0E50935F0F501E500F5F0E50A35F0F52D +:1008000000E500F502E501F582E502F583E0F50C6F +:10081000750102C3750000E501F5F0E50935F0F555 +:1008200001E500F5F0E50A35F0F500E500F502E533 +:1008300001F582E502F583E0F50D750103C375004E +:1008400000E501F5F0E50935F0F501E500F5F0E525 +:100850000A35F0F500E500F502E501F582E502F55F +:1008600083E0F501750000E50BF5F0E50045F0F5D6 +:1008700000E50CF5F0E50045F0F500E50DF5F0E5D7 +:100880000045F0F500E501F5F0E50045F0F500E57F +:100890000070028003020A280075000175010075CE +:1008A0000900750A00E500F4F500E501F4F501E53D +:1008B00009F4F509E50AF4F50AD3750B00E50BF523 +:1008C000F0E50035F0F500E50BF5F0E50135F0F564 +:1008D00001E50BF5F0E50935F0F509E50BF5F0E577 +:1008E0000A35F0F50A750B00C3E500F5F0E51F9534 +:1008F000F0F500E500F5F0E50B45F0F50BC3E5017B +:10090000F5F0E51E95F0F500E500F5F0E50B45F096 +:10091000F50BC3E509F5F0E51D95F0F500E500F5EB +:10092000F0E50B45F0F50BC3E50AF5F0E51C95F095 +:10093000F500E500F5F0E50B45F0F50B75010075E8 +:100940000900750A00E50BF500750B01C3750C0075 +:10095000E500F5F0E50C95F0F50C750C00E50CF5EF +:10096000F0E50C35F0F50CE50CF5F0E50B65F0F570 +:100970000BC3750C00E501F5F0E50C95F0F50C7571 +:100980000C00E50CF5F0E50C35F0F50CE50CF5F098 +:10099000E50B65F0F50BC3750C00E509F5F0E50C0A +:1009A00095F0F50C750C00E50CF5F0E50C35F0F55F +:1009B0000CE50CF5F0E50B65F0F50BC3750C00E5E7 +:1009C0000AF5F0E50C95F0F50C750C00E50CF5F06A +:1009D000E50C35F0F50CE50CF5F0E50B65F0F50BE5 +:1009E000750100750900750A00E50BF502E501F5D2 +:1009F00003E509F504E50AF505E50EF515E50FF53E +:100A000014E519C0E0E518C0E075E0042506F50618 +:100A100075E0003507F507E502F582E503F583E5A6 +:100A200004F500E505F50122007500027501007569 +:100A30000900750A000208E500000000000000003F +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/compare9.s.expected b/tests/GCCTestSuite/compare9.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/compare9.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/concat.c b/tests/GCCTestSuite/concat.c new file mode 100644 index 0000000..0b9d6f6 --- /dev/null +++ b/tests/GCCTestSuite/concat.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* Test we output an error for concatenation of artificial strings. + + Neil Booth, 10 Dec 2001. */ + +void foo () +{ + char s1[] = __FUNCTION__"."; /* { dg-error "(parse|syntax|expected|invalid|array)" } */ + char s2[] = __PRETTY_FUNCTION__".";/* { dg-error "(parse|syntax|expected|invalid|array)" } */ + char s3[] = "."__FUNCTION__; /* { dg-error "(parse|syntax|expected|invalid)" } */ + char s4[] = "."__PRETTY_FUNCTION__;/* { dg-error "(parse|syntax|expected|invalid)" } */ + char s5[] = ".""."; /* No error. */ +} diff --git a/tests/GCCTestSuite/concat.c.expected b/tests/GCCTestSuite/concat.c.expected new file mode 100644 index 0000000..0b9d6f6 --- /dev/null +++ b/tests/GCCTestSuite/concat.c.expected @@ -0,0 +1,16 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* Test we output an error for concatenation of artificial strings. + + Neil Booth, 10 Dec 2001. */ + +void foo () +{ + char s1[] = __FUNCTION__"."; /* { dg-error "(parse|syntax|expected|invalid|array)" } */ + char s2[] = __PRETTY_FUNCTION__".";/* { dg-error "(parse|syntax|expected|invalid|array)" } */ + char s3[] = "."__FUNCTION__; /* { dg-error "(parse|syntax|expected|invalid)" } */ + char s4[] = "."__PRETTY_FUNCTION__;/* { dg-error "(parse|syntax|expected|invalid)" } */ + char s5[] = ".""."; /* No error. */ +} diff --git a/tests/GCCTestSuite/concat.hex.expected b/tests/GCCTestSuite/concat.hex.expected new file mode 100644 index 0000000..cc52831 --- /dev/null +++ b/tests/GCCTestSuite/concat.hex.expected @@ -0,0 +1,498 @@ +:1000000000E506758217C39582F506E5077583003E +:100010009583F507D0E0F51AD0E0F51BE511F5184A +:10002000E510F519E506F50AE507F501750900C3C0 +:10003000750000E509F5F0E50A35F0F510E500F585 +:10004000F0E50135F0F511750000750100750C0142 +:10005000750D00750E00750F00C3750900E500F5FC +:10006000F0E50CA4F50BE500F5F0E50CA4E5F0F5E2 +:100070000AE50BF5F0E50935F0F509E501F5F0E5E0 +:100080000CA4F50BE501F5F0E50CA4E5F0F501E5B0 +:100090000BF5F0E50A35F0F50AC3C3750100E50973 +:1000A000F5F0E50E35F0F50EE50AF5F0E50F35F063 +:1000B000F50FC3750A00E500F5F0E50DA4F50BE5B5 +:1000C00000F5F0E50DA4E5F0F501E50BF5F0E50A26 +:1000D00035F0F50A750900C3C3750000E509F5F0B0 +:1000E000E50E35F0F50EE50AF5F0E50F35F0F50F04 +:1000F000C3750900750A00C3C3750000E509F5F072 +:10010000E50E35F0F50EE50AF5F0E50F35F0F50FE3 +:10011000C3750900750A00C3C3750000E509F5F051 +:10012000E50E35F0F50EE50AF5F0E50F35F0F50FC3 +:10013000C3750000E50EF5F0E51035F0F500E50FAC +:10014000F5F0E51135F0F50B750A66750900C37514 +:100150000100E509F5F0E50035F0F500E501F5F001 +:10016000E50B35F0F501E50AF503E501F502E500DB +:10017000F582E502F583E503F0E506F50AE507F506 +:1001800001750900C3750000E509F5F0E50A35F0D1 +:10019000F510E500F5F0E50135F0F5117500017594 +:1001A0000100750C01750D00750E00750F00C3750B +:1001B0000900E500F5F0E50CA4F50BE500F5F0E528 +:1001C0000CA4E5F0F50AE50BF5F0E50935F0F509C5 +:1001D000E501F5F0E50CA4F50BE501F5F0E50CA45F +:1001E000E5F0F501E50BF5F0E50A35F0F50AC3C3D6 +:1001F000750100E509F5F0E50E35F0F50EE50AF5B7 +:10020000F0E50F35F0F50FC3750A00E500F5F0E5F0 +:100210000DA4F50BE500F5F0E50DA4E5F0F501E51D +:100220000BF5F0E50A35F0F50A750900C3C3750052 +:1002300000E509F5F0E50E35F0F50EE50AF5F0E517 +:100240000F35F0F50FC3750900750A00C3C37500BB +:1002500000E509F5F0E50E35F0F50EE50AF5F0E5F7 +:100260000F35F0F50FC3750900750A00C3C375009B +:1002700000E509F5F0E50E35F0F50EE50AF5F0E5D7 +:100280000F35F0F50FC3750000E50EF5F0E51035FC +:10029000F0F500E50FF5F0E51135F0F50B750A6F97 +:1002A000750900C3750100E509F5F0E50035F0F5C5 +:1002B00000E501F5F0E50B35F0F501E50AF503E59C +:1002C00001F502E500F582E502F583E503F0E506B8 +:1002D000F50AE507F501750900C3750000E509F5A4 +:1002E000F0E50A35F0F510E500F5F0E50135F0F53B +:1002F00011750002750100750C01750D00750E0079 +:10030000750F00C3750900E500F5F0E50CA4F50BC9 +:10031000E500F5F0E50CA4E5F0F50AE50BF5F0E5F0 +:100320000935F0F509E501F5F0E50CA4F50BE5015B +:10033000F5F0E50CA4E5F0F501E50BF5F0E50A357F +:10034000F0F50AC3C3750100E509F5F0E50E35F0D7 +:10035000F50EE50AF5F0E50F35F0F50FC3750A0067 +:10036000E500F5F0E50DA4F50BE500F5F0E50DA4CD +:10037000E5F0F501E50BF5F0E50A35F0F50A75094C +:1003800000C3C3750000E509F5F0E50E35F0F50E84 +:10039000E50AF5F0E50F35F0F50FC3750900750AAC +:1003A00000C3C3750000E509F5F0E50E35F0F50E64 +:1003B000E50AF5F0E50F35F0F50FC3750900750A8C +:1003C00000C3C3750000E509F5F0E50E35F0F50E44 +:1003D000E50AF5F0E50F35F0F50FC3750000E50E01 +:1003E000F5F0E51035F0F500E50FF5F0E51135F025 +:1003F000F50B750A6F750900C3750100E509F5F085 +:10040000E50035F0F500E501F5F0E50B35F0F50117 +:10041000E50AF503E501F502E500F582E502F5835D +:10042000E503F0E506F50AE507F501750900C37572 +:100430000000E509F5F0E50A35F0F510E500F5F006 +:10044000E50135F0F511750003750100750C0175B6 +:100450000D00750E00750F00C3750900E500F5F07D +:10046000E50CA4F50BE500F5F0E50CA4E5F0F50AC4 +:10047000E50BF5F0E50935F0F509E501F5F0E50CDA +:10048000A4F50BE501F5F0E50CA4E5F0F501E50BAD +:10049000F5F0E50A35F0F50AC3C3750100E509F585 +:1004A000F0E50E35F0F50EE50AF5F0E50F35F0F55F +:1004B0000FC3750A00E500F5F0E50DA4F50BE500A6 +:1004C000F5F0E50DA4E5F0F501E50BF5F0E50A35ED +:1004D000F0F50A750900C3C3750000E509F5F0E5FC +:1004E0000E35F0F50EE50AF5F0E50F35F0F50FC322 +:1004F000750900750A00C3C3750000E509F5F0E54C +:100500000E35F0F50EE50AF5F0E50F35F0F50FC301 +:10051000750900750A00C3C3750000E509F5F0E52B +:100520000E35F0F50EE50AF5F0E50F35F0F50FC3E1 +:10053000750000E50EF5F0E51035F0F500E50FF576 +:10054000F0E51135F0F50B750A2E750900C375013C +:1005500000E509F5F0E50035F0F500E501F5F0E519 +:100560000B35F0F501E50AF503E501F502E500F5C7 +:1005700082E502F583E503F0E506F50AE507F501F6 +:10058000750900C3750000E509F5F0E50A35F0F5D9 +:1005900010E500F5F0E50135F0F511750004750181 +:1005A00000750C01750D00750E00750F00C37509FF +:1005B00000E500F5F0E50CA4F50BE500F5F0E50C21 +:1005C000A4E5F0F50AE50BF5F0E50935F0F509E5E8 +:1005D00001F5F0E50CA4F50BE501F5F0E50CA4E55B +:1005E000F0F501E50BF5F0E50A35F0F50AC3C37542 +:1005F0000100E509F5F0E50E35F0F50EE50AF5F038 +:10060000E50F35F0F50FC3750A00E500F5F0E50DCF +:10061000A4F50BE500F5F0E50DA4E5F0F501E50B1B +:10062000F5F0E50A35F0F50A750900C3C375000059 +:10063000E509F5F0E50E35F0F50EE50AF5F0E50F04 +:1006400035F0F50FC3750900750A00C3C3750000C6 +:10065000E509F5F0E50E35F0F50EE50AF5F0E50FE4 +:1006600035F0F50FC3750900750A00C3C3750000A6 +:10067000E509F5F0E50E35F0F50EE50AF5F0E50FC4 +:1006800035F0F50FC3750000E50EF5F0E51035F017 +:10069000F500E50FF5F0E51135F0F50B750A00757D +:1006A0000900C3750100E509F5F0E50035F0F50036 +:1006B000E501F5F0E50B35F0F501E50AF503E50197 +:1006C000F502E500F582E502F583E503F0E506F5C0 +:1006D0000AE507F501750905C3750000E509F5F0A0 +:1006E000E50A35F0F510E500F5F0E50135F0F51116 +:1006F000750000750100750C01750D00750E007513 +:100700000F00C3750900E500F5F0E50CA4F50BE555 +:1007100000F5F0E50CA4E5F0F50AE50BF5F0E509C8 +:1007200035F0F509E501F5F0E50CA4F50BE501F56B +:10073000F0E50CA4E5F0F501E50BF5F0E50A35F080 +:10074000F50AC3C3750100E509F5F0E50E35F0F5CE +:100750000EE50AF5F0E50F35F0F50FC3750A00E573 +:1007600000F5F0E50DA4F50BE500F5F0E50DA4E5C9 +:10077000F0F501E50BF5F0E50A35F0F50A7509002D +:10078000C3C3750000E509F5F0E50E35F0F50EE59B +:100790000AF5F0E50F35F0F50FC3750900750A008D +:1007A000C3C3750000E509F5F0E50E35F0F50EE57B +:1007B0000AF5F0E50F35F0F50FC3750900750A006D +:1007C000C3C3750000E509F5F0E50E35F0F50EE55B +:1007D0000AF5F0E50F35F0F50FC3750000E50EF5ED +:1007E000F0E51035F0F500E50FF5F0E51135F0F521 +:1007F0000B750A66750900C3750100E509F5F0E59A +:100800000035F0F500E501F5F0E50B35F0F501E513 +:100810000AF503E501F502E500F582E502F583E559 +:1008200003F0E506F50AE507F501750905C375004E +:1008300000E509F5F0E50A35F0F510E500F5F0E51D +:100840000135F0F511750001750100750C01750D8C +:1008500000750E00750F00C3750900E500F5F0E5A1 +:100860000CA4F50BE500F5F0E50CA4E5F0F50AE5C0 +:100870000BF5F0E50935F0F509E501F5F0E50CA417 +:10088000F50BE501F5F0E50CA4E5F0F501E50BF558 +:10089000F0E50A35F0F50AC3C3750100E509F5F086 +:1008A000E50E35F0F50EE50AF5F0E50F35F0F50F3C +:1008B000C3750A00E500F5F0E50DA4F50BE500F5BC +:1008C000F0E50DA4E5F0F501E50BF5F0E50A35F0EE +:1008D000F50A750900C3C3750000E509F5F0E50EDA +:1008E00035F0F50EE50AF5F0E50F35F0F50FC375B7 +:1008F0000900750A00C3C3750000E509F5F0E50EAF +:1009000035F0F50EE50AF5F0E50F35F0F50FC37596 +:100910000900750A00C3C3750000E509F5F0E50E8E +:1009200035F0F50EE50AF5F0E50F35F0F50FC37576 +:100930000000E50EF5F0E51035F0F500E50FF5F0F7 +:10094000E51135F0F50B750A6F750900C3750100E7 +:10095000E509F5F0E50035F0F500E501F5F0E50B0A +:1009600035F0F501E50AF503E501F502E500F5824C +:10097000E502F583E503F0E506F50AE507F50175FF +:100980000905C3750000E509F5F0E50A35F0F51035 +:10099000E500F5F0E50135F0F5117500027501008F +:1009A000750C01750D00750E00750F00C3750900FB +:1009B000E500F5F0E50CA4F50BE500F5F0E50CA479 +:1009C000E5F0F50AE50BF5F0E50935F0F509E50187 +:1009D000F5F0E50CA4F50BE501F5F0E50CA4E5F068 +:1009E000F501E50BF5F0E50A35F0F50AC3C375012D +:1009F00000E509F5F0E50E35F0F50EE50AF5F0E550 +:100A00000F35F0F50FC3750A00E500F5F0E50DA40C +:100A1000F50BE500F5F0E50DA4E5F0F501E50BF5C6 +:100A2000F0E50A35F0F50A750900C3C3750000E565 +:100A300009F5F0E50E35F0F50EE50AF5F0E50F35B0 +:100A4000F0F50FC3750900750A00C3C3750000E512 +:100A500009F5F0E50E35F0F50EE50AF5F0E50F3590 +:100A6000F0F50FC3750900750A00C3C3750000E5F2 +:100A700009F5F0E50E35F0F50EE50AF5F0E50F3570 +:100A8000F0F50FC3750000E50EF5F0E51035F0F553 +:100A900000E50FF5F0E51135F0F50B750A6F7509F6 +:100AA00000C3750100E509F5F0E50035F0F500E556 +:100AB00001F5F0E50B35F0F501E50AF503E501F583 +:100AC00002E500F582E502F583E503F0E506F50AA7 +:100AD000E507F501750905C3750000E509F5F0E5C1 +:100AE0000A35F0F510E500F5F0E50135F0F5117582 +:100AF0000003750100750C01750D00750E00750F72 +:100B000000C3750900E500F5F0E50CA4F50BE50060 +:100B1000F5F0E50CA4E5F0F50AE50BF5F0E509358F +:100B2000F0F509E501F5F0E50CA4F50BE501F5F0AC +:100B3000E50CA4E5F0F501E50BF5F0E50A35F0F577 +:100B40000AC3C3750100E509F5F0E50E35F0F50EB1 +:100B5000E50AF5F0E50F35F0F50FC3750A00E5007D +:100B6000F5F0E50DA4F50BE500F5F0E50DA4E5F0D5 +:100B7000F501E50BF5F0E50A35F0F50A750900C356 +:100B8000C3750000E509F5F0E50E35F0F50EE50A50 +:100B9000F5F0E50F35F0F50FC3750900750A00C3D0 +:100BA000C3750000E509F5F0E50E35F0F50EE50A30 +:100BB000F5F0E50F35F0F50FC3750900750A00C3B0 +:100BC000C3750000E509F5F0E50E35F0F50EE50A10 +:100BD000F5F0E50F35F0F50FC3750000E50EF5F003 +:100BE000E51035F0F500E50FF5F0E51135F0F50B02 +:100BF000750A2E750900C3750100E509F5F0E500D9 +:100C000035F0F500E501F5F0E50B35F0F501E50A05 +:100C1000F503E501F502E500F582E502F583E5035C +:100C2000F0E506F50AE507F501750905C37500004D +:100C3000E509F5F0E50A35F0F510E500F5F0E50118 +:100C400035F0F511750004750100750C01750D0086 +:100C5000750E00750F00C3750900E500F5F0E50C91 +:100C6000A4F50BE500F5F0E50CA4E5F0F50AE50BBD +:100C7000F5F0E50935F0F509E501F5F0E50CA4F529 +:100C80000BE501F5F0E50CA4E5F0F501E50BF5F059 +:100C9000E50A35F0F50AC3C3750100E509F5F0E58D +:100CA0000E35F0F50EE50AF5F0E50F35F0F50FC35A +:100CB000750A00E500F5F0E50DA4F50BE500F5F08B +:100CC000E50DA4E5F0F501E50BF5F0E50A35F0F5E5 +:100CD0000A750900C3C3750000E509F5F0E50E3596 +:100CE000F0F50EE50AF5F0E50F35F0F50FC37509DF +:100CF00000750A00C3C3750000E509F5F0E50E357F +:100D0000F0F50EE50AF5F0E50F35F0F50FC37509BE +:100D100000750A00C3C3750000E509F5F0E50E355E +:100D2000F0F50EE50AF5F0E50F35F0F50FC37500A7 +:100D300000E50EF5F0E51035F0F500E50FF5F0E50E +:100D40001135F0F50B750A00750900C3750100E552 +:100D500009F5F0E50035F0F500E501F5F0E50B35B6 +:100D6000F0F501E50AF503E501F502E500F582E598 +:100D700002F583E503F0E506F50AE507F5017509D7 +:100D80000AC3750000E509F5F0E50A35F0F510E550 +:100D900000F5F0E50135F0F51175000075010075FD +:100DA0000C01750D00750E00750F00C3750900E587 +:100DB00000F5F0E50CA4F50BE500F5F0E50CA4E575 +:100DC000F0F50AE50BF5F0E50935F0F509E501F573 +:100DD000F0E50CA4F50BE501F5F0E50CA4E5F0F564 +:100DE00001E50BF5F0E50A35F0F50AC3C37501001E +:100DF000E509F5F0E50E35F0F50EE50AF5F0E50F3D +:100E000035F0F50FC3750A00E500F5F0E50DA4F522 +:100E10000BE500F5F0E50DA4E5F0F501E50BF5F0C7 +:100E2000E50A35F0F50A750900C3C3750000E50948 +:100E3000F5F0E50E35F0F50EE50AF5F0E50F35F0C5 +:100E4000F50FC3750900750A00C3C3750000E509F5 +:100E5000F5F0E50E35F0F50EE50AF5F0E50F35F0A5 +:100E6000F50FC3750900750A00C3C3750000E509D5 +:100E7000F5F0E50E35F0F50EE50AF5F0E50F35F085 +:100E8000F50FC3750000E50EF5F0E51035F0F5003F +:100E9000E50FF5F0E51135F0F50B750A2E75090033 +:100EA000C3750100E509F5F0E50035F0F500E50151 +:100EB000F5F0E50B35F0F501E50AF503E501F5027E +:100EC000E500F582E502F583E503F0E506F50AE5C0 +:100ED00007F50175090AC3750000E509F5F0E50A93 +:100EE00035F0F510E500F5F0E50135F0F511750088 +:100EF00001750100750C01750D00750E00750F0070 +:100F0000C3750900E500F5F0E50CA4F50BE500F567 +:100F1000F0E50CA4E5F0F50AE50BF5F0E50935F090 +:100F2000F509E501F5F0E50CA4F50BE501F5F0E5B3 +:100F30000CA4E5F0F501E50BF5F0E50A35F0F50A4E +:100F4000C3C3750100E509F5F0E50E35F0F50EE5D2 +:100F50000AF5F0E50F35F0F50FC3750A00E500F569 +:100F6000F0E50DA4F50BE500F5F0E50DA4E5F0F5D1 +:100F700001E50BF5F0E50A35F0F50A750900C3C384 +:100F8000750000E509F5F0E50E35F0F50EE50AF51A +:100F9000F0E50F35F0F50FC3750900750A00C3C3FE +:100FA000750000E509F5F0E50E35F0F50EE50AF5FA +:100FB000F0E50F35F0F50FC3750900750A00C3C3DE +:100FC000750000E509F5F0E50E35F0F50EE50AF5DA +:100FD000F0E50F35F0F50FC3750000E50EF5F0E50F +:100FE0001035F0F500E50FF5F0E51135F0F50B756E +:100FF0000A66750900C3750100E509F5F0E50035DD +:10100000F0F500E501F5F0E50B35F0F501E50AF541 +:1010100003E501F502E500F582E502F583E503F05D +:10102000E506F50AE507F50175090AC3750000E54F +:1010300009F5F0E50A35F0F510E500F5F0E50135C4 +:10104000F0F511750002750100750C01750D007544 +:101050000E00750F00C3750900E500F5F0E50CA45E +:10106000F50BE500F5F0E50CA4E5F0F50AE50BF568 +:10107000F0E50935F0F509E501F5F0E50CA4F50B0F +:10108000E501F5F0E50CA4E5F0F501E50BF5F0E57B +:101090000A35F0F50AC3C3750100E509F5F0E50E60 +:1010A00035F0F50EE50AF5F0E50F35F0F50FC375EF +:1010B0000A00E500F5F0E50DA4F50BE500F5F0E517 +:1010C0000DA4E5F0F501E50BF5F0E50A35F0F50ABC +:1010D000750900C3C3750000E509F5F0E50E35F0AC +:1010E000F50EE50AF5F0E50F35F0F50FC3750900CB +:1010F000750A00C3C3750000E509F5F0E50E35F08B +:10110000F50EE50AF5F0E50F35F0F50FC3750900AA +:10111000750A00C3C3750000E509F5F0E50E35F06A +:10112000F50EE50AF5F0E50F35F0F50FC375000093 +:10113000E50EF5F0E51035F0F500E50FF5F0E511F9 +:1011400035F0F50B750A6F750900C3750100E509E7 +:10115000F5F0E50035F0F500E501F5F0E50B35F0CB +:10116000F501E50AF503E501F502E500F582E50282 +:10117000F583E503F0E506F50AE507F50175090ACB +:10118000C3750000E509F5F0E50A35F0F510E50056 +:10119000F5F0E50135F0F511750003750100750CEA +:1011A00001750D00750E00750F00C3750900E5008F +:1011B000F5F0E50CA4F50BE500F5F0E50CA4E5F081 +:1011C000F50AE50BF5F0E50935F0F509E501F5F06F +:1011D000E50CA4F50BE501F5F0E50CA4E5F0F5014F +:1011E000E50BF5F0E50A35F0F50AC3C3750100E536 +:1011F00009F5F0E50E35F0F50EE50AF5F0E50F35E9 +:10120000F0F50FC3750A00E500F5F0E50DA4F50B48 +:10121000E500F5F0E50DA4E5F0F501E50BF5F0E5E9 +:101220000A35F0F50A750900C3C3750000E509F534 +:10123000F0E50E35F0F50EE50AF5F0E50F35F0F5C1 +:101240000FC3750900750A00C3C3750000E509F5F1 +:10125000F0E50E35F0F50EE50AF5F0E50F35F0F5A1 +:101260000FC3750900750A00C3C3750000E509F5D1 +:10127000F0E50E35F0F50EE50AF5F0E50F35F0F581 +:101280000FC3750000E50EF5F0E51035F0F500E54B +:101290000FF5F0E51135F0F50B750A6F750900C310 +:1012A000750100E509F5F0E50035F0F500E501F51B +:1012B000F0E50B35F0F501E50AF503E501F502E58A +:1012C00000F582E502F583E503F0E506F50AE5079A +:1012D000F50175090AC3750000E509F5F0E50A3561 +:1012E000F0F510E500F5F0E50135F0F511750004B5 +:1012F000750100750C01750D00750E00750F00C3AA +:10130000750900E500F5F0E50CA4F50BE500F5F036 +:10131000E50CA4E5F0F50AE50BF5F0E50935F0F587 +:1013200009E501F5F0E50CA4F50BE501F5F0E50C98 +:10133000A4E5F0F501E50BF5F0E50A35F0F50AC393 +:10134000C3750100E509F5F0E50E35F0F50EE50A87 +:10135000F5F0E50F35F0F50FC3750A00E500F5F07F +:10136000E50DA4F50BE500F5F0E50DA4E5F0F501BC +:10137000E50BF5F0E50A35F0F50A750900C3C3750C +:101380000000E509F5F0E50E35F0F50EE50AF5F09B +:10139000E50F35F0F50FC3750900750A00C3C37575 +:1013A0000000E509F5F0E50E35F0F50EE50AF5F07B +:1013B000E50F35F0F50FC3750900750A00C3C37555 +:1013C0000000E509F5F0E50E35F0F50EE50AF5F05B +:1013D000E50F35F0F50FC3750000E50EF5F0E510EB +:1013E00035F0F500E50FF5F0E51135F0F50B750A70 +:1013F00000750900C3750100E509F5F0E50035F059 +:10140000F500E501F5F0E50B35F0F501E50AF5032A +:10141000E501F502E500F582E502F583E503F0E577 +:1014200006F50AE507F50175090FC3750000E50922 +:10143000F5F0E50A35F0F510E500F5F0E50135F0D9 +:10144000F511750000750100750C01750D00750E24 +:1014500000750F00C3750900E500F5F0E50CA4F573 +:101460000BE500F5F0E50CA4E5F0F50AE50BF5F069 +:10147000E50935F0F509E501F5F0E50CA4F50BE516 +:1014800001F5F0E50CA4E5F0F501E50BF5F0E50A52 +:1014900035F0F50AC3C3750100E509F5F0E50E3531 +:1014A000F0F50EE50AF5F0E50F35F0F50FC3750A16 +:1014B00000E500F5F0E50DA4F50BE500F5F0E50D10 +:1014C000A4E5F0F501E50BF5F0E50A35F0F50A7550 +:1014D0000900C3C3750000E509F5F0E50E35F0F528 +:1014E0000EE50AF5F0E50F35F0F50FC37509007547 +:1014F0000A00C3C3750000E509F5F0E50E35F0F507 +:101500000EE50AF5F0E50F35F0F50FC37509007526 +:101510000A00C3C3750000E509F5F0E50E35F0F5E6 +:101520000EE50AF5F0E50F35F0F50FC3750000E59F +:101530000EF5F0E51035F0F500E50FF5F0E51135A5 +:10154000F0F50B750A2E750900C3750100E509F564 +:10155000F0E50035F0F500E501F5F0E50B35F0F5C7 +:1015600001E50AF503E501F502E500F582E502F57E +:1015700083E503F0E506F50AE507F50175090FC3F4 +:10158000750000E509F5F0E50A35F0F510E500F520 +:10159000F0E50135F0F511750001750100750C01DC +:1015A000750D00750E00750F00C3750900E500F597 +:1015B000F0E50CA4F50BE500F5F0E50CA4E5F0F57D +:1015C0000AE50BF5F0E50935F0F509E501F5F0E57B +:1015D0000CA4F50BE501F5F0E50CA4E5F0F501E54B +:1015E0000BF5F0E50A35F0F50AC3C3750100E5090E +:1015F000F5F0E50E35F0F50EE50AF5F0E50F35F0FE +:10160000F50FC3750A00E500F5F0E50DA4F50BE54F +:1016100000F5F0E50DA4E5F0F501E50BF5F0E50AC0 +:1016200035F0F50A750900C3C3750000E509F5F04A +:10163000E50E35F0F50EE50AF5F0E50F35F0F50F9E +:10164000C3750900750A00C3C3750000E509F5F00C +:10165000E50E35F0F50EE50AF5F0E50F35F0F50F7E +:10166000C3750900750A00C3C3750000E509F5F0EC +:10167000E50E35F0F50EE50AF5F0E50F35F0F50F5E +:10168000C3750000E50EF5F0E51035F0F500E50F47 +:10169000F5F0E51135F0F50B750A66750900C375AF +:1016A0000100E509F5F0E50035F0F500E501F5F09C +:1016B000E50B35F0F501E50AF503E501F502E50076 +:1016C000F582E502F583E503F0E506F50AE507F5A1 +:1016D0000175090FC3750000E509F5F0E50A35F05D +:1016E000F510E500F5F0E50135F0F511750002752E +:1016F0000100750C01750D00750E00750F00C375A6 +:101700000900E500F5F0E50CA4F50BE500F5F0E5C2 +:101710000CA4E5F0F50AE50BF5F0E50935F0F5095F +:10172000E501F5F0E50CA4F50BE501F5F0E50CA4F9 +:10173000E5F0F501E50BF5F0E50A35F0F50AC3C370 +:10174000750100E509F5F0E50E35F0F50EE50AF551 +:10175000F0E50F35F0F50FC3750A00E500F5F0E58B +:101760000DA4F50BE500F5F0E50DA4E5F0F501E5B8 +:101770000BF5F0E50A35F0F50A750900C3C37500ED +:1017800000E509F5F0E50E35F0F50EE50AF5F0E5B2 +:101790000F35F0F50FC3750900750A00C3C3750056 +:1017A00000E509F5F0E50E35F0F50EE50AF5F0E592 +:1017B0000F35F0F50FC3750900750A00C3C3750036 +:1017C00000E509F5F0E50E35F0F50EE50AF5F0E572 +:1017D0000F35F0F50FC3750000E50EF5F0E5103597 +:1017E000F0F500E50FF5F0E51135F0F50B750A6F32 +:1017F000750900C3750100E509F5F0E50035F0F560 +:1018000000E501F5F0E50B35F0F501E50AF503E536 +:1018100001F502E500F582E502F583E503F0E50652 +:10182000F50AE507F50175090FC3750000E509F52F +:10183000F0E50A35F0F510E500F5F0E50135F0F5D5 +:1018400011750003750100750C01750D00750E0012 +:10185000750F00C3750900E500F5F0E50CA4F50B64 +:10186000E500F5F0E50CA4E5F0F50AE50BF5F0E58B +:101870000935F0F509E501F5F0E50CA4F50BE501F6 +:10188000F5F0E50CA4E5F0F501E50BF5F0E50A351A +:10189000F0F50AC3C3750100E509F5F0E50E35F072 +:1018A000F50EE50AF5F0E50F35F0F50FC3750A0002 +:1018B000E500F5F0E50DA4F50BE500F5F0E50DA468 +:1018C000E5F0F501E50BF5F0E50A35F0F50A7509E7 +:1018D00000C3C3750000E509F5F0E50E35F0F50E1F +:1018E000E50AF5F0E50F35F0F50FC3750900750A47 +:1018F00000C3C3750000E509F5F0E50E35F0F50EFF +:10190000E50AF5F0E50F35F0F50FC3750900750A26 +:1019100000C3C3750000E509F5F0E50E35F0F50EDE +:10192000E50AF5F0E50F35F0F50FC3750000E50E9B +:10193000F5F0E51035F0F500E50FF5F0E51135F0BF +:10194000F50B750A6F750900C3750100E509F5F01F +:10195000E50035F0F500E501F5F0E50B35F0F501B2 +:10196000E50AF503E501F502E500F582E502F583F8 +:10197000E503F0E506F50AE507F50175090FC375FE +:101980000000E509F5F0E50A35F0F510E500F5F0A1 +:10199000E50135F0F511750004750100750C017550 +:1019A0000D00750E00750F00C3750900E500F5F018 +:1019B000E50CA4F50BE500F5F0E50CA4E5F0F50A5F +:1019C000E50BF5F0E50935F0F509E501F5F0E50C75 +:1019D000A4F50BE501F5F0E50CA4E5F0F501E50B48 +:1019E000F5F0E50A35F0F50AC3C3750100E509F520 +:1019F000F0E50E35F0F50EE50AF5F0E50F35F0F5FA +:101A00000FC3750A00E500F5F0E50DA4F50BE50040 +:101A1000F5F0E50DA4E5F0F501E50BF5F0E50A3587 +:101A2000F0F50A750900C3C3750000E509F5F0E596 +:101A30000E35F0F50EE50AF5F0E50F35F0F50FC3BC +:101A4000750900750A00C3C3750000E509F5F0E5E6 +:101A50000E35F0F50EE50AF5F0E50F35F0F50FC39C +:101A6000750900750A00C3C3750000E509F5F0E5C6 +:101A70000E35F0F50EE50AF5F0E50F35F0F50FC37C +:101A8000750000E50EF5F0E51035F0F500E50FF511 +:101A9000F0E51135F0F50B750A00750900C3750105 +:101AA00000E509F5F0E50035F0F500E501F5F0E5B4 +:101AB0000B35F0F501E50AF503E501F502E500F562 +:101AC00082E502F583E503F0E506F50AE507F50191 +:101AD000750914C3750000E509F5F0E50A35F0F560 +:101AE00010E500F5F0E50135F0F511750000750120 +:101AF00000750C01750D00750E00750F00C375099A +:101B000000E500F5F0E50CA4F50BE500F5F0E50CBB +:101B1000A4E5F0F50AE50BF5F0E50935F0F509E582 +:101B200001F5F0E50CA4F50BE501F5F0E50CA4E5F5 +:101B3000F0F501E50BF5F0E50A35F0F50AC3C375DC +:101B40000100E509F5F0E50E35F0F50EE50AF5F0D2 +:101B5000E50F35F0F50FC3750A00E500F5F0E50D6A +:101B6000A4F50BE500F5F0E50DA4E5F0F501E50BB6 +:101B7000F5F0E50A35F0F50A750900C3C3750000F4 +:101B8000E509F5F0E50E35F0F50EE50AF5F0E50F9F +:101B900035F0F50FC3750900750A00C3C375000061 +:101BA000E509F5F0E50E35F0F50EE50AF5F0E50F7F +:101BB00035F0F50FC3750900750A00C3C375000041 +:101BC000E509F5F0E50E35F0F50EE50AF5F0E50F5F +:101BD00035F0F50FC3750000E50EF5F0E51035F0B2 +:101BE000F500E50FF5F0E51135F0F50B750A2E75EA +:101BF0000900C3750100E509F5F0E50035F0F500D1 +:101C0000E501F5F0E50B35F0F501E50AF503E50131 +:101C1000F502E500F582E502F583E503F0E506F55A +:101C20000AE507F501750914C3750000E509F5F02B +:101C3000E50A35F0F510E500F5F0E50135F0F511B0 +:101C4000750001750100750C01750D00750E0075AC +:101C50000F00C3750900E500F5F0E50CA4F50BE5F0 +:101C600000F5F0E50CA4E5F0F50AE50BF5F0E50963 +:101C700035F0F509E501F5F0E50CA4F50BE501F506 +:101C8000F0E50CA4E5F0F501E50BF5F0E50A35F01B +:101C9000F50AC3C3750100E509F5F0E50E35F0F569 +:101CA0000EE50AF5F0E50F35F0F50FC3750A00E50E +:101CB00000F5F0E50DA4F50BE500F5F0E50DA4E564 +:101CC000F0F501E50BF5F0E50A35F0F50A750900C8 +:101CD000C3C3750000E509F5F0E50E35F0F50EE536 +:101CE0000AF5F0E50F35F0F50FC3750900750A0028 +:101CF000C3C3750000E509F5F0E50E35F0F50EE516 +:101D00000AF5F0E50F35F0F50FC3750900750A0007 +:101D1000C3C3750000E509F5F0E50E35F0F50EE5F5 +:101D20000AF5F0E50F35F0F50FC3750000E50EF587 +:101D3000F0E51035F0F500E50FF5F0E51135F0F5BB +:101D40000B750A2E750900C3750100E509F5F0E56C +:101D50000035F0F500E501F5F0E50B35F0F501E5AE +:101D60000AF503E501F502E500F582E502F583E5F4 +:101D700003F0E506F50AE507F501750914C37500DA +:101D800000E509F5F0E50A35F0F510E500F5F0E5B8 +:101D90000135F0F511750002750100750C01750D26 +:101DA00000750E00750F00C3750900E500F5F0E53C +:101DB0000CA4F50BE500F5F0E50CA4E5F0F50AE55B +:101DC0000BF5F0E50935F0F509E501F5F0E50CA4B2 +:101DD000F50BE501F5F0E50CA4E5F0F501E50BF5F3 +:101DE000F0E50A35F0F50AC3C3750100E509F5F021 +:101DF000E50E35F0F50EE50AF5F0E50F35F0F50FD7 +:101E0000C3750A00E500F5F0E50DA4F50BE500F556 +:101E1000F0E50DA4E5F0F501E50BF5F0E50A35F088 +:101E2000F50A750900C3C3750000E509F5F0E50E74 +:101E300035F0F50EE50AF5F0E50F35F0F50FC37551 +:101E40000900750A00C3C3750000E509F5F0E50E49 +:101E500035F0F50EE50AF5F0E50F35F0F50FC37531 +:101E60000900750A00C3C3750000E509F5F0E50E29 +:101E700035F0F50EE50AF5F0E50F35F0F50FC37511 +:101E80000000E50EF5F0E51035F0F500E50FF5F092 +:101E9000E51135F0F50B750A00750900C3750100F1 +:101EA000E509F5F0E50035F0F500E501F5F0E50BA5 +:101EB00035F0F501E50AF503E501F502E500F582E7 +:101EC000E502F583E503F0750000E500F502E500A5 +:101ED000F503E500F504E500F505E518F511E5194C +:101EE000F510E51BC0E0E51AC0E075E0172506F522 +:101EF0000675E0003507F507E502F582E503F58391 +:101F0000E504F500E505F5012200000000000000F1 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/concat.s.expected b/tests/GCCTestSuite/concat.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/concat.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/concat2.c b/tests/GCCTestSuite/concat2.c new file mode 100644 index 0000000..1e92400 --- /dev/null +++ b/tests/GCCTestSuite/concat2.c @@ -0,0 +1,16 @@ +/* PR c/3581 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +/* Intended as a compile-time test for string literal concatenation. + The fact that the string isn't actually used in the resulting program + should allow this to compile for any target. */ + +#define e0 "a" +#define e1 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 +#define e2 e1 e1 e1 e1 e1 e1 e1 e1 e1 e1 +#define e3 e2 e2 e2 e2 e2 e2 e2 e2 e2 e2 +#define e4 e3 e3 e3 e3 e3 e3 e3 e3 e3 e3 +#define e5 e4 e4 e4 e4 e4 e4 e4 e4 e4 e4 + +void foo() { (void)(e5); } diff --git a/tests/GCCTestSuite/concat2.c.expected b/tests/GCCTestSuite/concat2.c.expected new file mode 100644 index 0000000..1e92400 --- /dev/null +++ b/tests/GCCTestSuite/concat2.c.expected @@ -0,0 +1,16 @@ +/* PR c/3581 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +/* Intended as a compile-time test for string literal concatenation. + The fact that the string isn't actually used in the resulting program + should allow this to compile for any target. */ + +#define e0 "a" +#define e1 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 +#define e2 e1 e1 e1 e1 e1 e1 e1 e1 e1 e1 +#define e3 e2 e2 e2 e2 e2 e2 e2 e2 e2 e2 +#define e4 e3 e3 e3 e3 e3 e3 e3 e3 e3 e3 +#define e5 e4 e4 e4 e4 e4 e4 e4 e4 e4 e4 + +void foo() { (void)(e5); } diff --git a/tests/GCCTestSuite/concat2.hex.expected b/tests/GCCTestSuite/concat2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/concat2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/concat2.s.expected b/tests/GCCTestSuite/concat2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/concat2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/const-compare.c b/tests/GCCTestSuite/const-compare.c new file mode 100644 index 0000000..d9c1b77 --- /dev/null +++ b/tests/GCCTestSuite/const-compare.c @@ -0,0 +1,29 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-m64 -O1 -static" } */ +typedef unsigned long long uint64_t; + +static int +match(name, pat) + uint64_t *name, *pat; +{ + int ok=0, negate_range; + uint64_t c, k; + + c = *pat++; + switch (c & 0xffffffffffULL) { + case ((uint64_t)(('[')|0x8000000000ULL)): + if ((negate_range = ((*pat & 0xffffffffffULL) == ((uint64_t)(('!')|0x8000000000ULL)) )) != '\0') + ++pat; + while (((c = *pat++) & 0xffffffffffULL) ) + if ((*pat & 0xffffffffffULL) == ((uint64_t)(('-')|0x8000000000ULL))) + { + pat += 2; + } + + if (ok == negate_range) + return(0); + break; + } + return(*name == '\0'); +} + diff --git a/tests/GCCTestSuite/const-compare.c.expected b/tests/GCCTestSuite/const-compare.c.expected new file mode 100644 index 0000000..d9c1b77 --- /dev/null +++ b/tests/GCCTestSuite/const-compare.c.expected @@ -0,0 +1,29 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-m64 -O1 -static" } */ +typedef unsigned long long uint64_t; + +static int +match(name, pat) + uint64_t *name, *pat; +{ + int ok=0, negate_range; + uint64_t c, k; + + c = *pat++; + switch (c & 0xffffffffffULL) { + case ((uint64_t)(('[')|0x8000000000ULL)): + if ((negate_range = ((*pat & 0xffffffffffULL) == ((uint64_t)(('!')|0x8000000000ULL)) )) != '\0') + ++pat; + while (((c = *pat++) & 0xffffffffffULL) ) + if ((*pat & 0xffffffffffULL) == ((uint64_t)(('-')|0x8000000000ULL))) + { + pat += 2; + } + + if (ok == negate_range) + return(0); + break; + } + return(*name == '\0'); +} + diff --git a/tests/GCCTestSuite/const-compare.hex.expected b/tests/GCCTestSuite/const-compare.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/const-compare.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/const-compare.s.expected b/tests/GCCTestSuite/const-compare.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/const-compare.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/const-elim-2.c b/tests/GCCTestSuite/const-elim-2.c new file mode 100644 index 0000000..ce55ba1 --- /dev/null +++ b/tests/GCCTestSuite/const-elim-2.c @@ -0,0 +1,10 @@ +/* The string constant in this test case should be emitted exactly once. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "hi there" 1 } } */ + +static inline int returns_23() { return 23; } + +const char *test1(void) { if (returns_23()) return 0; return "hi there"; } +const char *test2(void) { return "hi there"; } +const char *test3(void) { return "hi there"; } diff --git a/tests/GCCTestSuite/const-elim-2.c.expected b/tests/GCCTestSuite/const-elim-2.c.expected new file mode 100644 index 0000000..ce55ba1 --- /dev/null +++ b/tests/GCCTestSuite/const-elim-2.c.expected @@ -0,0 +1,10 @@ +/* The string constant in this test case should be emitted exactly once. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "hi there" 1 } } */ + +static inline int returns_23() { return 23; } + +const char *test1(void) { if (returns_23()) return 0; return "hi there"; } +const char *test2(void) { return "hi there"; } +const char *test3(void) { return "hi there"; } diff --git a/tests/GCCTestSuite/conv-3.c b/tests/GCCTestSuite/conv-3.c new file mode 100644 index 0000000..3b4f430 --- /dev/null +++ b/tests/GCCTestSuite/conv-3.c @@ -0,0 +1,18 @@ +/* PR middle-end/19100 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (void); + +int test (int v) +{ + return ((signed char) (v ? 0x100 : 0)) ? 17 : 18; +} + +int main() +{ + if (test (2) != 18) + abort (); + return 0; +} + diff --git a/tests/GCCTestSuite/conv-3.c.expected b/tests/GCCTestSuite/conv-3.c.expected new file mode 100644 index 0000000..3b4f430 --- /dev/null +++ b/tests/GCCTestSuite/conv-3.c.expected @@ -0,0 +1,18 @@ +/* PR middle-end/19100 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (void); + +int test (int v) +{ + return ((signed char) (v ? 0x100 : 0)) ? 17 : 18; +} + +int main() +{ + if (test (2) != 18) + abort (); + return 0; +} + diff --git a/tests/GCCTestSuite/conv-3.hex.expected b/tests/GCCTestSuite/conv-3.hex.expected new file mode 100644 index 0000000..76ce44b --- /dev/null +++ b/tests/GCCTestSuite/conv-3.hex.expected @@ -0,0 +1,38 @@ +:1000000075812F7506FF7507FF1200D502000C00E1 +:1000100000E506758204C39582F506E50775830041 +:100020009583F507D0E0F500D0E0F509750100E50E +:100030001FF5F0E50145F0F501E51EF5F0E5014598 +:10004000F0F501E51DF5F0E50145F0F501E51CF5DC +:10005000F0E50145F0F501E501700280030200CEF4 +:1000600000750100750A00E501F5F0E50A45F0F5B7 +:100070000AE50A700280030200BE00750112750ACB +:1000800000750B00750C00E501F502E50AF503E5C6 +:100090000BF504E50CF505E509C0E0E500C0E075E9 +:1000A000E0042506F50675E0003507F507E502F5DD +:1000B00082E503F583E504F500E505F50122007509 +:1000C0000111750A00750B00750C000200870075A0 +:1000D000010002006400E506758202C39582F50600 +:1000E000E5077583009583F507D0E0F50875E00115 +:1000F0002506F58275E0003507F583E508F0D0E0C8 +:10010000F50875E0002506F58275E0003507F583F2 +:10011000E508F0751F02751E00751D00751C0012A4 +:100120000010E582F502E583F503E500F504E5013D +:10013000F505E502F50BE503F50CE504F50DE50520 +:10014000F50E750012750100750900750A00750F2E +:1001500000C3E500F5F0E50B95F0F500E500F5F0DE +:10016000E50F45F0F50FC3E501F5F0E50C95F0F569 +:1001700000E500F5F0E50F45F0F50FC3E509F5F0F2 +:10018000E50D95F0F500E500F5F0E50F45F0F50F0C +:10019000C3E50AF5F0E50E95F0F500E500F5F0E5AC +:1001A0000F45F0F50F750100750900750A0075001F +:1001B00000E50FF5F0E50045F0F500E501F5F0E5A7 +:1001C0000045F0F500E509F5F0E50045F0F500E53E +:1001D0000AF5F0E50045F0F500E500700280030245 +:1001E000024800750000750100750900750A00E5F8 +:1001F00000F502E501F503E509F504E50AF50575E5 +:10020000E0002506F58275E0003507F583E0F50886 +:10021000E508C0E075E0012506F58275E0003507C8 +:10022000F583E0F508E508C0E075E0022506F5066F +:1002300075E0003507F507E502F582E503F583E58E +:1002400004F500E505F50122000201E300000000CD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/conv-3.s.expected b/tests/GCCTestSuite/conv-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/conv-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/cris-peep2-andu1.c b/tests/GCCTestSuite/cris-peep2-andu1.c new file mode 100644 index 0000000..2e546e6 --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu1.c @@ -0,0 +1,42 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler-not "and.d " } } */ +/* { dg-final { scan-assembler-not "move.d " } } */ +/* { dg-final { scan-assembler "cLear.b" } } */ +/* { dg-final { scan-assembler "movu.b" } } */ +/* { dg-final { scan-assembler "and.b" } } */ +/* { dg-final { scan-assembler "movu.w" } } */ +/* { dg-final { scan-assembler "and.w" } } */ +/* { dg-final { scan-assembler "andq" } } */ +/* { dg-options "-O2" } */ + +/* Test the "andu" peephole2 trivially, memory operand. */ + +int +clearb (int x, int *y) +{ + return *y & 0xff00; +} + +int +andb (int x, int *y) +{ + return *y & 0x3f; +} + +int +andw (int x, int *y) +{ + return *y & 0xfff; +} + +int +andq (int x, int *y) +{ + return *y & 0xf0; +} + +int +andq2 (int x, int *y) +{ + return *y & 0xfff0; +} diff --git a/tests/GCCTestSuite/cris-peep2-andu1.c.expected b/tests/GCCTestSuite/cris-peep2-andu1.c.expected new file mode 100644 index 0000000..2e546e6 --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu1.c.expected @@ -0,0 +1,42 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler-not "and.d " } } */ +/* { dg-final { scan-assembler-not "move.d " } } */ +/* { dg-final { scan-assembler "cLear.b" } } */ +/* { dg-final { scan-assembler "movu.b" } } */ +/* { dg-final { scan-assembler "and.b" } } */ +/* { dg-final { scan-assembler "movu.w" } } */ +/* { dg-final { scan-assembler "and.w" } } */ +/* { dg-final { scan-assembler "andq" } } */ +/* { dg-options "-O2" } */ + +/* Test the "andu" peephole2 trivially, memory operand. */ + +int +clearb (int x, int *y) +{ + return *y & 0xff00; +} + +int +andb (int x, int *y) +{ + return *y & 0x3f; +} + +int +andw (int x, int *y) +{ + return *y & 0xfff; +} + +int +andq (int x, int *y) +{ + return *y & 0xf0; +} + +int +andq2 (int x, int *y) +{ + return *y & 0xfff0; +} diff --git a/tests/GCCTestSuite/cris-peep2-andu1.hex.expected b/tests/GCCTestSuite/cris-peep2-andu1.hex.expected new file mode 100644 index 0000000..4513d0c --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu1.hex.expected @@ -0,0 +1,103 @@ +:1000000000E506758206C39582F506E5077583004F +:100010009583F507D0E0F518D0E0F519E512F50F56 +:10002000E51BF501E51AF500E501F50A750900C3C0 +:10003000750100E509F5F0E50A35F0F509E501F58A +:10004000F0E50035F0F501E501F502E509F582E599 +:1000500002F583E0F50B750901C3750100E509F5AB +:10006000F0E50A35F0F509E501F5F0E50035F0F5C4 +:1000700001E501F502E509F582E502F583E0F50CFD +:10008000750902C3750100E509F5F0E50A35F0F5DB +:1000900009E501F5F0E50035F0F501E501F502E5CA +:1000A00009F582E502F583E0F50D750903C37501D5 +:1000B00000E509F5F0E50A35F0F509E501F5F0E5AB +:1000C0000035F0F501E501F502E509F582E502F5F7 +:1000D00083E0F50E7500007501FF750900750A00D3 +:1000E000C3E500F5F0E50B55F0F500E501F5F0E5A9 +:1000F0000C55F0F501E509F5F0E50D55F0F509E5CC +:100100000AF5F0E50E55F0F50AE500F502E501F512 +:1001100003E509F504E50AF505E50FF512E519C053 +:10012000E0E518C0E075E0062506F50675E0003547 +:1001300007F507E502F582E503F583E504F500E53B +:1001400005F5012200E506758206C39582F506E5F0 +:10015000077583009583F507D0E0F518D0E0F51911 +:10016000E512F50FE51BF501E51AF500E501F50AC5 +:10017000750900C3750100E509F5F0E50A35F0F5EC +:1001800009E501F5F0E50035F0F501E501F502E5D9 +:1001900009F582E502F583E0F50B750901C37501E8 +:1001A00000E509F5F0E50A35F0F509E501F5F0E5BA +:1001B0000035F0F501E501F502E509F582E502F506 +:1001C00083E0F50C750902C3750100E509F5F0E55A +:1001D0000A35F0F509E501F5F0E50035F0F501E542 +:1001E00001F502E509F582E502F583E0F50D7509F3 +:1001F00003C3750100E509F5F0E50A35F0F509E5F9 +:1002000001F5F0E50035F0F501E501F502E509F548 +:1002100082E502F583E0F50E75003F750100750972 +:1002200000750A00C3E500F5F0E50B55F0F500E5B3 +:1002300001F5F0E50C55F0F501E509F5F0E50D5592 +:10024000F0F509E50AF5F0E50E55F0F50AE500F5DB +:1002500002E501F503E509F504E50AF505E50FF505 +:1002600012E519C0E0E518C0E075E0062506F506C0 +:1002700075E0003507F507E502F582E503F583E54E +:1002800004F500E505F5012200E506758206C39533 +:1002900082F506E5077583009583F507D0E0F5182C +:1002A000D0E0F519E512F50FE51BF501E51AF500AB +:1002B000E501F50A750900C3750100E509F5F0E5EA +:1002C0000A35F0F509E501F5F0E50035F0F501E551 +:1002D00001F502E509F582E502F583E0F50B750904 +:1002E00001C3750100E509F5F0E50A35F0F509E50A +:1002F00001F5F0E50035F0F501E501F502E509F558 +:1003000082E502F583E0F50C750902C3750100E58D +:1003100009F5F0E50A35F0F509E501F5F0E50035F8 +:10032000F0F501E501F502E509F582E502F583E066 +:10033000F50D750903C3750100E509F5F0E50A350A +:10034000F0F509E501F5F0E50035F0F501E501F519 +:1003500002E509F582E502F583E0F50E7500FF750B +:10036000010F750900750A00C3E500F5F0E50B55AE +:10037000F0F500E501F5F0E50C55F0F501E509F5BE +:10038000F0E50D55F0F509E50AF5F0E50E55F0F547 +:100390000AE500F502E501F503E509F504E50AF5CE +:1003A00005E50FF512E519C0E0E518C0E075E006B7 +:1003B0002506F50675E0003507F507E502F582E547 +:1003C00003F583E504F500E505F5012200E5067572 +:1003D0008206C39582F506E5077583009583F507C8 +:1003E000D0E0F518D0E0F519E512F50FE51BF501A1 +:1003F000E51AF500E501F50A750900C3750100E588 +:1004000009F5F0E50A35F0F509E501F5F0E5003507 +:10041000F0F501E501F502E509F582E502F583E075 +:10042000F50B750901C3750100E509F5F0E50A351D +:10043000F0F509E501F5F0E50035F0F501E501F528 +:1004400002E509F582E502F583E0F50C750902C3C2 +:10045000750100E509F5F0E50A35F0F509E501F566 +:10046000F0E50035F0F501E501F502E509F582E575 +:1004700002F583E0F50D750903C3750100E509F583 +:10048000F0E50A35F0F509E501F5F0E50035F0F5A0 +:1004900001E501F502E509F582E502F583E0F50ED7 +:1004A0007500F0750100750900750A00C3E500F5D7 +:1004B000F0E50B55F0F500E501F5F0E50C55F0F52C +:1004C00001E509F5F0E50D55F0F509E50AF5F0E56A +:1004D0000E55F0F50AE500F502E501F503E509F52D +:1004E00004E50AF505E50FF512E519C0E0E518C0C9 +:1004F000E075E0062506F50675E0003507F507E529 +:1005000002F582E503F583E504F500E505F5012232 +:1005100000E506758206C39582F506E5077583003A +:100520009583F507D0E0F518D0E0F519E512F50F41 +:10053000E51BF501E51AF500E501F50A750900C3AB +:10054000750100E509F5F0E50A35F0F509E501F575 +:10055000F0E50035F0F501E501F502E509F582E584 +:1005600002F583E0F50B750901C3750100E509F596 +:10057000F0E50A35F0F509E501F5F0E50035F0F5AF +:1005800001E501F502E509F582E502F583E0F50CE8 +:10059000750902C3750100E509F5F0E50A35F0F5C6 +:1005A00009E501F5F0E50035F0F501E501F502E5B5 +:1005B00009F582E502F583E0F50D750903C37501C0 +:1005C00000E509F5F0E50A35F0F509E501F5F0E596 +:1005D0000035F0F501E501F502E509F582E502F5E2 +:1005E00083E0F50E7500F07501FF750900750A00CE +:1005F000C3E500F5F0E50B55F0F500E501F5F0E594 +:100600000C55F0F501E509F5F0E50D55F0F509E5B6 +:100610000AF5F0E50E55F0F50AE500F502E501F5FD +:1006200003E509F504E50AF505E50FF512E519C03E +:10063000E0E518C0E075E0062506F50675E0003532 +:1006400007F507E502F582E503F583E504F500E526 +:1006500005F501220000000000000000000000007D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/cris-peep2-andu1.s.expected b/tests/GCCTestSuite/cris-peep2-andu1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/cris-peep2-andu2.c b/tests/GCCTestSuite/cris-peep2-andu2.c new file mode 100644 index 0000000..4f687cc --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu2.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "movu.w \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "and.w 2047,\\\$r" } } */ +/* { dg-final { scan-assembler-not "move.d \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "movu.b \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "and.b 95,\\\$r" } } */ +/* { dg-final { scan-assembler "andq -2,\\\$r" } } */ +/* { dg-options "-O2" } */ + +/* Test the "andu" peephole2 trivially, register operand. */ + +unsigned int +and_peep2_hi (unsigned int y, unsigned int *x) +{ + *x = y & 0x7ff; + return y; +} + +unsigned int +and_peep2_qi (unsigned int y, unsigned int *x) +{ + *x = y & 0x5f; + return y; +} + + +unsigned int +and_peep2_q (unsigned int y, unsigned int *x) +{ + *x = y & 0xfe; + return y; +} diff --git a/tests/GCCTestSuite/cris-peep2-andu2.c.expected b/tests/GCCTestSuite/cris-peep2-andu2.c.expected new file mode 100644 index 0000000..4f687cc --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu2.c.expected @@ -0,0 +1,32 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "movu.w \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "and.w 2047,\\\$r" } } */ +/* { dg-final { scan-assembler-not "move.d \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "movu.b \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "and.b 95,\\\$r" } } */ +/* { dg-final { scan-assembler "andq -2,\\\$r" } } */ +/* { dg-options "-O2" } */ + +/* Test the "andu" peephole2 trivially, register operand. */ + +unsigned int +and_peep2_hi (unsigned int y, unsigned int *x) +{ + *x = y & 0x7ff; + return y; +} + +unsigned int +and_peep2_qi (unsigned int y, unsigned int *x) +{ + *x = y & 0x5f; + return y; +} + + +unsigned int +and_peep2_q (unsigned int y, unsigned int *x) +{ + *x = y & 0xfe; + return y; +} diff --git a/tests/GCCTestSuite/cris-peep2-andu2.hex.expected b/tests/GCCTestSuite/cris-peep2-andu2.hex.expected new file mode 100644 index 0000000..81a78f0 --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu2.hex.expected @@ -0,0 +1,66 @@ +:1000000000E506758206C39582F506E5077583004F +:100010009583F507D0E0F518D0E0F519E516F50D54 +:10002000E515F50EE514F50F7509FF750A0775015D +:1000300000750000C3E509F5F0E51F55F0F509E589 +:100040000AF5F0E51E55F0F50AE501F5F0E51D5558 +:10005000F0F50BE500F5F0E51C55F0F50C75010029 +:10006000C3750000E501F5F0E51B35F0F501E5008D +:10007000F5F0E51A35F0F500E509F503E500F502C0 +:10008000E501F582E502F583E503F0750101C3752D +:100090000000E501F5F0E51B35F0F501E500F5F0B0 +:1000A000E51A35F0F500E50AF503E500F502E5018E +:1000B000F582E502F583E503F0750102C3750000E2 +:1000C000E501F5F0E51B35F0F501E500F5F0E51A81 +:1000D00035F0F500E50BF503E500F502E501F582E5 +:1000E000E502F583E503F0750103C3750000E50142 +:1000F000F5F0E51B35F0F501E500F5F0E51A35F012 +:10010000F500E50CF503E500F502E501F582E502F1 +:10011000F583E503F0E51FF502E51EF503E51DF5A2 +:1001200004E51CF505E50DF516E50EF515E50FF5ED +:1001300014E519C0E0E518C0E075E0062506F506EF +:1001400075E0003507F507E502F582E503F583E57F +:1001500004F500E505F5012200E506758206C39564 +:1001600082F506E5077583009583F507D0E0F5185D +:10017000D0E0F519E516F50DE515F50EE514F50FCA +:1001800075095F750A00750100750000C3E509F582 +:10019000F0E51F55F0F509E50AF5F0E51E55F0F517 +:1001A0000AE501F5F0E51D55F0F50BE500F5F0E584 +:1001B0001C55F0F50C750100C3750000E501F5F064 +:1001C000E51B35F0F501E500F5F0E51A35F0F50031 +:1001D000E509F503E500F502E501F582E502F583A1 +:1001E000E503F0750101C3750000E501F5F0E51BBD +:1001F00035F0F501E500F5F0E51A35F0F500E50A12 +:10020000F503E500F502E501F582E502F583E50376 +:10021000F0750102C3750000E501F5F0E51B35F04E +:10022000F501E500F5F0E51A35F0F500E50BF5030D +:10023000E500F502E501F582E502F583E503F075D9 +:100240000103C3750000E501F5F0E51B35F0F5018C +:10025000E500F5F0E51A35F0F500E50CF503E500ED +:10026000F502E501F582E502F583E503F0E51FF50A +:1002700002E51EF503E51DF504E51CF505E50DF5A4 +:1002800016E50EF515E50FF514E519C0E0E518C003 +:10029000E075E0062506F50675E0003507F507E58B +:1002A00002F582E503F583E504F500E505F5012295 +:1002B00000E506758206C39582F506E5077583009D +:1002C0009583F507D0E0F518D0E0F519E516F50DA2 +:1002D000E515F50EE514F50F7509FE750A007501B3 +:1002E00000750000C3E509F5F0E51F55F0F509E5D7 +:1002F0000AF5F0E51E55F0F50AE501F5F0E51D55A6 +:10030000F0F50BE500F5F0E51C55F0F50C75010076 +:10031000C3750000E501F5F0E51B35F0F501E500DA +:10032000F5F0E51A35F0F500E509F503E500F5020D +:10033000E501F582E502F583E503F0750101C3757A +:100340000000E501F5F0E51B35F0F501E500F5F0FD +:10035000E51A35F0F500E50AF503E500F502E501DB +:10036000F582E502F583E503F0750102C37500002F +:10037000E501F5F0E51B35F0F501E500F5F0E51ACE +:1003800035F0F500E50BF503E500F502E501F58232 +:10039000E502F583E503F0750103C3750000E5018F +:1003A000F5F0E51B35F0F501E500F5F0E51A35F05F +:1003B000F500E50CF503E500F502E501F582E5023F +:1003C000F583E503F0E51FF502E51EF503E51DF5F0 +:1003D00004E51CF505E50DF516E50EF515E50FF53B +:1003E00014E519C0E0E518C0E075E0062506F5063D +:1003F00075E0003507F507E502F582E503F583E5CD +:1004000004F500E505F501220000000000000000F1 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/cris-peep2-andu2.s.expected b/tests/GCCTestSuite/cris-peep2-andu2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-andu2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/cris-peep2-xsrand.c b/tests/GCCTestSuite/cris-peep2-xsrand.c new file mode 100644 index 0000000..9cfe40f --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-xsrand.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "and.w " } } */ +/* { dg-final { scan-assembler "and.b " } } */ +/* { dg-final { scan-assembler-not "and.d" } } */ +/* { dg-options "-O2" } */ + +/* Test the "asrandb", "asrandw", "lsrandb" and "lsrandw" peephole2:s + trivially. */ + +unsigned int +andwlsr (unsigned int x) +{ + return (x >> 17) & 0x7ff; +} + +unsigned int +andblsr (unsigned int x) +{ + return (x >> 25) & 0x5f; +} + +int +andwasr (int x) +{ + return (x >> 17) & 0x7ff; +} + +int +andbasr (int x) +{ + return (x >> 25) & 0x5f; +} diff --git a/tests/GCCTestSuite/cris-peep2-xsrand.c.expected b/tests/GCCTestSuite/cris-peep2-xsrand.c.expected new file mode 100644 index 0000000..9cfe40f --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-xsrand.c.expected @@ -0,0 +1,32 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "and.w " } } */ +/* { dg-final { scan-assembler "and.b " } } */ +/* { dg-final { scan-assembler-not "and.d" } } */ +/* { dg-options "-O2" } */ + +/* Test the "asrandb", "asrandw", "lsrandb" and "lsrandw" peephole2:s + trivially. */ + +unsigned int +andwlsr (unsigned int x) +{ + return (x >> 17) & 0x7ff; +} + +unsigned int +andblsr (unsigned int x) +{ + return (x >> 25) & 0x5f; +} + +int +andwasr (int x) +{ + return (x >> 17) & 0x7ff; +} + +int +andbasr (int x) +{ + return (x >> 25) & 0x5f; +} diff --git a/tests/GCCTestSuite/cris-peep2-xsrand2.c b/tests/GCCTestSuite/cris-peep2-xsrand2.c new file mode 100644 index 0000000..30679b2 --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-xsrand2.c @@ -0,0 +1,34 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "and.w -137," } } */ +/* { dg-final { scan-assembler "and.b -64," } } */ +/* { dg-final { scan-assembler "and.w -139," } } */ +/* { dg-final { scan-assembler "and.b -63," } } */ +/* { dg-final { scan-assembler-not "and.d" } } */ +/* { dg-options "-O2" } */ + +/* PR target/17984. Test-case based on + testsuite/gcc.dg/cris-peep2-xsrand.c. */ + +unsigned int +andwlsr (unsigned int x) +{ + return (x >> 16) & 0xff77; +} + +unsigned int +andblsr (unsigned int x) +{ + return (x >> 24) & 0xc0; +} + +int +andwasr (int x) +{ + return (x >> 16) & 0xff75; +} + +int +andbasr (int x) +{ + return (x >> 24) & 0xc1; +} diff --git a/tests/GCCTestSuite/cris-peep2-xsrand2.c.expected b/tests/GCCTestSuite/cris-peep2-xsrand2.c.expected new file mode 100644 index 0000000..30679b2 --- /dev/null +++ b/tests/GCCTestSuite/cris-peep2-xsrand2.c.expected @@ -0,0 +1,34 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "and.w -137," } } */ +/* { dg-final { scan-assembler "and.b -64," } } */ +/* { dg-final { scan-assembler "and.w -139," } } */ +/* { dg-final { scan-assembler "and.b -63," } } */ +/* { dg-final { scan-assembler-not "and.d" } } */ +/* { dg-options "-O2" } */ + +/* PR target/17984. Test-case based on + testsuite/gcc.dg/cris-peep2-xsrand.c. */ + +unsigned int +andwlsr (unsigned int x) +{ + return (x >> 16) & 0xff77; +} + +unsigned int +andblsr (unsigned int x) +{ + return (x >> 24) & 0xc0; +} + +int +andwasr (int x) +{ + return (x >> 16) & 0xff75; +} + +int +andbasr (int x) +{ + return (x >> 24) & 0xc1; +} diff --git a/tests/GCCTestSuite/darwin-20040809-2.c b/tests/GCCTestSuite/darwin-20040809-2.c new file mode 100644 index 0000000..5ed27a4 --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040809-2.c @@ -0,0 +1,15 @@ +/* Test dead code strip support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-g -fno-eliminate-unused-debug-symbols" } */ + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler ".stabd.46,0,0" } } */ +/* { dg-final { scan-assembler ".stabd.78,0,0" } } */ + diff --git a/tests/GCCTestSuite/darwin-20040809-2.c.expected b/tests/GCCTestSuite/darwin-20040809-2.c.expected new file mode 100644 index 0000000..5ed27a4 --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040809-2.c.expected @@ -0,0 +1,15 @@ +/* Test dead code strip support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-g -fno-eliminate-unused-debug-symbols" } */ + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler ".stabd.46,0,0" } } */ +/* { dg-final { scan-assembler ".stabd.78,0,0" } } */ + diff --git a/tests/GCCTestSuite/darwin-20040809-2.hex.expected b/tests/GCCTestSuite/darwin-20040809-2.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040809-2.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-20040809-2.s.expected b/tests/GCCTestSuite/darwin-20040809-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040809-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-20040812-1.c b/tests/GCCTestSuite/darwin-20040812-1.c new file mode 100644 index 0000000..4ae8657 --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040812-1.c @@ -0,0 +1,24 @@ +/* Test dead code strip support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ + +const char my_version_string[] __attribute__((__used__)) + = "Do not remove this string\n"; + + static int + __attribute__((__used__)) + static_debug_routine() +{ + int i; + i = 42; +} + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler ".no_dead_strip _my_version_string" } } */ +/* { dg-final { scan-assembler ".no_dead_strip _static_debug_routine" } } */ diff --git a/tests/GCCTestSuite/darwin-20040812-1.c.expected b/tests/GCCTestSuite/darwin-20040812-1.c.expected new file mode 100644 index 0000000..4ae8657 --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040812-1.c.expected @@ -0,0 +1,24 @@ +/* Test dead code strip support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ + +const char my_version_string[] __attribute__((__used__)) + = "Do not remove this string\n"; + + static int + __attribute__((__used__)) + static_debug_routine() +{ + int i; + i = 42; +} + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler ".no_dead_strip _my_version_string" } } */ +/* { dg-final { scan-assembler ".no_dead_strip _static_debug_routine" } } */ diff --git a/tests/GCCTestSuite/darwin-20040812-1.hex.expected b/tests/GCCTestSuite/darwin-20040812-1.hex.expected new file mode 100644 index 0000000..f5a3444 --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040812-1.hex.expected @@ -0,0 +1,187 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F50CD0E0F50D900000E582F50A90F7 +:100020000000E583F50B750900750100C37500003C +:10003000E501F5F0E50935F0F500C3750100E500CF +:10004000F5F0E50A35F0F500E501F5F0E50B35F0E2 +:10005000F50B750A44750900C3750100E509F5F053 +:10006000E50035F0F500E501F5F0E50B35F0F501BB +:10007000E50AF503E501F502E500F582E502F58301 +:10008000E503F0900000E582F50A900000E583F5B5 +:100090000B750900750101C3750000E501F5F0E578 +:1000A0000935F0F500C3750100E500F5F0E50A3506 +:1000B000F0F500E501F5F0E50B35F0F50B750A6F8D +:1000C000750900C3750100E509F5F0E50035F0F5A7 +:1000D00000E501F5F0E50B35F0F501E50AF503E57E +:1000E00001F502E500F582E502F583E503F09000F5 +:1000F00000E582F50A900000E583F50B75090075AF +:100100000102C3750000E501F5F0E50935F0F500E1 +:10011000C3750100E500F5F0E50A35F0F500E501ED +:10012000F5F0E50B35F0F50B750A20750900C37580 +:100130000100E509F5F0E50035F0F500E501F5F021 +:10014000E50B35F0F501E50AF503E501F502E500FB +:10015000F582E502F583E503F0900000E582F50AFB +:10016000900000E583F50B750900750103C3750068 +:1001700000E501F5F0E50935F0F500C3750100E58E +:1001800000F5F0E50A35F0F500E501F5F0E50B3591 +:10019000F0F50B750A6E750900C3750100E509F5E8 +:1001A000F0E50035F0F500E501F5F0E50B35F0F58B +:1001B00001E50AF503E501F502E500F582E502F542 +:1001C00083E503F0900000E582F50A900000E583E6 +:1001D000F50B750900750104C3750000E501F5F024 +:1001E000E50935F0F500C3750100E500F5F0E50A15 +:1001F00035F0F500E501F5F0E50B35F0F50B750A86 +:100200006F750900C3750100E509F5F0E50035F0EB +:10021000F500E501F5F0E50B35F0F501E50AF5032C +:10022000E501F502E500F582E502F583E503F090CE +:100230000000E582F50A900000E583F50B750900E2 +:10024000750105C3750000E501F5F0E50935F0F528 +:1002500000C3750100E500F5F0E50A35F0F500E5AD +:1002600001F5F0E50B35F0F50B750A74750900C35F +:10027000750100E509F5F0E50035F0F500E501F55B +:10028000F0E50B35F0F501E50AF503E501F502E5CA +:1002900000F582E502F583E503F0900000E582F5C4 +:1002A0000A900000E583F50B750900750106C3751A +:1002B0000000E501F5F0E50935F0F500C375010032 +:1002C000E500F5F0E50A35F0F500E501F5F0E50BA0 +:1002D00035F0F50B750A20750900C3750100E509B5 +:1002E000F5F0E50035F0F500E501F5F0E50B35F04A +:1002F000F501E50AF503E501F502E500F582E50201 +:10030000F583E503F0900000E582F50A900000E532 +:1003100083F50B750900750107C3750000E501F54C +:10032000F0E50935F0F500C3750100E500F5F0E5ED +:100330000A35F0F500E501F5F0E50B35F0F50B7544 +:100340000A72750900C3750100E509F5F0E500358D +:10035000F0F500E501F5F0E50B35F0F501E50AF5FE +:1003600003E501F502E500F582E502F583E503F01A +:10037000900000E582F50A900000E583F50B750911 +:1003800000750108C3750000E501F5F0E50935F0D9 +:10039000F500C3750100E500F5F0E50A35F0F5005C +:1003A000E501F5F0E50B35F0F50B750A657509000B +:1003B000C3750100E509F5F0E50035F0F500E5014C +:1003C000F5F0E50B35F0F501E50AF503E501F50279 +:1003D000E500F582E502F583E503F0900000E58293 +:1003E000F50A900000E583F50B750900750109C356 +:1003F000750000E501F5F0E50935F0F500C375017C +:1004000000E500F5F0E50A35F0F500E501F5F0E569 +:100410000B35F0F50B750A6D750900C3750100E524 +:1004200009F5F0E50035F0F500E501F5F0E50B35EF +:10043000F0F501E50AF503E501F502E500F582E5D1 +:1004400002F583E503F0900000E582F50A900000D4 +:10045000E583F50B75090075010AC3750000E50118 +:10046000F5F0E50935F0F500C3750100E500F5F09C +:10047000E50A35F0F500E501F5F0E50B35F0F50B93 +:10048000750A6F750900C3750100E509F5F0E5000F +:1004900035F0F500E501F5F0E50B35F0F501E50A7D +:1004A000F503E501F502E500F582E502F583E503D4 +:1004B000F0900000E582F50A900000E583F50B75E9 +:1004C000090075010BC3750000E501F5F0E509357C +:1004D000F0F500C3750100E500F5F0E50A35F0F52B +:1004E00000E501F5F0E50B35F0F50B750A767509B9 +:1004F00000C3750100E509F5F0E50035F0F500E50C +:1005000001F5F0E50B35F0F501E50AF503E501F538 +:1005100002E500F582E502F583E503F0900000E5D1 +:1005200082F50A900000E583F50B75090075010C52 +:10053000C3750000E501F5F0E50935F0F500C37578 +:100540000100E500F5F0E50A35F0F500E501F5F00C +:10055000E50B35F0F50B750A65750900C3750100EB +:10056000E509F5F0E50035F0F500E501F5F0E50BFE +:1005700035F0F501E50AF503E501F502E500F58240 +:10058000E502F583E503F0900000E582F50A9000AE +:1005900000E583F50B75090075010DC3750000E5D5 +:1005A00001F5F0E50935F0F500C3750100E500F54A +:1005B000F0E50A35F0F500E501F5F0E50B35F0F56D +:1005C0000B750A20750900C3750100E509F5F0E512 +:1005D0000035F0F500E501F5F0E50B35F0F501E546 +:1005E0000AF503E501F502E500F582E502F583E58C +:1005F00003F0900000E582F50A900000E583F50B1A +:1006000075090075010EC3750000E501F5F0E509F7 +:1006100035F0F500C3750100E500F5F0E50A35F0A9 +:10062000F500E501F5F0E50B35F0F50B750A74758D +:100630000900C3750100E509F5F0E50035F0F500A6 +:10064000E501F5F0E50B35F0F501E50AF503E50107 +:10065000F502E500F582E502F583E503F090000080 +:10066000E582F50A900000E583F50B750900750138 +:100670000FC3750000E501F5F0E50935F0F500C39D +:10068000750100E500F5F0E50A35F0F500E501F546 +:10069000F0E50B35F0F50B750A68750900C37501B7 +:1006A00000E509F5F0E50035F0F500E501F5F0E5C8 +:1006B0000B35F0F501E50AF503E501F502E500F576 +:1006C00082E502F583E503F0900000E582F50A90EB +:1006D0000000E583F50B750900750110C375000076 +:1006E000E501F5F0E50935F0F500C3750100E50019 +:1006F000F5F0E50A35F0F500E501F5F0E50B35F02C +:10070000F50B750A69750900C3750100E509F5F077 +:10071000E50035F0F500E501F5F0E50B35F0F50104 +:10072000E50AF503E501F502E500F582E502F5834A +:10073000E503F0900000E582F50A900000E583F5FE +:100740000B750900750111C3750000E501F5F0E5B1 +:100750000935F0F500C3750100E500F5F0E50A354F +:10076000F0F500E501F5F0E50B35F0F50B750A73D2 +:10077000750900C3750100E509F5F0E50035F0F5F0 +:1007800000E501F5F0E50B35F0F501E50AF503E5C7 +:1007900001F502E500F582E502F583E503F090003E +:1007A00000E582F50A900000E583F50B75090075F8 +:1007B0000112C3750000E501F5F0E50935F0F5001B +:1007C000C3750100E500F5F0E50A35F0F500E50137 +:1007D000F5F0E50B35F0F50B750A20750900C375CA +:1007E0000100E509F5F0E50035F0F500E501F5F06B +:1007F000E50B35F0F501E50AF503E501F502E50045 +:10080000F582E502F583E503F0900000E582F50A44 +:10081000900000E583F50B750900750113C37500A1 +:1008200000E501F5F0E50935F0F500C3750100E5D7 +:1008300000F5F0E50A35F0F500E501F5F0E50B35DA +:10084000F0F50B750A73750900C3750100E509F52C +:10085000F0E50035F0F500E501F5F0E50B35F0F5D4 +:1008600001E50AF503E501F502E500F582E502F58B +:1008700083E503F0900000E582F50A900000E5832F +:10088000F50B750900750114C3750000E501F5F05D +:10089000E50935F0F500C3750100E500F5F0E50A5E +:1008A00035F0F500E501F5F0E50B35F0F50B750ACF +:1008B00074750900C3750100E509F5F0E50035F030 +:1008C000F500E501F5F0E50B35F0F501E50AF50376 +:1008D000E501F502E500F582E502F583E503F09018 +:1008E0000000E582F50A900000E583F50B7509002C +:1008F000750115C3750000E501F5F0E50935F0F562 +:1009000000C3750100E500F5F0E50A35F0F500E5F6 +:1009100001F5F0E50B35F0F50B750A72750900C3AA +:10092000750100E509F5F0E50035F0F500E501F5A4 +:10093000F0E50B35F0F501E50AF503E501F502E513 +:1009400000F582E502F583E503F0900000E582F50D +:100950000A900000E583F50B750900750116C37553 +:100960000000E501F5F0E50935F0F500C37501007B +:10097000E500F5F0E50A35F0F500E501F5F0E50BE9 +:1009800035F0F50B750A69750900C3750100E509B5 +:10099000F5F0E50035F0F500E501F5F0E50B35F093 +:1009A000F501E50AF503E501F502E500F582E5024A +:1009B000F583E503F0900000E582F50A900000E57C +:1009C00083F50B750900750117C3750000E501F586 +:1009D000F0E50935F0F500C3750100E500F5F0E537 +:1009E0000A35F0F500E501F5F0E50B35F0F50B758E +:1009F0000A6E750900C3750100E509F5F0E50035DB +:100A0000F0F500E501F5F0E50B35F0F501E50AF547 +:100A100003E501F502E500F582E502F583E503F063 +:100A2000900000E582F50A900000E583F50B75095A +:100A300000750118C3750000E501F5F0E50935F012 +:100A4000F500C3750100E500F5F0E50A35F0F500A5 +:100A5000E501F5F0E50B35F0F50B750A6775090052 +:100A6000C3750100E509F5F0E50035F0F500E50195 +:100A7000F5F0E50B35F0F501E50AF503E501F502C2 +:100A8000E500F582E502F583E503F0900000E582DC +:100A9000F50A900000E583F50B750900750119C38F +:100AA000750000E501F5F0E50935F0F500C37501C5 +:100AB00000E500F5F0E50A35F0F500E501F5F0E5B3 +:100AC0000B35F0F50B750A0A750900C3750100E5D1 +:100AD00009F5F0E50035F0F500E501F5F0E50B3539 +:100AE000F0F501E50AF503E501F502E500F582E51B +:100AF00002F583E503F0900000E582F50A9000001E +:100B0000E583F50B75090075011AC3750000E50151 +:100B1000F5F0E50935F0F500C3750100E500F5F0E5 +:100B2000E50A35F0F500E501F5F0E50B35F0F50BDC +:100B3000750A00750900C3750100E509F5F0E500C7 +:100B400035F0F500E501F5F0E50B35F0F501E50AC6 +:100B5000F503E501F502E500F582E502F583E5031D +:100B6000F0750000750100750900750A00E500F5D3 +:100B700002E501F503E509F504E50AF505E50DC013 +:100B8000E0E50CC0E0E502F582E503F583E504F558 +:100B900000E505F501220000000000000000000053 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-20040812-1.s.expected b/tests/GCCTestSuite/darwin-20040812-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-20040812-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-1.c b/tests/GCCTestSuite/darwin-ld-1.c new file mode 100644 index 0000000..6076157 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-1.c @@ -0,0 +1,11 @@ +/* Test Darwin linker option -all_load. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-all_load" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-1.c.expected b/tests/GCCTestSuite/darwin-ld-1.c.expected new file mode 100644 index 0000000..6076157 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-1.c.expected @@ -0,0 +1,11 @@ +/* Test Darwin linker option -all_load. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-all_load" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-1.hex.expected b/tests/GCCTestSuite/darwin-ld-1.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-1.s.expected b/tests/GCCTestSuite/darwin-ld-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-2.c b/tests/GCCTestSuite/darwin-ld-2.c new file mode 100644 index 0000000..33a9c86 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-2.c @@ -0,0 +1,11 @@ +/* Test Darwin linker option -bind_at_load. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-bind_at_load" } */ +/* { dg-do link { target powerpc-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-2.c.expected b/tests/GCCTestSuite/darwin-ld-2.c.expected new file mode 100644 index 0000000..33a9c86 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-2.c.expected @@ -0,0 +1,11 @@ +/* Test Darwin linker option -bind_at_load. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-bind_at_load" } */ +/* { dg-do link { target powerpc-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-2.hex.expected b/tests/GCCTestSuite/darwin-ld-2.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-2.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-2.s.expected b/tests/GCCTestSuite/darwin-ld-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040809-1.c b/tests/GCCTestSuite/darwin-ld-20040809-1.c new file mode 100644 index 0000000..c54a4aa --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-1.c @@ -0,0 +1,13 @@ +/* Test -dead_strip support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-dead_strip" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040809-1.c.expected b/tests/GCCTestSuite/darwin-ld-20040809-1.c.expected new file mode 100644 index 0000000..c54a4aa --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-1.c.expected @@ -0,0 +1,13 @@ +/* Test -dead_strip support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-dead_strip" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040809-1.hex.expected b/tests/GCCTestSuite/darwin-ld-20040809-1.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040809-1.s.expected b/tests/GCCTestSuite/darwin-ld-20040809-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040809-2.c b/tests/GCCTestSuite/darwin-ld-20040809-2.c new file mode 100644 index 0000000..73d788d --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-2.c @@ -0,0 +1,12 @@ +/* Test -no_dead_strip_inits_and_terms support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-no_dead_strip_inits_and_terms" } */ + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040809-2.c.expected b/tests/GCCTestSuite/darwin-ld-20040809-2.c.expected new file mode 100644 index 0000000..73d788d --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-2.c.expected @@ -0,0 +1,12 @@ +/* Test -no_dead_strip_inits_and_terms support. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-no_dead_strip_inits_and_terms" } */ + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040809-2.hex.expected b/tests/GCCTestSuite/darwin-ld-20040809-2.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-2.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040809-2.s.expected b/tests/GCCTestSuite/darwin-ld-20040809-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040809-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040828-1.c b/tests/GCCTestSuite/darwin-ld-20040828-1.c new file mode 100644 index 0000000..b90328b --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-1.c @@ -0,0 +1,13 @@ +/* Test -segaddr. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-segaddr __DATA 4000" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040828-1.c.expected b/tests/GCCTestSuite/darwin-ld-20040828-1.c.expected new file mode 100644 index 0000000..b90328b --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-1.c.expected @@ -0,0 +1,13 @@ +/* Test -segaddr. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-segaddr __DATA 4000" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040828-1.hex.expected b/tests/GCCTestSuite/darwin-ld-20040828-1.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040828-1.s.expected b/tests/GCCTestSuite/darwin-ld-20040828-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040828-2.c b/tests/GCCTestSuite/darwin-ld-20040828-2.c new file mode 100644 index 0000000..51f5ae8 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-2.c @@ -0,0 +1,13 @@ +/* Test -segs_read_only_addr. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-segs_read_only_addr 4000 -dynamiclib" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040828-2.c.expected b/tests/GCCTestSuite/darwin-ld-20040828-2.c.expected new file mode 100644 index 0000000..51f5ae8 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-2.c.expected @@ -0,0 +1,13 @@ +/* Test -segs_read_only_addr. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-segs_read_only_addr 4000 -dynamiclib" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040828-2.hex.expected b/tests/GCCTestSuite/darwin-ld-20040828-2.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-2.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040828-2.s.expected b/tests/GCCTestSuite/darwin-ld-20040828-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040828-3.c b/tests/GCCTestSuite/darwin-ld-20040828-3.c new file mode 100644 index 0000000..ca8928b --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-3.c @@ -0,0 +1,13 @@ +/* Test -segs_read_write_addr. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-segs_read_only_addr 4000 -segs_read_write_addr 8000 -dynamiclib" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040828-3.c.expected b/tests/GCCTestSuite/darwin-ld-20040828-3.c.expected new file mode 100644 index 0000000..ca8928b --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-3.c.expected @@ -0,0 +1,13 @@ +/* Test -segs_read_write_addr. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-segs_read_only_addr 4000 -segs_read_write_addr 8000 -dynamiclib" } */ + + +int +main () +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-20040828-3.hex.expected b/tests/GCCTestSuite/darwin-ld-20040828-3.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-3.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-20040828-3.s.expected b/tests/GCCTestSuite/darwin-ld-20040828-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-20040828-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-3.c b/tests/GCCTestSuite/darwin-ld-3.c new file mode 100644 index 0000000..e3efaca --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-3.c @@ -0,0 +1,12 @@ + +/* Test Darwin linker option -arch_errors_fatal. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-arch_errors_fatal" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-3.c.expected b/tests/GCCTestSuite/darwin-ld-3.c.expected new file mode 100644 index 0000000..e3efaca --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-3.c.expected @@ -0,0 +1,12 @@ + +/* Test Darwin linker option -arch_errors_fatal. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-arch_errors_fatal" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-3.hex.expected b/tests/GCCTestSuite/darwin-ld-3.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-3.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-3.s.expected b/tests/GCCTestSuite/darwin-ld-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-4.c b/tests/GCCTestSuite/darwin-ld-4.c new file mode 100644 index 0000000..35d1be4 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-4.c @@ -0,0 +1,11 @@ +/* Test Darwin linker option -bundle. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-bundle" } */ +/* { dg-do link { target powerpc-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-4.c.expected b/tests/GCCTestSuite/darwin-ld-4.c.expected new file mode 100644 index 0000000..35d1be4 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-4.c.expected @@ -0,0 +1,11 @@ +/* Test Darwin linker option -bundle. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-bundle" } */ +/* { dg-do link { target powerpc-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-4.hex.expected b/tests/GCCTestSuite/darwin-ld-4.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-4.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-4.s.expected b/tests/GCCTestSuite/darwin-ld-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-5.c b/tests/GCCTestSuite/darwin-ld-5.c new file mode 100644 index 0000000..0540f92 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-5.c @@ -0,0 +1,11 @@ +/* Test Darwin linker option -dynamic. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-dynamic" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-5.c.expected b/tests/GCCTestSuite/darwin-ld-5.c.expected new file mode 100644 index 0000000..0540f92 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-5.c.expected @@ -0,0 +1,11 @@ +/* Test Darwin linker option -dynamic. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-dynamic" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-5.hex.expected b/tests/GCCTestSuite/darwin-ld-5.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-5.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-5.s.expected b/tests/GCCTestSuite/darwin-ld-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-6.c b/tests/GCCTestSuite/darwin-ld-6.c new file mode 100644 index 0000000..e3985ea --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-6.c @@ -0,0 +1,11 @@ +/* Test Darwin linker option -nofixprebinding. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-nofixprebinding" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-6.c.expected b/tests/GCCTestSuite/darwin-ld-6.c.expected new file mode 100644 index 0000000..e3985ea --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-6.c.expected @@ -0,0 +1,11 @@ +/* Test Darwin linker option -nofixprebinding. */ +/* Developed by Devang Patel . */ + +/* { dg-options "-nofixprebinding" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-ld-6.hex.expected b/tests/GCCTestSuite/darwin-ld-6.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-6.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-ld-6.s.expected b/tests/GCCTestSuite/darwin-ld-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-ld-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-version-1.c b/tests/GCCTestSuite/darwin-version-1.c new file mode 100644 index 0000000..11cfcef --- /dev/null +++ b/tests/GCCTestSuite/darwin-version-1.c @@ -0,0 +1,10 @@ +/* Basic test of the -mmacosx-version-min option. */ + +/* { dg-options "-mmacosx-version-min=10.1" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-version-1.c.expected b/tests/GCCTestSuite/darwin-version-1.c.expected new file mode 100644 index 0000000..11cfcef --- /dev/null +++ b/tests/GCCTestSuite/darwin-version-1.c.expected @@ -0,0 +1,10 @@ +/* Basic test of the -mmacosx-version-min option. */ + +/* { dg-options "-mmacosx-version-min=10.1" } */ +/* { dg-do link { target *-*-darwin* } } */ + +int main() +{ + return 0; +} + diff --git a/tests/GCCTestSuite/darwin-version-1.hex.expected b/tests/GCCTestSuite/darwin-version-1.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/darwin-version-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-version-1.s.expected b/tests/GCCTestSuite/darwin-version-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-version-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-weakimport-1.c b/tests/GCCTestSuite/darwin-weakimport-1.c new file mode 100644 index 0000000..e74ccc9 --- /dev/null +++ b/tests/GCCTestSuite/darwin-weakimport-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-require-weak "" } */ +/* { dg-options "-fno-common" } */ + +/* { dg-final { scan-assembler "weak_reference _a" } } */ +/* { dg-final { scan-assembler-not "weak_\[a-z \t\]*_b" } } */ + +extern void a (void) __attribute__((weak_import)); +extern void b (void) __attribute__((weak_import)); + +void b(void) +{ + a(); +} diff --git a/tests/GCCTestSuite/darwin-weakimport-1.c.expected b/tests/GCCTestSuite/darwin-weakimport-1.c.expected new file mode 100644 index 0000000..e74ccc9 --- /dev/null +++ b/tests/GCCTestSuite/darwin-weakimport-1.c.expected @@ -0,0 +1,14 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-require-weak "" } */ +/* { dg-options "-fno-common" } */ + +/* { dg-final { scan-assembler "weak_reference _a" } } */ +/* { dg-final { scan-assembler-not "weak_\[a-z \t\]*_b" } } */ + +extern void a (void) __attribute__((weak_import)); +extern void b (void) __attribute__((weak_import)); + +void b(void) +{ + a(); +} diff --git a/tests/GCCTestSuite/darwin-weakimport-1.hex.expected b/tests/GCCTestSuite/darwin-weakimport-1.hex.expected new file mode 100644 index 0000000..0680eba --- /dev/null +++ b/tests/GCCTestSuite/darwin-weakimport-1.hex.expected @@ -0,0 +1,11 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040000000E500F502E500F503E500F504E50034 +:10005000F50575E0002506F58275E0003507F583A6 +:10006000E0F508E508C0E075E0012506F58275E0D9 +:10007000003507F583E0F508E508C0E075E00225E6 +:1000800006F50675E0003507F507E502F582E5039C +:10009000F583E504F500E505F50122000000000008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/darwin-weakimport-1.s.expected b/tests/GCCTestSuite/darwin-weakimport-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/darwin-weakimport-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/decl-4.c b/tests/GCCTestSuite/decl-4.c new file mode 100644 index 0000000..acc7e77 --- /dev/null +++ b/tests/GCCTestSuite/decl-4.c @@ -0,0 +1,10 @@ +/* Redeclaration of parameters is an error. PR 13728. */ +/* { dg-do compile } */ + +void f (int fred, /* { dg-error "previous definition" "" } */ + int fred); /* { dg-error "redefinition of parameter" "" } */ + +void f2 (int fred, /* { dg-error "previous definition" "" } */ + int fred) /* { dg-error "redefinition of parameter" "" } */ +{ +} diff --git a/tests/GCCTestSuite/decl-4.c.expected b/tests/GCCTestSuite/decl-4.c.expected new file mode 100644 index 0000000..acc7e77 --- /dev/null +++ b/tests/GCCTestSuite/decl-4.c.expected @@ -0,0 +1,10 @@ +/* Redeclaration of parameters is an error. PR 13728. */ +/* { dg-do compile } */ + +void f (int fred, /* { dg-error "previous definition" "" } */ + int fred); /* { dg-error "redefinition of parameter" "" } */ + +void f2 (int fred, /* { dg-error "previous definition" "" } */ + int fred) /* { dg-error "redefinition of parameter" "" } */ +{ +} diff --git a/tests/GCCTestSuite/decl-4.hex.expected b/tests/GCCTestSuite/decl-4.hex.expected new file mode 100644 index 0000000..c0498b1 --- /dev/null +++ b/tests/GCCTestSuite/decl-4.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0082506F50675E0C2 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F50122000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/decl-4.s.expected b/tests/GCCTestSuite/decl-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/decl-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/decl-6.c b/tests/GCCTestSuite/decl-6.c new file mode 100644 index 0000000..0fd45d3 --- /dev/null +++ b/tests/GCCTestSuite/decl-6.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +extern int var; + +int foo1(void) +{ + extern int var; + + var += 1; +} + +int foo2(void) +{ + var += 1; +} diff --git a/tests/GCCTestSuite/decl-6.c.expected b/tests/GCCTestSuite/decl-6.c.expected new file mode 100644 index 0000000..0fd45d3 --- /dev/null +++ b/tests/GCCTestSuite/decl-6.c.expected @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +extern int var; + +int foo1(void) +{ + extern int var; + + var += 1; +} + +int foo2(void) +{ + var += 1; +} diff --git a/tests/GCCTestSuite/decl-6.hex.expected b/tests/GCCTestSuite/decl-6.hex.expected new file mode 100644 index 0000000..1fc666e --- /dev/null +++ b/tests/GCCTestSuite/decl-6.hex.expected @@ -0,0 +1,63 @@ +:1000000000D0E0F519D0E0F51AE510F518900000E1 +:10001000E582F50F900000E583F510900000E58281 +:10002000F509900000E583F50A750100C37500002D +:10003000E501F5F0E50935F0F501E500F5F0E50A33 +:1000400035F0F500E500F502E501F582E502F583FE +:10005000E0F50B750101C3750000E501F5F0E50958 +:1000600035F0F501E500F5F0E50A35F0F500E500BD +:10007000F502E501F582E502F583E0F50C75010274 +:10008000C3750000E501F5F0E50935F0F501E5007F +:10009000F5F0E50A35F0F500E500F502E501F58239 +:1000A000E502F583E0F50D750103C3750000E50178 +:1000B000F5F0E50935F0F501E500F5F0E50A35F074 +:1000C000F500E500F502E501F582E502F583E0F5CE +:1000D0000E750001750100750900750A00C3751BD6 +:1000E00000E500F5F0E50B35F0F500E501F5F0E58C +:1000F0000C35F0F501E509F5F0E50D35F0F509E50C +:100100000AF5F0E50E35F0F50C750B00C3750A0025 +:10011000E50BF5F0E50F35F0F50BE50AF5F0E51028 +:1001200035F0F50AE500F503E50AF502E50BF58281 +:10013000E502F583E503F0750B01C3750000E50BDF +:10014000F5F0E50F35F0F50BE500F5F0E51035F0CD +:10015000F50AE501F503E50AF502E50BF582E5028E +:10016000F583E503F0750B02C3750000E50BF5F0B0 +:10017000E50F35F0F50BE500F5F0E51035F0F50A83 +:10018000E509F503E50AF502E50BF582E502F583DD +:10019000E503F0750B03C3750000E50BF5F0E50F03 +:1001A00035F0F50BE500F5F0E51035F0F50AE50C56 +:1001B000F503E50AF502E50BF582E502F583E503B3 +:1001C000F0E51CF502E51CF503E51CF504E51CF55E +:1001D00005E518F510E51AC0E0E519C0E0E502F5FF +:1001E00082E503F583E504F500E505F5012200D07D +:1001F000E0F519D0E0F51AE510F518900000E58259 +:10020000F50F900000E583F510900000E582F509F8 +:10021000900000E583F50A750100C3750000E50153 +:10022000F5F0E50935F0F501E500F5F0E50A35F002 +:10023000F500E500F502E501F582E502F583E0F55C +:100240000B750101C3750000E501F5F0E50935F016 +:10025000F501E500F5F0E50A35F0F500E500F502F9 +:10026000E501F582E502F583E0F50C750102C37541 +:100270000000E501F5F0E50935F0F501E500F5F0E0 +:10028000E50A35F0F500E500F502E501F582E50245 +:10029000F583E0F50D750103C3750000E501F5F088 +:1002A000E50935F0F501E500F5F0E50A35F0F50072 +:1002B000E500F502E501F582E502F583E0F50E754E +:1002C0000001750100750900750A00C3751B00E582 +:1002D00000F5F0E50B35F0F500E501F5F0E50C353E +:1002E000F0F501E509F5F0E50D35F0F509E50AF55C +:1002F000F0E50E35F0F50C750B00C3750A00E50B43 +:10030000F5F0E50F35F0F50BE50AF5F0E51035F001 +:10031000F50AE500F503E50AF502E50BF582E502CD +:10032000F583E503F0750B01C3750000E50BF5F0EF +:10033000E50F35F0F50BE500F5F0E51035F0F50AC1 +:10034000E501F503E50AF502E50BF582E502F58323 +:10035000E503F0750B02C3750000E50BF5F0E50F42 +:1003600035F0F50BE500F5F0E51035F0F50AE50997 +:10037000F503E50AF502E50BF582E502F583E503F1 +:10038000F0750B03C3750000E50BF5F0E50F35F0D4 +:10039000F50BE500F5F0E51035F0F50AE50CF50391 +:1003A000E50AF502E50BF582E502F583E503F0E5E4 +:1003B0001CF502E51CF503E51CF504E51CF505E557 +:1003C00018F510E51AC0E0E519C0E0E502F582E590 +:1003D00003F583E504F500E505F5012200000000C2 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/decl-6.s.expected b/tests/GCCTestSuite/decl-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/decl-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/declspec-12.c b/tests/GCCTestSuite/declspec-12.c new file mode 100644 index 0000000..a1373ef --- /dev/null +++ b/tests/GCCTestSuite/declspec-12.c @@ -0,0 +1,6 @@ +/* Test type qualifier in empty declaration: OK but useless. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +const struct foo; /* { dg-warning "warning: useless type qualifier in empty declaration" } */ diff --git a/tests/GCCTestSuite/declspec-12.c.expected b/tests/GCCTestSuite/declspec-12.c.expected new file mode 100644 index 0000000..a1373ef --- /dev/null +++ b/tests/GCCTestSuite/declspec-12.c.expected @@ -0,0 +1,6 @@ +/* Test type qualifier in empty declaration: OK but useless. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +const struct foo; /* { dg-warning "warning: useless type qualifier in empty declaration" } */ diff --git a/tests/GCCTestSuite/declspec-12.hex.expected b/tests/GCCTestSuite/declspec-12.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/declspec-12.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/declspec-12.s.expected b/tests/GCCTestSuite/declspec-12.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/declspec-12.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/declspec-2.c b/tests/GCCTestSuite/declspec-2.c new file mode 100644 index 0000000..f2c535a --- /dev/null +++ b/tests/GCCTestSuite/declspec-2.c @@ -0,0 +1,14 @@ +/* Test declaration specifiers. Test cases that used to be handled in + a loop in grokdeclarator. Pedantic cases. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -pedantic" } */ + +/* These should all be diagnosed, but only once, not for every + identifier declared. */ + +const const int x0, /* { dg-warning "duplicate" } */ +x1; + +long long x2, /* { dg-warning "long long" } */ +x3; diff --git a/tests/GCCTestSuite/declspec-2.c.expected b/tests/GCCTestSuite/declspec-2.c.expected new file mode 100644 index 0000000..f2c535a --- /dev/null +++ b/tests/GCCTestSuite/declspec-2.c.expected @@ -0,0 +1,14 @@ +/* Test declaration specifiers. Test cases that used to be handled in + a loop in grokdeclarator. Pedantic cases. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -pedantic" } */ + +/* These should all be diagnosed, but only once, not for every + identifier declared. */ + +const const int x0, /* { dg-warning "duplicate" } */ +x1; + +long long x2, /* { dg-warning "long long" } */ +x3; diff --git a/tests/GCCTestSuite/declspec-2.hex.expected b/tests/GCCTestSuite/declspec-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/declspec-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/declspec-2.s.expected b/tests/GCCTestSuite/declspec-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/declspec-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/declspec-3.c b/tests/GCCTestSuite/declspec-3.c new file mode 100644 index 0000000..19b1fa2 --- /dev/null +++ b/tests/GCCTestSuite/declspec-3.c @@ -0,0 +1,34 @@ +/* Test declaration specifiers. Test diagnosis of storage class + specifiers not at start. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-W" } */ + +static int x0; +int static x1; /* { dg-warning "not at beginning" } */ + +extern int x2; +int extern x3; /* { dg-warning "not at beginning" } */ + +typedef int x4; +int typedef x5; /* { dg-warning "not at beginning" } */ + +void g (int); + +void +f (void) +{ + auto int x6 = 0; + int auto x7 = 0; /* { dg-warning "not at beginning" } */ + register int x8 = 0; + int register x9 = 0; /* { dg-warning "not at beginning" } */ + g (x6 + x7 + x8 + x9); +} + +const static int x10; /* { dg-warning "not at beginning" } */ + +/* Attributes are OK before storage class specifiers, since some + attributes are like such specifiers themselves. */ + +__attribute__((format(printf, 1, 2))) static void h (const char *, ...); +__attribute__((format(printf, 1, 2))) void static i (const char *, ...); /* { dg-warning "not at beginning" } */ diff --git a/tests/GCCTestSuite/declspec-3.c.expected b/tests/GCCTestSuite/declspec-3.c.expected new file mode 100644 index 0000000..19b1fa2 --- /dev/null +++ b/tests/GCCTestSuite/declspec-3.c.expected @@ -0,0 +1,34 @@ +/* Test declaration specifiers. Test diagnosis of storage class + specifiers not at start. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-W" } */ + +static int x0; +int static x1; /* { dg-warning "not at beginning" } */ + +extern int x2; +int extern x3; /* { dg-warning "not at beginning" } */ + +typedef int x4; +int typedef x5; /* { dg-warning "not at beginning" } */ + +void g (int); + +void +f (void) +{ + auto int x6 = 0; + int auto x7 = 0; /* { dg-warning "not at beginning" } */ + register int x8 = 0; + int register x9 = 0; /* { dg-warning "not at beginning" } */ + g (x6 + x7 + x8 + x9); +} + +const static int x10; /* { dg-warning "not at beginning" } */ + +/* Attributes are OK before storage class specifiers, since some + attributes are like such specifiers themselves. */ + +__attribute__((format(printf, 1, 2))) static void h (const char *, ...); +__attribute__((format(printf, 1, 2))) void static i (const char *, ...); /* { dg-warning "not at beginning" } */ diff --git a/tests/GCCTestSuite/declspec-3.hex.expected b/tests/GCCTestSuite/declspec-3.hex.expected new file mode 100644 index 0000000..6d345e2 --- /dev/null +++ b/tests/GCCTestSuite/declspec-3.hex.expected @@ -0,0 +1,38 @@ +:100000000000E506758209C39582F506E50775834C +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0082506F58275E0003507F583E516F032 +:1000500075E0072506F58275E0003507F583E5159F +:10006000F075E0062506F58275E0003507F583E5B5 +:1000700014F075E0052506F58275E0003507F58377 +:10008000E513F075E0042506F58275E0003507F507 +:1000900083E512F075E0032506F58275E00035076B +:1000A000F583E511F075E0022506F58275E000356F +:1000B00007F583E510F075130075140075150075CC +:1000C0001600750F00751000751100751200750B84 +:1000D00000750C00750D00750E00750000750100AF +:1000E000750900750A00C3751800E50FF5F0E513F2 +:1000F00035F0F50FE510F5F0E51435F0F510E511E4 +:10010000F5F0E51535F0F511E512F5F0E51635F0E9 +:10011000F513C3751200E50BF5F0E50F35F0F50B9F +:10012000E50CF5F0E51035F0F50CE50DF5F0E51111 +:1001300035F0F50DE50EF5F0E51335F0F50FC37567 +:100140000E00E500F5F0E50B35F0F500E501F5F002 +:10015000E50C35F0F501E509F5F0E50D35F0F509AB +:10016000E50AF5F0E50F35F0F50AE500F51FE501C4 +:10017000F51EE509F51DE50AF51C750000E500F51D +:1001800002E500F503E500F504E500F50575E00876 +:100190002506F58275E0003507F583E0F51675E074 +:1001A000072506F58275E0003507F583E0F515753E +:1001B000E0062506F58275E0003507F583E0F514C5 +:1001C00075E0052506F58275E0003507F583E0F555 +:1001D0001375E0042506F58275E0003507F583E028 +:1001E000F51275E0032506F58275E0003507F58305 +:1001F000E0F51175E0022506F58275E0003507F59A +:1002000083E0F51075E0002506F58275E0003507FE +:10021000F583E0F508E508C0E075E0012506F58204 +:1002200075E0003507F583E0F508E508C0E075E006 +:10023000092506F50675E0003507F507E502F582A4 +:10024000E503F583E504F500E505F501220000006E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/declspec-3.s.expected b/tests/GCCTestSuite/declspec-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/declspec-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/deprecated-3.c b/tests/GCCTestSuite/deprecated-3.c new file mode 100644 index 0000000..2c35bb3 --- /dev/null +++ b/tests/GCCTestSuite/deprecated-3.c @@ -0,0 +1,11 @@ +/* Test __attribute__((deprecated)). Test merging with multiple + declarations. Bug 7425. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void func(void); +void func(void) __attribute__((deprecated)); + +void f(void) { + func(); /* { dg-warning "'func' is deprecated" } */ +} diff --git a/tests/GCCTestSuite/deprecated-3.c.expected b/tests/GCCTestSuite/deprecated-3.c.expected new file mode 100644 index 0000000..2c35bb3 --- /dev/null +++ b/tests/GCCTestSuite/deprecated-3.c.expected @@ -0,0 +1,11 @@ +/* Test __attribute__((deprecated)). Test merging with multiple + declarations. Bug 7425. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void func(void); +void func(void) __attribute__((deprecated)); + +void f(void) { + func(); /* { dg-warning "'func' is deprecated" } */ +} diff --git a/tests/GCCTestSuite/deprecated-3.hex.expected b/tests/GCCTestSuite/deprecated-3.hex.expected new file mode 100644 index 0000000..0680eba --- /dev/null +++ b/tests/GCCTestSuite/deprecated-3.hex.expected @@ -0,0 +1,11 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040000000E500F502E500F503E500F504E50034 +:10005000F50575E0002506F58275E0003507F583A6 +:10006000E0F508E508C0E075E0012506F58275E0D9 +:10007000003507F583E0F508E508C0E075E00225E6 +:1000800006F50675E0003507F507E502F582E5039C +:10009000F583E504F500E505F50122000000000008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/deprecated-3.s.expected b/tests/GCCTestSuite/deprecated-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/deprecated-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/dll-2.c b/tests/GCCTestSuite/dll-2.c new file mode 100644 index 0000000..3b8b60e --- /dev/null +++ b/tests/GCCTestSuite/dll-2.c @@ -0,0 +1,22 @@ +/* These dllimport and dllexport appearing for a symbol. + The desired behavior is that if both dllimport + and dllexport appear (in either order) the result is dllexport. + + Microsoft's MSVC 2.0 allows dllimport followed by dllexport for variables, + but does not allow dllexport followed by dllimport. + + In C, it's ok to redeclare a variable so this works for variables + and functions. In C++, it only works for functions. */ + +/* { dg-require-dll "" } */ + +__declspec (dllimport) int foo1 (); +__declspec (dllexport) int foo1 (); /* { dg-warning "previous dllimport ignored" } */ +__declspec (dllexport) int foo2 (); +__declspec (dllimport) int foo2 (); /* { dg-warning "dllimport ignored" } */ + +__declspec (dllimport) int bar1; +__declspec (dllexport) int bar1; /* { dg-warning "previous dllimport ignored" } */ + +__declspec (dllexport) int bar2; +__declspec (dllimport) int bar2; /* { dg-warning "dllimport ignored" } */ diff --git a/tests/GCCTestSuite/dll-2.c.expected b/tests/GCCTestSuite/dll-2.c.expected new file mode 100644 index 0000000..3b8b60e --- /dev/null +++ b/tests/GCCTestSuite/dll-2.c.expected @@ -0,0 +1,22 @@ +/* These dllimport and dllexport appearing for a symbol. + The desired behavior is that if both dllimport + and dllexport appear (in either order) the result is dllexport. + + Microsoft's MSVC 2.0 allows dllimport followed by dllexport for variables, + but does not allow dllexport followed by dllimport. + + In C, it's ok to redeclare a variable so this works for variables + and functions. In C++, it only works for functions. */ + +/* { dg-require-dll "" } */ + +__declspec (dllimport) int foo1 (); +__declspec (dllexport) int foo1 (); /* { dg-warning "previous dllimport ignored" } */ +__declspec (dllexport) int foo2 (); +__declspec (dllimport) int foo2 (); /* { dg-warning "dllimport ignored" } */ + +__declspec (dllimport) int bar1; +__declspec (dllexport) int bar1; /* { dg-warning "previous dllimport ignored" } */ + +__declspec (dllexport) int bar2; +__declspec (dllimport) int bar2; /* { dg-warning "dllimport ignored" } */ diff --git a/tests/GCCTestSuite/dll-2.hex.expected b/tests/GCCTestSuite/dll-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/dll-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/dll-2.s.expected b/tests/GCCTestSuite/dll-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/dll-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/dll-4.c b/tests/GCCTestSuite/dll-4.c new file mode 100644 index 0000000..9fcc8e9 --- /dev/null +++ b/tests/GCCTestSuite/dll-4.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target arm*-*-pe* } } */ +/* { dg-do compile { target i?86-pc-cygwin } } */ +/* { dg-do compile { target i?86-pc-mingw* } } */ + +__declspec (dllimport) int foo1; +int foo1; /* { dg-warning "redeclared without dllimport" } */ + +__declspec (dllimport) int foo2; +int foo2 = 5; /* { dg-warning "redeclared without dllimport" } */ + +int f () { return foo1 + foo2; } + +/* FIXME: We should scan the output of nm for this case. */ +/* { dg-final { scan-assembler "(foo2:.*\.comm\[ \t_\]*foo1)" } } */ +/* { dg-final { scan-assembler-not "(__imp_|_imp__)" } } */ diff --git a/tests/GCCTestSuite/dll-4.c.expected b/tests/GCCTestSuite/dll-4.c.expected new file mode 100644 index 0000000..9fcc8e9 --- /dev/null +++ b/tests/GCCTestSuite/dll-4.c.expected @@ -0,0 +1,15 @@ +/* { dg-do compile { target arm*-*-pe* } } */ +/* { dg-do compile { target i?86-pc-cygwin } } */ +/* { dg-do compile { target i?86-pc-mingw* } } */ + +__declspec (dllimport) int foo1; +int foo1; /* { dg-warning "redeclared without dllimport" } */ + +__declspec (dllimport) int foo2; +int foo2 = 5; /* { dg-warning "redeclared without dllimport" } */ + +int f () { return foo1 + foo2; } + +/* FIXME: We should scan the output of nm for this case. */ +/* { dg-final { scan-assembler "(foo2:.*\.comm\[ \t_\]*foo1)" } } */ +/* { dg-final { scan-assembler-not "(__imp_|_imp__)" } } */ diff --git a/tests/GCCTestSuite/dll-4.hex.expected b/tests/GCCTestSuite/dll-4.hex.expected new file mode 100644 index 0000000..289e0c0 --- /dev/null +++ b/tests/GCCTestSuite/dll-4.hex.expected @@ -0,0 +1,31 @@ +:1000000000D0E0F51AD0E0F51BE511F518E510F584 +:1000100019900000E582F509900000E583F50A7566 +:100020000100C3750000E501F5F0E50935F0F501C3 +:10003000E500F5F0E50A35F0F500E500F502E5012B +:10004000F582E502F583E0F50E750101C375000048 +:10005000E501F5F0E50935F0F501E500F5F0E50A13 +:1000600035F0F500E500F502E501F582E502F583DE +:10007000E0F50F750102C3750000E501F5F0E50933 +:1000800035F0F501E500F5F0E50A35F0F500E5009D +:10009000F502E501F582E502F583E0F5107501034F +:1000A000C3750000E501F5F0E50935F0F501E5005F +:1000B000F5F0E50A35F0F500E500F502E501F58219 +:1000C000E502F583E0F511900004E582F509900062 +:1000D00004E583F50A750100C3750000E501F5F03C +:1000E000E50935F0F501E500F5F0E50A35F0F50034 +:1000F000E500F502E501F582E502F583E0F50B7513 +:100100000101C3750000E501F5F0E50935F0F501E1 +:10011000E500F5F0E50A35F0F500E500F502E5014A +:10012000F582E502F583E0F50C750102C375000068 +:10013000E501F5F0E50935F0F501E500F5F0E50A32 +:1001400035F0F500E500F502E501F582E502F583FD +:10015000E0F50D750103C3750000E501F5F0E50953 +:1001600035F0F501E500F5F0E50A35F0F500E500BC +:10017000F502E501F582E502F583E0F500C37501BE +:1001800000E50BF5F0E50E35F0F501E50CF5F0E5D1 +:100190000F35F0F509E50DF5F0E51035F0F50AE558 +:1001A00000F5F0E51135F0F500E501F502E509F59A +:1001B00003E50AF504E500F505E518F511E519F57F +:1001C00010E51BC0E0E51AC0E0E502F582E503F5A5 +:1001D00083E504F500E505F50122000000000000BC +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/dll-4.s.expected b/tests/GCCTestSuite/dll-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/dll-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/dollar.c b/tests/GCCTestSuite/dollar.c new file mode 100644 index 0000000..43407f2 --- /dev/null +++ b/tests/GCCTestSuite/dollar.c @@ -0,0 +1,9 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options -fno-dollars-in-identifiers } */ + +/* Test that -fno-dollars-in-identifiers is honoured. + Neil Booth, 17 May 2003. */ + +int foobar$; /* { dg-error "stray '\\$'" } */ diff --git a/tests/GCCTestSuite/dollar.c.expected b/tests/GCCTestSuite/dollar.c.expected new file mode 100644 index 0000000..43407f2 --- /dev/null +++ b/tests/GCCTestSuite/dollar.c.expected @@ -0,0 +1,9 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options -fno-dollars-in-identifiers } */ + +/* Test that -fno-dollars-in-identifiers is honoured. + Neil Booth, 17 May 2003. */ + +int foobar$; /* { dg-error "stray '\\$'" } */ diff --git a/tests/GCCTestSuite/dollar.hex.expected b/tests/GCCTestSuite/dollar.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/dollar.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/dollar.s.expected b/tests/GCCTestSuite/dollar.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/dollar.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/doloop-2.c b/tests/GCCTestSuite/doloop-2.c new file mode 100644 index 0000000..203297d --- /dev/null +++ b/tests/GCCTestSuite/doloop-2.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +extern void exit (int); +unsigned global_iters=0; + +void bi_reverse(int len) +{ + do { + global_iters++; + } while (--len > 0); +} + +int main() +{ + bi_reverse(5); + if (global_iters != 5) + exit (1); + return 0; +} diff --git a/tests/GCCTestSuite/doloop-2.c.expected b/tests/GCCTestSuite/doloop-2.c.expected new file mode 100644 index 0000000..203297d --- /dev/null +++ b/tests/GCCTestSuite/doloop-2.c.expected @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +extern void exit (int); +unsigned global_iters=0; + +void bi_reverse(int len) +{ + do { + global_iters++; + } while (--len > 0); +} + +int main() +{ + bi_reverse(5); + if (global_iters != 5) + exit (1); + return 0; +} diff --git a/tests/GCCTestSuite/doloop-2.hex.expected b/tests/GCCTestSuite/doloop-2.hex.expected new file mode 100644 index 0000000..fcf11ed --- /dev/null +++ b/tests/GCCTestSuite/doloop-2.hex.expected @@ -0,0 +1,165 @@ +:1000000075812F7506FF7507FF12073702000C0078 +:1000100000E50675820EC39582F506E50775830037 +:100020009583F507D0E0F50875E0012506F58275A2 +:10003000E0003507F583E508F0D0E0F50875E0004D +:100040002506F58275E0003507F583E508F075E0D3 +:10005000092506F58275E0003507F583E517F0758B +:10006000E0082506F58275E0003507F583E516F012 +:1000700075E0072506F58275E0003507F583E5157F +:10008000F075E0062506F58275E0003507F583E595 +:1000900014F075E0052506F58275E0003507F58357 +:1000A000E513F075E0042506F58275E0003507F5E7 +:1000B00083E512F075E0032506F58275E00035074B +:1000C000F583E511F075E0022506F58275E000354F +:1000D00007F583E510F0E51FF518E51EF517E51D9A +:1000E000F516E51CF515750C01750D00750E0075FE +:1000F0000F00750101C3750000E50CF5F0E50095F2 +:10010000F0F500750000E500F5F0E50035F0F500CC +:10011000E500F5F0E50165F0F501C3750000E50DBA +:10012000F5F0E50095F0F500750000E500F5F0E567 +:100130000035F0F500E500F5F0E50165F0F501C3E7 +:10014000750000E50EF5F0E50095F0F5007500008E +:10015000E500F5F0E50035F0F500E500F5F0E50126 +:1001600065F0F501C3750000E50FF5F0E50095F0C9 +:10017000F500750000E500F5F0E50035F0F500E567 +:1001800000F5F0E50165F0F501750900750A0075E7 +:100190000B00750000E501F5F0E50045F0F500E520 +:1001A00009F5F0E50045F0F500E50AF5F0E5004554 +:1001B000F0F500E50BF5F0E50045F0F500E5007021 +:1001C00002800302065200900000E582F50E9000C6 +:1001D00000E583F50F900000E582F509900000E549 +:1001E00083F50A750100C3750000E501F5F0E50926 +:1001F00035F0F501E500F5F0E50A35F0F500E5002C +:10020000F502E501F582E502F583E0F50B750101E4 +:10021000C3750000E501F5F0E50935F0F501E500ED +:10022000F5F0E50A35F0F500E500F502E501F582A7 +:10023000E502F583E0F50C750102C3750000E501E8 +:10024000F5F0E50935F0F501E500F5F0E50A35F0E2 +:10025000F500E500F502E501F582E502F583E0F53C +:100260000D750103C3750000E501F5F0E50935F0F2 +:10027000F501E500F5F0E50A35F0F500E500F502D9 +:10028000E501F582E502F583E0F5107500017501E1 +:1002900000750900750A00C3751100E500F5F0E569 +:1002A0000B35F0F500E501F5F0E50C35F0F501E56D +:1002B00009F5F0E50D35F0F509E50AF5F0E510353D +:1002C000F0F50C750B00C3750A00E50BF5F0E50EB3 +:1002D00035F0F50BE50AF5F0E50F35F0F50AE50028 +:1002E000F503E50AF502E50BF582E502F583E50382 +:1002F000F0750B01C3750000E50BF5F0E50E35F068 +:10030000F50BE500F5F0E50F35F0F50AE501F5032D +:10031000E50AF502E50BF582E502F583E503F075E4 +:100320000B02C3750000E50BF5F0E50E35F0F50B9B +:10033000E500F5F0E50F35F0F50AE509F503E50A06 +:10034000F502E50BF582E502F583E503F0750B0395 +:10035000C3750000E50BF5F0E50E35F0F50BE50093 +:10036000F5F0E50F35F0F50AE50CF503E50AF502C1 +:10037000E50BF582E502F583E503F07500017501F3 +:1003800000750900750A00C3E500F5F0E51895F061 +:10039000F518E501F5F0E51795F0F517E509F5F025 +:1003A000E51695F0F516E50AF5F0E51595F0F51565 +:1003B000751A00751400751200751300E518F51B09 +:1003C000E517F519E516F510E515F511750080E549 +:1003D00000F5F0E51325F0F513E500F5F0E511253E +:1003E000F0F511750C00750D00750E00750F007598 +:1003F0000B00750A01750001C3E511F5F0E51395D1 +:10040000F0F509E50BF5F0E50B35F0F509E509F533 +:10041000F0E50055F0F500E500F5F0E50C45F0F5E8 +:100420000C750001C3E511F5F0E51395F0F509E54C +:100430000BF5F0E50B35F0F509E513F5F0E5119551 +:10044000F0F501E50BF5F0E50B35F0F501E501F50B +:10045000F0E50945F0F509E50AF5F0E50965F0F57F +:1004600009E509F5F0E50055F0F500C3E510F5F0F4 +:10047000E51295F0F509E50BF5F0E50B35F0F5091A +:10048000E509F5F0E50055F0F500E500F5F0E50CBF +:1004900045F0F50C750001C3E511F5F0E51395F095 +:1004A000F509E50BF5F0E50B35F0F509E513F5F089 +:1004B000E51195F0F501E50BF5F0E50B35F0F501EB +:1004C000E501F5F0E50945F0F509E50AF5F0E5097E +:1004D00065F0F509E509F5F0E50055F0F500C3E52F +:1004E00010F5F0E51295F0F509E50BF5F0E50B35A3 +:1004F000F0F509E512F5F0E51095F0F501E50BF5DD +:10050000F0E50B35F0F501E501F5F0E50945F0F50D +:1005100009E50AF5F0E50965F0F509E509F5F0E505 +:100520000055F0F500C3E519F5F0E51495F0F5096F +:10053000E50BF5F0E50B35F0F509E509F5F0E5001B +:1005400055F0F500E500F5F0E50C45F0F50C75000B +:1005500001C3E511F5F0E51395F0F509E50BF5F0AC +:10056000E50B35F0F509E513F5F0E51195F0F5012A +:10057000E50BF5F0E50B35F0F501E501F5F0E509E2 +:1005800045F0F509E50AF5F0E50965F0F509E50935 +:10059000F5F0E50055F0F500C3E510F5F0E512952E +:1005A000F0F509E50BF5F0E50B35F0F509E512F589 +:1005B000F0E51095F0F501E50BF5F0E50B35F0F5FC +:1005C00001E501F5F0E50945F0F509E50AF5F0E585 +:1005D0000965F0F509E509F5F0E50055F0F500C30A +:1005E000E519F5F0E51495F0F509E50BF5F0E50BE7 +:1005F00035F0F509E514F5F0E51995F0F501E50B91 +:10060000F5F0E50B35F0F501E501F5F0E50945F00C +:10061000F509E50AF5F0E50965F0F509E509F5F0F4 +:10062000E50055F0F500C3E51BF5F0E51A95F0F58A +:1006300009E50BF5F0E50B35F0F509E509F5F0E511 +:100640000055F0F500E500F5F0E50C45F0F50C027D +:1006500000F200750000E500F502E500F503E50095 +:10066000F504E500F50575E0092506F58275E0005D +:100670003507F583E0F51775E0082506F58275E086 +:10068000003507F583E0F51675E0072506F5827558 +:10069000E0003507F583E0F51575E0062506F582DF +:1006A00075E0003507F583E0F51475E0052506F5DE +:1006B0008275E0003507F583E0F51375E004250643 +:1006C000F58275E0003507F583E0F51275E0032546 +:1006D00006F58275E0003507F583E0F51175E00257 +:1006E0002506F58275E0003507F583E0F51075E025 +:1006F000002506F58275E0003507F583E0F508E58D +:1007000008C0E075E0012506F58275E0003507F5C3 +:1007100083E0F508E508C0E075E00E2506F50675EE +:10072000E0003507F507E502F582E503F583E5040A +:10073000F500E505F5012200E506758202C3958204 +:10074000F506E5077583009583F507D0E0F5087594 +:10075000E0012506F58275E0003507F583E508F030 +:10076000D0E0F50875E0002506F58275E000350754 +:10077000F583E508F0900000E582F50A900000E5B9 +:1007800083F501750900C3750000E509F5F0E50A78 +:1007900035F0F50DE500F5F0E50135F0F50E7509DC +:1007A00000750A00750B00750C00750100C375001B +:1007B00000E501F5F0E50D35F0F501E500F5F0E5B2 +:1007C0000E35F0F500E509F503E500F502E501F564 +:1007D00082E502F583E503F0750101C3750000E5CC +:1007E00001F5F0E50D35F0F501E500F5F0E50E3524 +:1007F000F0F500E50AF503E500F502E501F582E50F +:1008000002F583E503F0750102C3750000E501F50B +:10081000F0E50D35F0F501E500F5F0E50E35F0F504 +:1008200000E50BF503E500F502E501F582E502F5CB +:1008300083E503F0750103C3750000E501F5F0E5FC +:100840000D35F0F501E500F5F0E50E35F0F500E5C4 +:100850000CF503E500F502E501F582E502F583E517 +:1008600003F0751F05751E00751D00751C00120034 +:1008700010900000E582F509900000E583F50A7507 +:100880000100C3750000E501F5F0E50935F0F5015B +:10089000E500F5F0E50A35F0F500E500F502E501C3 +:1008A000F582E502F583E0F50B750101C3750000E3 +:1008B000E501F5F0E50935F0F501E500F5F0E50AAB +:1008C00035F0F500E500F502E501F582E502F58376 +:1008D000E0F50C750102C3750000E501F5F0E509CE +:1008E00035F0F501E500F5F0E50A35F0F500E50035 +:1008F000F502E501F582E502F583E0F50D750103EA +:10090000C3750000E501F5F0E50935F0F501E500F6 +:10091000F5F0E50A35F0F500E500F502E501F582B0 +:10092000E502F583E0F50E75000575010075090017 +:10093000750A00750F00C3E500F5F0E50B95F0F5BD +:1009400000E500F5F0E50F45F0F50FC3E501F5F022 +:10095000E50C95F0F500E500F5F0E50F45F0F50F35 +:10096000C3E509F5F0E50D95F0F500E500F5F0E5D6 +:100970000F45F0F50FC3E50AF5F0E50E95F0F5002B +:10098000E500F5F0E50F45F0F50F7501007509007C +:10099000750A00750000E50FF5F0E50045F0F5007B +:1009A000E501F5F0E50045F0F500E509F5F0E500B5 +:1009B00045F0F500E50AF5F0E50045F0F500E50045 +:1009C00070028003020A2D00750000750100750990 +:1009D00000750A00E500F502E501F503E509F504F7 +:1009E000E50AF50575E0002506F58275E000350796 +:1009F000F583E0F508E508C0E075E0012506F5821D +:100A000075E0003507F583E0F508E508C0E075E01E +:100A1000022506F50675E0003507F507E502F582C3 +:100A2000E503F583E504F500E505F5012200751FF2 +:100A300001751E00751D00751C000209C80000002C +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/doloop-2.s.expected b/tests/GCCTestSuite/doloop-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/doloop-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/empty-source-1.c b/tests/GCCTestSuite/empty-source-1.c new file mode 100644 index 0000000..239001c --- /dev/null +++ b/tests/GCCTestSuite/empty-source-1.c @@ -0,0 +1,5 @@ +/* Test diagnostic for an empty source file. Test with no special + options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ diff --git a/tests/GCCTestSuite/empty-source-1.c.expected b/tests/GCCTestSuite/empty-source-1.c.expected new file mode 100644 index 0000000..239001c --- /dev/null +++ b/tests/GCCTestSuite/empty-source-1.c.expected @@ -0,0 +1,5 @@ +/* Test diagnostic for an empty source file. Test with no special + options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ diff --git a/tests/GCCTestSuite/empty-source-1.hex.expected b/tests/GCCTestSuite/empty-source-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/empty-source-1.s.expected b/tests/GCCTestSuite/empty-source-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/empty-source-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/empty-source-2.c b/tests/GCCTestSuite/empty-source-2.c new file mode 100644 index 0000000..6f54f03 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-2.c @@ -0,0 +1,6 @@ +/* Test diagnostic for an empty source file. Test with -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +/* { dg-warning "warning: ISO C forbids an empty source file" "empty" { target *-*-* } 1 } */ diff --git a/tests/GCCTestSuite/empty-source-2.c.expected b/tests/GCCTestSuite/empty-source-2.c.expected new file mode 100644 index 0000000..6f54f03 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-2.c.expected @@ -0,0 +1,6 @@ +/* Test diagnostic for an empty source file. Test with -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +/* { dg-warning "warning: ISO C forbids an empty source file" "empty" { target *-*-* } 1 } */ diff --git a/tests/GCCTestSuite/empty-source-2.hex.expected b/tests/GCCTestSuite/empty-source-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/empty-source-2.s.expected b/tests/GCCTestSuite/empty-source-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/empty-source-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/empty-source-3.c b/tests/GCCTestSuite/empty-source-3.c new file mode 100644 index 0000000..c589242 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-3.c @@ -0,0 +1,7 @@ +/* Test diagnostic for an empty source file. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +/* { dg-error "error: ISO C forbids an empty source file" "empty" { target *-*-* } 1 } */ diff --git a/tests/GCCTestSuite/empty-source-3.c.expected b/tests/GCCTestSuite/empty-source-3.c.expected new file mode 100644 index 0000000..c589242 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-3.c.expected @@ -0,0 +1,7 @@ +/* Test diagnostic for an empty source file. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +/* { dg-error "error: ISO C forbids an empty source file" "empty" { target *-*-* } 1 } */ diff --git a/tests/GCCTestSuite/empty-source-3.hex.expected b/tests/GCCTestSuite/empty-source-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/empty-source-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/empty-source-3.s.expected b/tests/GCCTestSuite/empty-source-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/empty-source-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/enum2.c b/tests/GCCTestSuite/enum2.c new file mode 100644 index 0000000..575cc5c --- /dev/null +++ b/tests/GCCTestSuite/enum2.c @@ -0,0 +1,8 @@ +/* { dg-options "-fshort-enums" } */ +/* Check that "-fshort-enums" packs enumeration tyes into a minimal + number of bytes.. */ + +enum e { e_1 }; + +extern int i[sizeof (enum e)]; +int i[1]; diff --git a/tests/GCCTestSuite/enum2.c.expected b/tests/GCCTestSuite/enum2.c.expected new file mode 100644 index 0000000..575cc5c --- /dev/null +++ b/tests/GCCTestSuite/enum2.c.expected @@ -0,0 +1,8 @@ +/* { dg-options "-fshort-enums" } */ +/* Check that "-fshort-enums" packs enumeration tyes into a minimal + number of bytes.. */ + +enum e { e_1 }; + +extern int i[sizeof (enum e)]; +int i[1]; diff --git a/tests/GCCTestSuite/enum2.hex.expected b/tests/GCCTestSuite/enum2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/enum2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/enum2.s.expected b/tests/GCCTestSuite/enum2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/enum2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/enum3.c b/tests/GCCTestSuite/enum3.c new file mode 100644 index 0000000..ba3c1da --- /dev/null +++ b/tests/GCCTestSuite/enum3.c @@ -0,0 +1,11 @@ +/* Test for non-integer enum values. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +enum e2 { + E1 = (void *)4, /* { dg-error "error: enumerator value for 'E1' is not an integer constant" } */ + E2 = (enum e)F, + E3 = (_Bool)1 +}; diff --git a/tests/GCCTestSuite/enum3.c.expected b/tests/GCCTestSuite/enum3.c.expected new file mode 100644 index 0000000..ba3c1da --- /dev/null +++ b/tests/GCCTestSuite/enum3.c.expected @@ -0,0 +1,11 @@ +/* Test for non-integer enum values. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +enum e2 { + E1 = (void *)4, /* { dg-error "error: enumerator value for 'E1' is not an integer constant" } */ + E2 = (enum e)F, + E3 = (_Bool)1 +}; diff --git a/tests/GCCTestSuite/enum3.hex.expected b/tests/GCCTestSuite/enum3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/enum3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/enum3.s.expected b/tests/GCCTestSuite/enum3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/enum3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/extra-semi-1.c b/tests/GCCTestSuite/extra-semi-1.c new file mode 100644 index 0000000..74857ca --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-1.c @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + no special options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +; diff --git a/tests/GCCTestSuite/extra-semi-1.c.expected b/tests/GCCTestSuite/extra-semi-1.c.expected new file mode 100644 index 0000000..74857ca --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-1.c.expected @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + no special options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +; diff --git a/tests/GCCTestSuite/extra-semi-1.hex.expected b/tests/GCCTestSuite/extra-semi-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/extra-semi-1.s.expected b/tests/GCCTestSuite/extra-semi-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/extra-semi-2.c b/tests/GCCTestSuite/extra-semi-2.c new file mode 100644 index 0000000..c4e1cc3 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-2.c @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +; /* { dg-warning "warning: ISO C does not allow extra ';' outside of a function" } */ diff --git a/tests/GCCTestSuite/extra-semi-2.c.expected b/tests/GCCTestSuite/extra-semi-2.c.expected new file mode 100644 index 0000000..c4e1cc3 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-2.c.expected @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +; /* { dg-warning "warning: ISO C does not allow extra ';' outside of a function" } */ diff --git a/tests/GCCTestSuite/extra-semi-2.hex.expected b/tests/GCCTestSuite/extra-semi-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/extra-semi-2.s.expected b/tests/GCCTestSuite/extra-semi-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/extra-semi-3.c b/tests/GCCTestSuite/extra-semi-3.c new file mode 100644 index 0000000..6b90767 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-3.c @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +; /* { dg-error "error: ISO C does not allow extra ';' outside of a function" } */ diff --git a/tests/GCCTestSuite/extra-semi-3.c.expected b/tests/GCCTestSuite/extra-semi-3.c.expected new file mode 100644 index 0000000..6b90767 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-3.c.expected @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +; /* { dg-error "error: ISO C does not allow extra ';' outside of a function" } */ diff --git a/tests/GCCTestSuite/extra-semi-3.hex.expected b/tests/GCCTestSuite/extra-semi-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/extra-semi-3.s.expected b/tests/GCCTestSuite/extra-semi-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/extra-semi-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/fdata-sections-1.c b/tests/GCCTestSuite/fdata-sections-1.c new file mode 100644 index 0000000..d2b2b58 --- /dev/null +++ b/tests/GCCTestSuite/fdata-sections-1.c @@ -0,0 +1,9 @@ +/* PR middle-end/15486 */ +/* Origin: Jonathan Larmour */ + +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-fdata-sections" } */ + +int x; + +/* { dg-final { scan-assembler "comm" } } */ diff --git a/tests/GCCTestSuite/fdata-sections-1.c.expected b/tests/GCCTestSuite/fdata-sections-1.c.expected new file mode 100644 index 0000000..d2b2b58 --- /dev/null +++ b/tests/GCCTestSuite/fdata-sections-1.c.expected @@ -0,0 +1,9 @@ +/* PR middle-end/15486 */ +/* Origin: Jonathan Larmour */ + +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-fdata-sections" } */ + +int x; + +/* { dg-final { scan-assembler "comm" } } */ diff --git a/tests/GCCTestSuite/fdata-sections-1.hex.expected b/tests/GCCTestSuite/fdata-sections-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/fdata-sections-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/fdata-sections-1.s.expected b/tests/GCCTestSuite/fdata-sections-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/fdata-sections-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-abs-1.c b/tests/GCCTestSuite/fold-abs-1.c new file mode 100644 index 0000000..2e69a20 --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fwrapv" } */ +#define ABS(x) (x > 0 ? x : -x) +int f (int a, int b) { + if ((ABS(a) | b) != 0) return 1; + else return 0; +} diff --git a/tests/GCCTestSuite/fold-abs-1.c.expected b/tests/GCCTestSuite/fold-abs-1.c.expected new file mode 100644 index 0000000..2e69a20 --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-1.c.expected @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fwrapv" } */ +#define ABS(x) (x > 0 ? x : -x) +int f (int a, int b) { + if ((ABS(a) | b) != 0) return 1; + else return 0; +} diff --git a/tests/GCCTestSuite/fold-abs-1.hex.expected b/tests/GCCTestSuite/fold-abs-1.hex.expected new file mode 100644 index 0000000..ac6e001 --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-1.hex.expected @@ -0,0 +1,92 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51AF517E519F516E518BB +:1000D000F515751400751000750E00750F00E51C00 +:1000E000F50D750080E500F5F0E50F25F0F50FE55D +:1000F00000F5F0E50D25F0F50D750C007511007596 +:100100001200751300750B00750A01750001C3E537 +:100110000DF5F0E50F95F0F509E50BF5F0E50B357C +:10012000F0F509E509F5F0E50055F0F500E500F515 +:10013000F0E50C45F0F50C750001C3E50DF5F0E5B3 +:100140000F95F0F509E50BF5F0E50B35F0F509E550 +:100150000FF5F0E50D95F0F501E50BF5F0E50B3544 +:10016000F0F501E501F5F0E50945F0F509E50AF5D9 +:10017000F0E50965F0F509E509F5F0E50055F0F55C +:1001800000C3E51DF5F0E50E95F0F509E50BF5F07A +:10019000E50B35F0F509E509F5F0E50055F0F5005A +:1001A000E500F5F0E50C45F0F50C750001C3E50D33 +:1001B000F5F0E50F95F0F509E50BF5F0E50B35F0F9 +:1001C000F509E50FF5F0E50D95F0F501E50BF5F016 +:1001D000E50B35F0F501E501F5F0E50945F0F50928 +:1001E000E50AF5F0E50965F0F509E509F5F0E50042 +:1001F00055F0F500C3E51DF5F0E50E95F0F509E5C0 +:100200000BF5F0E50B35F0F509E50EF5F0E51D957C +:10021000F0F501E50BF5F0E50B35F0F501E501F53D +:10022000F0E50945F0F509E50AF5F0E50965F0F5B1 +:1002300009E509F5F0E50055F0F500C3E51EF5F018 +:10024000E51095F0F509E50BF5F0E50B35F0F5094E +:10025000E509F5F0E50055F0F500E500F5F0E50CF1 +:1002600045F0F50C750001C3E50DF5F0E50F95F0CF +:10027000F509E50BF5F0E50B35F0F509E50FF5F0BF +:10028000E50D95F0F501E50BF5F0E50B35F0F50121 +:10029000E501F5F0E50945F0F509E50AF5F0E509B0 +:1002A00065F0F509E509F5F0E50055F0F500C3E561 +:1002B0001DF5F0E50E95F0F509E50BF5F0E50B35CC +:1002C000F0F509E50EF5F0E51D95F0F501E50BF506 +:1002D000F0E50B35F0F501E501F5F0E50945F0F540 +:1002E00009E50AF5F0E50965F0F509E509F5F0E538 +:1002F0000055F0F500C3E51EF5F0E51095F0F509A1 +:10030000E50BF5F0E50B35F0F509E510F5F0E51E28 +:1003100095F0F501E50BF5F0E50B35F0F501E5019C +:10032000F5F0E50945F0F509E50AF5F0E50965F0B0 +:10033000F509E509F5F0E50055F0F500C3E51FF511 +:10034000F0E51495F0F509E50BF5F0E50B35F0F562 +:1003500009E509F5F0E50055F0F500E500F5F0E5F3 +:100360000C45F0F50C750000E50CF5F0E50045F0E6 +:10037000F500E511F5F0E50045F0F500E512F5F0C2 +:10038000E50045F0F500E513F5F0E50045F0F50072 +:10039000E500700280030205A100E51FF4F51FE5EA +:1003A0001EF4F51EE51DF4F51DE51CF4F51CD375D2 +:1003B0000000E500F5F0E51F35F0F51FE500F5F06C +:1003C000E51E35F0F51EE500F5F0E51D35F0F51DEF +:1003D000E500F5F0E51C35F0F51CC3E51BF5F0E58F +:1003E0001F45F0F500E517F5F0E51E45F0F501E5D0 +:1003F00016F5F0E51D45F0F509E515F5F0E51C45A8 +:10040000F0F50E750A00750B00750C00750D007582 +:100410000F00C3E50AF5F0E50095F0F500E500F5FD +:10042000F0E50F45F0F50FC3E50BF5F0E50195F0AC +:10043000F500E500F5F0E50F45F0F50FC3E50CF527 +:10044000F0E50995F0F500E500F5F0E50F45F0F56C +:100450000FC3E50DF5F0E50E95F0F500E500F5F0BC +:10046000E50F45F0F50F750100750900750A007577 +:100470000000E50FF5F0E50045F0F500E501F5F0C9 +:10048000E50045F0F500E509F5F0E50045F0F5007B +:10049000E50AF5F0E50045F0F500E500700280039F +:1004A00002059100750000750100750900750A00CC +:1004B000E500F502E501F503E509F504E50AF505B2 +:1004C00075E0092506F58275E0003507F583E0F54E +:1004D0001775E0082506F58275E0003507F583E01D +:1004E000F51675E0072506F58275E0003507F583FA +:1004F000E0F51575E0062506F58275E0003507F58F +:1005000083E0F51475E0052506F58275E0003507F2 +:10051000F583E0F51375E0042506F58275E00035F6 +:1005200007F583E0F51275E0032506F58275E00016 +:100530003507F583E0F51175E0022506F58275E0D3 +:10054000003507F583E0F51075E0002506F58275A6 +:10055000E0003507F583E0F508E508C0E075E00147 +:100560002506F58275E0003507F583E0F508E50816 +:10057000C0E075E0122506F50675E0003507F507C1 +:10058000E502F582E503F583E504F500E505F501EF +:100590002200750001750100750900750A0002044A +:1005A000B0000203DA0000000000000000000000BC +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-abs-1.s.expected b/tests/GCCTestSuite/fold-abs-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-abs-3.c b/tests/GCCTestSuite/fold-abs-3.c new file mode 100644 index 0000000..d151a8d --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple -fwrapv" } */ +#define ABS(x) (x > 0 ? x : -x) +int f (int a) { + return ABS (ABS(a)); +} + +/* { dg-final { scan-tree-dump-times "ABS" 1 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-abs-3.c.expected b/tests/GCCTestSuite/fold-abs-3.c.expected new file mode 100644 index 0000000..d151a8d --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-3.c.expected @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple -fwrapv" } */ +#define ABS(x) (x > 0 ? x : -x) +int f (int a) { + return ABS (ABS(a)); +} + +/* { dg-final { scan-tree-dump-times "ABS" 1 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-abs-3.hex.expected b/tests/GCCTestSuite/fold-abs-3.hex.expected new file mode 100644 index 0000000..0d24d31 --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-3.hex.expected @@ -0,0 +1,217 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5173C +:10004000F518E516F519E515F51AE514F51B75E033 +:10005000052506F58275E0003507F583E513F07593 +:10006000E0042506F58275E0003507F583E512F01A +:1000700075E0032506F58275E0003507F583E51187 +:10008000F075E0022506F58275E0003507F583E599 +:1000900010F0751400751000750E00750F00E51C4A +:1000A000F50D750080E500F5F0E50F25F0F50FE59D +:1000B00000F5F0E50D25F0F50D750C0075110075D6 +:1000C0001200751300750B00750A01750001C3E578 +:1000D0000DF5F0E50F95F0F509E50BF5F0E50B35BD +:1000E000F0F509E509F5F0E50055F0F500E500F556 +:1000F000F0E50C45F0F50C750001C3E50DF5F0E5F4 +:100100000F95F0F509E50BF5F0E50B35F0F509E590 +:100110000FF5F0E50D95F0F501E50BF5F0E50B3584 +:10012000F0F501E501F5F0E50945F0F509E50AF519 +:10013000F0E50965F0F509E509F5F0E50055F0F59C +:1001400000C3E51DF5F0E50E95F0F509E50BF5F0BA +:10015000E50B35F0F509E509F5F0E50055F0F5009A +:10016000E500F5F0E50C45F0F50C750001C3E50D73 +:10017000F5F0E50F95F0F509E50BF5F0E50B35F039 +:10018000F509E50FF5F0E50D95F0F501E50BF5F056 +:10019000E50B35F0F501E501F5F0E50945F0F50968 +:1001A000E50AF5F0E50965F0F509E509F5F0E50082 +:1001B00055F0F500C3E51DF5F0E50E95F0F509E500 +:1001C0000BF5F0E50B35F0F509E50EF5F0E51D95BD +:1001D000F0F501E50BF5F0E50B35F0F501E501F57E +:1001E000F0E50945F0F509E50AF5F0E50965F0F5F2 +:1001F00009E509F5F0E50055F0F500C3E51EF5F059 +:10020000E51095F0F509E50BF5F0E50B35F0F5098E +:10021000E509F5F0E50055F0F500E500F5F0E50C31 +:1002200045F0F50C750001C3E50DF5F0E50F95F00F +:10023000F509E50BF5F0E50B35F0F509E50FF5F0FF +:10024000E50D95F0F501E50BF5F0E50B35F0F50161 +:10025000E501F5F0E50945F0F509E50AF5F0E509F0 +:1002600065F0F509E509F5F0E50055F0F500C3E5A1 +:100270001DF5F0E50E95F0F509E50BF5F0E50B350C +:10028000F0F509E50EF5F0E51D95F0F501E50BF546 +:10029000F0E50B35F0F501E501F5F0E50945F0F580 +:1002A00009E50AF5F0E50965F0F509E509F5F0E578 +:1002B0000055F0F500C3E51EF5F0E51095F0F509E1 +:1002C000E50BF5F0E50B35F0F509E510F5F0E51E69 +:1002D00095F0F501E50BF5F0E50B35F0F501E501DD +:1002E000F5F0E50945F0F509E50AF5F0E50965F0F1 +:1002F000F509E509F5F0E50055F0F500C3E51FF552 +:10030000F0E51495F0F509E50BF5F0E50B35F0F5A2 +:1003100009E509F5F0E50055F0F500E500F5F0E533 +:100320000C45F0F50C750000E50CF5F0E50045F026 +:10033000F500E511F5F0E50045F0F500E512F5F002 +:10034000E50045F0F500E513F5F0E50045F0F500B2 +:10035000E50070028003020D6700E51FF4F512E569 +:100360001EF4F50CE51DF4F50DE51CF4F50ED37542 +:100370000000E500F5F0E51235F0F512E500F5F0C6 +:10038000E50C35F0F50CE500F5F0E50D35F0F50D73 +:10039000E500F5F0E50E35F0F50E75170075130064 +:1003A000751000750F00750080E500F5F0E50F256C +:1003B000F0F50FE500F5F0E50E25F0F50E750B00F4 +:1003C000751400751500751600750A007511017514 +:1003D0000001C3E50EF5F0E50F95F0F509E50AF526 +:1003E000F0E50A35F0F509E509F5F0E50055F0F519 +:1003F00000E500F5F0E50B45F0F50B750001C3E5F0 +:100400000EF5F0E50F95F0F509E50AF5F0E50A358A +:10041000F0F509E50FF5F0E50E95F0F501E50AF5C3 +:10042000F0E50A35F0F501E501F5F0E50945F0F5EF +:1004300009E511F5F0E50965F0F509E509F5F0E5DF +:100440000055F0F500C3E50DF5F0E51095F0F50960 +:10045000E50AF5F0E50A35F0F509E509F5F0E500FE +:1004600055F0F500E500F5F0E50B45F0F50B7500EE +:1004700001C3E50EF5F0E50F95F0F509E50AF5F095 +:10048000E50A35F0F509E50FF5F0E50E95F0F50113 +:10049000E50AF5F0E50A35F0F501E501F5F0E509C5 +:1004A00045F0F509E511F5F0E50965F0F509E5090F +:1004B000F5F0E50055F0F500C3E50DF5F0E5109514 +:1004C000F0F509E50AF5F0E50A35F0F509E510F56E +:1004D000F0E50D95F0F501E50AF5F0E50A35F0F5E2 +:1004E00001E501F5F0E50945F0F509E511F5F0E55F +:1004F0000965F0F509E509F5F0E50055F0F500C3EB +:10050000E50CF5F0E51395F0F509E50AF5F0E50AD7 +:1005100035F0F509E509F5F0E50055F0F500E500E1 +:10052000F5F0E50B45F0F50B750001C3E50EF5F0B0 +:10053000E50F95F0F509E50AF5F0E50A35F0F5095E +:10054000E50FF5F0E50E95F0F501E50AF5F0E50AA1 +:1005500035F0F501E501F5F0E50945F0F509E5119E +:10056000F5F0E50965F0F509E509F5F0E50055F068 +:10057000F500C3E50DF5F0E51095F0F509E50AF590 +:10058000F0E50A35F0F509E510F5F0E50D95F0F523 +:1005900001E50AF5F0E50A35F0F501E501F5F0E5CC +:1005A0000945F0F509E511F5F0E50965F0F509E50E +:1005B00009F5F0E50055F0F500C3E50CF5F0E5139D +:1005C00095F0F509E50AF5F0E50A35F0F509E513CA +:1005D000F5F0E50C95F0F501E50AF5F0E50A35F0E2 +:1005E000F501E501F5F0E50945F0F509E511F5F04E +:1005F000E50965F0F509E509F5F0E50055F0F500C8 +:10060000C3E512F5F0E51795F0F509E50AF5F0E513 +:100610000A35F0F509E509F5F0E50055F0F500E5D6 +:1006200000F5F0E50B45F0F50B750000E50BF5F076 +:10063000E50045F0F500E514F5F0E50045F0F500BE +:10064000E515F5F0E50045F0F500E516F5F0E500F7 +:1006500045F0F500E50070028003020A57007514AA +:1006600000751000750E00750F00E51CF50D750086 +:1006700080E500F5F0E50F25F0F50FE500F5F0E574 +:100680000D25F0F50D750C00751100751200751330 +:1006900000750B00750A01750001C3E50DF5F0E565 +:1006A0000F95F0F509E50BF5F0E50B35F0F509E5EB +:1006B00009F5F0E50055F0F500E500F5F0E50C452D +:1006C000F0F50C750001C3E50DF5F0E50F95F0F5BB +:1006D00009E50BF5F0E50B35F0F509E50FF5F0E56B +:1006E0000D95F0F501E50BF5F0E50B35F0F501E5BD +:1006F00001F5F0E50945F0F509E50AF5F0E50965CC +:10070000F0F509E509F5F0E50055F0F500C3E51D44 +:10071000F5F0E50E95F0F509E50BF5F0E50B35F094 +:10072000F509E509F5F0E50055F0F500E500F5F00F +:10073000E50C45F0F50C750001C3E50DF5F0E50F8E +:1007400095F0F509E50BF5F0E50B35F0F509E50F4A +:10075000F5F0E50D95F0F501E50BF5F0E50B35F05D +:10076000F501E501F5F0E50945F0F509E50AF5F0D3 +:10077000E50965F0F509E509F5F0E50055F0F50046 +:10078000C3E51DF5F0E50E95F0F509E50BF5F0E58F +:100790000B35F0F509E50EF5F0E51D95F0F501E5F1 +:1007A0000BF5F0E50B35F0F501E501F5F0E5094550 +:1007B000F0F509E50AF5F0E50965F0F509E509F553 +:1007C000F0E50055F0F500C3E51EF5F0E51095F0F5 +:1007D000F509E50BF5F0E50B35F0F509E509F5F060 +:1007E000E50055F0F500E500F5F0E50C45F0F50CF9 +:1007F000750001C3E50DF5F0E50F95F0F509E50B82 +:10080000F5F0E50B35F0F509E50FF5F0E50D95F0A0 +:10081000F501E50BF5F0E50B35F0F501E501F5F037 +:10082000E50945F0F509E50AF5F0E50965F0F50992 +:10083000E509F5F0E50055F0F500C3E51DF5F0E537 +:100840000E95F0F509E50BF5F0E50B35F0F509E54A +:100850000EF5F0E51D95F0F501E50BF5F0E50B352E +:10086000F0F501E501F5F0E50945F0F509E50AF5D2 +:10087000F0E50965F0F509E509F5F0E50055F0F555 +:1008800000C3E51EF5F0E51095F0F509E50BF5F070 +:10089000E50B35F0F509E510F5F0E51E95F0F501ED +:1008A000E50BF5F0E50B35F0F501E501F5F0E509AF +:1008B00045F0F509E50AF5F0E50965F0F509E50902 +:1008C000F5F0E50055F0F500C3E51FF5F0E51495EA +:1008D000F0F509E50BF5F0E50B35F0F509E509F55F +:1008E000F0E50055F0F500E500F5F0E50C45F0F514 +:1008F0000C750000E50CF5F0E50045F0F500E5119C +:10090000F5F0E50045F0F500E512F5F0E50045F0FD +:10091000F500E513F5F0E50045F0F500E50070029F +:100920008003020A5300E51FF4F51FE51EF4F51ECF +:10093000E51DF4F51DE51CF4F51CD3750000E5007C +:10094000F5F0E51F35F0F51FE500F5F0E51E35F093 +:10095000F51EE500F5F0E51D35F0F51DE500F5F0B7 +:10096000E51C35F0F51CE51FF4F51FE51EF4F51E3A +:10097000E51DF4F51DE51CF4F51CD3750000E5003C +:10098000F5F0E51F35F0F51FE500F5F0E51E35F053 +:10099000F51EE500F5F0E51D35F0F51DE500F5F077 +:1009A000E51C35F0F51CE51FF502E51EF503E51D18 +:1009B000F504E51CF505E518F517E519F516E51A32 +:1009C000F515E51BF51475E0052506F58275E000C3 +:1009D0003507F583E0F51375E0042506F58275E02B +:1009E000003507F583E0F51275E0032506F58275FD +:1009F000E0003507F583E0F51175E0022506F58284 +:100A000075E0003507F583E0F51075E0002506F583 +:100A10008275E0003507F583E0F508E508C0E0756C +:100A2000E0012506F58275E0003507F583E0F5085D +:100A3000E508C0E075E00A2506F50675E000350713 +:100A4000F507E502F582E503F583E504F500E50524 +:100A5000F501220002096600751400751000750E7C +:100A600000750F00E51CF50D750080E500F5F0E55B +:100A70000F25F0F50FE500F5F0E50D25F0F50D7506 +:100A80000C00751100751200751300750B00750AC6 +:100A900001750001C3E50DF5F0E50F95F0F509E5E9 +:100AA0000BF5F0E50B35F0F509E509F5F0E5005536 +:100AB000F0F500E500F5F0E50C45F0F50C750001EA +:100AC000C3E50DF5F0E50F95F0F509E50BF5F0E55B +:100AD0000B35F0F509E50FF5F0E50D95F0F501E5BD +:100AE0000BF5F0E50B35F0F501E501F5F0E509450D +:100AF000F0F509E50AF5F0E50965F0F509E509F510 +:100B0000F0E50055F0F500C3E51DF5F0E50E95F0B4 +:100B1000F509E50BF5F0E50B35F0F509E509F5F01C +:100B2000E50055F0F500E500F5F0E50C45F0F50CB5 +:100B3000750001C3E50DF5F0E50F95F0F509E50B3E +:100B4000F5F0E50B35F0F509E50FF5F0E50D95F05D +:100B5000F501E50BF5F0E50B35F0F501E501F5F0F4 +:100B6000E50945F0F509E50AF5F0E50965F0F5094F +:100B7000E509F5F0E50055F0F500C3E51DF5F0E5F4 +:100B80000E95F0F509E50BF5F0E50B35F0F509E507 +:100B90000EF5F0E51D95F0F501E50BF5F0E50B35EB +:100BA000F0F501E501F5F0E50945F0F509E50AF58F +:100BB000F0E50965F0F509E509F5F0E50055F0F512 +:100BC00000C3E51EF5F0E51095F0F509E50BF5F02D +:100BD000E50B35F0F509E509F5F0E50055F0F50010 +:100BE000E500F5F0E50C45F0F50C750001C3E50DE9 +:100BF000F5F0E50F95F0F509E50BF5F0E50B35F0AF +:100C0000F509E50FF5F0E50D95F0F501E50BF5F0CB +:100C1000E50B35F0F501E501F5F0E50945F0F509DD +:100C2000E50AF5F0E50965F0F509E509F5F0E500F7 +:100C300055F0F500C3E51DF5F0E50E95F0F509E575 +:100C40000BF5F0E50B35F0F509E50EF5F0E51D9532 +:100C5000F0F501E50BF5F0E50B35F0F501E501F5F3 +:100C6000F0E50945F0F509E50AF5F0E50965F0F567 +:100C700009E509F5F0E50055F0F500C3E51EF5F0CE +:100C8000E51095F0F509E50BF5F0E50B35F0F50904 +:100C9000E510F5F0E51E95F0F501E50BF5F0E50B37 +:100CA00035F0F501E501F5F0E50945F0F509E50A4E +:100CB000F5F0E50965F0F509E509F5F0E50055F011 +:100CC000F500C3E51FF5F0E51495F0F509E50BF522 +:100CD000F0E50B35F0F509E509F5F0E50055F0F51F +:100CE00000E500F5F0E50C45F0F50C750000E50CAD +:100CF000F5F0E50045F0F500E511F5F0E50045F00B +:100D0000F500E512F5F0E50045F0F500E513F5F026 +:100D1000E50045F0F500E50070028003020D630078 +:100D2000E51FF4F51FE51EF4F51EE51DF4F51DE5C0 +:100D30001CF4F51CD3750000E500F5F0E51F35F057 +:100D4000F51FE500F5F0E51E35F0F51EE500F5F0C0 +:100D5000E51D35F0F51DE500F5F0E51C35F0F51C59 +:100D60000209A6000209A600E51FF512E51EF50C12 +:100D7000E51DF50DE51CF50E02039A0000000000CC +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-abs-3.s.expected b/tests/GCCTestSuite/fold-abs-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/fold-abs-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-mod-1.c b/tests/GCCTestSuite/fold-mod-1.c new file mode 100644 index 0000000..4a26d0f --- /dev/null +++ b/tests/GCCTestSuite/fold-mod-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +#define ABS(x) (x > 0 ? x : -x) + +unsigned int f (unsigned int a) { + /* (unsigned)-8 is not a power of 2. */ + return a % -8; +} + +int g (int b) { + return ABS (b) % -8; +} + +int h (int c) { + return ABS (c) % 8; +} + +unsigned int k (unsigned int d) { + return d % 8; +} + +/* { dg-final { scan-tree-dump "a % (4294967288|0fffffff8)" "gimple" } } */ +/* { dg-final { scan-tree-dump-times " & 7" 3 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-mod-1.c.expected b/tests/GCCTestSuite/fold-mod-1.c.expected new file mode 100644 index 0000000..4a26d0f --- /dev/null +++ b/tests/GCCTestSuite/fold-mod-1.c.expected @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +#define ABS(x) (x > 0 ? x : -x) + +unsigned int f (unsigned int a) { + /* (unsigned)-8 is not a power of 2. */ + return a % -8; +} + +int g (int b) { + return ABS (b) % -8; +} + +int h (int c) { + return ABS (c) % 8; +} + +unsigned int k (unsigned int d) { + return d % 8; +} + +/* { dg-final { scan-tree-dump "a % (4294967288|0fffffff8)" "gimple" } } */ +/* { dg-final { scan-tree-dump-times " & 7" 3 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-mod-1.hex.expected b/tests/GCCTestSuite/fold-mod-1.hex.expected new file mode 100644 index 0000000..0acc7c1 --- /dev/null +++ b/tests/GCCTestSuite/fold-mod-1.hex.expected @@ -0,0 +1,654 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758217C31E +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0062506F58275E0003507F583E5A7 +:1006600008F0D0E0F50875E0052506F58275E00094 +:100670003507F583E508F075E00E2506F58275E08F +:10068000003507F583E517F075E00D2506F5827551 +:10069000E0003507F583E516F075E00C2506F582D8 +:1006A00075E0003507F583E515F075E00B2506F5D7 +:1006B0008275E0003507F583E514F075E00A25063C +:1006C000F58275E0003507F583E513F075E009253F +:1006D00006F58275E0003507F583E512F075E00850 +:1006E0002506F58275E0003507F583E511F075E024 +:1006F000072506F58275E0003507F583E510F0E57E +:100700001FF511E51BF512E51AF513E519F514753A +:10071000E0042506F58275E0003507F583E511F064 +:1007200075E0032506F58275E0003507F583E51EC3 +:10073000F075E0022506F58275E0003507F583E5E2 +:100740001DF075E0012506F58275E0003507F5839B +:10075000E51CF07515017516007517007508007514 +:10076000E0002506F58275E0003507F583E508F021 +:10077000751900750D00750E00750F00E51CF5105C +:10078000750080E500F5F0E51025F0F510E500F5C1 +:10079000F0E50F25F0F50F750C00751A00751B00BC +:1007A000751F00750B00750A01750001C3E50FF593 +:1007B000F0E51095F0F509E50BF5F0E50B35F0F5F2 +:1007C00009E509F5F0E50055F0F500E500F5F0E57F +:1007D0000C45F0F50C750001C3E50FF5F0E510953B +:1007E000F0F509E50BF5F0E50B35F0F509E510F549 +:1007F000F0E50F95F0F501E50BF5F0E50B35F0F5BB +:1008000001E501F5F0E50945F0F509E50AF5F0E542 +:100810000965F0F509E509F5F0E50055F0F500C3C7 +:10082000E50EF5F0E51D95F0F509E50BF5F0E50BA6 +:1008300035F0F509E509F5F0E50055F0F500E500BE +:10084000F5F0E50C45F0F50C750001C3E50FF5F08A +:10085000E51095F0F509E50BF5F0E50B35F0F50938 +:10086000E510F5F0E50F95F0F501E50BF5F0E50B7A +:1008700035F0F501E501F5F0E50945F0F509E50A82 +:10088000F5F0E50965F0F509E509F5F0E50055F045 +:10089000F500C3E50EF5F0E51D95F0F509E50BF55E +:1008A000F0E50B35F0F509E51DF5F0E50E95F0F5F1 +:1008B00001E50BF5F0E50B35F0F501E501F5F0E5A7 +:1008C0000945F0F509E50AF5F0E50965F0F509E5F2 +:1008D00009F5F0E50055F0F500C3E50DF5F0E51E6E +:1008E00095F0F509E50BF5F0E50B35F0F509E509AF +:1008F000F5F0E50055F0F500E500F5F0E50C45F004 +:10090000F50C750001C3E50FF5F0E51095F0F5095C +:10091000E50BF5F0E50B35F0F509E510F5F0E50F21 +:1009200095F0F501E50BF5F0E50B35F0F501E50186 +:10093000F5F0E50945F0F509E50AF5F0E50965F09A +:10094000F509E509F5F0E50055F0F500C3E50EF50C +:10095000F0E51D95F0F509E50BF5F0E50B35F0F543 +:1009600009E51DF5F0E50E95F0F501E50BF5F0E56F +:100970000B35F0F501E501F5F0E50945F0F509E580 +:100980000AF5F0E50965F0F509E509F5F0E500552A +:10099000F0F500C3E50DF5F0E51E95F0F509E50B62 +:1009A000F5F0E50B35F0F509E51EF5F0E50D95F0F0 +:1009B000F501E50BF5F0E50B35F0F501E501F5F096 +:1009C000E50945F0F509E50AF5F0E50965F0F509F1 +:1009D000E509F5F0E50055F0F500C3E519F5F0E59A +:1009E0001195F0F509E50BF5F0E50B35F0F509E5A6 +:1009F00009F5F0E50055F0F500E500F5F0E50C45EA +:100A0000F0F50CE51AF501E51BF509E51FF50A758A +:100A10000000E50CF5F0E50045F0F500E501F5F026 +:100A2000E50045F0F500E509F5F0E50045F0F500D5 +:100A3000E50AF5F0E50045F0F500E50070028003F9 +:100A400002116B00751900750D00750E00750F0011 +:100A5000E512F51BE513F51AE514F510E518F51187 +:100A6000750080E500F5F0E51125F0F511E500F5DC +:100A7000F0E50F25F0F50F750C00751C00751D00D5 +:100A8000751E00750B00750A01750001C3E50FF5B1 +:100A9000F0E51195F0F509E50BF5F0E50B35F0F50E +:100AA00009E509F5F0E50055F0F500E500F5F0E59C +:100AB0000C45F0F50C750001C3E50FF5F0E5119557 +:100AC000F0F509E50BF5F0E50B35F0F509E511F565 +:100AD000F0E50F95F0F501E50BF5F0E50B35F0F5D8 +:100AE00001E501F5F0E50945F0F509E50AF5F0E560 +:100AF0000965F0F509E509F5F0E50055F0F500C3E5 +:100B0000E50EF5F0E51095F0F509E50BF5F0E50BD0 +:100B100035F0F509E509F5F0E50055F0F500E500DB +:100B2000F5F0E50C45F0F50C750001C3E50FF5F0A7 +:100B3000E51195F0F509E50BF5F0E50B35F0F50954 +:100B4000E511F5F0E50F95F0F501E50BF5F0E50B96 +:100B500035F0F501E501F5F0E50945F0F509E50A9F +:100B6000F5F0E50965F0F509E509F5F0E50055F062 +:100B7000F500C3E50EF5F0E51095F0F509E50BF588 +:100B8000F0E50B35F0F509E510F5F0E50E95F0F51B +:100B900001E50BF5F0E50B35F0F501E501F5F0E5C4 +:100BA0000945F0F509E50AF5F0E50965F0F509E50F +:100BB00009F5F0E50055F0F500C3E50DF5F0E51A8F +:100BC00095F0F509E50BF5F0E50B35F0F509E509CC +:100BD000F5F0E50055F0F500E500F5F0E50C45F021 +:100BE000F50C750001C3E50FF5F0E51195F0F50979 +:100BF000E50BF5F0E50B35F0F509E511F5F0E50F3E +:100C000095F0F501E50BF5F0E50B35F0F501E501A3 +:100C1000F5F0E50945F0F509E50AF5F0E50965F0B7 +:100C2000F509E509F5F0E50055F0F500C3E50EF529 +:100C3000F0E51095F0F509E50BF5F0E50B35F0F56D +:100C400009E510F5F0E50E95F0F501E50BF5F0E599 +:100C50000B35F0F501E501F5F0E50945F0F509E59D +:100C60000AF5F0E50965F0F509E509F5F0E5005547 +:100C7000F0F500C3E50DF5F0E51A95F0F509E50B83 +:100C8000F5F0E50B35F0F509E51AF5F0E50D95F011 +:100C9000F501E50BF5F0E50B35F0F501E501F5F0B3 +:100CA000E50945F0F509E50AF5F0E50965F0F5090E +:100CB000E509F5F0E50055F0F500C3E519F5F0E5B7 +:100CC0001B95F0F509E50BF5F0E50B35F0F509E5B9 +:100CD00009F5F0E50055F0F500E500F5F0E50C4507 +:100CE000F0F50CE51CF501E51DF509E51EF50A75A5 +:100CF0000000E50CF5F0E50045F0F500E501F5F044 +:100D0000E50045F0F500E509F5F0E50045F0F500F2 +:100D1000E50AF5F0E50045F0F500E5007002800316 +:100D20000210A30075E0042506F58275E000350782 +:100D3000F583E0F51F75E0032506F58275E00035C3 +:100D400007F583E0F51E75E0022506F58275E000E3 +:100D50003507F583E0F51D75E0012506F58275E0A0 +:100D6000003507F583E0F51CE512F51BE513F51AD0 +:100D7000E514F519120000E582F502E583F503E5B7 +:100D800000F504E501F505E502F511E503F512E5C9 +:100D900004F513E505F514E515F500E516F515E57B +:100DA00017F51675E0002506F58275E0003507F5A4 +:100DB00083E0F517750D00750E00750F00751000B6 +:100DC000C3750100E500F5F0E511A4F50CE500F5AB +:100DD000F0E511A4E5F0F509E50CF5F0E50135F0D5 +:100DE000F501E515F5F0E511A4F50CE515F5F0E5CF +:100DF00011A4E5F0F50AE50CF5F0E50935F0F50983 +:100E0000E516F5F0E511A4F50CE516F5F0E511A4ED +:100E1000E5F0F50BE50CF5F0E50A35F0F50AE51718 +:100E2000F5F0E511A4F50CE517F5F0E511A4E5F0F2 +:100E3000F511E50CF5F0E50B35F0F50BC3C3750CBA +:100E400000E501F5F0E50D35F0F50DE509F5F0E506 +:100E50000E35F0F50EE50AF5F0E50F35F0F50FE586 +:100E60000BF5F0E51035F0F510C3750900E500F558 +:100E7000F0E512A4F50CE500F5F0E512A4E5F0F5B7 +:100E80000AE50CF5F0E50935F0F509E515F5F0E5AD +:100E900012A4F50CE515F5F0E512A4E5F0F50BE567 +:100EA0000CF5F0E50A35F0F50AE516F5F0E512A4C3 +:100EB000F50CE516F5F0E512A4E5F0F511E50CF5F5 +:100EC000F0E50B35F0F50B750100C3C3750C00E5BB +:100ED00001F5F0E50D35F0F50DE509F5F0E50E3518 +:100EE000F0F50EE50AF5F0E50F35F0F50FE50BF539 +:100EF000F0E51035F0F510C3750A00E500F5F0E5F2 +:100F000013A4F50CE500F5F0E513A4E5F0F50BE509 +:100F10000CF5F0E50A35F0F50AE515F5F0E513A452 +:100F2000F50CE515F5F0E513A4E5F0F511E50CF584 +:100F3000F0E50B35F0F50B750100750900C3C375BD +:100F40000C00E501F5F0E50D35F0F50DE509F5F0DE +:100F5000E50E35F0F50EE50AF5F0E50F35F0F50F85 +:100F6000E50BF5F0E51035F0F510C3750B00E50065 +:100F7000F5F0E514A4F50CE500F5F0E514A4E5F0B2 +:100F8000F511E50CF5F0E50B35F0F50B7501007585 +:100F90000900750A00C3C3750000E501F5F0E50D11 +:100FA00035F0F50DE509F5F0E50E35F0F50EE50A3D +:100FB000F5F0E50F35F0F50FE50BF5F0E51035F040 +:100FC000F510E50DF502E50EF503E50FF504E51066 +:100FD000F50575E00E2506F58275E0003507F58309 +:100FE000E0F51775E00D2506F58275E0003507F58B +:100FF00083E0F51675E00C2506F58275E0003507EF +:10100000F583E0F51575E00B2506F58275E00035F2 +:1010100007F583E0F51475E00A2506F58275E00012 +:101020003507F583E0F51375E0092506F58275E0CF +:10103000003507F583E0F51275E0082506F58275A1 +:10104000E0003507F583E0F51175E0072506F58228 +:1010500075E0003507F583E0F51075E0052506F528 +:101060008275E0003507F583E0F508E508C0E07516 +:10107000E0062506F58275E0003507F583E0F50802 +:10108000E508C0E075E0172506F50675E0003507B0 +:10109000F507E502F582E503F583E504F500E505CE +:1010A000F5012200E512F4F512E513F4F513E51449 +:1010B000F4F514E518F4F518D3750000E500F5F023 +:1010C000E51235F0F512E500F5F0E51335F0F5130E +:1010D000E500F5F0E51435F0F514E500F5F0E51858 +:1010E00035F0F518E515F4F515E516F4F516E517E0 +:1010F000F4F51775E0002506F58275E0003507F573 +:1011000083E0F508E508F4F50875E0002506F582AA +:1011100075E0003507F583E508F0D3750000E500BC +:10112000F5F0E51535F0F515E500F5F0E51635F0C7 +:10113000F516E500F5F0E51735F0F517E500F5F0E3 +:1011400075E0002506F58275E0003507F583E0F5CA +:1011500008E50835F0F50875E0002506F58275E02C +:10116000003507F583E508F0020D2400E511F4F5DC +:1011700000E51EF4F501E51DF4F509E51CF4F50B99 +:10118000D3750A00E50AF5F0E50035F0F500E50A4B +:10119000F5F0E50135F0F501E50AF5F0E50935F082 +:1011A000F509E50AF5F0E50B35F0F50B75E00425DA +:1011B00006F58275E0003507F583E500F075E0037C +:1011C0002506F58275E0003507F583E501F075E049 +:1011D000022506F58275E0003507F583E509F0750F +:1011E000E0012506F58275E0003507F583E50BF093 +:1011F000E515F4F515E516F4F516E517F4F517758C +:10120000E0002506F58275E0003507F583E0F50876 +:10121000E508F4F50875E0002506F58275E000356F +:1012200007F583E508F0D3750000E500F5F0E51556 +:1012300035F0F515E500F5F0E51635F0F516E500A5 +:10124000F5F0E51735F0F517E500F5F075E0002548 +:1012500006F58275E0003507F583E0F508E5083509 +:10126000F0F50875E0002506F58275E0003507F514 +:1012700083E508F0020A4400E506758211C39582F1 +:10128000F506E5077583009583F507D0E0F5087549 +:10129000E0012506F58275E0003507F583E508F0E5 +:1012A000D0E0F50875E0002506F58275E000350709 +:1012B000F583E508F075E0082506F58275E0003550 +:1012C00007F583E516F075E0072506F58275E00061 +:1012D0003507F583E515F075E0062506F58275E01E +:1012E000003507F583E514F075E0052506F58275F0 +:1012F000E0003507F583E513F075E0042506F58277 +:1013000075E0003507F583E512F075E0032506F575 +:101310008275E0003507F583E511F075E0022506DA +:10132000F58275E0003507F583E510F0E51FF5005F +:10133000E51EF501E51DF509E51CF50AE51BF516A9 +:10134000E51AF515E519F513E500F50FE501F510BA +:10135000E509F511E50AF512750C00750D00751417 +:1013600000750E00750B00750A01750001C3E518C4 +:10137000F5F0E51295F0F509E50BF5F0E50B35F024 +:10138000F509E509F5F0E50055F0F500E500F5F0A3 +:10139000E50C45F0F50C750001C3E518F5F0E51214 +:1013A00095F0F509E50BF5F0E50B35F0F509E512DB +:1013B000F5F0E51895F0F501E50BF5F0E50B35F0E6 +:1013C000F501E501F5F0E50945F0F509E50AF5F067 +:1013D000E50965F0F509E509F5F0E50055F0F500DA +:1013E000C3E513F5F0E51195F0F509E50BF5F0E52A +:1013F0000B35F0F509E509F5F0E50055F0F500E5E8 +:1014000000F5F0E50C45F0F50C750001C3E518F5A5 +:10141000F0E51295F0F509E50BF5F0E50B35F0F583 +:1014200009E512F5F0E51895F0F501E50BF5F0E5A5 +:101430000B35F0F501E501F5F0E50945F0F509E5B5 +:101440000AF5F0E50965F0F509E509F5F0E500555F +:10145000F0F500C3E513F5F0E51195F0F509E50B9E +:10146000F5F0E50B35F0F509E511F5F0E51395F02C +:10147000F501E50BF5F0E50B35F0F501E501F5F0CB +:10148000E50945F0F509E50AF5F0E50965F0F50926 +:10149000E509F5F0E50055F0F500C3E515F5F0E5D3 +:1014A0001095F0F509E50BF5F0E50B35F0F509E5DC +:1014B00009F5F0E50055F0F500E500F5F0E50C451F +:1014C000F0F50C750001C3E518F5F0E51295F0F59F +:1014D00009E50BF5F0E50B35F0F509E512F5F0E55A +:1014E0001895F0F501E50BF5F0E50B35F0F501E5A4 +:1014F00001F5F0E50945F0F509E50AF5F0E50965BE +:10150000F0F509E509F5F0E50055F0F500C3E51340 +:10151000F5F0E51195F0F509E50BF5F0E50B35F083 +:10152000F509E511F5F0E51395F0F501E50BF5F09A +:10153000E50B35F0F501E501F5F0E50945F0F509B4 +:10154000E50AF5F0E50965F0F509E509F5F0E500CE +:1015500055F0F500C3E515F5F0E51095F0F509E552 +:101560000BF5F0E50B35F0F509E510F5F0E515950F +:10157000F0F501E50BF5F0E50B35F0F501E501F5CA +:10158000F0E50945F0F509E50AF5F0E50965F0F53E +:1015900009E509F5F0E50055F0F500C3E516F5F0AD +:1015A000E50F95F0F509E50BF5F0E50B35F0F509DC +:1015B000E509F5F0E50055F0F500E500F5F0E50C7E +:1015C00045F0F50CE50CF500E514F501750C01C3CB +:1015D000750900E500F5F0E50995F0F509750900D4 +:1015E000E509F5F0E50935F0F509E509F5F0E50C53 +:1015F00065F0F50CC3750900E50DF5F0E50995F00A +:10160000F509750900E509F5F0E50935F0F509E595 +:1016100009F5F0E50C65F0F50CC3750900E501F579 +:10162000F0E50995F0F509750900E509F5F0E5091A +:1016300035F0F509E509F5F0E50C65F0F50CC37535 +:101640000900E50EF5F0E50995F0F509750900E5E5 +:1016500009F5F0E50935F0F509E509F5F0E50C6562 +:10166000F0F50C750D00751400750E00E50DF50014 +:10167000E514F501E50EF509750B01C3750A00E5E2 +:101680000CF5F0E50A95F0F50A750A00E50AF5F0A3 +:10169000E50A35F0F50AE50AF5F0E50B65F0F50B1E +:1016A000C3750A00E500F5F0E50A95F0F50A750A3C +:1016B00000E50AF5F0E50A35F0F50AE50AF5F0E58A +:1016C0000B65F0F50BC3750A00E501F5F0E50A9529 +:1016D000F0F50A750A00E50AF5F0E50A35F0F50AB5 +:1016E000E50AF5F0E50B65F0F50BC3750A00E509B1 +:1016F000F5F0E50A95F0F50A750A00E50AF5F0E55A +:101700000A35F0F50AE50AF5F0E50B65F0F50B751D +:101710000100750900750A00750000E50BF5F0E59C +:101720000045F0F500E501F5F0E50045F0F500E5D0 +:1017300009F5F0E50045F0F500E50AF5F0E50045AE +:10174000F0F500E5007002800302177A00C3C3E5DC +:1017500016F5F0E50F95F0F50FE515F5F0E51095A8 +:10176000F0F510E513F5F0E51195F0F511E518F534 +:10177000F0E51295F0F51202135800E50FF502E5B9 +:1017800010F503E511F504E512F50575E0082506E9 +:10179000F58275E0003507F583E0F51675E007255D +:1017A00006F58275E0003507F583E0F51575E0066E +:1017B0002506F58275E0003507F583E0F51475E040 +:1017C000052506F58275E0003507F583E0F513750C +:1017D000E0042506F58275E0003507F583E0F51293 +:1017E00075E0032506F58275E0003507F583E0F521 +:1017F0001175E0022506F58275E0003507F583E0F6 +:10180000F51075E0002506F58275E0003507F583D3 +:10181000E0F508E508C0E075E0012506F58275E011 +:10182000003507F583E0F508E508C0E075E011250F +:1018300006F50675E0003507F507E502F582E503D4 +:10184000F583E504F500E505F5012200E50675825E +:1018500016C39582F506E5077583009583F507D0D5 +:10186000E0F50875E0052506F58275E0003507F519 +:1018700083E508F0D0E0F50875E0042506F58275EB +:10188000E0003507F583E508F075E00D2506F582E3 +:1018900075E0003507F583E517F075E00C2506F5D2 +:1018A0008275E0003507F583E516F075E00B250637 +:1018B000F58275E0003507F583E515F075E00A253A +:1018C00006F58275E0003507F583E514F075E0094B +:1018D0002506F58275E0003507F583E513F075E020 +:1018E000082506F58275E0003507F583E512F075E9 +:1018F000E0072506F58275E0003507F583E511F070 +:1019000075E0062506F58275E0003507F583E510DC +:10191000F075E0032506F58275E0003507F583E5EF +:101920001FF075E0022506F58275E0003507F583A6 +:10193000E51EF075E0012506F58275E0003507F536 +:1019400083E51DF075E0002506F58275E00035079A +:10195000F583E51CF0E51BF514E51AF515E519F519 +:1019600016E518F51775E0032506F58275E00035D4 +:1019700007F583E0F51F75E0022506F58275E000A6 +:101980003507F583E0F51E75E0012506F58275E063 +:10199000003507F583E0F51D75E0002506F5827535 +:1019A000E0003507F583E0F51CE514F51BE515F5BA +:1019B0001AE516F519E517F518120639E582F5024C +:1019C000E583F503E500F504E501F505E502F5001D +:1019D000E503F501E504F509E505F50A751000755F +:1019E0001100751200751300C3750B00E500F5F0CA +:1019F000E514A4F50FE500F5F0E514A4E5F0F50C09 +:101A0000E50FF5F0E50B35F0F50BE501F5F0E51424 +:101A1000A4F50FE501F5F0E514A4E5F0F50DE50FEB +:101A2000F5F0E50C35F0F50CE509F5F0E514A4F555 +:101A30000FE509F5F0E514A4E5F0F50EE50FF5F076 +:101A4000E50D35F0F50DE50AF5F0E514A4F50FE523 +:101A50000AF5F0E514A4E5F0F50AE50FF5F0E50E5A +:101A600035F0F50EC3C3750A00E50BF5F0E510354A +:101A7000F0F510E50CF5F0E51135F0F511E50DF593 +:101A8000F0E51235F0F512E50EF5F0E51335F0F559 +:101A900013C3750C00E500F5F0E515A4F50FE5009E +:101AA000F5F0E515A4E5F0F50DE50FF5F0E50C35DD +:101AB000F0F50CE501F5F0E515A4F50FE501F5F0FD +:101AC000E515A4E5F0F50EE50FF5F0E50D35F0F5BB +:101AD0000DE509F5F0E515A4F50FE509F5F0E515B7 +:101AE000A4E5F0F50AE50FF5F0E50E35F0F50E7515 +:101AF0000B00C3C3750900E50BF5F0E51035F0F5F3 +:101B000010E50CF5F0E51135F0F511E50DF5F0E512 +:101B10001235F0F512E50EF5F0E51335F0F513C3C7 +:101B2000750D00E500F5F0E516A4F50FE500F5F0FC +:101B3000E516A4E5F0F50EE50FF5F0E50D35F0F549 +:101B40000DE501F5F0E516A4F50FE501F5F0E51654 +:101B5000A4E5F0F50AE50FF5F0E50E35F0F50E75A4 +:101B60000B00750C00C3C3750100E50BF5F0E51023 +:101B700035F0F510E50CF5F0E51135F0F511E50D52 +:101B8000F5F0E51235F0F512E50EF5F0E51335F058 +:101B9000F513C3750E00E500F5F0E517A4F50FE5A4 +:101BA00000F5F0E517A4E5F0F50AE50FF5F0E50E10 +:101BB00035F0F50E750B00750C00750D00C3C3757F +:101BC0000000E50BF5F0E51035F0F510E50CF5F04B +:101BD000E51135F0F511E50DF5F0E51235F0F512EA +:101BE000E50EF5F0E51335F0F513C3E510F5F075E6 +:101BF000E0032506F58275E0003507F583E0F5087A +:101C0000E50895F0F500E511F5F075E0022506F51B +:101C10008275E0003507F583E0F508E50895F0F5F5 +:101C200001E512F5F075E0012506F58275E0003555 +:101C300007F583E0F508E50895F0F509E513F5F0FB +:101C400075E0002506F58275E0003507F583E0F5BF +:101C500008E50895F0F50AE500F502E501F503E56C +:101C600009F504E50AF50575E00D2506F58275E030 +:101C7000003507F583E0F51775E00C2506F582754C +:101C8000E0003507F583E0F51675E00B2506F582D3 +:101C900075E0003507F583E0F51575E00A2506F5D2 +:101CA0008275E0003507F583E0F51475E009250637 +:101CB000F58275E0003507F583E0F51375E008253A +:101CC00006F58275E0003507F583E0F51275E0074B +:101CD0002506F58275E0003507F583E0F51175E01E +:101CE000062506F58275E0003507F583E0F51075E9 +:101CF000E0042506F58275E0003507F583E0F50878 +:101D0000E508C0E075E0052506F58275E0003507B9 +:101D1000F583E0F508E508C0E075E0162506F50650 +:101D200075E0003507F507E502F582E503F583E583 +:101D300004F500E505F5012200E506758206C39568 +:101D400082F506E5077583009583F507D0E0F50871 +:101D500075E0012506F58275E0003507F583E50895 +:101D6000F0D0E0F50875E0002506F58275E0003555 +:101D700007F583E508F0750108750000750A007520 +:101D80000900E501F4F501E500F4F500E50AF4F5D4 +:101D900019E509F4F518D3750900E509F5F0E50131 +:101DA00035F0F501E509F5F0E50035F0F500E50958 +:101DB000F5F0E51935F0F519E509F5F0E51835F018 +:101DC000F518E501F51BE500F51A121277E582F525 +:101DD00002E583F503E500F504E501F505E502F507 +:101DE00000E503F501E504F509E505F50AE500F56B +:101DF00002E501F503E509F504E50AF50575E000DE +:101E00002506F58275E0003507F583E0F508E5085D +:101E1000C0E075E0012506F58275E0003507F58321 +:101E2000E0F508E508C0E075E0062506F50675E072 +:101E3000003507F507E502F582E503F583E504F5CE +:101E400000E505F5012200E50675820CC39582F5D3 +:101E500006E5077583009583F507D0E0F50875E082 +:101E6000012506F58275E0003507F583E508F0D019 +:101E7000E0F50875E0002506F58275E0003507F508 +:101E800083E508F075E0072506F58275E000350763 +:101E9000F583E515F075E0062506F58275E0003559 +:101EA00007F583E514F075E0052506F58275E00079 +:101EB0003507F583E513F075E0042506F58275E036 +:101EC000003507F583E512F075E0032506F5827508 +:101ED000E0003507F583E511F075E0022506F5828F +:101EE00075E0003507F583E510F0E51CF515751470 +:101EF00000750E00750F00751000E515F50D7500E5 +:101F000080E500F5F0E51025F0F510E500F5F0E5C9 +:101F10000D25F0F50D750C00751100751200751387 +:101F200000750B00750A01750001C3E50DF5F0E5BC +:101F30001095F0F509E50BF5F0E50B35F0F509E541 +:101F400009F5F0E50055F0F500E500F5F0E50C4584 +:101F5000F0F50C750001C3E50DF5F0E51095F0F511 +:101F600009E50BF5F0E50B35F0F509E510F5F0E5C1 +:101F70000D95F0F501E50BF5F0E50B35F0F501E514 +:101F800001F5F0E50945F0F509E50AF5F0E5096523 +:101F9000F0F509E509F5F0E50055F0F500C3E51D9C +:101FA000F5F0E50F95F0F509E50BF5F0E50B35F0EB +:101FB000F509E509F5F0E50055F0F500E500F5F067 +:101FC000E50C45F0F50C750001C3E50DF5F0E510E5 +:101FD00095F0F509E50BF5F0E50B35F0F509E510A1 +:101FE000F5F0E50D95F0F501E50BF5F0E50B35F0B5 +:101FF000F501E501F5F0E50945F0F509E50AF5F02B +:10200000E50965F0F509E509F5F0E50055F0F5009D +:10201000C3E51DF5F0E50F95F0F509E50BF5F0E5E5 +:102020000B35F0F509E50FF5F0E51D95F0F501E547 +:102030000BF5F0E50B35F0F501E501F5F0E50945A7 +:10204000F0F509E50AF5F0E50965F0F509E509F5AA +:10205000F0E50055F0F500C3E51EF5F0E50E95F04E +:10206000F509E50BF5F0E50B35F0F509E509F5F0B7 +:10207000E50055F0F500E500F5F0E50C45F0F50C50 +:10208000750001C3E50DF5F0E51095F0F509E50BD8 +:10209000F5F0E50B35F0F509E510F5F0E50D95F0F7 +:1020A000F501E50BF5F0E50B35F0F501E501F5F08F +:1020B000E50945F0F509E50AF5F0E50965F0F509EA +:1020C000E509F5F0E50055F0F500C3E51DF5F0E58F +:1020D0000F95F0F509E50BF5F0E50B35F0F509E5A1 +:1020E0000FF5F0E51D95F0F501E50BF5F0E50B3585 +:1020F000F0F501E501F5F0E50945F0F509E50AF52A +:10210000F0E50965F0F509E509F5F0E50055F0F5AC +:1021100000C3E51EF5F0E50E95F0F509E50BF5F0C9 +:10212000E50B35F0F509E50EF5F0E51E95F0F50146 +:10213000E50BF5F0E50B35F0F501E501F5F0E50906 +:1021400045F0F509E50AF5F0E50965F0F509E50959 +:10215000F5F0E50055F0F500C3E51FF5F0E5149541 +:10216000F0F509E50BF5F0E50B35F0F509E509F5B6 +:10217000F0E50055F0F500E500F5F0E50C45F0F56B +:102180000C750000E50CF5F0E50045F0F500E511F3 +:10219000F5F0E50045F0F500E512F5F0E50045F055 +:1021A000F500E513F5F0E50045F0F500E5007002F7 +:1021B000800302233000E51FF4F500E51EF4F5016D +:1021C000E51DF4F509E515F4F51CD3750A00E50ADB +:1021D000F5F0E50035F0F500E50AF5F0E50135F03C +:1021E000F501E50AF5F0E50935F0F509E50AF5F040 +:1021F000E51C35F0F51C750D08750C00750B0075A8 +:102200000A00E50DF4F51BE50CF4F51AE50BF4F501 +:1022100019E50AF4F518D3750A00E50AF5F0E51B8F +:1022200035F0F51BE50AF5F0E51A35F0F51AE50A83 +:10223000F5F0E51935F0F519E50AF5F0E51835F092 +:10224000F518E500F51FE501F51EE509F51D121865 +:102250004BE582F502E583F503E500F504E501F5BC +:1022600005E502F500E503F501E504F509E505F5E9 +:102270000AE500F502E501F503E509F504E50AF5CF +:102280000575E0072506F58275E0003507F583E062 +:10229000F51575E0062506F58275E0003507F5832E +:1022A000E0F51475E0052506F58275E0003507F5C3 +:1022B00083E0F51375E0042506F58275E000350727 +:1022C000F583E0F51275E0032506F58275E000352B +:1022D00007F583E0F51175E0022506F58275E0004B +:1022E0003507F583E0F51075E0002506F58275E009 +:1022F000003507F583E0F508E508C0E075E0012545 +:1023000006F58275E0003507F583E0F508E508C0BD +:10231000E075E00C2506F50675E0003507F507E5E4 +:1023200002F582E503F583E504F500E505F50122F4 +:1023300000E51FF500E51EF501E51DF509E515F5BC +:102340001C0221F600E50675820CC39582F506E5B0 +:10235000077583009583F507D0E0F50875E0012542 +:1023600006F58275E0003507F583E508F0D0E0F565 +:102370000875E0002506F58275E0003507F583E570 +:1023800008F075E0072506F58275E0003507F5834E +:10239000E515F075E0062506F58275E0003507F5D0 +:1023A00083E514F075E0052506F58275E000350734 +:1023B000F583E513F075E0042506F58275E0003538 +:1023C00007F583E512F075E0032506F58275E00058 +:1023D0003507F583E511F075E0022506F58275E015 +:1023E000003507F583E510F0E51CF515751400754B +:1023F0000E00750F00751000E515F50D750080E5F0 +:1024000000F5F0E51025F0F510E500F5F0E50D25F7 +:10241000F0F50D750C00751100751200751300753F +:102420000B00750A01750001C3E50DF5F0E5109587 +:10243000F0F509E50BF5F0E50B35F0F509E509F5E3 +:10244000F0E50055F0F500E500F5F0E50C45F0F598 +:102450000C750001C3E50DF5F0E51095F0F509E503 +:102460000BF5F0E50B35F0F509E510F5F0E50D9508 +:10247000F0F501E50BF5F0E50B35F0F501E501F5BB +:10248000F0E50945F0F509E50AF5F0E50965F0F52F +:1024900009E509F5F0E50055F0F500C3E51DF5F097 +:1024A000E50F95F0F509E50BF5F0E50B35F0F509CD +:1024B000E509F5F0E50055F0F500E500F5F0E50C6F +:1024C00045F0F50C750001C3E50DF5F0E51095F04C +:1024D000F509E50BF5F0E50B35F0F509E510F5F03C +:1024E000E50D95F0F501E50BF5F0E50B35F0F5019F +:1024F000E501F5F0E50945F0F509E50AF5F0E5092E +:1025000065F0F509E509F5F0E50055F0F500C3E5DE +:102510001DF5F0E50F95F0F509E50BF5F0E50B3548 +:10252000F0F509E50FF5F0E51D95F0F501E50BF582 +:10253000F0E50B35F0F501E501F5F0E50945F0F5BD +:1025400009E50AF5F0E50965F0F509E509F5F0E5B5 +:102550000055F0F500C3E51EF5F0E50E95F0F50920 +:10256000E50BF5F0E50B35F0F509E509F5F0E500CB +:1025700055F0F500E500F5F0E50C45F0F50C7500BB +:1025800001C3E50DF5F0E51095F0F509E50BF5F063 +:10259000E50B35F0F509E510F5F0E50D95F0F501E1 +:1025A000E50BF5F0E50B35F0F501E501F5F0E50992 +:1025B00045F0F509E50AF5F0E50965F0F509E509E5 +:1025C000F5F0E50055F0F500C3E51DF5F0E50F95D4 +:1025D000F0F509E50BF5F0E50B35F0F509E50FF53C +:1025E000F0E51D95F0F501E50BF5F0E50B35F0F59F +:1025F00001E501F5F0E50945F0F509E50AF5F0E535 +:102600000965F0F509E509F5F0E50055F0F500C3B9 +:10261000E51EF5F0E50E95F0F509E50BF5F0E50B97 +:1026200035F0F509E50EF5F0E51E95F0F501E50B41 +:10263000F5F0E50B35F0F501E501F5F0E50945F0BC +:10264000F509E50AF5F0E50965F0F509E509F5F0A4 +:10265000E50055F0F500C3E51FF5F0E51495F0F53C +:1026600009E50BF5F0E50B35F0F509E509F5F0E5C1 +:102670000055F0F500E500F5F0E50C45F0F50C75BA +:102680000000E50CF5F0E50045F0F500E511F5F08A +:10269000E50045F0F500E512F5F0E50045F0F50040 +:1026A000E513F5F0E50045F0F500E5007002800364 +:1026B0000227EE00E51FF4F500E51EF4F501E51D27 +:1026C000F4F509E515F4F51CD3750A00E50AF5F0F3 +:1026D000E50035F0F500E50AF5F0E50135F0F50126 +:1026E000E50AF5F0E50935F0F509E50AF5F0E51C30 +:1026F00035F0F51C751B08751A0075190075180062 +:10270000E500F51FE501F51EE509F51D12184BE57D +:1027100082F502E583F503E500F504E501F505E53D +:1027200002F500E503F501E504F509E505F50AE51F +:1027300000F502E501F503E509F504E50AF505757F +:10274000E0072506F58275E0003507F583E0F5150D +:1027500075E0062506F58275E0003507F583E0F59E +:102760001475E0052506F58275E0003507F583E070 +:10277000F51375E0042506F58275E0003507F5834D +:10278000E0F51275E0032506F58275E0003507F5E2 +:1027900083E0F51175E0022506F58275E000350746 +:1027A000F583E0F51075E0002506F58275E000354B +:1027B00007F583E0F508E508C0E075E0012506F5BA +:1027C0008275E0003507F583E0F508E508C0E0759F +:1027D000E00C2506F50675E0003507F507E502F57E +:1027E00082E503F583E504F500E505F5012200E542 +:1027F0001FF500E51EF501E51DF509E515F51C02BF +:1028000026F400E506758206C39582F506E5077590 +:1028100083009583F507D0E0F50875E0012506F5FE +:102820008275E0003507F583E508F0D0E0F508751E +:10283000E0002506F58275E0003507F583E508F030 +:10284000751B08751A00751900751800121277E5C6 +:1028500082F502E583F503E500F504E501F505E5FC +:1028600002F500E503F501E504F509E505F50AE5DE +:1028700000F502E501F503E509F504E50AF505753E +:10288000E0002506F58275E0003507F583E0F508E0 +:10289000E508C0E075E0012506F58275E000350722 +:1028A000F583E0F508E508C0E075E0062506F506C5 +:1028B00075E0003507F507E502F582E503F583E5E8 +:1028C00004F500E505F5012200000000000000000D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-mod-1.s.expected b/tests/GCCTestSuite/fold-mod-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/fold-mod-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-xor-1.c b/tests/GCCTestSuite/fold-xor-1.c new file mode 100644 index 0000000..52b1ac4 --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f (int a, int b) { + return ~a ^ ~b; +} + +unsigned int g (unsigned int a, unsigned int b) { + return ~a ^ ~b; +} +/* { dg-final { scan-tree-dump-times "a \\^ b" 2 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-xor-1.c.expected b/tests/GCCTestSuite/fold-xor-1.c.expected new file mode 100644 index 0000000..52b1ac4 --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-1.c.expected @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f (int a, int b) { + return ~a ^ ~b; +} + +unsigned int g (unsigned int a, unsigned int b) { + return ~a ^ ~b; +} +/* { dg-final { scan-tree-dump-times "a \\^ b" 2 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-xor-1.hex.expected b/tests/GCCTestSuite/fold-xor-1.hex.expected new file mode 100644 index 0000000..f47e1e7 --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-1.hex.expected @@ -0,0 +1,31 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E51241 +:10004000F50FE51FF4F500E51EF4F501E51DF4F5E7 +:1000500009E51CF4F50AE51BF4F50BE51AF4F50CBB +:10006000E519F4F50DE518F4F50EC3E50BF5F0E52B +:100070000065F0F500E50CF5F0E50165F0F501E54A +:100080000DF5F0E50965F0F509E50EF5F0E50A6511 +:10009000F0F50AE500F502E501F503E509F504E5EB +:1000A0000AF505E50FF51275E0002506F58275E005 +:1000B000003507F583E0F508E508C0E075E00125A7 +:1000C00006F58275E0003507F583E0F508E508C020 +:1000D000E075E00A2506F50675E0003507F507E549 +:1000E00002F582E503F583E504F500E505F5012257 +:1000F00000E50675820AC39582F506E5077583005B +:100100009583F507D0E0F50875E0012506F58275C1 +:10011000E0003507F583E508F0D0E0F50875E0006C +:100120002506F58275E0003507F583E508F0E51250 +:10013000F50FE51FF4F500E51EF4F501E51DF4F5F6 +:1001400009E51CF4F50AE51BF4F50BE51AF4F50CCA +:10015000E519F4F50DE518F4F50EC3E50BF5F0E53A +:100160000065F0F500E50CF5F0E50165F0F501E559 +:100170000DF5F0E50965F0F509E50EF5F0E50A6520 +:10018000F0F50AE500F502E501F503E509F504E5FA +:100190000AF505E50FF51275E0002506F58275E014 +:1001A000003507F583E0F508E508C0E075E00125B6 +:1001B00006F58275E0003507F583E0F508E508C02F +:1001C000E075E00A2506F50675E0003507F507E558 +:1001D00002F582E503F583E504F500E505F5012266 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-xor-1.s.expected b/tests/GCCTestSuite/fold-xor-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-xor-2.c b/tests/GCCTestSuite/fold-xor-2.c new file mode 100644 index 0000000..35337c9 --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ +int f (int a, int b) { + return ~(a ^ -(b + 1)); +} + +int g (int a, int b) { + return b ^ a; +} + +unsigned int h (unsigned int a, unsigned int b) { + return ~(-(b + 1) ^ a); +} + +/* { dg-final { scan-tree-dump-times "b \\^ a" 3 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-xor-2.c.expected b/tests/GCCTestSuite/fold-xor-2.c.expected new file mode 100644 index 0000000..35337c9 --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-2.c.expected @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ +int f (int a, int b) { + return ~(a ^ -(b + 1)); +} + +int g (int a, int b) { + return b ^ a; +} + +unsigned int h (unsigned int a, unsigned int b) { + return ~(-(b + 1) ^ a); +} + +/* { dg-final { scan-tree-dump-times "b \\^ a" 3 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/fold-xor-2.hex.expected b/tests/GCCTestSuite/fold-xor-2.hex.expected new file mode 100644 index 0000000..ae6cb8e --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-2.hex.expected @@ -0,0 +1,55 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5163D +:10004000F50BE515F50CE514F50DE513F50F750049 +:1000500001750100750900750A00C3750E00E50001 +:10006000F5F0E51B35F0F500E501F5F0E51A35F0A2 +:10007000F501E509F5F0E51935F0F509E50AF5F0C2 +:10008000E51835F0F50AE500F4F500E501F4F501B1 +:10009000E509F4F509E50AF4F50ED3750A00E50A59 +:1000A000F5F0E50035F0F500E50AF5F0E50135F08D +:1000B000F501E50AF5F0E50935F0F509E50AF5F091 +:1000C000E50E35F0F50EC3E500F5F0E51F65F0F53A +:1000D00000E501F5F0E51E65F0F501E509F5F0E54F +:1000E0001D65F0F509E50EF5F0E51C65F0F50AE58E +:1000F00000F4F500E501F4F501E509F4F509E50A78 +:10010000F4F50AE500F502E501F503E509F504E576 +:100110000AF505E50BF516E50CF515E50DF514E505 +:100120000FF51375E0002506F58275E0003507F53B +:1001300083E0F508E508C0E075E0012506F5827565 +:10014000E0003507F583E0F508E508C0E075E00A52 +:100150002506F50675E0003507F507E502F582E5A9 +:1001600003F583E504F500E505F5012200E50675D4 +:100170008208C39582F506E5077583009583F50728 +:10018000D0E0F50AD0E0F50CE510F501C3E51FF568 +:10019000F0E51B65F0F500E51EF5F0E51A65F0F5F4 +:1001A00009E51DF5F0E51965F0F50BE51CF5F0E541 +:1001B0001865F0F50DE500F502E509F503E50BF529 +:1001C00004E50DF505E501F510E50CC0E0E50AC014 +:1001D000E075E0082506F50675E0003507F507E54A +:1001E00002F582E503F583E504F500E505F5012256 +:1001F00000E50675820AC39582F506E5077583005A +:100200009583F507D0E0F50875E0012506F58275C0 +:10021000E0003507F583E508F0D0E0F50875E0006B +:100220002506F58275E0003507F583E508F0E5164B +:10023000F50BE515F50CE514F50DE513F50F750057 +:1002400001750100750900750A00C3750E00E5000F +:10025000F5F0E51B35F0F500E501F5F0E51A35F0B0 +:10026000F501E509F5F0E51935F0F509E50AF5F0D0 +:10027000E51835F0F50AE500F4F500E501F4F501BF +:10028000E509F4F509E50AF4F50ED3750A00E50A67 +:10029000F5F0E50035F0F500E50AF5F0E50135F09B +:1002A000F501E50AF5F0E50935F0F509E50AF5F09F +:1002B000E50E35F0F50EC3E51FF5F0E50065F0F548 +:1002C00000E51EF5F0E50165F0F501E51DF5F0E549 +:1002D0000965F0F509E51CF5F0E50E65F0F50AE5B0 +:1002E00000F4F500E501F4F501E509F4F509E50A86 +:1002F000F4F50AE500F502E501F503E509F504E585 +:100300000AF505E50BF516E50CF515E50DF514E513 +:100310000FF51375E0002506F58275E0003507F549 +:1003200083E0F508E508C0E075E0012506F5827573 +:10033000E0003507F583E0F508E508C0E075E00A60 +:100340002506F50675E0003507F507E502F582E5B7 +:1003500003F583E504F500E505F501220000000042 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/fold-xor-2.s.expected b/tests/GCCTestSuite/fold-xor-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/fold-xor-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/ftrapv-1.c b/tests/GCCTestSuite/ftrapv-1.c new file mode 100644 index 0000000..eb1e53b --- /dev/null +++ b/tests/GCCTestSuite/ftrapv-1.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2004 Free Software Foundation. + + PR other/15526 + Verify correct overflow checking with -ftrapv. + + Written by Falk Hueffner, 20th May 2004. */ + +/* { dg-do run } */ +/* { dg-options "-ftrapv" } */ + +__attribute__((noinline)) int +mulv(int a, int b) +{ + return a * b; +} + +int +main() +{ + int tmp; + tmp=mulv( 0, 0); + tmp=mulv( 0, -1); + tmp=mulv(-1, 0); + tmp=mulv(-1, -1); + return 0; +} diff --git a/tests/GCCTestSuite/ftrapv-1.c.expected b/tests/GCCTestSuite/ftrapv-1.c.expected new file mode 100644 index 0000000..eb1e53b --- /dev/null +++ b/tests/GCCTestSuite/ftrapv-1.c.expected @@ -0,0 +1,26 @@ +/* Copyright (C) 2004 Free Software Foundation. + + PR other/15526 + Verify correct overflow checking with -ftrapv. + + Written by Falk Hueffner, 20th May 2004. */ + +/* { dg-do run } */ +/* { dg-options "-ftrapv" } */ + +__attribute__((noinline)) int +mulv(int a, int b) +{ + return a * b; +} + +int +main() +{ + int tmp; + tmp=mulv( 0, 0); + tmp=mulv( 0, -1); + tmp=mulv(-1, 0); + tmp=mulv(-1, -1); + return 0; +} diff --git a/tests/GCCTestSuite/ftrapv-1.hex.expected b/tests/GCCTestSuite/ftrapv-1.hex.expected new file mode 100644 index 0000000..3cc30e7 --- /dev/null +++ b/tests/GCCTestSuite/ftrapv-1.hex.expected @@ -0,0 +1,92 @@ +:1000000075812F7506FF7507FF1203A002000C0013 +:10001000E506758210C39582F506E50775830095A0 +:1000200083F507D0E0F50875E0012506F58275E057 +:10003000003507F583E508F0D0E0F50875E0002508 +:1000400006F58275E0003507F583E508F075E007F1 +:100050002506F58275E0003507F583E515F075E0B6 +:10006000062506F58275E0003507F583E514F07581 +:10007000E0052506F58275E0003507F583E513F008 +:1000800075E0042506F58275E0003507F583E51275 +:10009000F075E0032506F58275E0003507F583E588 +:1000A00011F075E0022506F58275E0003507F5834D +:1000B000E510F0E51FF500E51EF501E51DF509E584 +:1000C0001CF50AE519F512E518F515E509F513E52E +:1000D0000AF514750E00750F00751000751100C338 +:1000E000750900E500F5F0E51BA4F50DE500F5F058 +:1000F000E51BA4E5F0F50AE50DF5F0E50935F0F5A9 +:1001000009E501F5F0E51BA4F50DE501F5F0E51BAA +:10011000A4E5F0F50BE50DF5F0E50A35F0F50AE597 +:1001200013F5F0E51BA4F50DE513F5F0E51BA4E5CB +:10013000F0F50CE50DF5F0E50B35F0F50BE514F5F4 +:10014000F0E51BA4F50DE514F5F0E51BA4E5F0F5CD +:1001500014E50DF5F0E50C35F0F50CC3C3750D0095 +:10016000E509F5F0E50E35F0F50EE50AF5F0E50FD9 +:1001700035F0F50FE50BF5F0E51035F0F510E50C71 +:10018000F5F0E51135F0F511C3750A00E500F5F05D +:10019000E51AA4F50DE500F5F0E51AA4E5F0F50B78 +:1001A000E50DF5F0E50A35F0F50AE501F5F0E51A9B +:1001B000A4F50DE501F5F0E51AA4E5F0F50CE50D63 +:1001C000F5F0E50B35F0F50BE513F5F0E51AA4F5C0 +:1001D0000DE513F5F0E51AA4E5F0F514E50DF5F0DD +:1001E000E50C35F0F50C750900C3C3750D00E50984 +:1001F000F5F0E50E35F0F50EE50AF5F0E50F35F012 +:10020000F50FE50BF5F0E51035F0F510E50CF5F020 +:10021000E51135F0F511C3750B00E500F5F0E512B9 +:10022000A4F50DE500F5F0E512A4E5F0F50CE50DFB +:10023000F5F0E50B35F0F50BE501F5F0E512A4F569 +:100240000DE501F5F0E512A4E5F0F514E50DF5F086 +:10025000E50C35F0F50C750900750A00C3C375018E +:1002600000E509F5F0E50E35F0F50EE50AF5F0E5E7 +:100270000F35F0F50FE50BF5F0E51035F0F510E56D +:100280000CF5F0E51135F0F511C3750C00E500F53E +:10029000F0E515A4F50DE500F5F0E515A4E5F0F59C +:1002A00014E50DF5F0E50C35F0F50C750900750A4F +:1002B00000750B00C3C3750000E509F5F0E50E35C8 +:1002C000F0F50EE50AF5F0E50F35F0F50FE50BF565 +:1002D000F0E51035F0F510E50CF5F0E51135F0F529 +:1002E00011E50EF502E50FF503E510F504E511F54E +:1002F0000575E0072506F58275E0003507F583E012 +:10030000F51575E0062506F58275E0003507F583DD +:10031000E0F51475E0052506F58275E0003507F572 +:1003200083E0F51375E0042506F58275E0003507D6 +:10033000F583E0F51275E0032506F58275E00035DA +:1003400007F583E0F51175E0022506F58275E000FA +:100350003507F583E0F51075E0002506F58275E0B8 +:10036000003507F583E0F508E508C0E075E00125F4 +:1003700006F58275E0003507F583E0F508E508C06D +:10038000E075E0102506F50675E0003507F507E590 +:1003900002F582E503F583E504F500E505F50122A4 +:1003A00000E506758202C39582F506E507758300B0 +:1003B0009583F507D0E0F50875E0012506F582750F +:1003C000E0003507F583E508F0D0E0F50875E000BA +:1003D0002506F58275E0003507F583E508F0751F01 +:1003E00000751E00751D00751C00751B00751A0038 +:1003F00075190075180012000F751F00751E007525 +:100400001D00751C00750A01750900750100750055 +:1004100000E50AF4F51BE509F4F51AE501F4F51910 +:10042000E500F4F518D3750000E500F5F0E51B359F +:10043000F0F51BE500F5F0E51A35F0F51AE500F5E5 +:10044000F0E51935F0F519E500F5F0E51835F0F5AA +:100450001812000F750A017509007501007500007A +:10046000E50AF4F51FE509F4F51EE501F4F51DE5CF +:1004700000F4F51CD3750000E500F5F0E51F35F03C +:10048000F51FE500F5F0E51E35F0F51EE500F5F089 +:10049000E51D35F0F51DE500F5F0E51C35F0F51C22 +:1004A000751B00751A0075190075180012000F757C +:1004B0000A01750900750100750000E50AF4F51FD1 +:1004C000E509F4F51EE501F4F51DE500F4F51CD38E +:1004D000750000E500F5F0E51F35F0F51FE500F5C6 +:1004E000F0E51E35F0F51EE500F5F0E51D35F0F5FB +:1004F0001DE500F5F0E51C35F0F51C750A017509E0 +:1005000000750100750000E50AF4F51BE509F4F536 +:100510001AE501F4F519E500F4F518D3750000E5C6 +:1005200000F5F0E51B35F0F51BE500F5F0E51A35B3 +:10053000F0F51AE500F5F0E51935F0F519E500F5E7 +:10054000F0E51835F0F51812000F75000075010080 +:10055000750900750A00E500F502E501F503E509F6 +:10056000F504E50AF50575E0002506F58275E0005D +:100570003507F583E0F508E508C0E075E0012506DC +:10058000F58275E0003507F583E0F508E508C0E081 +:1005900075E0022506F50675E0003507F507E5026A +:1005A000F582E503F583E504F500E505F501220094 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/ftrapv-1.s.expected b/tests/GCCTestSuite/ftrapv-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/ftrapv-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/funcdef-attr-1.c b/tests/GCCTestSuite/funcdef-attr-1.c new file mode 100644 index 0000000..17249a0 --- /dev/null +++ b/tests/GCCTestSuite/funcdef-attr-1.c @@ -0,0 +1,14 @@ +/* The declarator in a function definition should be able to take the + form of an attributed function declarator, not just a plain + function declarator. This was formerly allowed by some of the code + but then the wrong constraint checks were made because other code + didn't recognise the declarator as being that of the function + definition. */ +/* Origin: Joseph Myers . */ + +int (__attribute__((const)) x) (a, b) + int a; + int b; +{ + return a + b; +} diff --git a/tests/GCCTestSuite/funcdef-attr-1.c.expected b/tests/GCCTestSuite/funcdef-attr-1.c.expected new file mode 100644 index 0000000..17249a0 --- /dev/null +++ b/tests/GCCTestSuite/funcdef-attr-1.c.expected @@ -0,0 +1,14 @@ +/* The declarator in a function definition should be able to take the + form of an attributed function declarator, not just a plain + function declarator. This was formerly allowed by some of the code + but then the wrong constraint checks were made because other code + didn't recognise the declarator as being that of the function + definition. */ +/* Origin: Joseph Myers . */ + +int (__attribute__((const)) x) (a, b) + int a; + int b; +{ + return a + b; +} diff --git a/tests/GCCTestSuite/funcdef-attr-1.hex.expected b/tests/GCCTestSuite/funcdef-attr-1.hex.expected new file mode 100644 index 0000000..accd545 --- /dev/null +++ b/tests/GCCTestSuite/funcdef-attr-1.hex.expected @@ -0,0 +1,10 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F50CD0E0F50EE511F5017C +:10002000E510F50AC3750000E51BF5F0E51F35F096 +:10003000F500E51AF5F0E51E35F0F509E519F5F0DE +:10004000E51D35F0F50BE518F5F0E51C35F0F50D7F +:10005000E500F502E509F503E50BF504E50DF50509 +:10006000E501F511E50AF510E50EC0E0E50CC0E08C +:1000700075E0082506F50675E0003507F507E50289 +:10008000F582E503F583E504F500E505F5012200B9 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/funcdef-attr-1.s.expected b/tests/GCCTestSuite/funcdef-attr-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/funcdef-attr-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/funcdef-var-2.c b/tests/GCCTestSuite/funcdef-var-2.c new file mode 100644 index 0000000..744987e --- /dev/null +++ b/tests/GCCTestSuite/funcdef-var-2.c @@ -0,0 +1,11 @@ +/* Test ICE on defining function with a name previously declared as a + nonfunction. Bug 28299 from Bernhard Fischer . + Reduced testcase from Volker Reichelt . */ + +/* { dg-do compile } */ +/* { dg-options "-Wmissing-prototypes" } */ + +int foo; +/* { dg-error "previous declaration" "previous declaration" { target *-*-* } 8 } */ +void foo () {} /* { dg-error "redeclared as different kind of symbol" } */ +/* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 10 } */ diff --git a/tests/GCCTestSuite/funcdef-var-2.c.expected b/tests/GCCTestSuite/funcdef-var-2.c.expected new file mode 100644 index 0000000..744987e --- /dev/null +++ b/tests/GCCTestSuite/funcdef-var-2.c.expected @@ -0,0 +1,11 @@ +/* Test ICE on defining function with a name previously declared as a + nonfunction. Bug 28299 from Bernhard Fischer . + Reduced testcase from Volker Reichelt . */ + +/* { dg-do compile } */ +/* { dg-options "-Wmissing-prototypes" } */ + +int foo; +/* { dg-error "previous declaration" "previous declaration" { target *-*-* } 8 } */ +void foo () {} /* { dg-error "redeclared as different kind of symbol" } */ +/* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 10 } */ diff --git a/tests/GCCTestSuite/funcdef-var-2.hex.expected b/tests/GCCTestSuite/funcdef-var-2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/funcdef-var-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/funcdef-var-2.s.expected b/tests/GCCTestSuite/funcdef-var-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/funcdef-var-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/funroll-loops-all.c b/tests/GCCTestSuite/funroll-loops-all.c new file mode 100644 index 0000000..c627675 --- /dev/null +++ b/tests/GCCTestSuite/funroll-loops-all.c @@ -0,0 +1,4 @@ +/* PR 17594 */ +/* { dg-do compile } */ +/* { dg-options "-funroll-loops-all" } */ +/* { dg-error "unrecognized command line option \"-funroll-loops-all\"" "" { target *-*-* } 0 } */ diff --git a/tests/GCCTestSuite/funroll-loops-all.c.expected b/tests/GCCTestSuite/funroll-loops-all.c.expected new file mode 100644 index 0000000..c627675 --- /dev/null +++ b/tests/GCCTestSuite/funroll-loops-all.c.expected @@ -0,0 +1,4 @@ +/* PR 17594 */ +/* { dg-do compile } */ +/* { dg-options "-funroll-loops-all" } */ +/* { dg-error "unrecognized command line option \"-funroll-loops-all\"" "" { target *-*-* } 0 } */ diff --git a/tests/GCCTestSuite/funroll-loops-all.hex.expected b/tests/GCCTestSuite/funroll-loops-all.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/funroll-loops-all.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/funroll-loops-all.s.expected b/tests/GCCTestSuite/funroll-loops-all.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/funroll-loops-all.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/gnu89-dupqual-1.c b/tests/GCCTestSuite/gnu89-dupqual-1.c new file mode 100644 index 0000000..9bd1db0 --- /dev/null +++ b/tests/GCCTestSuite/gnu89-dupqual-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -Werror" } */ + +typedef const int CI; +const const int c1; /* { dg-bogus "duplicate" } */ +const CI c2; /* { dg-bogus "duplicate" } */ +const CI *c3; /* { dg-bogus "duplicate" } */ + +typedef volatile int VI; +volatile volatile int v1; /* { dg-bogus "duplicate" } */ +volatile VI v2; /* { dg-bogus "duplicate" } */ +volatile VI *v3; /* { dg-bogus "duplicate" } */ diff --git a/tests/GCCTestSuite/gnu89-dupqual-1.c.expected b/tests/GCCTestSuite/gnu89-dupqual-1.c.expected new file mode 100644 index 0000000..9bd1db0 --- /dev/null +++ b/tests/GCCTestSuite/gnu89-dupqual-1.c.expected @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -Werror" } */ + +typedef const int CI; +const const int c1; /* { dg-bogus "duplicate" } */ +const CI c2; /* { dg-bogus "duplicate" } */ +const CI *c3; /* { dg-bogus "duplicate" } */ + +typedef volatile int VI; +volatile volatile int v1; /* { dg-bogus "duplicate" } */ +volatile VI v2; /* { dg-bogus "duplicate" } */ +volatile VI *v3; /* { dg-bogus "duplicate" } */ diff --git a/tests/GCCTestSuite/gnu89-dupqual-1.hex.expected b/tests/GCCTestSuite/gnu89-dupqual-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/gnu89-dupqual-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/gnu89-dupqual-1.s.expected b/tests/GCCTestSuite/gnu89-dupqual-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/gnu89-dupqual-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/h8300-stack-1.c b/tests/GCCTestSuite/h8300-stack-1.c new file mode 100644 index 0000000..b63bde2 --- /dev/null +++ b/tests/GCCTestSuite/h8300-stack-1.c @@ -0,0 +1,14 @@ +/* Make sure that the H8 backend does not generate a non-atomic stack + adjustment. */ +/* { dg-do compile { target h8300-*-* } } */ +/* { dg-options "" } */ + +void foo (short, short, short, short, short, short); + +void +bar () +{ + foo (0, 0, 0, 0, 0, 0); +} + +/* { dg-final { scan-assembler-not "addx" } } */ diff --git a/tests/GCCTestSuite/h8300-stack-1.c.expected b/tests/GCCTestSuite/h8300-stack-1.c.expected new file mode 100644 index 0000000..b63bde2 --- /dev/null +++ b/tests/GCCTestSuite/h8300-stack-1.c.expected @@ -0,0 +1,14 @@ +/* Make sure that the H8 backend does not generate a non-atomic stack + adjustment. */ +/* { dg-do compile { target h8300-*-* } } */ +/* { dg-options "" } */ + +void foo (short, short, short, short, short, short); + +void +bar () +{ + foo (0, 0, 0, 0, 0, 0); +} + +/* { dg-final { scan-assembler-not "addx" } } */ diff --git a/tests/GCCTestSuite/h8300-stack-1.hex.expected b/tests/GCCTestSuite/h8300-stack-1.hex.expected new file mode 100644 index 0000000..e0ded11 --- /dev/null +++ b/tests/GCCTestSuite/h8300-stack-1.hex.expected @@ -0,0 +1,27 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040001F00751E00751D00751C00751B00751ABC +:1000500000751900751800750C00750D00750A0003 +:10006000750B00750901E506F500C3E509F5F0E536 +:100070000095F0F509E507F500750100E501F5F0DB +:10008000E50095F0F501E50CF503E501F502E5095C +:10009000F582E502F583E503F0750902E506F50052 +:1000A000C3E509F5F0E50095F0F509E507F50075FC +:1000B0000100E501F5F0E50095F0F501E50DF5032A +:1000C000E501F502E509F582E502F583E503F07542 +:1000D0000903E506F500C3E509F5F0E50095F0F53F +:1000E00009E507F500750100E501F5F0E50095F07B +:1000F000F501E50AF503E501F502E509F582E502FA +:10010000F583E503F0750904E506F500C3E509F597 +:10011000F0E50095F0F509E507F500750100E5014A +:10012000F5F0E50095F0F501E50BF503E501F502C5 +:10013000E509F582E502F583E503F0750000E500C9 +:10014000F502E500F503E500F504E500F50575E0C9 +:10015000002506F58275E0003507F583E0F508E532 +:1001600008C0E075E0012506F58275E0003507F569 +:1001700083E0F508E508C0E075E0022506F50675A0 +:10018000E0003507F507E502F582E503F583E504B0 +:10019000F500E505F5012200000000000000000068 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/h8300-stack-1.s.expected b/tests/GCCTestSuite/h8300-stack-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/h8300-stack-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/if-empty-1.c b/tests/GCCTestSuite/if-empty-1.c new file mode 100644 index 0000000..a3156c1 --- /dev/null +++ b/tests/GCCTestSuite/if-empty-1.c @@ -0,0 +1,23 @@ +/* Test diagnostics for empty bodies in if / else. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wextra" } */ + +void +f (int x) +{ + if (x) + ; /* { dg-warning "warning: empty body in an if-statement" } */ + if (x) + ; /* By design we don't warn in this case. */ + else + (void)0; + if (x) + (void)0; + else + ; /* { dg-warning "warning: empty body in an else-statement" } */ + if (x) + (void)0; + else + (void)0; +} diff --git a/tests/GCCTestSuite/if-empty-1.c.expected b/tests/GCCTestSuite/if-empty-1.c.expected new file mode 100644 index 0000000..a3156c1 --- /dev/null +++ b/tests/GCCTestSuite/if-empty-1.c.expected @@ -0,0 +1,23 @@ +/* Test diagnostics for empty bodies in if / else. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wextra" } */ + +void +f (int x) +{ + if (x) + ; /* { dg-warning "warning: empty body in an if-statement" } */ + if (x) + ; /* By design we don't warn in this case. */ + else + (void)0; + if (x) + (void)0; + else + ; /* { dg-warning "warning: empty body in an else-statement" } */ + if (x) + (void)0; + else + (void)0; +} diff --git a/tests/GCCTestSuite/if-empty-1.hex.expected b/tests/GCCTestSuite/if-empty-1.hex.expected new file mode 100644 index 0000000..4d94692 --- /dev/null +++ b/tests/GCCTestSuite/if-empty-1.hex.expected @@ -0,0 +1,21 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F509750100E51E +:100020001FF5F0E50145F0F501E51EF5F0E50145A8 +:10003000F0F501E51DF5F0E50145F0F501E51CF5EC +:10004000F0E50145F0F501E501700280030201369B +:1000500000750100E51FF5F0E50145F0F501E51E2D +:10006000F5F0E50145F0F501E51DF5F0E50145F098 +:10007000F501E51CF5F0E50145F0F501E50170023B +:10008000800302013200750100E51FF5F0E501452E +:10009000F0F501E51EF5F0E50145F0F501E51DF58A +:1000A000F0E50145F0F501E51CF5F0E50145F0F559 +:1000B00001E5017002800302012E00750100E51FB9 +:1000C000F5F0E50145F0F501E51EF5F0E50145F037 +:1000D000F501E51DF5F0E50145F0F501E51CF5F04C +:1000E000E50145F0F501E5017002800302012A00F7 +:1000F000750100E501F502E501F503E501F504E50B +:1001000001F505E509C0E0E500C0E075E00425065D +:10011000F50675E0003507F507E502F582E503F51C +:1001200083E504F500E505F50122000200F0000278 +:1001300000BB000200860002005100000000000029 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/if-empty-1.s.expected b/tests/GCCTestSuite/if-empty-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/if-empty-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-1.c b/tests/GCCTestSuite/inline-1.c new file mode 100644 index 0000000..4dce611 --- /dev/null +++ b/tests/GCCTestSuite/inline-1.c @@ -0,0 +1,28 @@ +/* Verify that DECL_INLINE gets copied between DECLs properly. */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-final { if [ istarget hppa*-*-* ] { scan-assembler-not "xyzzy?,%r" } else { scan-assembler-not "xyzzy" } } } */ + +/* Test that declaration followed by definition inlines. */ +static inline int xyzzy0 (int); +static int xyzzy0 (int x) { return x; } +int test0 (void) +{ + return xyzzy0 (5); +} + +/* Test that definition following declaration inlines. */ +static int xyzzy1 (int); +static inline int xyzzy1 (int x) { return x; } +int test1 (void) +{ + return xyzzy1 (5); +} + +/* Test that redeclaration inside a function body inlines. */ +extern inline int xyzzy2 (int x) { return x; } +int test2 (void) +{ + extern int xyzzy2 (int); + return xyzzy2 (5); +} diff --git a/tests/GCCTestSuite/inline-1.c.expected b/tests/GCCTestSuite/inline-1.c.expected new file mode 100644 index 0000000..4dce611 --- /dev/null +++ b/tests/GCCTestSuite/inline-1.c.expected @@ -0,0 +1,28 @@ +/* Verify that DECL_INLINE gets copied between DECLs properly. */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-final { if [ istarget hppa*-*-* ] { scan-assembler-not "xyzzy?,%r" } else { scan-assembler-not "xyzzy" } } } */ + +/* Test that declaration followed by definition inlines. */ +static inline int xyzzy0 (int); +static int xyzzy0 (int x) { return x; } +int test0 (void) +{ + return xyzzy0 (5); +} + +/* Test that definition following declaration inlines. */ +static int xyzzy1 (int); +static inline int xyzzy1 (int x) { return x; } +int test1 (void) +{ + return xyzzy1 (5); +} + +/* Test that redeclaration inside a function body inlines. */ +extern inline int xyzzy2 (int x) { return x; } +int test2 (void) +{ + extern int xyzzy2 (int); + return xyzzy2 (5); +} diff --git a/tests/GCCTestSuite/inline-1.hex.expected b/tests/GCCTestSuite/inline-1.hex.expected new file mode 100644 index 0000000..4b8dbb2 --- /dev/null +++ b/tests/GCCTestSuite/inline-1.hex.expected @@ -0,0 +1,49 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501E51FF50286 +:10002000E51EF503E51DF504E51CF505E501C0E059 +:10003000E500C0E075E0042506F50675E00035072B +:10004000F507E502F582E503F583E504F500E5052E +:10005000F5012200E506758202C39582F506E507E3 +:100060007583009583F507D0E0F50875E001250656 +:10007000F58275E0003507F583E508F0D0E0F50876 +:1000800075E0002506F58275E0003507F583E50883 +:10009000F0751F05751E00751D00751C001200000F +:1000A000E582F502E583F503E500F504E501F505D4 +:1000B000E502F500E503F501E504F509E505F50AB6 +:1000C000E500F502E501F503E509F504E50AF505A6 +:1000D00075E0002506F58275E0003507F583E0F54B +:1000E00008E508C0E075E0012506F58275E00035F9 +:1000F00007F583E0F508E508C0E075E0022506F5A0 +:100100000675E0003507F507E502F582E503F5839E +:10011000E504F500E505F5012200E506758204C356 +:100120009582F506E5077583009583F507D0E0F520 +:1001300000D0E0F501E51FF502E51EF503E51DF52C +:1001400004E51CF505E501C0E0E500C0E075E0044C +:100150002506F50675E0003507F507E502F582E5A9 +:1001600003F583E504F500E505F5012200E50675D4 +:100170008202C39582F506E5077583009583F5072E +:10018000D0E0F50875E0012506F58275E000350739 +:10019000F583E508F0D0E0F50875E0002506F58266 +:1001A00075E0003507F583E508F0751F05751E003D +:1001B000751D00751C00120119E582F502E583F535 +:1001C00003E500F504E501F505E502F500E503F5B5 +:1001D00001E504F509E505F50AE500F502E501F597 +:1001E00003E509F504E50AF50575E0002506F58245 +:1001F00075E0003507F583E0F508E508C0E075E037 +:10020000012506F58275E0003507F583E0F508E580 +:1002100008C0E075E0022506F50675E0003507F533 +:1002200007E502F582E503F583E504F500E505F54C +:1002300001220000E506758202C39582F506E507F6 +:100240007583009583F507D0E0F50875E001250674 +:10025000F58275E0003507F583E508F0D0E0F50894 +:1002600075E0002506F58275E0003507F583E508A1 +:10027000F0751F05751E00751D00751C00E582F5E3 +:1002800002E583F503E500F504E501F505E502F572 +:1002900000E503F501E504F509E505F50AE500F5D6 +:1002A00002E501F503E509F504E50AF50575E00049 +:1002B0002506F58275E0003507F583E0F508E508C9 +:1002C000C0E075E0012506F58275E0003507F5838D +:1002D000E0F508E508C0E075E0022506F50675E0E2 +:1002E000003507F507E502F582E503F583E504F53A +:1002F00000E505F5012200000000000000000000FC +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-1.s.expected b/tests/GCCTestSuite/inline-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-10.c b/tests/GCCTestSuite/inline-10.c new file mode 100644 index 0000000..ed6851a --- /dev/null +++ b/tests/GCCTestSuite/inline-10.c @@ -0,0 +1,6 @@ +/* Test inline main, gnu99 mode, freestanding, -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -ffreestanding -pedantic-errors" } */ + +inline int main (void); diff --git a/tests/GCCTestSuite/inline-10.c.expected b/tests/GCCTestSuite/inline-10.c.expected new file mode 100644 index 0000000..ed6851a --- /dev/null +++ b/tests/GCCTestSuite/inline-10.c.expected @@ -0,0 +1,6 @@ +/* Test inline main, gnu99 mode, freestanding, -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -ffreestanding -pedantic-errors" } */ + +inline int main (void); diff --git a/tests/GCCTestSuite/inline-10.hex.expected b/tests/GCCTestSuite/inline-10.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline-10.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-10.s.expected b/tests/GCCTestSuite/inline-10.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-10.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-17.c b/tests/GCCTestSuite/inline-17.c new file mode 100644 index 0000000..235ad8b --- /dev/null +++ b/tests/GCCTestSuite/inline-17.c @@ -0,0 +1,24 @@ +/* Test __attribute__((gnu_inline)). */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ +/* { dg-final { scan-assembler "func1" } } */ +/* { dg-final { scan-assembler-not "func2" } } */ +/* { dg-final { scan-assembler "func3" } } */ +/* { dg-final { scan-assembler "func4" } } */ + +#if __STDC_VERSION__ >= 199901L +# define inline __attribute__((gnu_inline)) inline +#endif + +extern inline int func1 (void) { return 0; } +inline int func1 (void) { return 1; } + +extern int func2 (void); +extern inline int func2 (void) { return 2; } + +inline int func3 (void); +inline int func3 (void) { return 3; } + +extern int func4 (void); +extern inline int func4 (void) { return 4; } +int func4 (void) { return 5; } diff --git a/tests/GCCTestSuite/inline-17.c.expected b/tests/GCCTestSuite/inline-17.c.expected new file mode 100644 index 0000000..235ad8b --- /dev/null +++ b/tests/GCCTestSuite/inline-17.c.expected @@ -0,0 +1,24 @@ +/* Test __attribute__((gnu_inline)). */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ +/* { dg-final { scan-assembler "func1" } } */ +/* { dg-final { scan-assembler-not "func2" } } */ +/* { dg-final { scan-assembler "func3" } } */ +/* { dg-final { scan-assembler "func4" } } */ + +#if __STDC_VERSION__ >= 199901L +# define inline __attribute__((gnu_inline)) inline +#endif + +extern inline int func1 (void) { return 0; } +inline int func1 (void) { return 1; } + +extern int func2 (void); +extern inline int func2 (void) { return 2; } + +inline int func3 (void); +inline int func3 (void) { return 3; } + +extern int func4 (void); +extern inline int func4 (void) { return 4; } +int func4 (void) { return 5; } diff --git a/tests/GCCTestSuite/inline-17.hex.expected b/tests/GCCTestSuite/inline-17.hex.expected new file mode 100644 index 0000000..1a10082 --- /dev/null +++ b/tests/GCCTestSuite/inline-17.hex.expected @@ -0,0 +1,13 @@ +:1000000000D0E0F500D0E0F501750901750A007532 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200D02E +:10004000E0F500D0E0F501750903750A00750B00B5 +:10005000750C00E509F502E50AF503E50BF504E585 +:100060000CF505E501C0E0E500C0E0E502F582E53C +:1000700003F583E504F500E505F5012200D0E0F580 +:1000800000D0E0F501750905750A00750B00750CC7 +:1000900000E509F502E50AF503E50BF504E50CF5C5 +:1000A00005E501C0E0E500C0E0E502F582E503F505 +:1000B00083E504F500E505F50122000000000000DD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-17.s.expected b/tests/GCCTestSuite/inline-17.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-17.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-18.c b/tests/GCCTestSuite/inline-18.c new file mode 100644 index 0000000..5a37195 --- /dev/null +++ b/tests/GCCTestSuite/inline-18.c @@ -0,0 +1,28 @@ +/* Test -fgnu89-extern-inline. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -fgnu89-inline" } */ +/* { dg-final { scan-assembler "func1" } } */ +/* { dg-final { scan-assembler-not "func2" } } */ +/* { dg-final { scan-assembler "func3" } } */ +/* { dg-final { scan-assembler "func4" } } */ + +#ifndef __GNUC_GNU_INLINE__ +#error __GNUC_GNU_INLINE__ is not defined +#endif + +#ifdef __GNUC_STDC_INLINE__ +#error __GNUC_STDC_INLINE__ is defined +#endif + +extern inline int func1 (void) { return 0; } +inline int func1 (void) { return 1; } + +extern int func2 (void); +extern inline int func2 (void) { return 2; } + +inline int func3 (void); +inline int func3 (void) { return 3; } + +extern int func4 (void); +extern inline int func4 (void) { return 4; } +int func4 (void) { return 5; } diff --git a/tests/GCCTestSuite/inline-18.c.expected b/tests/GCCTestSuite/inline-18.c.expected new file mode 100644 index 0000000..5a37195 --- /dev/null +++ b/tests/GCCTestSuite/inline-18.c.expected @@ -0,0 +1,28 @@ +/* Test -fgnu89-extern-inline. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -fgnu89-inline" } */ +/* { dg-final { scan-assembler "func1" } } */ +/* { dg-final { scan-assembler-not "func2" } } */ +/* { dg-final { scan-assembler "func3" } } */ +/* { dg-final { scan-assembler "func4" } } */ + +#ifndef __GNUC_GNU_INLINE__ +#error __GNUC_GNU_INLINE__ is not defined +#endif + +#ifdef __GNUC_STDC_INLINE__ +#error __GNUC_STDC_INLINE__ is defined +#endif + +extern inline int func1 (void) { return 0; } +inline int func1 (void) { return 1; } + +extern int func2 (void); +extern inline int func2 (void) { return 2; } + +inline int func3 (void); +inline int func3 (void) { return 3; } + +extern int func4 (void); +extern inline int func4 (void) { return 4; } +int func4 (void) { return 5; } diff --git a/tests/GCCTestSuite/inline-18.hex.expected b/tests/GCCTestSuite/inline-18.hex.expected new file mode 100644 index 0000000..1a10082 --- /dev/null +++ b/tests/GCCTestSuite/inline-18.hex.expected @@ -0,0 +1,13 @@ +:1000000000D0E0F500D0E0F501750901750A007532 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200D02E +:10004000E0F500D0E0F501750903750A00750B00B5 +:10005000750C00E509F502E50AF503E50BF504E585 +:100060000CF505E501C0E0E500C0E0E502F582E53C +:1000700003F583E504F500E505F5012200D0E0F580 +:1000800000D0E0F501750905750A00750B00750CC7 +:1000900000E509F502E50AF503E50BF504E50CF5C5 +:1000A00005E501C0E0E500C0E0E502F582E503F505 +:1000B00083E504F500E505F50122000000000000DD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-18.s.expected b/tests/GCCTestSuite/inline-18.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-18.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-19.c b/tests/GCCTestSuite/inline-19.c new file mode 100644 index 0000000..96dceb4 --- /dev/null +++ b/tests/GCCTestSuite/inline-19.c @@ -0,0 +1,28 @@ +/* Test -fgnu89-extern-inline. */ +/* { dg-do compile } */ +/* { dg-options "-fgnu89-inline" } */ +/* { dg-final { scan-assembler "func1" } } */ +/* { dg-final { scan-assembler-not "func2" } } */ +/* { dg-final { scan-assembler "func3" } } */ +/* { dg-final { scan-assembler "func4" } } */ + +#ifndef __GNUC_GNU_INLINE__ +#error __GNUC_GNU_INLINE__ is not defined +#endif + +#ifdef __GNUC_STDC_INLINE__ +#error __GNUC_STDC_INLINE__ is defined +#endif + +extern inline int func1 (void) { return 0; } +inline int func1 (void) { return 1; } + +extern int func2 (void); +extern inline int func2 (void) { return 2; } + +inline int func3 (void); +inline int func3 (void) { return 3; } + +extern int func4 (void); +extern inline int func4 (void) { return 4; } +int func4 (void) { return 5; } diff --git a/tests/GCCTestSuite/inline-19.c.expected b/tests/GCCTestSuite/inline-19.c.expected new file mode 100644 index 0000000..96dceb4 --- /dev/null +++ b/tests/GCCTestSuite/inline-19.c.expected @@ -0,0 +1,28 @@ +/* Test -fgnu89-extern-inline. */ +/* { dg-do compile } */ +/* { dg-options "-fgnu89-inline" } */ +/* { dg-final { scan-assembler "func1" } } */ +/* { dg-final { scan-assembler-not "func2" } } */ +/* { dg-final { scan-assembler "func3" } } */ +/* { dg-final { scan-assembler "func4" } } */ + +#ifndef __GNUC_GNU_INLINE__ +#error __GNUC_GNU_INLINE__ is not defined +#endif + +#ifdef __GNUC_STDC_INLINE__ +#error __GNUC_STDC_INLINE__ is defined +#endif + +extern inline int func1 (void) { return 0; } +inline int func1 (void) { return 1; } + +extern int func2 (void); +extern inline int func2 (void) { return 2; } + +inline int func3 (void); +inline int func3 (void) { return 3; } + +extern int func4 (void); +extern inline int func4 (void) { return 4; } +int func4 (void) { return 5; } diff --git a/tests/GCCTestSuite/inline-19.hex.expected b/tests/GCCTestSuite/inline-19.hex.expected new file mode 100644 index 0000000..1a10082 --- /dev/null +++ b/tests/GCCTestSuite/inline-19.hex.expected @@ -0,0 +1,13 @@ +:1000000000D0E0F500D0E0F501750901750A007532 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200D02E +:10004000E0F500D0E0F501750903750A00750B00B5 +:10005000750C00E509F502E50AF503E50BF504E585 +:100060000CF505E501C0E0E500C0E0E502F582E53C +:1000700003F583E504F500E505F5012200D0E0F580 +:1000800000D0E0F501750905750A00750B00750CC7 +:1000900000E509F502E50AF503E50BF504E50CF5C5 +:1000A00005E501C0E0E500C0E0E502F582E503F505 +:1000B00083E504F500E505F50122000000000000DD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-19.s.expected b/tests/GCCTestSuite/inline-19.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-19.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-2.c b/tests/GCCTestSuite/inline-2.c new file mode 100644 index 0000000..ef7c711 --- /dev/null +++ b/tests/GCCTestSuite/inline-2.c @@ -0,0 +1,19 @@ +/* Ensure that we continue to consider FOO local, even though + it has been deferred. */ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O3 -finline-limit=0 -fpic" } */ + +static int foo(void) +{ + return 3; +} + +int bar(void) +{ + /* Call twice to avoid bypassing the limit for functions called once. */ + return foo() + foo() + 1; +} + +/* { dg-final { scan-assembler-not "jsr" { target alpha*-*-* } } } */ +/* { dg-final { scan-assembler-not "PLT" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-assembler-not "plt" { target powerpc*-*-* } } } */ diff --git a/tests/GCCTestSuite/inline-2.c.expected b/tests/GCCTestSuite/inline-2.c.expected new file mode 100644 index 0000000..ef7c711 --- /dev/null +++ b/tests/GCCTestSuite/inline-2.c.expected @@ -0,0 +1,19 @@ +/* Ensure that we continue to consider FOO local, even though + it has been deferred. */ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O3 -finline-limit=0 -fpic" } */ + +static int foo(void) +{ + return 3; +} + +int bar(void) +{ + /* Call twice to avoid bypassing the limit for functions called once. */ + return foo() + foo() + 1; +} + +/* { dg-final { scan-assembler-not "jsr" { target alpha*-*-* } } } */ +/* { dg-final { scan-assembler-not "PLT" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-assembler-not "plt" { target powerpc*-*-* } } } */ diff --git a/tests/GCCTestSuite/inline-2.hex.expected b/tests/GCCTestSuite/inline-2.hex.expected new file mode 100644 index 0000000..5605dfd --- /dev/null +++ b/tests/GCCTestSuite/inline-2.hex.expected @@ -0,0 +1,34 @@ +:1000000000D0E0F500D0E0F501750903750A007530 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200E519 +:1000400006758206C39582F506E5077583009583DC +:10005000F507D0E0F50875E0012506F58275E000AA +:100060003507F583E508F0D0E0F50875E0002506D2 +:10007000F58275E0003507F583E508F075E00525A4 +:1000800006F58275E0003507F583E513F075E004A9 +:100090002506F58275E0003507F583E512F075E079 +:1000A000032506F58275E0003507F583E511F07547 +:1000B000E0022506F58275E0003507F583E510F0CE +:1000C000120000E582F502E583F503E500F504E59D +:1000D00001F505E502F510E503F511E504F512E576 +:1000E00005F513120000E582F502E583F503E5004E +:1000F000F504E501F505E502F50BE503F501E50479 +:10010000F509E505F50AC3750000E50BF5F0E51006 +:1001100035F0F500E501F5F0E51135F0F501E509FB +:10012000F5F0E51235F0F509E50AF5F0E51335F0DF +:10013000F50F750B01750C00750D00750E00C3757C +:100140000A00E50BF5F0E50035F0F500E50CF5F0FB +:10015000E50135F0F501E50DF5F0E50935F0F509B6 +:10016000E50EF5F0E50F35F0F50AE500F502E501DD +:10017000F503E509F504E50AF50575E0052506F53D +:100180008275E0003507F583E0F51375E004250678 +:10019000F58275E0003507F583E0F51275E003257B +:1001A00006F58275E0003507F583E0F51175E0028C +:1001B0002506F58275E0003507F583E0F51075E05A +:1001C000002506F58275E0003507F583E0F508E5C2 +:1001D00008C0E075E0012506F58275E0003507F5F9 +:1001E00083E0F508E508C0E075E0062506F506752C +:1001F000E0003507F507E502F582E503F583E50440 +:10020000F500E505F50122000000000000000000F7 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-2.s.expected b/tests/GCCTestSuite/inline-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-21.c b/tests/GCCTestSuite/inline-21.c new file mode 100644 index 0000000..8961ce4 --- /dev/null +++ b/tests/GCCTestSuite/inline-21.c @@ -0,0 +1,4 @@ +/* Test -fno-gnu89-inline. */ +/* { dg-do compile } */ +/* { dg-options "-fno-gnu89-inline" } */ +/* { dg-error "is not supported" "" { target *-*-* } 0 } */ diff --git a/tests/GCCTestSuite/inline-21.c.expected b/tests/GCCTestSuite/inline-21.c.expected new file mode 100644 index 0000000..8961ce4 --- /dev/null +++ b/tests/GCCTestSuite/inline-21.c.expected @@ -0,0 +1,4 @@ +/* Test -fno-gnu89-inline. */ +/* { dg-do compile } */ +/* { dg-options "-fno-gnu89-inline" } */ +/* { dg-error "is not supported" "" { target *-*-* } 0 } */ diff --git a/tests/GCCTestSuite/inline-21.hex.expected b/tests/GCCTestSuite/inline-21.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline-21.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-21.s.expected b/tests/GCCTestSuite/inline-21.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-21.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-4.c b/tests/GCCTestSuite/inline-4.c new file mode 100644 index 0000000..2442f2d --- /dev/null +++ b/tests/GCCTestSuite/inline-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "big_static_inline" } } */ + +extern void f(void); +static inline void big_static_inline(void) +{ + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); +} diff --git a/tests/GCCTestSuite/inline-4.c.expected b/tests/GCCTestSuite/inline-4.c.expected new file mode 100644 index 0000000..2442f2d --- /dev/null +++ b/tests/GCCTestSuite/inline-4.c.expected @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "big_static_inline" } } */ + +extern void f(void); +static inline void big_static_inline(void) +{ + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); +} diff --git a/tests/GCCTestSuite/inline-4.hex.expected b/tests/GCCTestSuite/inline-4.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline-4.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-4.s.expected b/tests/GCCTestSuite/inline-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-5.c b/tests/GCCTestSuite/inline-5.c new file mode 100644 index 0000000..d72fad6 --- /dev/null +++ b/tests/GCCTestSuite/inline-5.c @@ -0,0 +1,13 @@ +/* PR middle-end/13448 */ + +/* { dg-options "-O3" } */ + +void funct (const int n) +{ + n++; /* { dg-error "" } */ +} + +int main () { + funct (1); + return 0; +} diff --git a/tests/GCCTestSuite/inline-5.c.expected b/tests/GCCTestSuite/inline-5.c.expected new file mode 100644 index 0000000..d72fad6 --- /dev/null +++ b/tests/GCCTestSuite/inline-5.c.expected @@ -0,0 +1,13 @@ +/* PR middle-end/13448 */ + +/* { dg-options "-O3" } */ + +void funct (const int n) +{ + n++; /* { dg-error "" } */ +} + +int main () { + funct (1); + return 0; +} diff --git a/tests/GCCTestSuite/inline-5.hex.expected b/tests/GCCTestSuite/inline-5.hex.expected new file mode 100644 index 0000000..c966bda --- /dev/null +++ b/tests/GCCTestSuite/inline-5.hex.expected @@ -0,0 +1,19 @@ +:1000000075812F7506FF7507FF12006602000C0050 +:10001000E506758204C39582F506E50775830095AC +:1000200083F507D0E0F500D0E0F501C3750900E5E0 +:1000300009F502E509F503E509F504E509F505E526 +:1000400001C0E0E500C0E075E0042506F50675E0B6 +:10005000003507F507E502F582E503F583E504F5CC +:1000600000E505F5012200E506758202C39582F5DB +:1000700006E5077583009583F507D0E0F50875E080 +:10008000012506F58275E0003507F583E508F0D017 +:10009000E0F50875E0002506F58275E0003507F506 +:1000A00083E508F0751F01751E00751D00751C00A5 +:1000B00012000F750000750100750900750A00E552 +:1000C00000F502E501F503E509F504E50AF5057516 +:1000D000E0002506F58275E0003507F583E0F508B8 +:1000E000E508C0E075E0012506F58275E0003507FA +:1000F000F583E0F508E508C0E075E0022506F506A1 +:1001000075E0003507F507E502F582E503F583E5BF +:1001100004F500E505F501220000000000000000E4 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-5.s.expected b/tests/GCCTestSuite/inline-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-6.c b/tests/GCCTestSuite/inline-6.c new file mode 100644 index 0000000..81d6dc2 --- /dev/null +++ b/tests/GCCTestSuite/inline-6.c @@ -0,0 +1,6 @@ +/* Test duplicate inline, gnu89 mode. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } */ + +inline inline void f (void) {} diff --git a/tests/GCCTestSuite/inline-6.c.expected b/tests/GCCTestSuite/inline-6.c.expected new file mode 100644 index 0000000..81d6dc2 --- /dev/null +++ b/tests/GCCTestSuite/inline-6.c.expected @@ -0,0 +1,6 @@ +/* Test duplicate inline, gnu89 mode. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } */ + +inline inline void f (void) {} diff --git a/tests/GCCTestSuite/inline-6.hex.expected b/tests/GCCTestSuite/inline-6.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/inline-6.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-6.s.expected b/tests/GCCTestSuite/inline-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-7.c b/tests/GCCTestSuite/inline-7.c new file mode 100644 index 0000000..508aaa4 --- /dev/null +++ b/tests/GCCTestSuite/inline-7.c @@ -0,0 +1,6 @@ +/* Test duplicate inline, gnu99 mode. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fgnu89-inline" } */ + +inline inline void f (void) {} diff --git a/tests/GCCTestSuite/inline-7.c.expected b/tests/GCCTestSuite/inline-7.c.expected new file mode 100644 index 0000000..508aaa4 --- /dev/null +++ b/tests/GCCTestSuite/inline-7.c.expected @@ -0,0 +1,6 @@ +/* Test duplicate inline, gnu99 mode. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fgnu89-inline" } */ + +inline inline void f (void) {} diff --git a/tests/GCCTestSuite/inline-7.hex.expected b/tests/GCCTestSuite/inline-7.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/inline-7.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-7.s.expected b/tests/GCCTestSuite/inline-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-8.c b/tests/GCCTestSuite/inline-8.c new file mode 100644 index 0000000..80d9fff --- /dev/null +++ b/tests/GCCTestSuite/inline-8.c @@ -0,0 +1,6 @@ +/* Test inline main, gnu99 mode, hosted. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fhosted" } */ + +inline int main (void); /* { dg-warning "warning: cannot inline function 'main'" } */ diff --git a/tests/GCCTestSuite/inline-8.c.expected b/tests/GCCTestSuite/inline-8.c.expected new file mode 100644 index 0000000..80d9fff --- /dev/null +++ b/tests/GCCTestSuite/inline-8.c.expected @@ -0,0 +1,6 @@ +/* Test inline main, gnu99 mode, hosted. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fhosted" } */ + +inline int main (void); /* { dg-warning "warning: cannot inline function 'main'" } */ diff --git a/tests/GCCTestSuite/inline-8.hex.expected b/tests/GCCTestSuite/inline-8.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline-8.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-8.s.expected b/tests/GCCTestSuite/inline-8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-9.c b/tests/GCCTestSuite/inline-9.c new file mode 100644 index 0000000..0f22b08 --- /dev/null +++ b/tests/GCCTestSuite/inline-9.c @@ -0,0 +1,6 @@ +/* Test inline main, gnu99 mode, hosted, -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fhosted -pedantic-errors" } */ + +inline int main (void); /* { dg-error "error: cannot inline function 'main'" } */ diff --git a/tests/GCCTestSuite/inline-9.c.expected b/tests/GCCTestSuite/inline-9.c.expected new file mode 100644 index 0000000..0f22b08 --- /dev/null +++ b/tests/GCCTestSuite/inline-9.c.expected @@ -0,0 +1,6 @@ +/* Test inline main, gnu99 mode, hosted, -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -fhosted -pedantic-errors" } */ + +inline int main (void); /* { dg-error "error: cannot inline function 'main'" } */ diff --git a/tests/GCCTestSuite/inline-9.hex.expected b/tests/GCCTestSuite/inline-9.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline-9.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-9.s.expected b/tests/GCCTestSuite/inline-9.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline-9.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline-mcpy.c b/tests/GCCTestSuite/inline-mcpy.c new file mode 100644 index 0000000..4917394 --- /dev/null +++ b/tests/GCCTestSuite/inline-mcpy.c @@ -0,0 +1,11 @@ +/* Test if we inline memcpy even with -Os, when the user requested it. */ +/* Don't name this test with memcpy in its name, otherwise the scan-assembler + would be confused. */ +/* { dg-do compile { target i?86-*-linux* x86_64-*-linux* } } */ +/* { dg-options "-Os -minline-all-stringops" } */ +/* { dg-final { scan-assembler-not "memcpy" } } */ +char f(int i) +{ + char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; + return ram_split[i][0]; +} diff --git a/tests/GCCTestSuite/inline-mcpy.c.expected b/tests/GCCTestSuite/inline-mcpy.c.expected new file mode 100644 index 0000000..4917394 --- /dev/null +++ b/tests/GCCTestSuite/inline-mcpy.c.expected @@ -0,0 +1,11 @@ +/* Test if we inline memcpy even with -Os, when the user requested it. */ +/* Don't name this test with memcpy in its name, otherwise the scan-assembler + would be confused. */ +/* { dg-do compile { target i?86-*-linux* x86_64-*-linux* } } */ +/* { dg-options "-Os -minline-all-stringops" } */ +/* { dg-final { scan-assembler-not "memcpy" } } */ +char f(int i) +{ + char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; + return ram_split[i][0]; +} diff --git a/tests/GCCTestSuite/inline1.c b/tests/GCCTestSuite/inline1.c new file mode 100644 index 0000000..f7a7eb4 --- /dev/null +++ b/tests/GCCTestSuite/inline1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This test is expected to fail with an error for the redefinition of foo. + This violates the constraint of 6.9#3 (no more than one external definition + of an identifier with internal linkage in the same translation unit). */ +static inline int foo(void) { return 1; } /* { dg-error "previous definition of" } */ +static inline int foo(void) { return 0; } /* { dg-error "redefinition of" } */ + diff --git a/tests/GCCTestSuite/inline1.c.expected b/tests/GCCTestSuite/inline1.c.expected new file mode 100644 index 0000000..f7a7eb4 --- /dev/null +++ b/tests/GCCTestSuite/inline1.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This test is expected to fail with an error for the redefinition of foo. + This violates the constraint of 6.9#3 (no more than one external definition + of an identifier with internal linkage in the same translation unit). */ +static inline int foo(void) { return 1; } /* { dg-error "previous definition of" } */ +static inline int foo(void) { return 0; } /* { dg-error "redefinition of" } */ + diff --git a/tests/GCCTestSuite/inline1.hex.expected b/tests/GCCTestSuite/inline1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline1.s.expected b/tests/GCCTestSuite/inline1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline2.c b/tests/GCCTestSuite/inline2.c new file mode 100644 index 0000000..ede4104 --- /dev/null +++ b/tests/GCCTestSuite/inline2.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This test should compile successfully. */ +extern inline int foo (void) { return 0; } +inline int foo (void) { return 1; } diff --git a/tests/GCCTestSuite/inline2.c.expected b/tests/GCCTestSuite/inline2.c.expected new file mode 100644 index 0000000..ede4104 --- /dev/null +++ b/tests/GCCTestSuite/inline2.c.expected @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This test should compile successfully. */ +extern inline int foo (void) { return 0; } +inline int foo (void) { return 1; } diff --git a/tests/GCCTestSuite/inline2.hex.expected b/tests/GCCTestSuite/inline2.hex.expected new file mode 100644 index 0000000..161325c --- /dev/null +++ b/tests/GCCTestSuite/inline2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750901750A007532 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F501220000FE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline2.s.expected b/tests/GCCTestSuite/inline2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline4.c b/tests/GCCTestSuite/inline4.c new file mode 100644 index 0000000..a5c7dda --- /dev/null +++ b/tests/GCCTestSuite/inline4.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This testcase should fail since we're redefining foo in the same + translation unit. */ +int foo (void) { return 2; } /* { dg-error "previous definition of" } */ +extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */ diff --git a/tests/GCCTestSuite/inline4.c.expected b/tests/GCCTestSuite/inline4.c.expected new file mode 100644 index 0000000..a5c7dda --- /dev/null +++ b/tests/GCCTestSuite/inline4.c.expected @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This testcase should fail since we're redefining foo in the same + translation unit. */ +int foo (void) { return 2; } /* { dg-error "previous definition of" } */ +extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */ diff --git a/tests/GCCTestSuite/inline4.hex.expected b/tests/GCCTestSuite/inline4.hex.expected new file mode 100644 index 0000000..6ae035a --- /dev/null +++ b/tests/GCCTestSuite/inline4.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750902750A007531 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F501220000FE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline4.s.expected b/tests/GCCTestSuite/inline4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/inline5.c b/tests/GCCTestSuite/inline5.c new file mode 100644 index 0000000..86a2776 --- /dev/null +++ b/tests/GCCTestSuite/inline5.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This testcase should fail since we're redefining foo in the same + translation unit. */ +extern inline int foo (void) { return 2; } /* { dg-error "previous definition of" } */ +extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */ diff --git a/tests/GCCTestSuite/inline5.c.expected b/tests/GCCTestSuite/inline5.c.expected new file mode 100644 index 0000000..86a2776 --- /dev/null +++ b/tests/GCCTestSuite/inline5.c.expected @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -std=gnu89" } */ +/* This testcase should fail since we're redefining foo in the same + translation unit. */ +extern inline int foo (void) { return 2; } /* { dg-error "previous definition of" } */ +extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */ diff --git a/tests/GCCTestSuite/inline5.hex.expected b/tests/GCCTestSuite/inline5.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/inline5.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/inline5.s.expected b/tests/GCCTestSuite/inline5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/inline5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/intermod-1.c b/tests/GCCTestSuite/intermod-1.c new file mode 100644 index 0000000..9f8d19d --- /dev/null +++ b/tests/GCCTestSuite/intermod-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-not {foo[1-9]\.[0-9]} } } */ + +/* Check that we don't get .0 suffixes on static variables when not using + intermodule analysis. */ + +static int foo1; +static int foo2 = 1; + +static void foo5(void) { } +static void foo6(void); +static void foo6(void) { } +static void foo7(void); +void foo7(void) { } + +void foo9(void) +{ + foo1 = 2; + foo2 = 3; + foo5(); + foo6(); + foo7(); +} diff --git a/tests/GCCTestSuite/intermod-1.c.expected b/tests/GCCTestSuite/intermod-1.c.expected new file mode 100644 index 0000000..9f8d19d --- /dev/null +++ b/tests/GCCTestSuite/intermod-1.c.expected @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-not {foo[1-9]\.[0-9]} } } */ + +/* Check that we don't get .0 suffixes on static variables when not using + intermodule analysis. */ + +static int foo1; +static int foo2 = 1; + +static void foo5(void) { } +static void foo6(void); +static void foo6(void) { } +static void foo7(void); +void foo7(void) { } + +void foo9(void) +{ + foo1 = 2; + foo2 = 3; + foo5(); + foo6(); + foo7(); +} diff --git a/tests/GCCTestSuite/intermod-1.hex.expected b/tests/GCCTestSuite/intermod-1.hex.expected new file mode 100644 index 0000000..0530367 --- /dev/null +++ b/tests/GCCTestSuite/intermod-1.hex.expected @@ -0,0 +1,48 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F5012200D0E0F500D0B8 +:10007000E0F501750900E509F502E509F503E50973 +:10008000F504E509F505E501C0E0E500C0E0E5029D +:10009000F582E503F583E504F500E505F5012200A9 +:1000A000E506758202C39582F506E507758300951E +:1000B00083F507D0E0F50875E0012506F58275E0C7 +:1000C000003507F583E508F0D0E0F50875E0002578 +:1000D00006F58275E0003507F583E508F09000002D +:1000E000E582F50D900000E583F50E750902750AAD +:1000F00000750B00750C00750100C3750000E5016B +:10010000F5F0E50D35F0F501E500F5F0E50E35F01B +:10011000F500E509F503E500F502E501F582E502E4 +:10012000F583E503F0750101C3750000E501F5F005 +:10013000E50D35F0F501E500F5F0E50E35F0F500DB +:10014000E50AF503E500F502E501F582E502F58330 +:10015000E503F0750102C3750000E501F5F0E50D5A +:1001600035F0F501E500F5F0E50E35F0F500E50BAD +:10017000F503E500F502E501F582E502F583E50307 +:10018000F0750103C3750000E501F5F0E50D35F0EC +:10019000F501E500F5F0E50E35F0F500E50CF503A9 +:1001A000E500F502E501F582E502F583E503F0904F +:1001B0000004E582F50D900004E583F50E75090352 +:1001C000750A00750B00750C00750100C375000001 +:1001D000E501F5F0E50D35F0F501E500F5F0E50E8A +:1001E00035F0F500E509F503E500F502E501F582D6 +:1001F000E502F583E503F0750101C3750000E50133 +:10020000F5F0E50D35F0F501E500F5F0E50E35F01A +:10021000F500E50AF503E500F502E501F582E502E2 +:10022000F583E503F0750102C3750000E501F5F003 +:10023000E50D35F0F501E500F5F0E50E35F0F500DA +:10024000E50BF503E500F502E501F582E502F5832E +:10025000E503F0750103C3750000E501F5F0E50D58 +:1002600035F0F501E500F5F0E50E35F0F500E50CAB +:10027000F503E500F502E501F582E502F583E50306 +:10028000F012000012003512006A750000E500F55A +:1002900002E500F503E500F504E500F50575E0006D +:1002A0002506F58275E0003507F583E0F508E508D9 +:1002B000C0E075E0012506F58275E0003507F5839D +:1002C000E0F508E508C0E075E0022506F50675E0F2 +:1002D000003507F507E502F582E503F583E504F54A +:1002E00000E505F50122000000000000000000000C +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/intermod-1.s.expected b/tests/GCCTestSuite/intermod-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/intermod-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/intmax_t-1.c b/tests/GCCTestSuite/intmax_t-1.c new file mode 100644 index 0000000..bcfb51c --- /dev/null +++ b/tests/GCCTestSuite/intmax_t-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +/* { dg-error "" "" { target *-*-solaris2.5.1 mips*-*-elf* *arm*-*-*elf* xscale*-*-elf* xtensa-*-elf* } 0 } */ + +/* Compile with -Wall to get a warning if built-in and system intmax_t don't + match. */ + +#include + +__INTMAX_TYPE__ __im_t__; +__UINTMAX_TYPE__ __uim_t__; +intmax_t *im_t_p; +uintmax_t *uim_t_p; + +void +imt (void) +{ + im_t_p = &__im_t__; +} + +void +uimt (void) +{ + uim_t_p = &__uim_t__; +} diff --git a/tests/GCCTestSuite/intmax_t-1.c.expected b/tests/GCCTestSuite/intmax_t-1.c.expected new file mode 100644 index 0000000..bcfb51c --- /dev/null +++ b/tests/GCCTestSuite/intmax_t-1.c.expected @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +/* { dg-error "" "" { target *-*-solaris2.5.1 mips*-*-elf* *arm*-*-*elf* xscale*-*-elf* xtensa-*-elf* } 0 } */ + +/* Compile with -Wall to get a warning if built-in and system intmax_t don't + match. */ + +#include + +__INTMAX_TYPE__ __im_t__; +__UINTMAX_TYPE__ __uim_t__; +intmax_t *im_t_p; +uintmax_t *uim_t_p; + +void +imt (void) +{ + im_t_p = &__im_t__; +} + +void +uimt (void) +{ + uim_t_p = &__uim_t__; +} diff --git a/tests/GCCTestSuite/intmax_t-1.hex.expected b/tests/GCCTestSuite/intmax_t-1.hex.expected new file mode 100644 index 0000000..eb4af91 --- /dev/null +++ b/tests/GCCTestSuite/intmax_t-1.hex.expected @@ -0,0 +1,24 @@ +:1000000000D0E0F50ED0E0F50FE510F50D900008FA +:10001000E582F50B900008E583F50C900000E58281 +:10002000F509900000E583F50A750100C37500002D +:10003000E501F5F0E50B35F0F501E500F5F0E50C2F +:1000400035F0F500E509F503E500F502E501F58277 +:10005000E502F583E503F0750101C3750000E501D4 +:10006000F5F0E50B35F0F501E500F5F0E50C35F0C0 +:10007000F500E50AF503E500F502E501F582E50284 +:10008000F583E503F0750000E500F502E500F503F2 +:10009000E500F504E500F505E50DF510E50FC0E018 +:1000A000E50EC0E0E502F582E503F583E504F50021 +:1000B000E505F5012200D0E0F50ED0E0F50FE510E2 +:1000C000F50D90000AE582F50B90000AE583F50C2A +:1000D000900004E582F509900004E583F50A7501B6 +:1000E00000C3750000E501F5F0E50B35F0F501E51D +:1000F00000F5F0E50C35F0F500E509F503E500F550 +:1001000002E501F582E502F583E503F0750101C31F +:10011000750000E501F5F0E50B35F0F501E500F5BA +:10012000F0E50C35F0F500E50AF503E500F502E52C +:1001300001F582E502F583E503F0750000E500F5C1 +:1001400002E500F503E500F504E500F505E50DF52C +:1001500010E50FC0E0E50EC0E0E502F582E503F52D +:1001600083E504F500E505F501220000000000002C +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/intmax_t-1.s.expected b/tests/GCCTestSuite/intmax_t-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/intmax_t-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/kpice1.c b/tests/GCCTestSuite/kpice1.c new file mode 100644 index 0000000..be9179b --- /dev/null +++ b/tests/GCCTestSuite/kpice1.c @@ -0,0 +1,6 @@ +/* { dg-do compile { target h8300-*-* } } */ +/* { dg-options "-ms -mn" } */ + +void f(void) __attribute__((interrupt_handler)); +void g(void) { } +void f(void) { g(); } diff --git a/tests/GCCTestSuite/kpice1.c.expected b/tests/GCCTestSuite/kpice1.c.expected new file mode 100644 index 0000000..be9179b --- /dev/null +++ b/tests/GCCTestSuite/kpice1.c.expected @@ -0,0 +1,6 @@ +/* { dg-do compile { target h8300-*-* } } */ +/* { dg-options "-ms -mn" } */ + +void f(void) __attribute__((interrupt_handler)); +void g(void) { } +void f(void) { g(); } diff --git a/tests/GCCTestSuite/kpice1.hex.expected b/tests/GCCTestSuite/kpice1.hex.expected new file mode 100644 index 0000000..d45d227 --- /dev/null +++ b/tests/GCCTestSuite/kpice1.hex.expected @@ -0,0 +1,15 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200E506758202C39582F50605 +:10004000E5077583009583F507D0E0F50875E001B5 +:100050002506F58275E0003507F583E508F0D0E068 +:10006000F50875E0002506F58275E0003507F58393 +:10007000E508F0120000750000E500F502E500F566 +:1000800003E500F504E500F50575E0002506F582B9 +:1000900075E0003507F583E0F508E508C0E075E098 +:1000A000012506F58275E0003507F583E0F508E5E2 +:1000B00008C0E075E0022506F50675E0003507F595 +:1000C00007E502F582E503F583E504F500E505F5AE +:1000D00001220000000000000000000000000000FD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/kpice1.s.expected b/tests/GCCTestSuite/kpice1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/kpice1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/label-compound-stmt-1.c b/tests/GCCTestSuite/label-compound-stmt-1.c new file mode 100644 index 0000000..7141163 --- /dev/null +++ b/tests/GCCTestSuite/label-compound-stmt-1.c @@ -0,0 +1,7 @@ +/* Test that labels at ends of compound statements are hard errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f(void) { g: } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "label|parse|syntax" "label at end of compound statement" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/label-compound-stmt-1.c.expected b/tests/GCCTestSuite/label-compound-stmt-1.c.expected new file mode 100644 index 0000000..7141163 --- /dev/null +++ b/tests/GCCTestSuite/label-compound-stmt-1.c.expected @@ -0,0 +1,7 @@ +/* Test that labels at ends of compound statements are hard errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f(void) { g: } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "label|parse|syntax" "label at end of compound statement" { target *-*-* } 6 } */ diff --git a/tests/GCCTestSuite/label-compound-stmt-1.hex.expected b/tests/GCCTestSuite/label-compound-stmt-1.hex.expected new file mode 100644 index 0000000..0f71613 --- /dev/null +++ b/tests/GCCTestSuite/label-compound-stmt-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F50100750900E509F544 +:1000100002E509F503E509F504E509F505E501C083 +:10002000E0E500C0E0E502F582E503F583E504F5CF +:1000300000E505F5012200000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/label-compound-stmt-1.s.expected b/tests/GCCTestSuite/label-compound-stmt-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/label-compound-stmt-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/local1.c b/tests/GCCTestSuite/local1.c new file mode 100644 index 0000000..e9f653b --- /dev/null +++ b/tests/GCCTestSuite/local1.c @@ -0,0 +1,23 @@ +/* This is allowed, with the effect that the 'extern' declaration at block + scope refers to the same object as the 'static' declaration at file scope. + + C90 6.1.2.2 [as corrected by TC1], C99 6.2.2: + + For an identifier declared with the storage-class specifier + extern in a scope in which a prior declaration of that + identifier is visible, if the prior declaration specifies + internal or external linkage, the linkage of the identifier at + the later daclaration is the same as the linkage specified at + the prior declaration. If no prior declaration is visible, + or if the prior declaration specifies no linkage, then the + identifer has external linkage. + + This is PR 14366. */ + +static int i; + +extern int i; + +static void f() { + extern int i; +} diff --git a/tests/GCCTestSuite/local1.c.expected b/tests/GCCTestSuite/local1.c.expected new file mode 100644 index 0000000..e9f653b --- /dev/null +++ b/tests/GCCTestSuite/local1.c.expected @@ -0,0 +1,23 @@ +/* This is allowed, with the effect that the 'extern' declaration at block + scope refers to the same object as the 'static' declaration at file scope. + + C90 6.1.2.2 [as corrected by TC1], C99 6.2.2: + + For an identifier declared with the storage-class specifier + extern in a scope in which a prior declaration of that + identifier is visible, if the prior declaration specifies + internal or external linkage, the linkage of the identifier at + the later daclaration is the same as the linkage specified at + the prior declaration. If no prior declaration is visible, + or if the prior declaration specifies no linkage, then the + identifer has external linkage. + + This is PR 14366. */ + +static int i; + +extern int i; + +static void f() { + extern int i; +} diff --git a/tests/GCCTestSuite/local1.hex.expected b/tests/GCCTestSuite/local1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/local1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/local1.s.expected b/tests/GCCTestSuite/local1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/local1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/loop-5.c b/tests/GCCTestSuite/loop-5.c new file mode 100644 index 0000000..198823b --- /dev/null +++ b/tests/GCCTestSuite/loop-5.c @@ -0,0 +1,16 @@ +/* PR c/16180 */ +/* { dg-options "-O2" } */ + +extern int b; +int foo (int a) +{ + if (a) + { + b = 0; + for(;;) + goto L; + } + L: + for(;;) + return 0; +} diff --git a/tests/GCCTestSuite/loop-5.c.expected b/tests/GCCTestSuite/loop-5.c.expected new file mode 100644 index 0000000..198823b --- /dev/null +++ b/tests/GCCTestSuite/loop-5.c.expected @@ -0,0 +1,16 @@ +/* PR c/16180 */ +/* { dg-options "-O2" } */ + +extern int b; +int foo (int a) +{ + if (a) + { + b = 0; + for(;;) + goto L; + } + L: + for(;;) + return 0; +} diff --git a/tests/GCCTestSuite/loop-5.hex.expected b/tests/GCCTestSuite/loop-5.hex.expected new file mode 100644 index 0000000..c66987b --- /dev/null +++ b/tests/GCCTestSuite/loop-5.hex.expected @@ -0,0 +1,57 @@ +:1000000000E506758205C39582F506E50775830050 +:100010009583F507D0E0F51BD0E0F50875E00025E5 +:1000200006F58275E0003507F583E508F0E512F581 +:1000300018E511F519E510F51AE51FF500E51EF5AF +:1000400001E51DF50DE51CF50E750F00E500F5F059 +:10005000E50F45F0F50FE501F5F0E50F45F0F50F7B +:10006000E50DF5F0E50F45F0F50FE50EF5F0E50FC0 +:1000700045F0F50FE50F700280030201C400007522 +:100080000001750100750D00750E00751001C37536 +:100090000F00E500F5F0E50F95F0F50F750F00E5A1 +:1000A0000FF5F0E50F35F0F50FE50FF5F0E510650C +:1000B000F0F510C3750F00E501F5F0E50F95F0F5CB +:1000C0000F750F00E50FF5F0E50F35F0F50FE50FB3 +:1000D000F5F0E51065F0F510C3750F00E50DF5F0CE +:1000E000E50F95F0F50F750F00E50FF5F0E50F350D +:1000F000F0F50FE50FF5F0E51065F0F510C3750F9D +:1001000000E50EF5F0E50F95F0F50F750F00E50F22 +:10011000F5F0E50F35F0F50FE50FF5F0E51065F0BA +:10012000F510750100750D00750E00750000E510E5 +:10013000F5F0E50045F0F500E501F5F0E50045F0E6 +:10014000F500E50DF5F0E50045F0F500E50EF5F0FC +:10015000E50045F0F500E500700280030201C000F3 +:10016000750900750A00750B00750C00E509F502AC +:10017000E50AF503E50BF504E50CF505E518F512C0 +:10018000E519F511E51AF51075E0002506F58275FB +:10019000E0003507F583E0F508E508C0E0E51BC0A1 +:1001A000E075E0052506F50675E0003507F507E57D +:1001B00002F582E503F583E504F500E505F5012286 +:1001C0000002016C00900000E582F511900000E54E +:1001D00083F512750D00750E00750F007510007512 +:1001E0000100C3750000E501F5F0E51135F0F501FA +:1001F000E500F5F0E51235F0F500E50DF503E50055 +:10020000F502E501F582E502F583E503F0750101EC +:10021000C3750000E501F5F0E51135F0F501E500E5 +:10022000F5F0E51235F0F500E50EF503E500F50211 +:10023000E501F582E502F583E503F0750102C3757A +:100240000000E501F5F0E51135F0F501E500F5F008 +:10025000E51235F0F500E50FF503E500F502E501DF +:10026000F582E502F583E503F0750103C37500002F +:10027000E501F5F0E51135F0F501E500F5F0E512E1 +:1002800035F0F500E510F503E500F502E501F5822E +:10029000E502F583E503F0750001750100750D00B9 +:1002A000750E00751001C3750F00E500F5F0E50F40 +:1002B00095F0F50F750F00E50FF5F0E50F35F0F54A +:1002C0000FE50FF5F0E51065F0F510C3750F00E5CB +:1002D00001F5F0E50F95F0F50F750F00E50FF5F05E +:1002E000E50F35F0F50FE50FF5F0E51065F0F510C9 +:1002F000C3750F00E50DF5F0E50F95F0F50F750FDF +:1003000000E50FF5F0E50F35F0F50FE50FF5F0E539 +:100310001065F0F510C3750F00E50EF5F0E50F95CB +:10032000F0F50F750F00E50FF5F0E50F35F0F50F5F +:10033000E50FF5F0E51065F0F510750100750D009D +:10034000750E00750000E510F5F0E50045F0F500CC +:10035000E501F5F0E50045F0F500E50DF5F0E50007 +:1003600045F0F500E50EF5F0E50045F0F500E50097 +:100370007002800302037B0002007E0002007E0008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/loop-5.s.expected b/tests/GCCTestSuite/loop-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/loop-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/m-un-1.c b/tests/GCCTestSuite/m-un-1.c new file mode 100644 index 0000000..ad84d44 --- /dev/null +++ b/tests/GCCTestSuite/m-un-1.c @@ -0,0 +1,37 @@ +/* m-un-1.c: "un" for "uninitialized" */ + +/* +From: Jim Wilson +Date: Wed, 6 Jul 1994 13:11:47 -0700 +To: dje@cygnus.com +Subject: Re: devo/gcc ChangeLog.fsf stmt.c +Cc: cvs-gcc@cygnus.com, tege@cygnus.com + + How about a test case? :-) + +Compile with -O -Wall and the broken compiler gives you: +tmp.c:6: warning: `k' might be used uninitialized in this function +The fixed compiler (and gcc 2.5.8) gives no warning. + +This happens to fix a performance regression in the code generated for +while loops, but that is presumably much much harder to test for. +*/ + +/* { dg-do compile } */ +/* { dg-options "-O -Wall" } */ + +int +sub () +{ + int i = 0; + int j = 0; + int k; /* { dg-bogus "`k' might be used uninitialized" "uninitialized warning regression" } */ + + while (i == 0 && j == 0) + { + k = 10; + i = sub (); + } + + return k; +} diff --git a/tests/GCCTestSuite/m-un-1.c.expected b/tests/GCCTestSuite/m-un-1.c.expected new file mode 100644 index 0000000..ad84d44 --- /dev/null +++ b/tests/GCCTestSuite/m-un-1.c.expected @@ -0,0 +1,37 @@ +/* m-un-1.c: "un" for "uninitialized" */ + +/* +From: Jim Wilson +Date: Wed, 6 Jul 1994 13:11:47 -0700 +To: dje@cygnus.com +Subject: Re: devo/gcc ChangeLog.fsf stmt.c +Cc: cvs-gcc@cygnus.com, tege@cygnus.com + + How about a test case? :-) + +Compile with -O -Wall and the broken compiler gives you: +tmp.c:6: warning: `k' might be used uninitialized in this function +The fixed compiler (and gcc 2.5.8) gives no warning. + +This happens to fix a performance regression in the code generated for +while loops, but that is presumably much much harder to test for. +*/ + +/* { dg-do compile } */ +/* { dg-options "-O -Wall" } */ + +int +sub () +{ + int i = 0; + int j = 0; + int k; /* { dg-bogus "`k' might be used uninitialized" "uninitialized warning regression" } */ + + while (i == 0 && j == 0) + { + k = 10; + i = sub (); + } + + return k; +} diff --git a/tests/GCCTestSuite/m-un-1.hex.expected b/tests/GCCTestSuite/m-un-1.hex.expected new file mode 100644 index 0000000..4230e9b --- /dev/null +++ b/tests/GCCTestSuite/m-un-1.hex.expected @@ -0,0 +1,89 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0750B00750C00750D0075D4 +:1000D0000E00751400751500751600751700750073 +:1000E00000750100750900750A00750F00C3E50071 +:1000F000F5F0E50B95F0F500E500F5F0E50F45F0BE +:10010000F50FC3E501F5F0E50C95F0F500E500F518 +:10011000F0E50F45F0F50FC3E509F5F0E50D95F0B5 +:10012000F500E500F5F0E50F45F0F50FC3E50AF53C +:10013000F0E50E95F0F500E500F5F0E50F45F0F57A +:100140000F750100750900750A00E50FF500750FC0 +:1001500001C3750B00E500F5F0E50B95F0F50B75A7 +:100160000B00E50BF5F0E50B35F0F50BE50BF5F0C5 +:10017000E50F65F0F50FC3750B00E501F5F0E50B34 +:1001800095F0F50B750B00E50BF5F0E50B35F0F58B +:100190000BE50BF5F0E50F65F0F50FC3750B00E50A +:1001A00009F5F0E50B95F0F50B750B00E50BF5F097 +:1001B000E50B35F0F50BE50BF5F0E50F65F0F50F08 +:1001C000C3750B00E50AF5F0E50B95F0F50B750B23 +:1001D00000E50BF5F0E50B35F0F50BE50BF5F0E57B +:1001E0000F65F0F50F750100750900750A007500BF +:1001F00000E50FF5F0E50045F0F500E501F5F0E567 +:100200000045F0F500E509F5F0E50045F0F500E5FD +:100210000AF5F0E50045F0F500E500700280030204 +:10022000041800750000750100750900750A007555 +:100230000C01C3750B00E500F5F0E50B95F0F50B2F +:10024000750B00E50BF5F0E50B35F0F50BE50BF55F +:10025000F0E50C65F0F50CC3750B00E501F5F0E574 +:100260000B95F0F50B750B00E50BF5F0E50B35F094 +:10027000F50BE50BF5F0E50C65F0F50CC3750B001F +:10028000E509F5F0E50B95F0F50B750B00E50BF5C1 +:10029000F0E50B35F0F50BE50BF5F0E50C65F0F549 +:1002A0000CC3750B00E50AF5F0E50B95F0F50B7541 +:1002B0000B00E50BF5F0E50B35F0F50BE50BF5F074 +:1002C000E50C65F0F50C750100750900750A0075FF +:1002D0000000E50CF5F0E50045F0F500E501F5F06E +:1002E000E50045F0F500E509F5F0E50045F0F5001D +:1002F000E50AF5F0E50045F0F500E5007002800341 +:100300000203360075100A7511007512007513008E +:10031000120000E582F502E583F503E500F504E54A +:1003200001F505E502F50BE503F50CE504F50DE532 +:1003300005F50E0200DE00E510F502E511F503E516 +:1003400012F504E513F50575E0092506F58275E05B +:10035000003507F583E0F51775E0082506F5827589 +:10036000E0003507F583E0F51675E0072506F58210 +:1003700075E0003507F583E0F51575E0062506F50F +:100380008275E0003507F583E0F51475E005250674 +:10039000F58275E0003507F583E0F51375E0042577 +:1003A00006F58275E0003507F583E0F51275E00388 +:1003B0002506F58275E0003507F583E0F51175E057 +:1003C000022506F58275E0003507F583E0F5107526 +:1003D000E0002506F58275E0003507F583E0F508B5 +:1003E000E508C0E075E0012506F58275E0003507F7 +:1003F000F583E0F508E508C0E075E00A2506F50696 +:1004000075E0003507F507E502F582E503F583E5BC +:1004100004F500E505F50122007500007501007581 +:100420000900750A00750C00C3E500F5F0E51495A8 +:10043000F0F500E500F5F0E50C45F0F50CC3E5013D +:10044000F5F0E51595F0F500E500F5F0E50C45F063 +:10045000F50CC3E509F5F0E51695F0F500E500F5B6 +:10046000F0E50C45F0F50CC3E50AF5F0E51795F05D +:10047000F500E500F5F0E50C45F0F50C75010075AB +:100480000900750A00E50CF500750C01C3750B0039 +:10049000E500F5F0E50B95F0F50B750B00E50BF5B8 +:1004A000F0E50B35F0F50BE50BF5F0E50C65F0F537 +:1004B0000CC3750B00E501F5F0E50B95F0F50B7538 +:1004C0000B00E50BF5F0E50B35F0F50BE50BF5F062 +:1004D000E50C65F0F50CC3750B00E509F5F0E50BCF +:1004E00095F0F50B750B00E50BF5F0E50B35F0F528 +:1004F0000BE50BF5F0E50C65F0F50CC3750B00E5AD +:100500000AF5F0E50B95F0F50B750B00E50BF5F032 +:10051000E50B35F0F50BE50BF5F0E50C65F0F50CAA +:10052000750100750900750A00750000E50CF5F00D +:10053000E50045F0F500E501F5F0E50045F0F500D2 +:10054000E509F5F0E50045F0F500E50AF5F0E50010 +:1005500045F0F500E5007002800302056D007500AE +:1005600000750100750900750A0002022F00750070 +:1005700001750100750900750A0002022F000000D4 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/m-un-1.s.expected b/tests/GCCTestSuite/m-un-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/m-un-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/merge-all-constants-1.c b/tests/GCCTestSuite/merge-all-constants-1.c new file mode 100644 index 0000000..5c9cd06 --- /dev/null +++ b/tests/GCCTestSuite/merge-all-constants-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-w -O2 -fmerge-all-constants" } */ + +const char str1[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; +const char str2[38] = "0123456789abcdefghijklmnopqrstuvwxyz"; +const char str3[10] = "0123456789abcdefghijklmnopqrstuvwxyz"; + +/* { dg-final { scan-assembler-not "\.rodata\.str" } } */ diff --git a/tests/GCCTestSuite/merge-all-constants-1.c.expected b/tests/GCCTestSuite/merge-all-constants-1.c.expected new file mode 100644 index 0000000..5c9cd06 --- /dev/null +++ b/tests/GCCTestSuite/merge-all-constants-1.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-w -O2 -fmerge-all-constants" } */ + +const char str1[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; +const char str2[38] = "0123456789abcdefghijklmnopqrstuvwxyz"; +const char str3[10] = "0123456789abcdefghijklmnopqrstuvwxyz"; + +/* { dg-final { scan-assembler-not "\.rodata\.str" } } */ diff --git a/tests/GCCTestSuite/merge-all-constants-1.hex.expected b/tests/GCCTestSuite/merge-all-constants-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/merge-all-constants-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/merge-all-constants-1.s.expected b/tests/GCCTestSuite/merge-all-constants-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/merge-all-constants-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/nested-redef-1.c b/tests/GCCTestSuite/nested-redef-1.c new file mode 100644 index 0000000..34b92d8 --- /dev/null +++ b/tests/GCCTestSuite/nested-redef-1.c @@ -0,0 +1,44 @@ +/* Test diagnosis of nested tag redefinitions. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s0 { + struct s0 { int a; } x; /* { dg-error "error: nested redefinition of 'struct s0'" } */ +}; + +struct s1 { + const struct s1 { int b; } x; /* { dg-error "error: nested redefinition of 'struct s1'" } */ +}; + +struct s2 { + struct s2 { int c; } *x; /* { dg-error "error: nested redefinition of 'struct s2'" } */ +}; + +struct s3 { + struct s4 { + struct s5 { + struct s3 { int a; } **x; /* { dg-error "error: nested redefinition of 'struct s3'" } */ + } y; + } z; +}; + +struct s6; +struct s6 { struct s6 *p; }; + +union u0 { + union u0 { int c; } *x; /* { dg-error "error: nested redefinition of 'union u0'" } */ +}; + +enum e0 { + E0 = sizeof(enum e0 { E1 }) /* { dg-error "error: nested redefinition of 'enum e0'" } */ +}; + +enum e1 { + E2 = sizeof(enum e2 { E2 }), /* { dg-error "error: redeclaration of enumerator 'E2'" } */ + /* { dg-error "previous definition" "previous E2" { target *-*-* } 38 } */ + E3 +}; + +enum e3; +enum e3 { E4 = 0 }; diff --git a/tests/GCCTestSuite/nested-redef-1.c.expected b/tests/GCCTestSuite/nested-redef-1.c.expected new file mode 100644 index 0000000..34b92d8 --- /dev/null +++ b/tests/GCCTestSuite/nested-redef-1.c.expected @@ -0,0 +1,44 @@ +/* Test diagnosis of nested tag redefinitions. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s0 { + struct s0 { int a; } x; /* { dg-error "error: nested redefinition of 'struct s0'" } */ +}; + +struct s1 { + const struct s1 { int b; } x; /* { dg-error "error: nested redefinition of 'struct s1'" } */ +}; + +struct s2 { + struct s2 { int c; } *x; /* { dg-error "error: nested redefinition of 'struct s2'" } */ +}; + +struct s3 { + struct s4 { + struct s5 { + struct s3 { int a; } **x; /* { dg-error "error: nested redefinition of 'struct s3'" } */ + } y; + } z; +}; + +struct s6; +struct s6 { struct s6 *p; }; + +union u0 { + union u0 { int c; } *x; /* { dg-error "error: nested redefinition of 'union u0'" } */ +}; + +enum e0 { + E0 = sizeof(enum e0 { E1 }) /* { dg-error "error: nested redefinition of 'enum e0'" } */ +}; + +enum e1 { + E2 = sizeof(enum e2 { E2 }), /* { dg-error "error: redeclaration of enumerator 'E2'" } */ + /* { dg-error "previous definition" "previous E2" { target *-*-* } 38 } */ + E3 +}; + +enum e3; +enum e3 { E4 = 0 }; diff --git a/tests/GCCTestSuite/nested-redef-1.hex.expected b/tests/GCCTestSuite/nested-redef-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/nested-redef-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/nested-redef-1.s.expected b/tests/GCCTestSuite/nested-redef-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/nested-redef-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/nonnull-1.c b/tests/GCCTestSuite/nonnull-1.c new file mode 100644 index 0000000..51a8a33 --- /dev/null +++ b/tests/GCCTestSuite/nonnull-1.c @@ -0,0 +1,39 @@ +/* Test for the "nonnull" function attribute. */ +/* Origin: Jason Thorpe */ +/* { dg-do compile } */ +/* { dg-options "-Wnonnull" } */ + +#include + +extern void func1 (char *, char *, int) __attribute__((nonnull)); + +extern void func2 (char *, char *) __attribute__((nonnull(1))); + +extern void func3 (char *, int, char *, int) + __attribute__((nonnull(1,3))); + +extern void func4 (char *, char *) __attribute__((nonnull(1))) + __attribute__((nonnull(2))); + +void +foo (int i1, int i2, int i3, char *cp1, char *cp2, char *cp3) +{ + func1(cp1, cp2, i1); + + func1(NULL, cp2, i1); /* { dg-warning "null" "null with argless nonnull 1" } */ + func1(cp1, NULL, i1); /* { dg-warning "null" "null with argless nonnull 2" } */ + func1(cp1, cp2, 0); + + func2(cp1, NULL); + func2(NULL, cp1); /* { dg-warning "null" "null with single explicit nonnull" } */ + + func3(NULL, i2, cp3, i3); /* { dg-warning "null" "null with explicit nonnull 1" } */ + func3(cp3, i2, NULL, i3); /* { dg-warning "null" "null with explicit nonnull 3" } */ + + func1(i1 ? cp1 : NULL, cp2, i3); /* { dg-warning "null" "null with cond expr rhs" } */ + func1(i1 ? NULL : cp1, cp2, i3); /* { dg-warning "null" "null with cond expr lhs" } */ + func1(i1 ? (i2 ? cp1 : NULL) : cp2, cp3, i3); /* { dg-warning "null" "null with nested cond expr" } */ + + func4(NULL, cp1); /* { dg-warning "null" "null with multiple attributes 1" } */ + func4(cp1, NULL); /* { dg-warning "null" "null with multiple attributes 2" } */ +} diff --git a/tests/GCCTestSuite/nonnull-1.c.expected b/tests/GCCTestSuite/nonnull-1.c.expected new file mode 100644 index 0000000..51a8a33 --- /dev/null +++ b/tests/GCCTestSuite/nonnull-1.c.expected @@ -0,0 +1,39 @@ +/* Test for the "nonnull" function attribute. */ +/* Origin: Jason Thorpe */ +/* { dg-do compile } */ +/* { dg-options "-Wnonnull" } */ + +#include + +extern void func1 (char *, char *, int) __attribute__((nonnull)); + +extern void func2 (char *, char *) __attribute__((nonnull(1))); + +extern void func3 (char *, int, char *, int) + __attribute__((nonnull(1,3))); + +extern void func4 (char *, char *) __attribute__((nonnull(1))) + __attribute__((nonnull(2))); + +void +foo (int i1, int i2, int i3, char *cp1, char *cp2, char *cp3) +{ + func1(cp1, cp2, i1); + + func1(NULL, cp2, i1); /* { dg-warning "null" "null with argless nonnull 1" } */ + func1(cp1, NULL, i1); /* { dg-warning "null" "null with argless nonnull 2" } */ + func1(cp1, cp2, 0); + + func2(cp1, NULL); + func2(NULL, cp1); /* { dg-warning "null" "null with single explicit nonnull" } */ + + func3(NULL, i2, cp3, i3); /* { dg-warning "null" "null with explicit nonnull 1" } */ + func3(cp3, i2, NULL, i3); /* { dg-warning "null" "null with explicit nonnull 3" } */ + + func1(i1 ? cp1 : NULL, cp2, i3); /* { dg-warning "null" "null with cond expr rhs" } */ + func1(i1 ? NULL : cp1, cp2, i3); /* { dg-warning "null" "null with cond expr lhs" } */ + func1(i1 ? (i2 ? cp1 : NULL) : cp2, cp3, i3); /* { dg-warning "null" "null with nested cond expr" } */ + + func4(NULL, cp1); /* { dg-warning "null" "null with multiple attributes 1" } */ + func4(cp1, NULL); /* { dg-warning "null" "null with multiple attributes 2" } */ +} diff --git a/tests/GCCTestSuite/nonnull-1.hex.expected b/tests/GCCTestSuite/nonnull-1.hex.expected new file mode 100644 index 0000000..be13b7c --- /dev/null +++ b/tests/GCCTestSuite/nonnull-1.hex.expected @@ -0,0 +1,176 @@ +:100000000000000000E506758230C39582F506E524 +:10001000077583009583F507D0E0F50875E0152591 +:1000200006F58275E0003507F583E508F0D0E0F5C8 +:100030000875E0142506F58275E0003507F583E5BF +:1000400008F075E01D2506F58275E0003507F5839B +:10005000E517F075E01C2506F58275E0003507F51B +:1000600083E516F075E01B2506F58275E00035077F +:10007000F583E515F075E01A2506F58275E0003583 +:1000800007F583E514F075E0192506F58275E000A3 +:100090003507F583E513F075E0182506F58275E060 +:1000A000003507F583E512F075E0172506F5827532 +:1000B000E0003507F583E511F075E0162506F582B9 +:1000C00075E0003507F583E510F0E51FF514E51E32 +:1000D000F515E51DF516E51CF51775E00D2506F57A +:1000E0008275E0003507F583E51BF075E00C250609 +:1000F000F58275E0003507F583E51AF075E00B250C +:1001000006F58275E0003507F583E519F075E00A1C +:100110002506F58275E0003507F583E518F07509C9 +:1001200030750001E500F5F0E50995F0F509E50603 +:10013000F500E500F5F0E50925F0F509750100E5A4 +:1001400007F500E500F5F0E50135F0F501E501F50D +:1001500002E509F582E502F583E0F50875E0112571 +:1001600006F58275E0003507F583E508F07509307E +:10017000750002E500F5F0E50995F0F509E506F5ED +:1001800000E500F5F0E50925F0F509750100E50742 +:10019000F500E500F5F0E50135F0F501E501F502C2 +:1001A000E509F582E502F583E0F50875E01025061E +:1001B000F58275E0003507F583E508F075093075BF +:1001C0000003E500F5F0E50995F0F509E506F50011 +:1001D000E500F5F0E50925F0F509750100E507F5FD +:1001E00000E500F5F0E50135F0F501E501F502E582 +:1001F00009F582E502F583E0F50875E00F2506F5BF +:100200008275E0003507F583E508F0750930750063 +:1002100004E500F5F0E50995F0F509E506F500E5DA +:1002200000F5F0E50925F0F509750100E507F50091 +:10023000E500F5F0E50135F0F501E501F502E50928 +:10024000F582E502F583E0F50875E00E2506F582F6 +:1002500075E0003507F583E508F075093075000590 +:10026000E500F5F0E50995F0F509E506F500E5008E +:10027000F5F0E50925F0F509750100E507F500E55C +:1002800000F5F0E50135F0F501E501F502E509F5C8 +:1002900082E502F583E0F512750930750006E50088 +:1002A000F5F0E50995F0F509E506F500E500F5F04E +:1002B000E50925F0F509750100E507F500E500F50C +:1002C000F0E50135F0F501E501F502E509F582E516 +:1002D00002F583E0F513750930750007E500F5F0C8 +:1002E000E50995F0F509E506F500E500F5F0E50905 +:1002F00025F0F509750100E507F500E500F5F0E5E5 +:100300000135F0F501E501F502E509F582E502F5B3 +:1003100083E0F510750930750008E500F5F0E50992 +:1003200095F0F509E506F500E500F5F0E50925F09D +:10033000F509750100E507F500E500F5F0E5013583 +:10034000F0F501E501F502E509F582E502F583E046 +:10035000F511750930750009E500F5F0E50995F02E +:10036000F509E506F500E500F5F0E50925F0F509E4 +:10037000750100E507F500E500F5F0E50135F0F55C +:1003800001E501F502E509F582E502F583E0F508EE +:1003900075E0132506F58275E0003507F583E5085D +:1003A000F075093075000AE500F5F0E50995F0F5FE +:1003B00009E506F500E500F5F0E50925F0F5097514 +:1003C0000100E507F500E500F5F0E50135F0F50180 +:1003D000E501F502E509F582E502F583E0F508752A +:1003E000E0122506F58275E0003507F583E508F093 +:1003F000E512F51FE513F51EE510F51DE511F51CD9 +:10040000E514F51BE515F51AE516F519E517F518C8 +:10041000751F00751E00E510F51DE511F51CE514AE +:10042000F51BE515F51AE516F519E517F518751D0F +:1004300000751C00E512F51FE513F51EE514F51B0C +:10044000E515F51AE516F519E517F518751B00758C +:100450001A00751900751800E512F51FE513F51E51 +:10046000E510F51DE511F51C751D00751C00E51264 +:10047000F51FE513F51E751F00751E00E512F51D2D +:10048000E513F51C751F00751E0075E00D2506F5BA +:100490008275E0003507F583E0F51D75E00C250653 +:1004A000F58275E0003507F583E0F51C75E00B2556 +:1004B00006F58275E0003507F583E0F51B75E00A67 +:1004C0002506F58275E0003507F583E0F51A75E03D +:1004D000132506F58275E0003507F583E0F51975FB +:1004E000E0122506F58275E0003507F583E0F51882 +:1004F000750901E506F500C3E509F5F0E50095F09D +:10050000F509E507F500750100E501F5F0E5009551 +:10051000F0F50175E0112506F58275E0003507F567 +:1005200083E0F508E508F503E501F502E509F58244 +:10053000E502F583E503F0750902E506F500C3E57C +:1005400009F5F0E50095F0F509E507F500750100FE +:10055000E501F5F0E50095F0F50175E0102506F5EB +:100560008275E0003507F583E0F508E508F503E559 +:1005700001F502E509F582E502F583E503F0750969 +:1005800003E506F500C3E509F5F0E50095F0F5098A +:10059000E507F500750100E501F5F0E50095F0F5DA +:1005A0000175E00F2506F58275E0003507F583E05B +:1005B000F508E508F503E501F502E509F582E50230 +:1005C000F583E503F0750904E506F500C3E509F5D3 +:1005D000F0E50095F0F509E507F500750100E50186 +:1005E000F5F0E50095F0F50175E00E2506F582754C +:1005F000E0003507F583E0F508E508F503E501F5CA +:1006000002E509F582E502F583E503F07519007549 +:10061000180075E0132506F58275E0003507F583AF +:10062000E0F51F75E0122506F58275E0003507F547 +:1006300083E0F51E75E00D2506F58275E0003507AF +:10064000F583E0F51D75E00C2506F58275E00035B3 +:1006500007F583E0F51C75E00B2506F58275E000D3 +:100660003507F583E0F51B75E00A2506F58275E090 +:10067000003507F583E0F51A750901E506F500C3B5 +:10068000E509F5F0E50095F0F509E507F5007501D8 +:1006900000E501F5F0E50095F0F50175E01125069E +:1006A000F58275E0003507F583E0F508E508F50308 +:1006B000E501F502E509F582E502F583E503F0754C +:1006C0000902E506F500C3E509F5F0E50095F0F54A +:1006D00009E507F500750100E501F5F0E50095F085 +:1006E000F50175E0102506F58275E0003507F58304 +:1006F000E0F508E508F503E501F502E509F582E511 +:1007000002F583E503F0750903E506F500C3E50985 +:10071000F5F0E50095F0F509E507F500750100E550 +:1007200001F5F0E50095F0F50175E00F2506F5827D +:1007300075E0003507F583E0F508E508F503E50108 +:10074000F502E509F582E502F583E503F075090494 +:10075000E506F500C3E509F5F0E50095F0F509E5D6 +:1007600007F500750100E501F5F0E50095F0F501EC +:1007700075E00E2506F58275E0003507F583E0F596 +:1007800008E508F503E501F502E509F582E502F55E +:1007900083E503F0750000E514F5F0E50045F0F59C +:1007A00000E515F5F0E50045F0F500E516F5F0E596 +:1007B0000045F0F500E517F5F0E50045F0F500E53A +:1007C0000070028003020AE000751F00751E00E53C +:1007D00010F51DE511F51C75E0112506F58275E093 +:1007E000003507F583E0F51B75E0102506F58275E9 +:1007F000E0003507F583E0F51A75E00F2506F58270 +:1008000075E0003507F583E0F51975E00E2506F56E +:100810008275E0003507F583E0F518750000E514F2 +:10082000F5F0E50045F0F500E515F5F0E50045F0DB +:10083000F500E516F5F0E50045F0F500E517F5F0F3 +:10084000E50045F0F500E50070028003020AD600DD +:10085000E512F51FE513F51EE510F51DE511F51C74 +:1008600075E0112506F58275E0003507F583E0F5A2 +:100870001B75E0102506F58275E0003507F583E06D +:10088000F51A75E00F2506F58275E0003507F5834A +:10089000E0F51975E00E2506F58275E0003507F5DF +:1008A00083E0F518750000E514F5F0E50045F0F576 +:1008B00000E515F5F0E50045F0F500E516F5F0E585 +:1008C0000045F0F500E517F5F0E50045F0F500E529 +:1008D0000070028003020A4700E510F51FE511F5DC +:1008E0001E75E0132506F58275E0003507F583E0F7 +:1008F000F51D75E0122506F58275E0003507F583D4 +:10090000E0F51C75E0112506F58275E0003507F568 +:1009100083E0F51B75E0102506F58275E0003507CC +:10092000F583E0F51A75E00F2506F58275E00035D0 +:1009300007F583E0F51975E00E2506F58275E000F0 +:100940003507F583E0F518751F00751E00E512F5F3 +:100950001DE513F51C751D00751C00E512F51FE55E +:1009600013F51E750000E500F502E500F503E5004E +:10097000F504E500F50575E01D2506F58275E00036 +:100980003507F583E0F51775E01C2506F58275E05F +:10099000003507F583E0F51675E01B2506F5827531 +:1009A000E0003507F583E0F51575E01A2506F582B8 +:1009B00075E0003507F583E0F51475E0192506F5B7 +:1009C0008275E0003507F583E0F51375E01825061C +:1009D000F58275E0003507F583E0F51275E017251F +:1009E00006F58275E0003507F583E0F51175E01630 +:1009F0002506F58275E0003507F583E0F51075E012 +:100A0000142506F58275E0003507F583E0F508E565 +:100A100008C0E075E0152506F58275E0003507F59C +:100A200083E0F508E508C0E075E0302506F50675B9 +:100A3000E0003507F507E502F582E503F583E504F7 +:100A4000F500E505F501220075000075E00D2506AD +:100A5000F58275E0003507F583E0F508E508F5F067 +:100A6000E50045F0F50075E00C2506F58275E0001F +:100A70003507F583E0F508E508F5F0E50045F0F504 +:100A80000075E00B2506F58275E0003507F583E07B +:100A9000F508E508F5F0E50045F0F50075E00A25F4 +:100AA00006F58275E0003507F583E0F508E508F501 +:100AB000F0E50045F0F500E50070028003020ACA87 +:100AC000007510007511000208D900E512F510E557 +:100AD00013F5110208D900751F00751E0002085891 +:100AE00000E512F51FE513F51E0207CF0000000018 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/nonnull-1.s.expected b/tests/GCCTestSuite/nonnull-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/nonnull-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/nonnull-2.c b/tests/GCCTestSuite/nonnull-2.c new file mode 100644 index 0000000..bd36d23 --- /dev/null +++ b/tests/GCCTestSuite/nonnull-2.c @@ -0,0 +1,16 @@ +/* Test for the invalid use of the "nonnull" function attribute. */ +/* Origin: Jason Thorpe */ +/* { dg-do compile } */ + +extern void func1 () __attribute__((nonnull)); /* { dg-error "without arguments" } */ + +extern void func2 (char *) __attribute__((nonnull(2))); /* { dg-error "out-of-range operand" } */ + +extern void func3 (char *) __attribute__((nonnull(foo))); /* { dg-error "invalid operand number" } */ + +extern void func4 (int) __attribute__((nonnull(1))); /* { dg-error "references non-pointer" } */ + +void +foo (void) +{ +} diff --git a/tests/GCCTestSuite/nonnull-2.c.expected b/tests/GCCTestSuite/nonnull-2.c.expected new file mode 100644 index 0000000..bd36d23 --- /dev/null +++ b/tests/GCCTestSuite/nonnull-2.c.expected @@ -0,0 +1,16 @@ +/* Test for the invalid use of the "nonnull" function attribute. */ +/* Origin: Jason Thorpe */ +/* { dg-do compile } */ + +extern void func1 () __attribute__((nonnull)); /* { dg-error "without arguments" } */ + +extern void func2 (char *) __attribute__((nonnull(2))); /* { dg-error "out-of-range operand" } */ + +extern void func3 (char *) __attribute__((nonnull(foo))); /* { dg-error "invalid operand number" } */ + +extern void func4 (int) __attribute__((nonnull(1))); /* { dg-error "references non-pointer" } */ + +void +foo (void) +{ +} diff --git a/tests/GCCTestSuite/nonnull-2.hex.expected b/tests/GCCTestSuite/nonnull-2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/nonnull-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/nonnull-2.s.expected b/tests/GCCTestSuite/nonnull-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/nonnull-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-1.c b/tests/GCCTestSuite/noreturn-1.c new file mode 100644 index 0000000..3bd6a26 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-1.c @@ -0,0 +1,59 @@ +/* Check for various valid and erroneous "noreturn" cases. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wmissing-noreturn" } */ + +extern void exit (int); + +extern void foo1(void) __attribute__ ((__noreturn__)); +void +foo1(void) +{ +} /* { dg-warning "'noreturn' function does return" "detect falling off end of noreturn" } */ + +extern void foo2(void) __attribute__ ((__noreturn__)); +void +foo2(void) +{ + exit(0); +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo3(void); +void +foo3(void) +{ +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo4(void); +void +foo4(void) +{ /* { dg-warning "candidate for attribute 'noreturn'" "detect noreturn candidate" } */ + exit(0); +} + +extern void foo5(void) __attribute__ ((__noreturn__)); +void +foo5(void) +{ + return; /* { dg-warning "'noreturn' has a 'return' statement" "detect invalid return" } */ +} /* { dg-warning "function does return" "detect return from noreturn" } */ + +extern void foo6(void); +void +foo6(void) +{ + return; +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo7(void); +void +foo7(void) +{ + foo6(); +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo8(void) __attribute__ ((__noreturn__)); +void +foo8(void) +{ + foo7(); +} /* { dg-warning "'noreturn' function does return" "detect return from tail call" } */ diff --git a/tests/GCCTestSuite/noreturn-1.c.expected b/tests/GCCTestSuite/noreturn-1.c.expected new file mode 100644 index 0000000..3bd6a26 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-1.c.expected @@ -0,0 +1,59 @@ +/* Check for various valid and erroneous "noreturn" cases. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wmissing-noreturn" } */ + +extern void exit (int); + +extern void foo1(void) __attribute__ ((__noreturn__)); +void +foo1(void) +{ +} /* { dg-warning "'noreturn' function does return" "detect falling off end of noreturn" } */ + +extern void foo2(void) __attribute__ ((__noreturn__)); +void +foo2(void) +{ + exit(0); +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo3(void); +void +foo3(void) +{ +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo4(void); +void +foo4(void) +{ /* { dg-warning "candidate for attribute 'noreturn'" "detect noreturn candidate" } */ + exit(0); +} + +extern void foo5(void) __attribute__ ((__noreturn__)); +void +foo5(void) +{ + return; /* { dg-warning "'noreturn' has a 'return' statement" "detect invalid return" } */ +} /* { dg-warning "function does return" "detect return from noreturn" } */ + +extern void foo6(void); +void +foo6(void) +{ + return; +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo7(void); +void +foo7(void) +{ + foo6(); +} /* { dg-bogus "warning:" "this function should not get any warnings" } */ + +extern void foo8(void) __attribute__ ((__noreturn__)); +void +foo8(void) +{ + foo7(); +} /* { dg-warning "'noreturn' function does return" "detect return from tail call" } */ diff --git a/tests/GCCTestSuite/noreturn-1.hex.expected b/tests/GCCTestSuite/noreturn-1.hex.expected new file mode 100644 index 0000000..9d6582a --- /dev/null +++ b/tests/GCCTestSuite/noreturn-1.hex.expected @@ -0,0 +1,55 @@ +:100000000000D0E0F500D0E0F501750900E509F544 +:1000100002E509F503E509F504E509F505E501C083 +:10002000E0E500C0E0E502F582E503F583E504F5CF +:1000300000E505F5012200E506758202C39582F50B +:1000400006E5077583009583F507D0E0F50875E0B0 +:10005000012506F58275E0003507F583E508F0D047 +:10006000E0F50875E0002506F58275E0003507F536 +:1000700083E508F0751F00751E00751D00751C00D6 +:10008000750000E500F502E500F503E500F504E57F +:1000900000F50575E0002506F58275E0003507F5E9 +:1000A00083E0F508E508C0E075E0012506F58275F6 +:1000B000E0003507F583E0F508E508C0E075E002EB +:1000C0002506F50675E0003507F507E502F582E53A +:1000D00003F583E504F500E505F5012200D0E0F520 +:1000E00000D0E0F501750900E509F502E509F50321 +:1000F000E509F504E509F505E501C0E0E500C0E026 +:10010000E502F582E503F583E504F500E505F50173 +:100110002200E506758202C39582F506E507758320 +:10012000009583F507D0E0F50875E0012506F58216 +:1001300075E0003507F583E508F0D0E0F50875E0D7 +:10014000002506F58275E0003507F583E508F075B2 +:100150001F00751E00751D00751C00750000E50070 +:10016000F502E500F503E500F504E500F50575E0A9 +:10017000002506F58275E0003507F583E0F508E512 +:1001800008C0E075E0012506F58275E0003507F549 +:1001900083E0F508E508C0E075E0022506F5067580 +:1001A000E0003507F507E502F582E503F583E50490 +:1001B000F500E505F5012200D0E0F500D0E0F501FD +:1001C000750900E509F502E509F503E509F504E51A +:1001D00009F505E501C0E0E500C0E0E502F582E5CE +:1001E00003F583E504F500E505F5012200D0E0F50F +:1001F00000D0E0F501750900E509F502E509F50310 +:10020000E509F504E509F505E501C0E0E500C0E014 +:10021000E502F582E503F583E504F500E505F50162 +:100220002200E506758202C39582F506E50775830F +:10023000009583F507D0E0F50875E0012506F58205 +:1002400075E0003507F583E508F0D0E0F50875E0C6 +:10025000002506F58275E0003507F583E508F01204 +:1002600001EC750000E500F502E500F503E500F599 +:1002700004E500F50575E0002506F58275E000351A +:1002800007F583E0F508E508C0E075E0012506F50F +:100290008275E0003507F583E0F508E508C0E075F4 +:1002A000E0022506F50675E0003507F507E502F5DD +:1002B00082E503F583E504F500E505F5012200E597 +:1002C00006758202C39582F506E50775830095835E +:1002D000F507D0E0F50875E0012506F58275E00028 +:1002E0003507F583E508F0D0E0F50875E000250650 +:1002F000F58275E0003507F583E508F012022175F7 +:100300000000E500F502E500F503E500F504E50071 +:10031000F50575E0002506F58275E0003507F583E3 +:10032000E0F508E508C0E075E0012506F58275E016 +:10033000003507F583E0F508E508C0E075E0022523 +:1003400006F50675E0003507F507E502F582E503D9 +:10035000F583E504F500E505F50122000000000045 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-1.s.expected b/tests/GCCTestSuite/noreturn-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/noreturn-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-2.c b/tests/GCCTestSuite/noreturn-2.c new file mode 100644 index 0000000..4214de3 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-2.c @@ -0,0 +1,12 @@ +/* Check for invalid "noreturn" warning. */ +/* { dg-do compile } */ +/* { dg-options "-O3 -Wall" } */ +extern void abort (void) __attribute__ ((__noreturn__)); + +void noreturn (int x) __attribute__ ((__noreturn__)); + +void +noreturn (int x) +{ + abort (); +} /* { dg-bogus "does return" "noreturn does return" } */ diff --git a/tests/GCCTestSuite/noreturn-2.c.expected b/tests/GCCTestSuite/noreturn-2.c.expected new file mode 100644 index 0000000..4214de3 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-2.c.expected @@ -0,0 +1,12 @@ +/* Check for invalid "noreturn" warning. */ +/* { dg-do compile } */ +/* { dg-options "-O3 -Wall" } */ +extern void abort (void) __attribute__ ((__noreturn__)); + +void noreturn (int x) __attribute__ ((__noreturn__)); + +void +noreturn (int x) +{ + abort (); +} /* { dg-bogus "does return" "noreturn does return" } */ diff --git a/tests/GCCTestSuite/noreturn-2.hex.expected b/tests/GCCTestSuite/noreturn-2.hex.expected new file mode 100644 index 0000000..91e145a --- /dev/null +++ b/tests/GCCTestSuite/noreturn-2.hex.expected @@ -0,0 +1,11 @@ +:100000000000E506758206C39582F506E50775834F +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040000000E500F502E500F503E500F504E50034 +:10005000F50575E0002506F58275E0003507F583A6 +:10006000E0F508E508C0E075E0012506F58275E0D9 +:10007000003507F583E0F508E508C0E075E00625E2 +:1000800006F50675E0003507F507E502F582E5039C +:10009000F583E504F500E505F50122000000000008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-2.s.expected b/tests/GCCTestSuite/noreturn-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/noreturn-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-5.c b/tests/GCCTestSuite/noreturn-5.c new file mode 100644 index 0000000..e69087a --- /dev/null +++ b/tests/GCCTestSuite/noreturn-5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ +/* Check that 'noreturn' and 'volatile extern' are compatible. + The testsuite uses -ansi -pedantic-errors by default, so this has + to override. */ +extern void xxx (int) __attribute__((noreturn)); +typedef void voidfn (int); +__volatile extern voidfn xxx; diff --git a/tests/GCCTestSuite/noreturn-5.c.expected b/tests/GCCTestSuite/noreturn-5.c.expected new file mode 100644 index 0000000..e69087a --- /dev/null +++ b/tests/GCCTestSuite/noreturn-5.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ +/* Check that 'noreturn' and 'volatile extern' are compatible. + The testsuite uses -ansi -pedantic-errors by default, so this has + to override. */ +extern void xxx (int) __attribute__((noreturn)); +typedef void voidfn (int); +__volatile extern voidfn xxx; diff --git a/tests/GCCTestSuite/noreturn-5.hex.expected b/tests/GCCTestSuite/noreturn-5.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-5.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-5.s.expected b/tests/GCCTestSuite/noreturn-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/noreturn-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-6.c b/tests/GCCTestSuite/noreturn-6.c new file mode 100644 index 0000000..eb1fd24 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-6.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* Check for volatile behaviour. */ +extern int xxx (void); +volatile extern int xxx (void); /* { dg-error "not compatible" } */ diff --git a/tests/GCCTestSuite/noreturn-6.c.expected b/tests/GCCTestSuite/noreturn-6.c.expected new file mode 100644 index 0000000..eb1fd24 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-6.c.expected @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* Check for volatile behaviour. */ +extern int xxx (void); +volatile extern int xxx (void); /* { dg-error "not compatible" } */ diff --git a/tests/GCCTestSuite/noreturn-6.hex.expected b/tests/GCCTestSuite/noreturn-6.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-6.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-6.s.expected b/tests/GCCTestSuite/noreturn-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/noreturn-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-7.c b/tests/GCCTestSuite/noreturn-7.c new file mode 100644 index 0000000..8ae5e23 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-7.c @@ -0,0 +1,42 @@ +/* PR optimization/13394 */ +/* Origin: Carlo Wood */ + +/* Verify that a bogus "function does return" warning is not issued + in presence of tail recursion within a noreturn function. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -Wreturn-type -Wmissing-noreturn" } */ + + +void f(void) __attribute__ ((__noreturn__)); +void _exit(int status) __attribute__ ((__noreturn__)); + +int z = 0; + +void g() +{ /* { dg-warning "possible candidate" } */ + if (++z > 10) + _exit(0); + g(); +} + +void f() +{ + if (++z > 10) + _exit(0); + f(); +} /* { dg-bogus "does return" } */ + +int h() +{ /* { dg-warning "possible candidate" } */ + if (++z > 10) + _exit(0); + return h(); +} /* { dg-bogus "end of non-void function" } */ + +int k() +{ /* { dg-warning "possible candidate" } */ + if (++z > 10) + _exit(0); + k(); +} /* { dg-warning "control reaches" } */ diff --git a/tests/GCCTestSuite/noreturn-7.c.expected b/tests/GCCTestSuite/noreturn-7.c.expected new file mode 100644 index 0000000..8ae5e23 --- /dev/null +++ b/tests/GCCTestSuite/noreturn-7.c.expected @@ -0,0 +1,42 @@ +/* PR optimization/13394 */ +/* Origin: Carlo Wood */ + +/* Verify that a bogus "function does return" warning is not issued + in presence of tail recursion within a noreturn function. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -Wreturn-type -Wmissing-noreturn" } */ + + +void f(void) __attribute__ ((__noreturn__)); +void _exit(int status) __attribute__ ((__noreturn__)); + +int z = 0; + +void g() +{ /* { dg-warning "possible candidate" } */ + if (++z > 10) + _exit(0); + g(); +} + +void f() +{ + if (++z > 10) + _exit(0); + f(); +} /* { dg-bogus "does return" } */ + +int h() +{ /* { dg-warning "possible candidate" } */ + if (++z > 10) + _exit(0); + return h(); +} /* { dg-bogus "end of non-void function" } */ + +int k() +{ /* { dg-warning "possible candidate" } */ + if (++z > 10) + _exit(0); + k(); +} /* { dg-warning "control reaches" } */ diff --git a/tests/GCCTestSuite/noreturn-7.hex.expected b/tests/GCCTestSuite/noreturn-7.hex.expected new file mode 100644 index 0000000..22902ed --- /dev/null +++ b/tests/GCCTestSuite/noreturn-7.hex.expected @@ -0,0 +1,404 @@ +:100000000000E50675820AC39582F506E50775834B +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0092506F58275E0003507F583E517F030 +:1000500075E0082506F58275E0003507F583E5169D +:10006000F075E0072506F58275E0003507F583E5B4 +:1000700015F075E0062506F58275E0003507F58375 +:10008000E514F075E0052506F58275E0003507F505 +:1000900083E513F075E0042506F58275E000350769 +:1000A000F583E512F075E0032506F58275E000356D +:1000B00007F583E511F075E0022506F58275E0008D +:1000C0003507F583E510F0900000E582F509900012 +:1000D00000E583F50B750100C3750000E501F5F03F +:1000E000E50935F0F501E500F5F0E50B35F0F50033 +:1000F000E500F502E501F582E502F583E0F50F750F +:100100000101C3750000E501F5F0E50935F0F501E1 +:10011000E500F5F0E50B35F0F500E500F502E50149 +:10012000F582E502F583E0F50C750102C375000068 +:10013000E501F5F0E50935F0F501E500F5F0E50B31 +:1001400035F0F500E500F502E501F582E502F583FD +:10015000E0F50A750103C3750000E501F5F0E50956 +:1001600035F0F501E500F5F0E50B35F0F500E500BB +:10017000F502E501F582E502F583E0F501750E0172 +:10018000750B00750900750000C3750D00E50EF5CF +:10019000F0E50F35F0F50DE50BF5F0E50C35F0F574 +:1001A0000EE509F5F0E50A35F0F50FE500F5F0E5A7 +:1001B0000135F0F510900000E582F509900000E5AA +:1001C00083F50A750100C3750000E501F5F0E50946 +:1001D00035F0F501E500F5F0E50A35F0F500E50D3F +:1001E000F503E500F502E501F582E502F583E50397 +:1001F000F0750101C3750000E501F5F0E50935F082 +:10020000F501E500F5F0E50A35F0F500E50EF5033A +:10021000E500F502E501F582E502F583E503F075F9 +:100220000102C3750000E501F5F0E50935F0F501BF +:10023000E500F5F0E50A35F0F500E50FF503E5001A +:10024000F502E501F582E502F583E503F0750103AA +:10025000C3750000E501F5F0E50935F0F501E500AD +:10026000F5F0E50A35F0F500E510F503E500F502D7 +:10027000E501F582E502F583E503F075170A7511CE +:1002800000751200751300750080E500F5F0E513A8 +:1002900025F0F513E500F5F0E51025F0F510750CE7 +:1002A00000751400751500751600750B00750A01B0 +:1002B000750001C3E510F5F0E51395F0F509E50BC0 +:1002C000F5F0E50B35F0F509E509F5F0E50055F039 +:1002D000F500E500F5F0E50C45F0F50C750001C3FF +:1002E000E510F5F0E51395F0F509E50BF5F0E50BF4 +:1002F00035F0F509E513F5F0E51095F0F501E50B9E +:10030000F5F0E50B35F0F501E501F5F0E50945F00F +:10031000F509E50AF5F0E50965F0F509E509F5F0F7 +:10032000E50055F0F500C3E50FF5F0E51295F0F5A1 +:1003300009E50BF5F0E50B35F0F509E509F5F0E514 +:100340000055F0F500E500F5F0E50C45F0F50C750D +:100350000001C3E510F5F0E51395F0F509E50BF59F +:10036000F0E50B35F0F509E513F5F0E51095F0F53E +:1003700001E50BF5F0E50B35F0F501E501F5F0E5EC +:100380000945F0F509E50AF5F0E50965F0F509E537 +:1003900009F5F0E50055F0F500C3E50FF5F0E512BD +:1003A00095F0F509E50BF5F0E50B35F0F509E512EB +:1003B000F5F0E50F95F0F501E50BF5F0E50B35F0FF +:1003C000F501E501F5F0E50945F0F509E50AF5F077 +:1003D000E50965F0F509E509F5F0E50055F0F500EA +:1003E000C3E50EF5F0E51195F0F509E50BF5F0E53F +:1003F0000B35F0F509E509F5F0E50055F0F500E5F8 +:1004000000F5F0E50C45F0F50C750001C3E510F5BD +:10041000F0E51395F0F509E50BF5F0E50B35F0F592 +:1004200009E513F5F0E51095F0F501E50BF5F0E5BC +:100430000B35F0F501E501F5F0E50945F0F509E5C5 +:100440000AF5F0E50965F0F509E509F5F0E500556F +:10045000F0F500C3E50FF5F0E51295F0F509E50BB1 +:10046000F5F0E50B35F0F509E512F5F0E50F95F03F +:10047000F501E50BF5F0E50B35F0F501E501F5F0DB +:10048000E50945F0F509E50AF5F0E50965F0F50936 +:10049000E509F5F0E50055F0F500C3E50EF5F0E5EA +:1004A0001195F0F509E50BF5F0E50B35F0F509E5EB +:1004B00011F5F0E50E95F0F501E50BF5F0E50B35DE +:1004C000F0F501E501F5F0E50945F0F509E50AF576 +:1004D000F0E50965F0F509E509F5F0E50055F0F5F9 +:1004E00000C3E50DF5F0E51795F0F509E50BF5F01E +:1004F000E50B35F0F509E509F5F0E50055F0F500F7 +:10050000E500F5F0E50C45F0F50C750000E50CF59F +:10051000F0E50045F0F500E514F5F0E50045F0F5EF +:1005200000E515F5F0E50045F0F500E516F5F0E518 +:100530000045F0F500E50070028003020626001277 +:100540000001750000E500F502E500F503E500F5A2 +:1005500004E500F50575E0092506F58275E000352E +:1005600007F583E0F51775E0082506F58275E000CC +:100570003507F583E0F51675E0072506F58275E089 +:10058000003507F583E0F51575E0062506F582755B +:10059000E0003507F583E0F51475E0052506F582E2 +:1005A00075E0003507F583E0F51375E0042506F5E1 +:1005B0008275E0003507F583E0F51275E003250646 +:1005C000F58275E0003507F583E0F51175E0022549 +:1005D00006F58275E0003507F583E0F51075E0005B +:1005E0002506F58275E0003507F583E0F508E50896 +:1005F000C0E075E0012506F58275E0003507F5835A +:10060000E0F508E508C0E075E00A2506F50675E0A6 +:10061000003507F507E502F582E503F583E504F506 +:1006200000E505F5012200751F00751E00751D000F +:10063000751C0002053F00E50675820AC39582F528 +:1006400006E5077583009583F507D0E0F50875E0AA +:10065000012506F58275E0003507F583E508F0D041 +:10066000E0F50875E0002506F58275E0003507F530 +:1006700083E508F075E0092506F58275E000350789 +:10068000F583E517F075E0082506F58275E000357D +:1006900007F583E516F075E0072506F58275E0009D +:1006A0003507F583E515F075E0062506F58275E05A +:1006B000003507F583E514F075E0052506F582752C +:1006C000E0003507F583E513F075E0042506F582B3 +:1006D00075E0003507F583E512F075E0032506F5B2 +:1006E0008275E0003507F583E511F075E002250617 +:1006F000F58275E0003507F583E510F0900000E520 +:1007000082F509900000E583F50B750100C37500C3 +:1007100000E501F5F0E50935F0F501E500F5F0E556 +:100720000B35F0F500E500F502E501F582E502F58F +:1007300083E0F50F750101C3750000E501F5F0E5F3 +:100740000935F0F501E500F5F0E50B35F0F500E5CC +:1007500000F502E501F582E502F583E0F50C75018F +:1007600002C3750000E501F5F0E50935F0F501E596 +:1007700000F5F0E50B35F0F500E500F502E501F5D3 +:1007800082E502F583E0F50A750103C3750000E513 +:1007900001F5F0E50935F0F501E500F5F0E50B357B +:1007A000F0F500E500F502E501F582E502F583E0EC +:1007B000F501750E01750B00750900750000C37514 +:1007C0000D00E50EF5F0E50F35F0F50DE50BF5F054 +:1007D000E50C35F0F50EE509F5F0E50A35F0F50F15 +:1007E000E500F5F0E50135F0F510900000E582F543 +:1007F00009900000E583F50A750100C3750000E566 +:1008000001F5F0E50935F0F501E500F5F0E50A350B +:10081000F0F500E50DF503E500F502E501F582E5EB +:1008200002F583E503F0750101C3750000E501F5EC +:10083000F0E50935F0F501E500F5F0E50A35F0F5EC +:1008400000E50EF503E500F502E501F582E502F5A8 +:1008500083E503F0750102C3750000E501F5F0E5DD +:100860000935F0F501E500F5F0E50A35F0F500E5AC +:100870000FF503E500F502E501F582E502F583E5F4 +:1008800003F0750103C3750000E501F5F0E50935D6 +:10089000F0F501E500F5F0E50A35F0F500E510F5B5 +:1008A00003E500F502E501F582E502F583E503F0D5 +:1008B00075170A751100751200751300750080E533 +:1008C00000F5F0E51325F0F513E500F5F0E510254A +:1008D000F0F510750C00751400751500751600758F +:1008E0000B00750A01750001C3E510F5F0E51395DD +:1008F000F0F509E50BF5F0E50B35F0F509E509F53F +:10090000F0E50055F0F500E500F5F0E50C45F0F5F3 +:100910000C750001C3E510F5F0E51395F0F509E558 +:100920000BF5F0E50B35F0F509E513F5F0E510955D +:10093000F0F501E50BF5F0E50B35F0F501E501F516 +:10094000F0E50945F0F509E50AF5F0E50965F0F58A +:1009500009E509F5F0E50055F0F500C3E50FF5F000 +:10096000E51295F0F509E50BF5F0E50B35F0F50925 +:10097000E509F5F0E50055F0F500E500F5F0E50CCA +:1009800045F0F50C750001C3E510F5F0E51395F0A1 +:10099000F509E50BF5F0E50B35F0F509E513F5F094 +:1009A000E51095F0F501E50BF5F0E50B35F0F501F7 +:1009B000E501F5F0E50945F0F509E50AF5F0E50989 +:1009C00065F0F509E509F5F0E50055F0F500C3E53A +:1009D0000FF5F0E51295F0F509E50BF5F0E50B35AF +:1009E000F0F509E512F5F0E50F95F0F501E50BF5E9 +:1009F000F0E50B35F0F501E501F5F0E50945F0F519 +:100A000009E50AF5F0E50965F0F509E509F5F0E510 +:100A10000055F0F500C3E50EF5F0E51195F0F50988 +:100A2000E50BF5F0E50B35F0F509E509F5F0E50026 +:100A300055F0F500E500F5F0E50C45F0F50C750016 +:100A400001C3E510F5F0E51395F0F509E50BF5F0B8 +:100A5000E50B35F0F509E513F5F0E51095F0F50136 +:100A6000E50BF5F0E50B35F0F501E501F5F0E509ED +:100A700045F0F509E50AF5F0E50965F0F509E50940 +:100A8000F5F0E50055F0F500C3E50FF5F0E512953A +:100A9000F0F509E50BF5F0E50B35F0F509E512F594 +:100AA000F0E50F95F0F501E50BF5F0E50B35F0F508 +:100AB00001E501F5F0E50945F0F509E50AF5F0E590 +:100AC0000965F0F509E509F5F0E50055F0F500C315 +:100AD000E50EF5F0E51195F0F509E50BF5F0E50B00 +:100AE00035F0F509E511F5F0E50E95F0F501E50BAA +:100AF000F5F0E50B35F0F501E501F5F0E50945F018 +:100B0000F509E50AF5F0E50965F0F509E509F5F0FF +:100B1000E50055F0F500C3E50DF5F0E51795F0F5A6 +:100B200009E50BF5F0E50B35F0F509E509F5F0E51C +:100B30000055F0F500E500F5F0E50C45F0F50C7515 +:100B40000000E50CF5F0E50045F0F500E514F5F0E2 +:100B5000E50045F0F500E515F5F0E50045F0F50098 +:100B6000E516F5F0E50045F0F500E50070028003BC +:100B7000020C5B00120636750000E500F502E50088 +:100B8000F503E500F504E500F50575E0092506F532 +:100B90008275E0003507F583E0F51775E008250656 +:100BA000F58275E0003507F583E0F51675E0072559 +:100BB00006F58275E0003507F583E0F51575E0066A +:100BC0002506F58275E0003507F583E0F51475E03C +:100BD000052506F58275E0003507F583E0F5137508 +:100BE000E0042506F58275E0003507F583E0F5128F +:100BF00075E0032506F58275E0003507F583E0F51D +:100C00001175E0022506F58275E0003507F583E0F1 +:100C1000F51075E0002506F58275E0003507F583CF +:100C2000E0F508E508C0E075E0012506F58275E00D +:100C3000003507F583E0F508E508C0E075E00A2512 +:100C400006F50675E0003507F507E502F582E503D0 +:100C5000F583E504F500E505F5012200751F007533 +:100C60001E00751D00751C00020B7400E5067582E0 +:100C70000AC39582F506E5077583009583F507D0CD +:100C8000E0F50875E0012506F58275E0003507F509 +:100C900083E508F0D0E0F50875E0002506F58275DB +:100CA000E0003507F583E508F075E0092506F582D3 +:100CB00075E0003507F583E517F075E0082506F5C2 +:100CC0008275E0003507F583E516F075E007250627 +:100CD000F58275E0003507F583E515F075E006252A +:100CE00006F58275E0003507F583E514F075E0053B +:100CF0002506F58275E0003507F583E513F075E00C +:100D0000042506F58275E0003507F583E512F075D8 +:100D1000E0032506F58275E0003507F583E511F05F +:100D200075E0022506F58275E0003507F583E510CC +:100D3000F0900000E582F509900000E583F50B7561 +:100D40000100C3750000E501F5F0E50935F0F50196 +:100D5000E500F5F0E50B35F0F500E500F502E501FD +:100D6000F582E502F583E0F50F750101C37500001A +:100D7000E501F5F0E50935F0F501E500F5F0E50BE5 +:100D800035F0F500E500F502E501F582E502F583B1 +:100D9000E0F50C750102C3750000E501F5F0E50909 +:100DA00035F0F501E500F5F0E50B35F0F500E5006F +:100DB000F502E501F582E502F583E0F50A75010328 +:100DC000C3750000E501F5F0E50935F0F501E50032 +:100DD000F5F0E50B35F0F500E500F502E501F582EB +:100DE000E502F583E0F501750E01750B007509004C +:100DF000750000C3750D00E50EF5F0E50F35F0F553 +:100E00000DE50BF5F0E50C35F0F50EE509F5F0E52F +:100E10000A35F0F50FE500F5F0E50135F0F5109035 +:100E20000000E582F509900000E583F50A750100F0 +:100E3000C3750000E501F5F0E50935F0F501E500C1 +:100E4000F5F0E50A35F0F500E50DF503E500F502EE +:100E5000E501F582E502F583E503F0750101C3754F +:100E60000000E501F5F0E50935F0F501E500F5F0E4 +:100E7000E50A35F0F500E50EF503E500F502E501BC +:100E8000F582E502F583E503F0750102C375000004 +:100E9000E501F5F0E50935F0F501E500F5F0E50AC5 +:100EA00035F0F500E50FF503E500F502E501F58203 +:100EB000E502F583E503F0750103C3750000E50164 +:100EC000F5F0E50935F0F501E500F5F0E50A35F056 +:100ED000F500E510F503E500F502E501F582E50210 +:100EE000F583E503F075170A751100751200751387 +:100EF00000750080E500F5F0E51325F0F513E50039 +:100F0000F5F0E51025F0F510750C00751400751559 +:100F100000751600750B00750A01750001C3E51018 +:100F2000F5F0E51395F0F509E50BF5F0E50B35F077 +:100F3000F509E509F5F0E50055F0F500E500F5F0F7 +:100F4000E50C45F0F50C750001C3E510F5F0E5136F +:100F500095F0F509E50BF5F0E50B35F0F509E5132E +:100F6000F5F0E51095F0F501E50BF5F0E50B35F042 +:100F7000F501E501F5F0E50945F0F509E50AF5F0BB +:100F8000E50965F0F509E509F5F0E50055F0F5002E +:100F9000C3E50FF5F0E51295F0F509E50BF5F0E581 +:100FA0000B35F0F509E509F5F0E50055F0F500E53C +:100FB00000F5F0E50C45F0F50C750001C3E510F502 +:100FC000F0E51395F0F509E50BF5F0E50B35F0F5D7 +:100FD00009E513F5F0E51095F0F501E50BF5F0E501 +:100FE0000B35F0F501E501F5F0E50945F0F509E50A +:100FF0000AF5F0E50965F0F509E509F5F0E50055B4 +:10100000F0F500C3E50FF5F0E51295F0F509E50BF5 +:10101000F5F0E50B35F0F509E512F5F0E50F95F083 +:10102000F501E50BF5F0E50B35F0F501E501F5F01F +:10103000E50945F0F509E50AF5F0E50965F0F5097A +:10104000E509F5F0E50055F0F500C3E50EF5F0E52E +:101050001195F0F509E50BF5F0E50B35F0F509E52F +:1010600009F5F0E50055F0F500E500F5F0E50C4573 +:10107000F0F50C750001C3E510F5F0E51395F0F5FA +:1010800009E50BF5F0E50B35F0F509E513F5F0E5AD +:101090001095F0F501E50BF5F0E50B35F0F501E500 +:1010A00001F5F0E50945F0F509E50AF5F0E5096512 +:1010B000F0F509E509F5F0E50055F0F500C3E50F99 +:1010C000F5F0E51295F0F509E50BF5F0E50B35F0D7 +:1010D000F509E512F5F0E50F95F0F501E50BF5F0F2 +:1010E000E50B35F0F501E501F5F0E50945F0F50909 +:1010F000E50AF5F0E50965F0F509E509F5F0E50023 +:1011000055F0F500C3E50EF5F0E51195F0F509E5AC +:101110000BF5F0E50B35F0F509E511F5F0E50E9569 +:10112000F0F501E50BF5F0E50B35F0F501E501F51E +:10113000F0E50945F0F509E50AF5F0E50965F0F592 +:1011400009E509F5F0E50055F0F500C3E50DF5F00A +:10115000E51795F0F509E50BF5F0E50B35F0F50928 +:10116000E509F5F0E50055F0F500E500F5F0E50CD2 +:1011700045F0F50C750000E50CF5F0E50045F0F5DF +:1011800000E514F5F0E50045F0F500E515F5F0E5AE +:101190000045F0F500E516F5F0E50045F0F500E551 +:1011A00000700280030212AD00120C6BE582F502A2 +:1011B000E583F503E500F504E501F505E502F50035 +:1011C000E503F501E504F509E505F50AE500F50295 +:1011D000E501F503E509F504E50AF50575E00925DE +:1011E00006F58275E0003507F583E0F51775E00830 +:1011F0002506F58275E0003507F583E0F51675E004 +:10120000072506F58275E0003507F583E0F51575CD +:10121000E0062506F58275E0003507F583E0F51454 +:1012200075E0052506F58275E0003507F583E0F5E4 +:101230001375E0042506F58275E0003507F583E0B7 +:10124000F51275E0032506F58275E0003507F58394 +:10125000E0F51175E0022506F58275E0003507F529 +:1012600083E0F51075E0002506F58275E00035078E +:10127000F583E0F508E508C0E075E0012506F58294 +:1012800075E0003507F583E0F508E508C0E075E096 +:101290000A2506F50675E0003507F507E502F58233 +:1012A000E503F583E504F500E505F5012200751F6A +:1012B00000751E00751D00751C000211A900E506D1 +:1012C00075820BC39582F506E5077583009583F556 +:1012D00007D0E0F50875E0022506F58275E00035D7 +:1012E00007F583E508F0D0E0F50875E0012506F57F +:1012F0008275E0003507F583E508F075E00A2506FC +:10130000F58275E0003507F583E517F075E00925EE +:1013100006F58275E0003507F583E516F075E008FF +:101320002506F58275E0003507F583E515F075E0D3 +:10133000072506F58275E0003507F583E514F0759D +:10134000E0062506F58275E0003507F583E513F024 +:1013500075E0052506F58275E0003507F583E51291 +:10136000F075E0042506F58275E0003507F583E5A4 +:1013700011F075E0032506F58275E0003507F58369 +:10138000E510F0900000E582F509900000E583F596 +:101390000B750100C3750000E501F5F0E50935F0B6 +:1013A000F501E500F5F0E50B35F0F500E500F50297 +:1013B000E501F582E502F583E0F50F750101C375DE +:1013C0000000E501F5F0E50935F0F501E500F5F07F +:1013D000E50B35F0F500E500F502E501F582E502E3 +:1013E000F583E0F50C750102C3750000E501F5F029 +:1013F000E50935F0F501E500F5F0E50B35F0F50010 +:10140000E500F502E501F582E502F583E0F50A75F0 +:101410000103C3750000E501F5F0E50935F0F501BC +:10142000E500F5F0E50B35F0F500E500F502E50126 +:10143000F582E502F583E0F501750E01750B007587 +:101440000900750000C3750D00E50EF5F0E50F35D8 +:10145000F0F50DE50BF5F0E50C35F0F50EE509F5C9 +:10146000F0E50A35F0F50FE500F5F0E50135F0F5AA +:1014700010900000E582F509900000E583F50A75FB +:101480000100C3750000E501F5F0E50935F0F5014F +:10149000E500F5F0E50A35F0F500E50DF503E500AA +:1014A000F502E501F582E502F583E503F07501013A +:1014B000C3750000E501F5F0E50935F0F501E5003B +:1014C000F5F0E50A35F0F500E50EF503E500F50267 +:1014D000E501F582E502F583E503F0750102C375C8 +:1014E0000000E501F5F0E50935F0F501E500F5F05E +:1014F000E50A35F0F500E50FF503E500F502E50135 +:10150000F582E502F583E503F0750103C37500007C +:10151000E501F5F0E50935F0F501E500F5F0E50A3E +:1015200035F0F500E510F503E500F502E501F5827B +:10153000E502F583E503F075170A751100751200D1 +:10154000751300750080E500F5F0E51325F0F5133F +:10155000E500F5F0E51025F0F510750C00751400A8 +:10156000751500751600750B00750A01750001C32D +:10157000E510F5F0E51395F0F509E50BF5F0E50B51 +:1015800035F0F509E509F5F0E50055F0F500E50061 +:10159000F5F0E50C45F0F50C750001C3E510F5F02C +:1015A000E51395F0F509E50BF5F0E50B35F0F509D8 +:1015B000E513F5F0E51095F0F501E50BF5F0E50B19 +:1015C00035F0F501E501F5F0E50945F0F509E50A25 +:1015D000F5F0E50965F0F509E509F5F0E50055F0E8 +:1015E000F500C3E50FF5F0E51295F0F509E50BF50B +:1015F000F0E50B35F0F509E509F5F0E50055F0F5F6 +:1016000000E500F5F0E50C45F0F50C750001C3E5CB +:1016100010F5F0E51395F0F509E50BF5F0E50B3560 +:10162000F0F509E513F5F0E51095F0F501E50BF59A +:10163000F0E50B35F0F501E501F5F0E50945F0F5CC +:1016400009E50AF5F0E50965F0F509E509F5F0E5C4 +:101650000055F0F500C3E50FF5F0E51295F0F5093A +:10166000E50BF5F0E50B35F0F509E512F5F0E50FC2 +:1016700095F0F501E50BF5F0E50B35F0F501E50129 +:10168000F5F0E50945F0F509E50AF5F0E50965F03D +:10169000F509E509F5F0E50055F0F500C3E50EF5AF +:1016A000F0E51195F0F509E50BF5F0E50B35F0F5F2 +:1016B00009E509F5F0E50055F0F500E500F5F0E580 +:1016C0000C45F0F50C750001C3E510F5F0E5139538 +:1016D000F0F509E50BF5F0E50B35F0F509E513F547 +:1016E000F0E51095F0F501E50BF5F0E50B35F0F5BB +:1016F00001E501F5F0E50945F0F509E50AF5F0E544 +:101700000965F0F509E509F5F0E50055F0F500C3C8 +:10171000E50FF5F0E51295F0F509E50BF5F0E50BB1 +:1017200035F0F509E512F5F0E50F95F0F501E50B5B +:10173000F5F0E50B35F0F501E501F5F0E50945F0CB +:10174000F509E50AF5F0E50965F0F509E509F5F0B3 +:10175000E50055F0F500C3E50EF5F0E51195F0F55F +:1017600009E50BF5F0E50B35F0F509E511F5F0E5C8 +:101770000E95F0F501E50BF5F0E50B35F0F501E51B +:1017800001F5F0E50945F0F509E50AF5F0E509652B +:10179000F0F509E509F5F0E50055F0F500C3E50DB4 +:1017A000F5F0E51795F0F509E50BF5F0E50B35F0EB +:1017B000F509E509F5F0E50055F0F500E500F5F06F +:1017C000E50C45F0F50C750000E50CF5F0E500457D +:1017D000F0F500E514F5F0E50045F0F500E515F548 +:1017E000F0E50045F0F500E516F5F0E50045F0F50B +:1017F00000E50070028003021913001212BD75E0AB +:10180000002506F58275E0003507F583E0F50275E1 +:10181000E0002506F58275E0003507F583E0F50365 +:1018200075E0002506F58275E0003507F583E0F5E3 +:101830000475E0002506F58275E0003507F583E0C4 +:10184000F50575E00A2506F58275E0003507F58394 +:10185000E0F51775E0092506F58275E0003507F516 +:1018600083E0F51675E0082506F58275E00035077A +:10187000F583E0F51575E0072506F58275E000357E +:1018800007F583E0F51475E0062506F58275E0009E +:101890003507F583E0F51375E0052506F58275E05B +:1018A000003507F583E0F51275E0042506F582752D +:1018B000E0003507F583E0F51175E0032506F582B4 +:1018C00075E0003507F583E0F51075E0012506F5B4 +:1018D0008275E0003507F583E0F508E508C0E0759E +:1018E000E0022506F58275E0003507F583E0F5088E +:1018F000E508C0E075E00B2506F50675E000350744 +:10190000F507E502F582E503F583E504F500E50555 +:10191000F5012200751F00751E00751D00751C0065 +:101920000217FB00000000000000000000000000A3 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/noreturn-7.s.expected b/tests/GCCTestSuite/noreturn-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/noreturn-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/null-pointer-1.c b/tests/GCCTestSuite/null-pointer-1.c new file mode 100644 index 0000000..8cc15c6 --- /dev/null +++ b/tests/GCCTestSuite/null-pointer-1.c @@ -0,0 +1,20 @@ +/* PR c/13382 */ +/* Origin: Richard Hutchinson */ + +/* Verify that the null initializer is converted to the right + pointer type. */ + +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +struct t +{ + int aMember; +}; + +struct t *const aPointer = 0; + +void foo() +{ + int anInt = (aPointer == 0) ? 0 : aPointer->aMember; +} diff --git a/tests/GCCTestSuite/null-pointer-1.c.expected b/tests/GCCTestSuite/null-pointer-1.c.expected new file mode 100644 index 0000000..8cc15c6 --- /dev/null +++ b/tests/GCCTestSuite/null-pointer-1.c.expected @@ -0,0 +1,20 @@ +/* PR c/13382 */ +/* Origin: Richard Hutchinson */ + +/* Verify that the null initializer is converted to the right + pointer type. */ + +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +struct t +{ + int aMember; +}; + +struct t *const aPointer = 0; + +void foo() +{ + int anInt = (aPointer == 0) ? 0 : aPointer->aMember; +} diff --git a/tests/GCCTestSuite/null-pointer-1.hex.expected b/tests/GCCTestSuite/null-pointer-1.hex.expected new file mode 100644 index 0000000..c59a790 --- /dev/null +++ b/tests/GCCTestSuite/null-pointer-1.hex.expected @@ -0,0 +1,29 @@ +:1000000000D0E0F50ED0E0F50FE510F50D90000002 +:10001000E582F50A900000E583F50B750900C375CC +:100020000000E509F5F0E50A35F0F509E500F5F021 +:10003000E50B35F0F501E501F502E509F582E5028C +:10004000F583E0F500750901C3750100E509F5F0D8 +:10005000E50A35F0F509E501F5F0E50B35F0F501B8 +:10006000E501F502E509F582E502F583E0F50A759B +:100070000100750900750C00C3E501F5F0E5009578 +:10008000F0F500E500F5F0E50C45F0F50CC3E509E9 +:10009000F5F0E50A95F0F500E500F5F0E50C45F022 +:1000A000F50C750100750900750A00E50CF5007581 +:1000B0000C01C3750B00E500F5F0E50B95F0F50BB1 +:1000C000750B00E50BF5F0E50B35F0F50BE50BF5E1 +:1000D000F0E50C65F0F50CC3750B00E501F5F0E5F6 +:1000E0000B95F0F50B750B00E50BF5F0E50B35F016 +:1000F000F50BE50BF5F0E50C65F0F50CC3750B00A1 +:10010000E509F5F0E50B95F0F50B750B00E50BF542 +:10011000F0E50B35F0F50BE50BF5F0E50C65F0F5CA +:100120000CC3750B00E50AF5F0E50B95F0F50B75C2 +:100130000B00E50BF5F0E50B35F0F50BE50BF5F0F5 +:10014000E50C65F0F50C750100750900750A007580 +:100150000000E50CF5F0E50045F0F500E501F5F0EF +:10016000E50045F0F500E509F5F0E50045F0F5009E +:10017000E50AF5F0E50045F0F500E50070028003C2 +:100180000201BB00C3C3C3C3C3C3C3750000E50002 +:10019000F502E500F503E500F504E500F505E50DDC +:1001A000F510E50FC0E0E50EC0E0E502F582E503DD +:1001B000F583E504F500E505F501220002018B0059 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/null-pointer-1.s.expected b/tests/GCCTestSuite/null-pointer-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/null-pointer-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/old-style-then-proto-1.c b/tests/GCCTestSuite/old-style-then-proto-1.c new file mode 100644 index 0000000..abe02d0 --- /dev/null +++ b/tests/GCCTestSuite/old-style-then-proto-1.c @@ -0,0 +1,44 @@ +/* Test for old-style definition followed by prototype declaration. + Mismatched qualifiers used to be wrongly forbidden. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f1() {} +void f1(void); /* { dg-warning "warning: prototype for 'f1' follows non-prototype definition" } */ + +void f2() {} /* { dg-error "error: previous definition of 'f2' was here" } */ +void f2(int); /* { dg-error "error: prototype for 'f2' declares more arguments than previous old-style definition" } */ + +void f3(a) int a; {} /* { dg-error "error: previous definition of 'f3' was here" } */ +void f3(void); /* { dg-error "error: prototype for 'f3' declares fewer arguments than previous old-style definition" } */ + +void f4(a) int a; {} +void f4(int); /* { dg-warning "warning: prototype for 'f4' follows non-prototype definition" } */ + +void f5(a) int a; {} /* { dg-error "error: previous definition of 'f5' was here" } */ +void f5(int, int); /* { dg-error "error: prototype for 'f5' declares more arguments than previous old-style definition" } */ + +void f6(a) int a; {} /* { dg-error "error: previous definition of 'f6' was here" } */ +void f6(int, ...); /* { dg-error "error: conflicting types for 'f6'" } */ + +void f7(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f7' was here" } */ +void f7(int); /* { dg-error "error: prototype for 'f7' declares fewer arguments than previous old-style definition" } */ + +void f8(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f8' was here" } */ +void f8(int, ...); /* { dg-error "error: conflicting types for 'f8'" } */ + +void f9(a, b) int a, b; {} +void f9(int, int); /* { dg-warning "warning: prototype for 'f9' follows non-prototype definition" } */ + +void f10(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f10' was here" } */ +void f10(int, long); /* { dg-error "error: prototype for 'f10' declares argument 2 with incompatible type" } */ + +void f11(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f11' was here" } */ +void f11(long, int); /* { dg-error "error: prototype for 'f11' declares argument 1 with incompatible type" } */ + +void f12(a, b) const int a; volatile int b; {} +void f12(volatile int, const int); /* { dg-warning "warning: prototype for 'f12' follows non-prototype definition" } */ + +void f13(a) const int a[2][2]; {} /* { dg-error "error: previous definition of 'f13' was here" } */ +void f13(volatile int [2][2]); /* { dg-error "error: prototype for 'f13' declares argument 1 with incompatible type" } */ diff --git a/tests/GCCTestSuite/old-style-then-proto-1.c.expected b/tests/GCCTestSuite/old-style-then-proto-1.c.expected new file mode 100644 index 0000000..abe02d0 --- /dev/null +++ b/tests/GCCTestSuite/old-style-then-proto-1.c.expected @@ -0,0 +1,44 @@ +/* Test for old-style definition followed by prototype declaration. + Mismatched qualifiers used to be wrongly forbidden. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f1() {} +void f1(void); /* { dg-warning "warning: prototype for 'f1' follows non-prototype definition" } */ + +void f2() {} /* { dg-error "error: previous definition of 'f2' was here" } */ +void f2(int); /* { dg-error "error: prototype for 'f2' declares more arguments than previous old-style definition" } */ + +void f3(a) int a; {} /* { dg-error "error: previous definition of 'f3' was here" } */ +void f3(void); /* { dg-error "error: prototype for 'f3' declares fewer arguments than previous old-style definition" } */ + +void f4(a) int a; {} +void f4(int); /* { dg-warning "warning: prototype for 'f4' follows non-prototype definition" } */ + +void f5(a) int a; {} /* { dg-error "error: previous definition of 'f5' was here" } */ +void f5(int, int); /* { dg-error "error: prototype for 'f5' declares more arguments than previous old-style definition" } */ + +void f6(a) int a; {} /* { dg-error "error: previous definition of 'f6' was here" } */ +void f6(int, ...); /* { dg-error "error: conflicting types for 'f6'" } */ + +void f7(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f7' was here" } */ +void f7(int); /* { dg-error "error: prototype for 'f7' declares fewer arguments than previous old-style definition" } */ + +void f8(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f8' was here" } */ +void f8(int, ...); /* { dg-error "error: conflicting types for 'f8'" } */ + +void f9(a, b) int a, b; {} +void f9(int, int); /* { dg-warning "warning: prototype for 'f9' follows non-prototype definition" } */ + +void f10(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f10' was here" } */ +void f10(int, long); /* { dg-error "error: prototype for 'f10' declares argument 2 with incompatible type" } */ + +void f11(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f11' was here" } */ +void f11(long, int); /* { dg-error "error: prototype for 'f11' declares argument 1 with incompatible type" } */ + +void f12(a, b) const int a; volatile int b; {} +void f12(volatile int, const int); /* { dg-warning "warning: prototype for 'f12' follows non-prototype definition" } */ + +void f13(a) const int a[2][2]; {} /* { dg-error "error: previous definition of 'f13' was here" } */ +void f13(volatile int [2][2]); /* { dg-error "error: prototype for 'f13' declares argument 1 with incompatible type" } */ diff --git a/tests/GCCTestSuite/old-style-then-proto-1.hex.expected b/tests/GCCTestSuite/old-style-then-proto-1.hex.expected new file mode 100644 index 0000000..08bd84a --- /dev/null +++ b/tests/GCCTestSuite/old-style-then-proto-1.hex.expected @@ -0,0 +1,67 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F5012200E50675820447 +:10007000C39582F506E5077583009583F507D0E003 +:10008000F500D0E0F501750900E509F502E509F58F +:1000900003E509F504E509F505E501C0E0E500C063 +:1000A000E075E0042506F50675E0003507F507E57F +:1000B00002F582E503F583E504F500E505F5012287 +:1000C00000E506758204C39582F506E50775830091 +:1000D0009583F507D0E0F500D0E0F501750900E55E +:1000E00009F502E509F503E509F504E509F505E576 +:1000F00001C0E0E500C0E075E0042506F50675E006 +:10010000003507F507E502F582E503F583E504F51B +:1001100000E505F5012200E506758204C39582F528 +:1001200006E5077583009583F507D0E0F500D0E07C +:10013000F501750900E509F502E509F503E509F59D +:1001400004E509F505E501C0E0E500C0E075E0045F +:100150002506F50675E0003507F507E502F582E5A9 +:1001600003F583E504F500E505F5012200E50675D4 +:100170008204C39582F506E5077583009583F5072C +:10018000D0E0F500D0E0F501750900E509F502E5DC +:1001900009F503E509F504E509F505E501C0E0E524 +:1001A00000C0E075E0042506F50675E0003507F5AA +:1001B00007E502F582E503F583E504F500E505F5BD +:1001C000012200E506758208C39582F506E50775EC +:1001D00083009583F507D0E0F500D0E0F5017509BF +:1001E00000E509F502E509F503E509F504E509F57A +:1001F00005E501C0E0E500C0E075E0082506F5066C +:1002000075E0003507F507E502F582E503F583E5BE +:1002100004F500E505F5012200E506758208C395A1 +:1002200082F506E5077583009583F507D0E0F500B4 +:10023000D0E0F501750900E509F502E509F503E5EA +:1002400009F504E509F505E501C0E0E500C0E07544 +:10025000E0082506F50675E0003507F507E502F527 +:1002600082E503F583E504F500E505F5012200E5E7 +:1002700006758208C39582F506E5077583009583A8 +:10028000F507D0E0F500D0E0F501750900E509F5C6 +:1002900002E509F503E509F504E509F505E501C001 +:1002A000E0E500C0E075E0082506F50675E00035DC +:1002B00007F507E502F582E503F583E504F500E5BA +:1002C00005F5012200E506758208C39582F506E56D +:1002D000077583009583F507D0E0F500D0E0F501C0 +:1002E000750900E509F502E509F503E509F504E5F9 +:1002F00009F505E501C0E0E500C0E075E008250668 +:10030000F50675E0003507F507E502F582E503F52A +:1003100083E504F500E505F5012200E50675820890 +:10032000C39582F506E5077583009583F507D0E050 +:10033000F500D0E0F501750900E509F502E509F5DC +:1003400003E509F504E509F505E501C0E0E500C0B0 +:10035000E075E0082506F50675E0003507F507E5C8 +:1003600002F582E503F583E504F500E505F50122D4 +:1003700000E506758208C39582F506E507758300DA +:100380009583F507D0E0F500D0E0F501750900E5AB +:1003900009F502E509F503E509F504E509F505E5C3 +:1003A00001C0E0E500C0E075E0082506F50675E04F +:1003B000003507F507E502F582E503F583E504F569 +:1003C00000E505F5012200E506758202C39582F578 +:1003D00006E5077583009583F507D0E0F500D0E0CA +:1003E000F501750900E509F502E509F503E509F5EB +:1003F00004E509F505E501C0E0E500C0E075E002AF +:100400002506F50675E0003507F507E502F582E5F6 +:1004100003F583E504F500E505F501220000000081 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/old-style-then-proto-1.s.expected b/tests/GCCTestSuite/old-style-then-proto-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/old-style-then-proto-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/overflow-1.c b/tests/GCCTestSuite/overflow-1.c new file mode 100644 index 0000000..db51a5e --- /dev/null +++ b/tests/GCCTestSuite/overflow-1.c @@ -0,0 +1,25 @@ +/* PR optimization/13318 */ +/* Origin: */ +/* Reduced testcase: Wolfgang Bangerth */ + +/* Verify that the big multiplier doesn't cause an integer + overflow in the loop optimizer. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct S { + int key; + int rnext,rprev; +}; + +void foo(struct S* H) +{ + int i, k; + for (i=0; i<2; i++){ + struct S* cell=H+k; + cell->key=i*(0xffffffffUL/2); + cell->rnext=k+(1-i); + cell->rprev=k+(1-i); + } +} diff --git a/tests/GCCTestSuite/overflow-1.c.expected b/tests/GCCTestSuite/overflow-1.c.expected new file mode 100644 index 0000000..db51a5e --- /dev/null +++ b/tests/GCCTestSuite/overflow-1.c.expected @@ -0,0 +1,25 @@ +/* PR optimization/13318 */ +/* Origin: */ +/* Reduced testcase: Wolfgang Bangerth */ + +/* Verify that the big multiplier doesn't cause an integer + overflow in the loop optimizer. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct S { + int key; + int rnext,rprev; +}; + +void foo(struct S* H) +{ + int i, k; + for (i=0; i<2; i++){ + struct S* cell=H+k; + cell->key=i*(0xffffffffUL/2); + cell->rnext=k+(1-i); + cell->rprev=k+(1-i); + } +} diff --git a/tests/GCCTestSuite/overflow-1.hex.expected b/tests/GCCTestSuite/overflow-1.hex.expected new file mode 100644 index 0000000..9442f42 --- /dev/null +++ b/tests/GCCTestSuite/overflow-1.hex.expected @@ -0,0 +1,337 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758214C321 +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0092506F58275E0003507F583E5A4 +:1006600008F0D0E0F50875E0082506F58275E00091 +:100670003507F583E508F075E0112506F58275E08C +:10068000003507F583E517F075E0102506F582754E +:10069000E0003507F583E516F075E00F2506F582D5 +:1006A00075E0003507F583E515F075E00E2506F5D4 +:1006B0008275E0003507F583E514F075E00D250639 +:1006C000F58275E0003507F583E513F075E00C253C +:1006D00006F58275E0003507F583E512F075E00B4D +:1006E0002506F58275E0003507F583E511F075E024 +:1006F0000A2506F58275E0003507F583E510F075EB +:10070000E0012506F58275E0003507F583E51FF069 +:1007100075E0002506F58275E0003507F583E51ED6 +:10072000F075080075E0072506F58275E0003507CD +:10073000F583E508F075160075100075080075E082 +:10074000052506F58275E0003507F583E508F075A7 +:10075000150275140075110075120075E005250667 +:10076000F58275E0003507F583E0F513750080E547 +:1007700000F5F0E51325F0F513E500F5F0E5122599 +:10078000F0F512750C00750D00750E00750F0075F3 +:100790000B00750A01750001C3E512F5F0E513952C +:1007A000F0F509E50BF5F0E50B35F0F509E509F590 +:1007B000F0E50055F0F500E500F5F0E50C45F0F545 +:1007C0000C750001C3E512F5F0E51395F0F509E5A8 +:1007D0000BF5F0E50B35F0F509E513F5F0E51295AD +:1007E000F0F501E50BF5F0E50B35F0F501E501F568 +:1007F000F0E50945F0F509E50AF5F0E50965F0F5DC +:1008000009E509F5F0E50055F0F500C3E511F5F04F +:10081000E51095F0F509E50BF5F0E50B35F0F50978 +:10082000E509F5F0E50055F0F500E500F5F0E50C1B +:1008300045F0F50C750001C3E512F5F0E51395F0F0 +:10084000F509E50BF5F0E50B35F0F509E513F5F0E5 +:10085000E51295F0F501E50BF5F0E50B35F0F50146 +:10086000E501F5F0E50945F0F509E50AF5F0E509DA +:1008700065F0F509E509F5F0E50055F0F500C3E58B +:1008800011F5F0E51095F0F509E50BF5F0E50B3500 +:10089000F0F509E510F5F0E51195F0F501E50BF53A +:1008A000F0E50B35F0F501E501F5F0E50945F0F56A +:1008B00009E50AF5F0E50965F0F509E509F5F0E562 +:1008C0000055F0F500C3E514F5F0E51695F0F509CF +:1008D000E50BF5F0E50B35F0F509E509F5F0E50078 +:1008E00055F0F500E500F5F0E50C45F0F50C750068 +:1008F00001C3E512F5F0E51395F0F509E50BF5F008 +:10090000E50B35F0F509E513F5F0E51295F0F50185 +:10091000E50BF5F0E50B35F0F501E501F5F0E5093E +:1009200045F0F509E50AF5F0E50965F0F509E50991 +:10093000F5F0E50055F0F500C3E511F5F0E510958B +:10094000F0F509E50BF5F0E50B35F0F509E510F5E7 +:10095000F0E51195F0F501E50BF5F0E50B35F0F557 +:1009600001E501F5F0E50945F0F509E50AF5F0E5E1 +:100970000965F0F509E509F5F0E50055F0F500C366 +:10098000E514F5F0E51695F0F509E50BF5F0E50B46 +:1009900035F0F509E516F5F0E51495F0F501E50BF0 +:1009A000F5F0E50B35F0F501E501F5F0E50945F069 +:1009B000F509E50AF5F0E50965F0F509E509F5F051 +:1009C000E50055F0F500C3E515F5F075E0072506DF +:1009D000F58275E0003507F583E0F508E50895F048 +:1009E000F509E50BF5F0E50B35F0F509E509F5F04E +:1009F000E50055F0F500E500F5F0E50C45F0F50CE7 +:100A0000750101C3750000E50CF5F0E50095F0F502 +:100A100000750000E500F5F0E50035F0F500E500B3 +:100A2000F5F0E50165F0F501C3750000E50DF5F0A1 +:100A3000E50095F0F500750000E500F5F0E50035FE +:100A4000F0F500E500F5F0E50165F0F501C375008E +:100A500000E50EF5F0E50095F0F500750000E50005 +:100A6000F5F0E50035F0F500E500F5F0E50165F09D +:100A7000F501C3750000E50FF5F0E50095F0F50010 +:100A8000750000E500F5F0E50035F0F500E500F54E +:100A9000F0E50165F0F501750900750A00750B00B8 +:100AA000750000E501F5F0E50045F0F500E509F514 +:100AB000F0E50045F0F500E50AF5F0E50045F0F554 +:100AC00000E50BF5F0E50045F0F500E5007002806B +:100AD0000302141000750C0C750D0075E00425065A +:100AE000F58275E0003507F583E0F501750E0075B8 +:100AF0000000C375090075E0062506F58275E00063 +:100B00003507F583E0F508E508F5F0E50CA4F50BED +:100B100075E0062506F58275E0003507F583E0F5FA +:100B200008E508F5F0E50CA4E5F0F50AE50BF5F0AD +:100B3000E50935F0F509E501F5F0E50CA4F50BE55F +:100B400001F5F0E50CA4E5F0F501E50BF5F0E50A9B +:100B500035F0F50AC3C3750100E509F5F0E50E357A +:100B6000F0F50EE50AF5F0E50035F0F500C3750A7D +:100B70000075E0062506F58275E0003507F583E08F +:100B8000F508E508F5F0E50DA4F50B75E00625067A +:100B9000F58275E0003507F583E0F508E508F5F026 +:100BA000E50DA4E5F0F501E50BF5F0E50A35F0F506 +:100BB0000A750900C3C3750100E509F5F0E50E35B6 +:100BC000F0F50EE50AF5F0E50035F0F500C375091E +:100BD00000750A00C3C3750100E509F5F0E50E359F +:100BE000F0F50EE50AF5F0E50035F0F500C37509FE +:100BF00000750A00C3C3750100E509F5F0E50E357F +:100C0000F0F50EE50AF5F0E50035F0F500C37501E5 +:100C100000E50EF5F075E0012506F58275E000357A +:100C200007F583E0F508E50835F0F50875E00325DC +:100C300006F58275E0003507F583E508F0E500F577 +:100C4000F075E0002506F58275E0003507F583E0D4 +:100C5000F508E50835F0F50875E0022506F582751A +:100C6000E0003507F583E508F075010175000075B2 +:100C70000A00750900E501F4F501E500F4F500E569 +:100C80000AF4F51DE509F4F51CD3750900E509F52D +:100C9000F0E50135F0F501E509F5F0E50035F0F591 +:100CA00000E509F5F0E51D35F0F51DE509F5F0E580 +:100CB0001C35F0F51CE501F51FE500F51E751B025E +:100CC000751A00751900751800120000E582F5020A +:100CD000E583F503E500F504E501F505E502F51208 +:100CE000E503F513E504F514E505F517750100C3F3 +:100CF000750000E501F5F075E0032506F58275E065 +:100D0000003507F583E0F508E50835F0F519E5004D +:100D1000F5F075E0022506F58275E0003507F583EC +:100D2000E0F508E50835F0F51A75E0072506F582C7 +:100D300075E0003507F583E0F500E516F515E510DB +:100D4000F51875E0052506F58275E0003507F58391 +:100D5000E0F51B750D00750E00750F00751100C3D1 +:100D6000750100E500F5F0E512A4F50CE500F5F0DD +:100D7000E512A4E5F0F509E50CF5F0E50135F0F52F +:100D800001E515F5F0E512A4F50CE515F5F0E51211 +:100D9000A4E5F0F50AE50CF5F0E50935F0F509E50F +:100DA00018F5F0E512A4F50CE518F5F0E512A4E548 +:100DB000F0F50BE50CF5F0E50A35F0F50AE51BF565 +:100DC000F0E512A4F50CE51BF5F0E512A4E5F0F54D +:100DD00012E50CF5F0E50B35F0F50BC3C3750C000F +:100DE000E501F5F0E50D35F0F50DE509F5F0E50E59 +:100DF00035F0F50EE50AF5F0E50F35F0F50FE50BEA +:100E0000F5F0E51135F0F511C3750900E500F5F0D1 +:100E1000E513A4F50CE500F5F0E513A4E5F0F50AFB +:100E2000E50CF5F0E50935F0F509E515F5F0E51304 +:100E3000A4F50CE515F5F0E513A4E5F0F50BE50CCC +:100E4000F5F0E50A35F0F50AE518F5F0E513A4F537 +:100E50000CE518F5F0E513A4E5F0F512E50CF5F056 +:100E6000E50B35F0F50B750100C3C3750C00E5010A +:100E7000F5F0E50D35F0F50DE509F5F0E50E35F089 +:100E8000F50EE50AF5F0E50F35F0F50FE50BF5F099 +:100E9000E51135F0F511C3750A00E500F5F0E5142C +:100EA000A4F50CE500F5F0E514A4E5F0F50BE50C70 +:100EB000F5F0E50A35F0F50AE515F5F0E514A4F5C9 +:100EC0000CE515F5F0E514A4E5F0F512E50CF5F0E8 +:100ED000E50B35F0F50B750100750900C3C3750C02 +:100EE00000E501F5F0E50D35F0F50DE509F5F0E566 +:100EF0000E35F0F50EE50AF5F0E50F35F0F50FE5E6 +:100F00000BF5F0E51135F0F511C3750B00E500F5B3 +:100F1000F0E517A4F50CE500F5F0E517A4E5F0F50C +:100F200012E50CF5F0E50B35F0F50B7501007509D0 +:100F300000750A00C3C3750000E501F5F0E50D3545 +:100F4000F0F50DE509F5F0E50E35F0F50EE50AF5DD +:100F5000F0E50F35F0F50FE50BF5F0E51135F0F59F +:100F600011750100C3750000E501F5F0E51935F0D4 +:100F7000F501E500F5F0E51A35F0F500E50DF503AE +:100F8000E500F502E501F582E502F583E503F0757C +:100F90000101C3750000E501F5F0E51935F0F50133 +:100FA000E500F5F0E51A35F0F500E50EF503E5008E +:100FB000F502E501F582E502F583E503F07501022E +:100FC000C3750000E501F5F0E51935F0F501E50020 +:100FD000F5F0E51A35F0F500E50FF503E500F5024B +:100FE000E501F582E502F583E503F0750103C375BC +:100FF0000000E501F5F0E51935F0F501E500F5F043 +:10100000E51A35F0F500E511F503E500F502E50117 +:10101000F582E502F583E503F0750104C375000070 +:10102000E501F5F075E0032506F58275E00035076A +:10103000F583E0F508E50835F0F50DE500F5F07508 +:10104000E0022506F58275E0003507F583E0F50836 +:10105000E50835F0F50E750901750A007501007592 +:101060000000C375E0072506F58275E0003507F539 +:1010700083E0F508E508F5F0E50995F0F509E516D2 +:10108000F5F0E50A95F0F50AE510F5F0E50195F0C3 +:10109000F50175E0052506F58275E0003507F58355 +:1010A000E0F508E508F5F0E50095F0F500C3750BEF +:1010B00000E509F5F075E0062506F58275E00035D6 +:1010C00007F583E0F508E50835F0F509E50AF5F0E0 +:1010D00075E0042506F58275E0003507F583E0F537 +:1010E00008E50835F0F50AE501F5F075E004250698 +:1010F000F58275E0003507F583E0F508E50835F081 +:10110000F50BE500F5F075E0042506F58275E000C5 +:101110003507F583E0F508E50835F0F50C750100B5 +:10112000C3750000E501F5F0E50D35F0F501E500CA +:10113000F5F0E50E35F0F500E509F503E500F502FB +:10114000E501F582E502F583E503F0750101C3755C +:101150000000E501F5F0E50D35F0F501E500F5F0ED +:10116000E50E35F0F500E50AF503E500F502E501C9 +:10117000F582E502F583E503F0750102C375000011 +:10118000E501F5F0E50D35F0F501E500F5F0E50ECA +:1011900035F0F500E50BF503E500F502E501F58214 +:1011A000E502F583E503F0750103C3750000E50171 +:1011B000F5F0E50D35F0F501E500F5F0E50E35F05B +:1011C000F500E50CF503E500F502E501F582E50221 +:1011D000F583E503F0750008C3750100E500F5F03F +:1011E00075E0032506F58275E0003507F583E0F527 +:1011F00008E50835F0F500E501F5F075E002250693 +:10120000F58275E0003507F583E0F508E50835F06F +:10121000F50E750B01750A00750900750100C3759F +:10122000E0072506F58275E0003507F583E0F5084F +:10123000E508F5F0E50B95F0F50CE516F5F0E50A97 +:1012400095F0F50BE510F5F0E50995F0F50975E079 +:10125000052506F58275E0003507F583E0F508E51C +:1012600008F5F0E50195F0F501C3750A00E50CF508 +:10127000F075E0062506F58275E0003507F583E098 +:10128000F508E50835F0F50AE50BF5F075E00425FD +:1012900006F58275E0003507F583E0F508E50835C9 +:1012A000F0F50BE509F5F075E0042506F58275E02B +:1012B000003507F583E0F508E50835F0F50CE501A4 +:1012C000F5F075E0042506F58275E0003507F58335 +:1012D000E0F508E50835F0F50D750900C375010066 +:1012E000E509F5F0E50035F0F509E501F5F0E50E65 +:1012F00035F0F501E50AF503E501F502E509F582AA +:10130000E502F583E503F0750901C3750100E50900 +:10131000F5F0E50035F0F509E501F5F0E50E35F0FD +:10132000F501E50BF503E501F502E509F582E502B6 +:10133000F583E503F0750902C3750100E509F5F0D1 +:10134000E50035F0F509E501F5F0E50E35F0F501BC +:10135000E50CF503E501F502E509F582E502F58303 +:10136000E503F0750903C3750100E509F5F0E50033 +:1013700035F0F509E501F5F0E50E35F0F501E50D7F +:10138000F503E501F502E509F582E502F583E503DC +:10139000F0750101750900750A00750B00C3750031 +:1013A00000E501F5F075E0072506F58275E00035EA +:1013B00007F583E0F508E50835F0F50875E0072541 +:1013C00006F58275E0003507F583E508F0E509F5D7 +:1013D000F0E51635F0F516E50AF5F0E51035F0F50F +:1013E00010E50BF5F075E0052506F58275E0003592 +:1013F00007F583E0F508E50835F0F50875E0052503 +:1014000006F58275E0003507F583E508F002074F21 +:1014100000750000E500F502E500F503E500F504C0 +:10142000E500F50575E0112506F58275E000350744 +:10143000F583E0F51775E0102506F58275E00035B7 +:1014400007F583E0F51675E00F2506F58275E000D7 +:101450003507F583E0F51575E00E2506F58275E094 +:10146000003507F583E0F51475E00D2506F5827566 +:10147000E0003507F583E0F51375E00C2506F582ED +:1014800075E0003507F583E0F51275E00B2506F5EC +:101490008275E0003507F583E0F51175E00A250651 +:1014A000F58275E0003507F583E0F51075E0082555 +:1014B00006F58275E0003507F583E0F508E508C01C +:1014C000E075E0092506F58275E0003507F583E053 +:1014D000F508E508C0E075E0142506F50675E0009E +:1014E0003507F507E502F582E503F583E504F50028 +:1014F000E505F501220000000000000000000000EA +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/overflow-1.s.expected b/tests/GCCTestSuite/overflow-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/overflow-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pack-test-2.c b/tests/GCCTestSuite/pack-test-2.c new file mode 100644 index 0000000..974d982 --- /dev/null +++ b/tests/GCCTestSuite/pack-test-2.c @@ -0,0 +1,25 @@ +/* Tests for syntax checking of #pragma pack. + Contributed by Mike Coleman */ + +/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */ + +#pragma pack(pop) /* { dg-error "without matching" } */ + +#pragma pack(push) +#pragma pack(pop) /* reset */ + +#pragma pack(push, foo, 1) +#pragma pack(pop, foo, 1) /* { dg-error "malformed" } (/ +#pragma pack(pop) /* reset */ + +#pragma pack(push, foo, 1) +#pragma pack(pop, bar) /* { dg-error "without matching" } */ +#pragma pack(pop) /* reset */ + +#pragma pack(push, foo, 1) +#pragma pack(pop) +#pragma pack(pop, foo) /* { dg-error "without matching" } */ + +#pragma pack(push, foo, 3) /* { dg-error "small power of two" } */ + +extern int blah; /* prevent "ISO C forbids an empty source file" */ diff --git a/tests/GCCTestSuite/pack-test-2.c.expected b/tests/GCCTestSuite/pack-test-2.c.expected new file mode 100644 index 0000000..974d982 --- /dev/null +++ b/tests/GCCTestSuite/pack-test-2.c.expected @@ -0,0 +1,25 @@ +/* Tests for syntax checking of #pragma pack. + Contributed by Mike Coleman */ + +/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */ + +#pragma pack(pop) /* { dg-error "without matching" } */ + +#pragma pack(push) +#pragma pack(pop) /* reset */ + +#pragma pack(push, foo, 1) +#pragma pack(pop, foo, 1) /* { dg-error "malformed" } (/ +#pragma pack(pop) /* reset */ + +#pragma pack(push, foo, 1) +#pragma pack(pop, bar) /* { dg-error "without matching" } */ +#pragma pack(pop) /* reset */ + +#pragma pack(push, foo, 1) +#pragma pack(pop) +#pragma pack(pop, foo) /* { dg-error "without matching" } */ + +#pragma pack(push, foo, 3) /* { dg-error "small power of two" } */ + +extern int blah; /* prevent "ISO C forbids an empty source file" */ diff --git a/tests/GCCTestSuite/pack-test-2.hex.expected b/tests/GCCTestSuite/pack-test-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pack-test-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pack-test-2.s.expected b/tests/GCCTestSuite/pack-test-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pack-test-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pack-test-3.c b/tests/GCCTestSuite/pack-test-3.c new file mode 100644 index 0000000..8b03903 --- /dev/null +++ b/tests/GCCTestSuite/pack-test-3.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ + +/* Copyright (C) 2003 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 15 Jul 2003 */ + +/* you should not be able to pack a typedef to a struct, only the + underlying struct can be packed. */ + +/* ok */ +struct u1 +{ + char field1; + short field2; + int field3; +}; + +/* ok */ +typedef struct p1 { + char field1; + short field2; + int field3; +} __attribute__ ((packed)) p1_t1; + +/* ok */ +typedef struct __attribute__ ((packed)) p2 { + char field1; + short field2; + int field3; +} p2_t1; + +int ary1[sizeof (struct p1) == sizeof (p1_t1) ? 1 : -1]; +int ary2[sizeof (struct p2) == sizeof (p2_t1) ? 1 : -1]; +int ary3[sizeof (struct p1) == sizeof (struct p2) ? 1 : -1]; + +/* not ok */ +typedef struct u1 __attribute__ ((packed)) u1_t1; /* { dg-warning "attribute ignored" "" }*/ +typedef struct u1 u1_t2 __attribute__ ((packed)); /* { dg-warning "attribute ignored" "" }*/ + +typedef struct p3 { + char field1; + short field2; + int field3; +} p3_t1 __attribute__ ((packed)); /* { dg-warning "attribute ignored" "" }*/ + diff --git a/tests/GCCTestSuite/pack-test-3.c.expected b/tests/GCCTestSuite/pack-test-3.c.expected new file mode 100644 index 0000000..8b03903 --- /dev/null +++ b/tests/GCCTestSuite/pack-test-3.c.expected @@ -0,0 +1,44 @@ +/* { dg-do compile } */ + +/* Copyright (C) 2003 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 15 Jul 2003 */ + +/* you should not be able to pack a typedef to a struct, only the + underlying struct can be packed. */ + +/* ok */ +struct u1 +{ + char field1; + short field2; + int field3; +}; + +/* ok */ +typedef struct p1 { + char field1; + short field2; + int field3; +} __attribute__ ((packed)) p1_t1; + +/* ok */ +typedef struct __attribute__ ((packed)) p2 { + char field1; + short field2; + int field3; +} p2_t1; + +int ary1[sizeof (struct p1) == sizeof (p1_t1) ? 1 : -1]; +int ary2[sizeof (struct p2) == sizeof (p2_t1) ? 1 : -1]; +int ary3[sizeof (struct p1) == sizeof (struct p2) ? 1 : -1]; + +/* not ok */ +typedef struct u1 __attribute__ ((packed)) u1_t1; /* { dg-warning "attribute ignored" "" }*/ +typedef struct u1 u1_t2 __attribute__ ((packed)); /* { dg-warning "attribute ignored" "" }*/ + +typedef struct p3 { + char field1; + short field2; + int field3; +} p3_t1 __attribute__ ((packed)); /* { dg-warning "attribute ignored" "" }*/ + diff --git a/tests/GCCTestSuite/pack-test-3.hex.expected b/tests/GCCTestSuite/pack-test-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pack-test-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pack-test-3.s.expected b/tests/GCCTestSuite/pack-test-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pack-test-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/parm-mismatch-1.c b/tests/GCCTestSuite/parm-mismatch-1.c new file mode 100644 index 0000000..6b82b7b --- /dev/null +++ b/tests/GCCTestSuite/parm-mismatch-1.c @@ -0,0 +1,18 @@ +/* Test diagnostics for parameter mismatches. Types that can't match + (). */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f0(); /* { dg-error "error: previous declaration of 'f0' was here" } */ +void f0(int, ...); /* { dg-error "error: conflicting types for 'f0'" } */ +/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 8 } */ +void f1(int, ...); /* { dg-error "error: previous declaration of 'f1' was here" } */ +void f1(); /* { dg-error "error: conflicting types for 'f1'" } */ +/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 11 } */ +void f2(); /* { dg-error "error: previous declaration of 'f2' was here" } */ +void f2(char); /* { dg-error "error: conflicting types for 'f2'" } */ +/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 14 } */ +void f3(char); /* { dg-error "error: previous declaration of 'f3' was here" } */ +void f3(); /* { dg-error "error: conflicting types for 'f3'" } */ +/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 17 } */ diff --git a/tests/GCCTestSuite/parm-mismatch-1.c.expected b/tests/GCCTestSuite/parm-mismatch-1.c.expected new file mode 100644 index 0000000..6b82b7b --- /dev/null +++ b/tests/GCCTestSuite/parm-mismatch-1.c.expected @@ -0,0 +1,18 @@ +/* Test diagnostics for parameter mismatches. Types that can't match + (). */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f0(); /* { dg-error "error: previous declaration of 'f0' was here" } */ +void f0(int, ...); /* { dg-error "error: conflicting types for 'f0'" } */ +/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 8 } */ +void f1(int, ...); /* { dg-error "error: previous declaration of 'f1' was here" } */ +void f1(); /* { dg-error "error: conflicting types for 'f1'" } */ +/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 11 } */ +void f2(); /* { dg-error "error: previous declaration of 'f2' was here" } */ +void f2(char); /* { dg-error "error: conflicting types for 'f2'" } */ +/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 14 } */ +void f3(char); /* { dg-error "error: previous declaration of 'f3' was here" } */ +void f3(); /* { dg-error "error: conflicting types for 'f3'" } */ +/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 17 } */ diff --git a/tests/GCCTestSuite/parm-mismatch-1.hex.expected b/tests/GCCTestSuite/parm-mismatch-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/parm-mismatch-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/parm-mismatch-1.s.expected b/tests/GCCTestSuite/parm-mismatch-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/parm-mismatch-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/postincr-1.c b/tests/GCCTestSuite/postincr-1.c new file mode 100644 index 0000000..53f5c8f --- /dev/null +++ b/tests/GCCTestSuite/postincr-1.c @@ -0,0 +1,21 @@ +/* Simple test for proper postincrement semantics. */ +/* { dg-do run } */ + +extern void exit (int); + +int i=0; +int c=0; +int *f () +{ + ++c; + return &i; +} + +int main () +{ + int r; + r = (*f())++; + if (!(r == 0 && i == 1 && c == 1)) + exit (1); + return 0; +} diff --git a/tests/GCCTestSuite/postincr-1.c.expected b/tests/GCCTestSuite/postincr-1.c.expected new file mode 100644 index 0000000..53f5c8f --- /dev/null +++ b/tests/GCCTestSuite/postincr-1.c.expected @@ -0,0 +1,21 @@ +/* Simple test for proper postincrement semantics. */ +/* { dg-do run } */ + +extern void exit (int); + +int i=0; +int c=0; +int *f () +{ + ++c; + return &i; +} + +int main () +{ + int r; + r = (*f())++; + if (!(r == 0 && i == 1 && c == 1)) + exit (1); + return 0; +} diff --git a/tests/GCCTestSuite/postincr-1.hex.expected b/tests/GCCTestSuite/postincr-1.hex.expected new file mode 100644 index 0000000..4c49f1a --- /dev/null +++ b/tests/GCCTestSuite/postincr-1.hex.expected @@ -0,0 +1,215 @@ +:1000000075812F7506FF7507FF12020F02000C00A5 +:1000100000D0E0F519D0E0F51AE510F518900004CD +:10002000E582F50F900004E583F510900004E58269 +:10003000F509900004E583F50A750100C375000019 +:10004000E501F5F0E50935F0F501E500F5F0E50A23 +:1000500035F0F500E500F502E501F582E502F583EE +:10006000E0F50B750101C3750000E501F5F0E50948 +:1000700035F0F501E500F5F0E50A35F0F500E500AD +:10008000F502E501F582E502F583E0F50C75010264 +:10009000C3750000E501F5F0E50935F0F501E5006F +:1000A000F5F0E50A35F0F500E500F502E501F58229 +:1000B000E502F583E0F50D750103C3750000E50168 +:1000C000F5F0E50935F0F501E500F5F0E50A35F064 +:1000D000F500E500F502E501F582E502F583E0F5BE +:1000E0000E750001750100750900750A00C3751BC6 +:1000F00000E500F5F0E50B35F0F500E501F5F0E57C +:100100000C35F0F501E509F5F0E50D35F0F509E5FB +:100110000AF5F0E50E35F0F50C750B00C3750A0015 +:10012000E50BF5F0E50F35F0F50BE50AF5F0E51018 +:1001300035F0F50AE500F503E50AF502E50BF58271 +:10014000E502F583E503F0750B01C3750000E50BCF +:10015000F5F0E50F35F0F50BE500F5F0E51035F0BD +:10016000F50AE501F503E50AF502E50BF582E5027E +:10017000F583E503F0750B02C3750000E50BF5F0A0 +:10018000E50F35F0F50BE500F5F0E51035F0F50A73 +:10019000E509F503E50AF502E50BF582E502F583CD +:1001A000E503F0750B03C3750000E50BF5F0E50FF3 +:1001B00035F0F50BE500F5F0E51035F0F50AE50C46 +:1001C000F503E50AF502E50BF582E502F583E503A3 +:1001D000F0900000E582F501900000E583F50975D7 +:1001E0000000E501F502E509F503E500F504E50089 +:1001F000F505E518F510E51AC0E0E519C0E0E502DF +:10020000F582E503F583E504F500E505F501220037 +:10021000E506758205C39582F506E50775830095A9 +:1002200083F507D0E0F50875E0012506F58275E055 +:10023000003507F583E508F0D0E0F50875E0002506 +:1002400006F58275E0003507F583E508F075E004F2 +:100250002506F58275E0003507F583E512F075E0B7 +:10026000032506F58275E0003507F583E511F07585 +:10027000E0022506F58275E0003507F583E510F00C +:10028000900000E582F50A900000E583F50175090C +:1002900000C3750000E509F5F0E50A35F0F50DE558 +:1002A00000F5F0E50135F0F50E750900750A0075E9 +:1002B0000B00750C00750100C3750000E501F5F039 +:1002C000E50D35F0F501E500F5F0E50E35F0F5004A +:1002D000E509F503E500F502E501F582E502F583A0 +:1002E000E503F0750101C3750000E501F5F0E50DCA +:1002F00035F0F501E500F5F0E50E35F0F500E50A1D +:10030000F503E500F502E501F582E502F583E50375 +:10031000F0750102C3750000E501F5F0E50D35F05B +:10032000F501E500F5F0E50E35F0F500E50BF50318 +:10033000E500F502E501F582E502F583E503F075D8 +:100340000103C3750000E501F5F0E50D35F0F50199 +:10035000E500F5F0E50E35F0F500E50CF503E500F8 +:10036000F502E501F582E502F583E503F09000046E +:10037000E582F50A900004E583F501750900C3756F +:100380000000E509F5F0E50A35F0F50DE500F5F0BA +:10039000E50135F0F50E750900750A00750B00755D +:1003A0000C00750100C3750000E501F5F0E50D35A1 +:1003B000F0F501E500F5F0E50E35F0F500E509F59D +:1003C00003E500F502E501F582E502F583E503F0BA +:1003D000750101C3750000E501F5F0E50D35F0F597 +:1003E00001E500F5F0E50E35F0F500E50AF503E569 +:1003F00000F502E501F582E502F583E503F07501FC +:1004000002C3750000E501F5F0E50D35F0F501E5F5 +:1004100000F5F0E50E35F0F500E50BF503E500F528 +:1004200002E501F582E502F583E503F0750103C3FA +:10043000750000E501F5F0E50D35F0F501E500F595 +:10044000F0E50E35F0F500E50CF503E500F502E505 +:1004500001F582E502F583E503F0120010E582F56F +:1004600002E583F503E502F511E503F512750100D8 +:10047000C3750000E501F5F0E51135F0F501E50083 +:10048000F5F0E51235F0F500E500F502E501F5823D +:10049000E502F583E0F50D750101C3750000E50186 +:1004A000F5F0E51135F0F501E500F5F0E51235F070 +:1004B000F500E500F502E501F582E502F583E0F5DA +:1004C0000E750102C3750000E501F5F0E51135F088 +:1004D000F501E500F5F0E51235F0F500E500F5026F +:1004E000E501F582E502F583E0F50F750103C375BB +:1004F0000000E501F5F0E51135F0F501E500F5F056 +:10050000E51235F0F500E500F502E501F582E502BA +:10051000F583E0F510750B01750A00750100750093 +:1005200000C3750900E50BF5F0E50D35F0F509E5BB +:100530000AF5F0E50E35F0F50AE501F5F0E50F35C1 +:10054000F0F50BE500F5F0E51035F0F50C75010060 +:10055000C3750000E501F5F0E51135F0F501E500A2 +:10056000F5F0E51235F0F500E509F503E500F502D3 +:10057000E501F582E502F583E503F0750101C37538 +:100580000000E501F5F0E51135F0F501E500F5F0C5 +:10059000E51235F0F500E50AF503E500F502E501A1 +:1005A000F582E502F583E503F0750102C3750000ED +:1005B000E501F5F0E51135F0F501E500F5F0E5129E +:1005C00035F0F500E50BF503E500F502E501F582F0 +:1005D000E502F583E503F0750103C3750000E5014D +:1005E000F5F0E51135F0F501E500F5F0E51235F02F +:1005F000F500E50CF503E500F502E501F582E502FD +:10060000F583E503F0750000750100750900750AB2 +:1006100000E50FF50BE510F50C750F00C3E500F5CF +:10062000F0E50D95F0F500E500F5F0E50F45F0F586 +:100630000FC3E501F5F0E50E95F0F500E500F5F0E6 +:10064000E50F45F0F50FC3E509F5F0E50B95F0F57D +:1006500000E500F5F0E50F45F0F50FC3E50AF5F00C +:10066000E50C95F0F500E500F5F0E50F45F0F50F28 +:10067000750100750900750A00E50FF500750F0199 +:10068000C3750B00E500F5F0E50B95F0F50B750B68 +:1006900000E50BF5F0E50B35F0F50BE50BF5F0E5B6 +:1006A0000F65F0F50FC3750B00E501F5F0E50B954F +:1006B000F0F50B750B00E50BF5F0E50B35F0F50BE0 +:1006C000E50BF5F0E50F65F0F50FC3750B00E509D7 +:1006D000F5F0E50B95F0F50B750B00E50BF5F0E586 +:1006E0000B35F0F50BE50BF5F0E50F65F0F50FC3F5 +:1006F000750B00E50AF5F0E50B95F0F50B750B00B1 +:10070000E50BF5F0E50B35F0F50BE50BF5F0E50F36 +:1007100065F0F50F750100750900750A0075000098 +:10072000E50FF5F0E50045F0F500E501F5F0E50031 +:1007300045F0F500E509F5F0E50045F0F500E50ABE +:10074000F5F0E50045F0F500E50070028003020BCE +:100750003700750100750900750A00750B007500FA +:1007600000E501F5F0E50045F0F500E509F5F0E5F7 +:100770000045F0F500E50AF5F0E50045F0F500E587 +:100780000BF5F0E50045F0F500E50070028003028E +:10079000091C00750000750100750900750A0075D7 +:1007A0000C01C3750B00E500F5F0E50B95F0F50BBA +:1007B000750B00E50BF5F0E50B35F0F50BE50BF5EA +:1007C000F0E50C65F0F50CC3750B00E501F5F0E5FF +:1007D0000B95F0F50B750B00E50BF5F0E50B35F01F +:1007E000F50BE50BF5F0E50C65F0F50CC3750B00AA +:1007F000E509F5F0E50B95F0F50B750B00E50BF54C +:10080000F0E50B35F0F50BE50BF5F0E50C65F0F5D3 +:100810000CC3750B00E50AF5F0E50B95F0F50B75CB +:100820000B00E50BF5F0E50B35F0F50BE50BF5F0FE +:10083000E50C65F0F50C750100750900750A007589 +:100840000000E50CF5F0E50045F0F500E501F5F0F8 +:10085000E50045F0F500E509F5F0E50045F0F500A7 +:10086000E50AF5F0E50045F0F500E50070028003CB +:1008700002090C00750000750100750900750A0079 +:10088000E500F502E501F503E509F504E50AF505DE +:1008900075E0042506F58275E0003507F583E0F57F +:1008A0001275E0032506F58275E0003507F583E053 +:1008B000F51175E0022506F58275E0003507F58330 +:1008C000E0F51075E0002506F58275E0003507F5C6 +:1008D00083E0F508E508C0E075E0012506F58275BE +:1008E000E0003507F583E0F508E508C0E075E005B0 +:1008F0002506F50675E0003507F507E502F582E502 +:1009000003F583E504F500E505F5012200751F01F7 +:10091000751E00751D00751C00020874009000040F +:10092000E582F509900004E583F50A750100C375B9 +:100930000000E501F5F0E50935F0F501E500F5F019 +:10094000E50A35F0F500E500F502E501F582E5027E +:10095000F583E0F50B750101C3750000E501F5F0C5 +:10096000E50935F0F501E500F5F0E50A35F0F500AB +:10097000E500F502E501F582E502F583E0F50C7589 +:100980000102C3750000E501F5F0E50935F0F50158 +:10099000E500F5F0E50A35F0F500E500F502E501C2 +:1009A000F582E502F583E0F50D750103C3750000DE +:1009B000E501F5F0E50935F0F501E500F5F0E50AAA +:1009C00035F0F500E500F502E501F582E502F58375 +:1009D000E0F50E750001750100750900750A0075D6 +:1009E0000F00C3E500F5F0E50B95F0F500E500F527 +:1009F000F0E50F45F0F50FC3E501F5F0E50C95F0D6 +:100A0000F500E500F5F0E50F45F0F50FC3E509F554 +:100A1000F0E50D95F0F500E500F5F0E50F45F0F592 +:100A20000FC3E50AF5F0E50E95F0F500E500F5F0E9 +:100A3000E50F45F0F50F750100750900750A00E531 +:100A40000FF500750F01C3750B00E500F5F0E50B20 +:100A500095F0F50B750B00E50BF5F0E50B35F0F5B2 +:100A60000BE50BF5F0E50F65F0F50FC3750B00E531 +:100A700001F5F0E50B95F0F50B750B00E50BF5F0C6 +:100A8000E50B35F0F50BE50BF5F0E50F65F0F50F2F +:100A9000C3750B00E509F5F0E50B95F0F50B750B4B +:100AA00000E50BF5F0E50B35F0F50BE50BF5F0E5A2 +:100AB0000F65F0F50FC3750B00E50AF5F0E50B9532 +:100AC000F0F50B750B00E50BF5F0E50B35F0F50BCC +:100AD000E50BF5F0E50F65F0F50F75010075090000 +:100AE000750A00750000E50FF5F0E50045F0F5002A +:100AF000E501F5F0E50045F0F500E509F5F0E50064 +:100B000045F0F500E50AF5F0E50045F0F500E500F3 +:100B100070028003020B2700750000750100750943 +:100B200000750A0002079F00750001750100750934 +:100B300000750A0002079F00900000E582F5099009 +:100B40000000E583F50A750100C3750000E501F5B5 +:100B5000F0E50935F0F501E500F5F0E50A35F0F5C9 +:100B600000E500F502E501F582E502F583E0F50B0D +:100B7000750101C3750000E501F5F0E50935F0F5F3 +:100B800001E500F5F0E50A35F0F500E500F502E5D0 +:100B900001F582E502F583E0F50C750102C37500ED +:100BA00000E501F5F0E50935F0F501E500F5F0E5C2 +:100BB0000A35F0F500E500F502E501F582E502F5FC +:100BC00083E0F50D750103C3750000E501F5F0E55F +:100BD0000935F0F501E500F5F0E50A35F0F500E539 +:100BE00000F502E501F582E502F583E0F50E7500FA +:100BF00001750100750900750A00750F00C3E50055 +:100C0000F5F0E50B95F0F500E500F5F0E50F45F0A2 +:100C1000F50FC3E501F5F0E50C95F0F500E500F5FD +:100C2000F0E50F45F0F50FC3E509F5F0E50D95F09A +:100C3000F500E500F5F0E50F45F0F50FC3E50AF521 +:100C4000F0E50E95F0F500E500F5F0E50F45F0F55F +:100C50000F750100750900750A00E50FF500750FA5 +:100C600001C3750B00E500F5F0E50B95F0F50B758C +:100C70000B00E50BF5F0E50B35F0F50BE50BF5F0AA +:100C8000E50F65F0F50FC3750B00E501F5F0E50B19 +:100C900095F0F50B750B00E50BF5F0E50B35F0F570 +:100CA0000BE50BF5F0E50F65F0F50FC3750B00E5EF +:100CB00009F5F0E50B95F0F50B750B00E50BF5F07C +:100CC000E50B35F0F50BE50BF5F0E50F65F0F50FED +:100CD000C3750B00E50AF5F0E50B95F0F50B750B08 +:100CE00000E50BF5F0E50B35F0F50BE50BF5F0E560 +:100CF0000F65F0F50F750100750900750A007500A4 +:100D000000E50FF5F0E50045F0F500E501F5F0E54B +:100D10000045F0F500E509F5F0E50045F0F500E5E2 +:100D20000AF5F0E50045F0F500E5007002800302E9 +:100D30000D4200750100750900750A00750B00026F +:100D4000075E00750101750900750A00750B000248 +:100D5000075E00000000000000000000000000002E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/postincr-1.s.expected b/tests/GCCTestSuite/postincr-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/postincr-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr11459-1.c b/tests/GCCTestSuite/pr11459-1.c new file mode 100644 index 0000000..1edd94f --- /dev/null +++ b/tests/GCCTestSuite/pr11459-1.c @@ -0,0 +1,6 @@ +/* -ansi -std=c99 should mean -std=c99, but the specs reordered the + options. Bug 11459. */ +/* { dg-do compile } */ +/* { dg-options "-ansi -std=c99 -pedantic" } */ + +long long i; diff --git a/tests/GCCTestSuite/pr11459-1.c.expected b/tests/GCCTestSuite/pr11459-1.c.expected new file mode 100644 index 0000000..1edd94f --- /dev/null +++ b/tests/GCCTestSuite/pr11459-1.c.expected @@ -0,0 +1,6 @@ +/* -ansi -std=c99 should mean -std=c99, but the specs reordered the + options. Bug 11459. */ +/* { dg-do compile } */ +/* { dg-options "-ansi -std=c99 -pedantic" } */ + +long long i; diff --git a/tests/GCCTestSuite/pr11459-1.hex.expected b/tests/GCCTestSuite/pr11459-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pr11459-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr11459-1.s.expected b/tests/GCCTestSuite/pr11459-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr11459-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr11864-1.c b/tests/GCCTestSuite/pr11864-1.c new file mode 100644 index 0000000..1aa3f1a --- /dev/null +++ b/tests/GCCTestSuite/pr11864-1.c @@ -0,0 +1,42 @@ +/* PR optimization/11864 + * Reporter: Kazumoto Kojima + * Summary: [3.3/3.4 regression] miscompiles zero extension and test + * Description: + * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension + * and test if it's zero. + * + * Testcase tweaked by dank@kegel.com. Not marked as xfail because it's a regression. + */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort(void); + +int val = 0xff00; + +int f(void) +{ + return val; +} + +unsigned char a[1] = {0,0}; + +void foo(void) +{ + a[0] = f() & 255; + + if (!a[0]) + a[0] = f() & 255; + + if (!a[0]) + a[0] = 1 + (f() & 127); +} + +int main() +{ + foo(); + if (!a[0]) + abort(); + + return 0; +} diff --git a/tests/GCCTestSuite/pr11864-1.c.expected b/tests/GCCTestSuite/pr11864-1.c.expected new file mode 100644 index 0000000..1aa3f1a --- /dev/null +++ b/tests/GCCTestSuite/pr11864-1.c.expected @@ -0,0 +1,42 @@ +/* PR optimization/11864 + * Reporter: Kazumoto Kojima + * Summary: [3.3/3.4 regression] miscompiles zero extension and test + * Description: + * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension + * and test if it's zero. + * + * Testcase tweaked by dank@kegel.com. Not marked as xfail because it's a regression. + */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort(void); + +int val = 0xff00; + +int f(void) +{ + return val; +} + +unsigned char a[1] = {0,0}; + +void foo(void) +{ + a[0] = f() & 255; + + if (!a[0]) + a[0] = f() & 255; + + if (!a[0]) + a[0] = 1 + (f() & 127); +} + +int main() +{ + foo(); + if (!a[0]) + abort(); + + return 0; +} diff --git a/tests/GCCTestSuite/pr11864-1.hex.expected b/tests/GCCTestSuite/pr11864-1.hex.expected new file mode 100644 index 0000000..4ca3f4b --- /dev/null +++ b/tests/GCCTestSuite/pr11864-1.hex.expected @@ -0,0 +1,215 @@ +:1000000075812F7506FF7507FF12097102000C003C +:1000100000D0E0F518D0E0F519E511F50EE510F582 +:100020000F900000E582F509900000E583F50A7560 +:100030000100C3750000E501F5F0E50935F0F501B3 +:10004000E500F5F0E50A35F0F500E500F502E5011B +:10005000F582E502F583E0F50B750101C37500003B +:10006000E501F5F0E50935F0F501E500F5F0E50A03 +:1000700035F0F500E500F502E501F582E502F583CE +:10008000E0F50C750102C3750000E501F5F0E50926 +:1000900035F0F501E500F5F0E50A35F0F500E5008D +:1000A000F502E501F582E502F583E0F50D75010342 +:1000B000C3750000E501F5F0E50935F0F501E5004F +:1000C000F5F0E50A35F0F500E500F502E501F58209 +:1000D000E502F583E0F500E50BF502E50CF503E537 +:1000E0000DF504E500F505E50EF511E50FF510E554 +:1000F00019C0E0E518C0E0E502F582E503F583E507 +:1001000004F500E505F5012200E506758205C395B5 +:1001100082F506E5077583009583F507D0E0F508BD +:1001200075E0012506F58275E0003507F583E508E1 +:10013000F0D0E0F50875E0002506F58275E00035A1 +:1001400007F583E508F075E0042506F58275E00003 +:100150003507F583E512F075E0032506F58275E0B5 +:10016000003507F583E511F075E0022506F5827587 +:10017000E0003507F583E510F0120010E582F50286 +:10018000E502F512900004E582F510900004E58385 +:10019000F511750000750100750C01750D00750EE7 +:1001A00000750F00C3750900E500F5F0E50CA4F536 +:1001B0000BE500F5F0E50CA4E5F0F50AE50BF5F02C +:1001C000E50935F0F509E501F5F0E50CA4F50BE5D9 +:1001D00001F5F0E50CA4E5F0F501E50BF5F0E50A15 +:1001E00035F0F50AC3C3750100E509F5F0E50E35F4 +:1001F000F0F50EE50AF5F0E50F35F0F50FC3750AD9 +:1002000000E500F5F0E50DA4F50BE500F5F0E50DD2 +:10021000A4E5F0F501E50BF5F0E50A35F0F50A7512 +:100220000900C3C3750000E509F5F0E50E35F0F5EA +:100230000EE50AF5F0E50F35F0F50FC37509007509 +:100240000A00C3C3750000E509F5F0E50E35F0F5C9 +:100250000EE50AF5F0E50F35F0F50FC375090075E9 +:100260000A00C3C3750000E509F5F0E50E35F0F5A9 +:100270000EE50AF5F0E50F35F0F50FC3750000E562 +:100280000EF5F0E51035F0F500E50FF5F0E5113568 +:10029000F0F5017509FFC3E509F5F0E51255F0F534 +:1002A0000B750A00C3750900E50AF5F0E50035F0A5 +:1002B000F500E509F5F0E50135F0F501E50BF5038D +:1002C000E501F502E500F582E502F583E503F0902E +:1002D0000004E582F510900004E583F51175000037 +:1002E000750100750C01750D00750E00750F00C3CA +:1002F000750900E500F5F0E50CA4F50BE500F5F057 +:10030000E50CA4E5F0F50AE50BF5F0E50935F0F5A7 +:1003100009E501F5F0E50CA4F50BE501F5F0E50CB8 +:10032000A4E5F0F501E50BF5F0E50A35F0F50AC3B3 +:10033000C3750100E509F5F0E50E35F0F50EE50AA7 +:10034000F5F0E50F35F0F50FC3750A00E500F5F09F +:10035000E50DA4F50BE500F5F0E50DA4E5F0F501DC +:10036000E50BF5F0E50A35F0F50A750900C3C3752C +:100370000000E509F5F0E50E35F0F50EE50AF5F0BB +:10038000E50F35F0F50FC3750900750A00C3C37595 +:100390000000E509F5F0E50E35F0F50EE50AF5F09B +:1003A000E50F35F0F50FC3750900750A00C3C37575 +:1003B0000000E509F5F0E50E35F0F50EE50AF5F07B +:1003C000E50F35F0F50FC3750000E50EF5F0E5100B +:1003D00035F0F500E50FF5F0E51135F0F501E50034 +:1003E000F509E501F50A750100C3750000E501F5A1 +:1003F000F0E50935F0F501E500F5F0E50A35F0F531 +:1004000000E500F502E501F582E502F583E0F5017E +:10041000750001C3750900E501F5F0E50995F0F5F2 +:1004200009750900E509F5F0E50935F0F509E50973 +:10043000F5F0E50065F0F500750900750A00750B2B +:1004400000750100E500F5F0E50145F0F501E5096D +:10045000F5F0E50145F0F501E50AF5F0E50145F0B7 +:10046000F501E50BF5F0E50145F0F501E501700258 +:10047000800302081700900004E582F51090000444 +:10048000E583F511750000750100750C01750D000F +:10049000750E00750F00C3750900E500F5F0E50C59 +:1004A000A4F50BE500F5F0E50CA4E5F0F50AE50B85 +:1004B000F5F0E50935F0F509E501F5F0E50CA4F5F1 +:1004C0000BE501F5F0E50CA4E5F0F501E50BF5F021 +:1004D000E50A35F0F50AC3C3750100E509F5F0E555 +:1004E0000E35F0F50EE50AF5F0E50F35F0F50FC322 +:1004F000750A00E500F5F0E50DA4F50BE500F5F053 +:10050000E50DA4E5F0F501E50BF5F0E50A35F0F5AC +:100510000A750900C3C3750000E509F5F0E50E355D +:10052000F0F50EE50AF5F0E50F35F0F50FC37509A6 +:1005300000750A00C3C3750000E509F5F0E50E3546 +:10054000F0F50EE50AF5F0E50F35F0F50FC3750986 +:1005500000750A00C3C3750000E509F5F0E50E3526 +:10056000F0F50EE50AF5F0E50F35F0F50FC375006F +:1005700000E50EF5F0E51035F0F500E50FF5F0E5D6 +:100580001135F0F501E500F509E501F50A75010001 +:10059000C3750000E501F5F0E50935F0F501E5006A +:1005A000F5F0E50A35F0F500E500F502E501F58224 +:1005B000E502F583E0F501750001C3750900E50169 +:1005C000F5F0E50995F0F509750900E509F5F0E59F +:1005D0000935F0F509E509F5F0E50065F0F5007578 +:1005E0000900750A00750B00750100E500F5F0E5DE +:1005F0000145F0F501E509F5F0E50145F0F501E506 +:100600000AF5F0E50145F0F501E50BF5F0E50145EA +:10061000F0F501E501700280030206AC00750000F0 +:10062000E500F502E500F503E500F504E500F50554 +:1006300075E0042506F58275E0003507F583E0F5E1 +:100640001275E0032506F58275E0003507F583E0B5 +:10065000F51175E0022506F58275E0003507F58392 +:10066000E0F51075E0002506F58275E0003507F528 +:1006700083E0F508E508C0E075E0012506F5827520 +:10068000E0003507F583E0F508E508C0E075E00512 +:100690002506F50675E0003507F507E502F582E564 +:1006A00003F583E504F500E505F5012200120010CD +:1006B000E582F502E502F512900004E582F510905E +:1006C0000004E583F511750000750100750C0175D6 +:1006D0000D00750E00750F00C3750900E500F5F0FB +:1006E000E50CA4F50BE500F5F0E50CA4E5F0F50A42 +:1006F000E50BF5F0E50935F0F509E501F5F0E50C58 +:10070000A4F50BE501F5F0E50CA4E5F0F501E50B2A +:10071000F5F0E50A35F0F50AC3C3750100E509F502 +:10072000F0E50E35F0F50EE50AF5F0E50F35F0F5DC +:100730000FC3750A00E500F5F0E50DA4F50BE50023 +:10074000F5F0E50DA4E5F0F501E50BF5F0E50A356A +:10075000F0F50A750900C3C3750000E509F5F0E579 +:100760000E35F0F50EE50AF5F0E50F35F0F50FC39F +:10077000750900750A00C3C3750000E509F5F0E5C9 +:100780000E35F0F50EE50AF5F0E50F35F0F50FC37F +:10079000750900750A00C3C3750000E509F5F0E5A9 +:1007A0000E35F0F50EE50AF5F0E50F35F0F50FC35F +:1007B000750000E50EF5F0E51035F0F500E50FF5F4 +:1007C000F0E51135F0F50A75090175017FC3E50102 +:1007D000F5F0E51255F0F50BC3750100E50BF5F0EA +:1007E000E50935F0F50B750900C3750100E509F55C +:1007F000F0E50035F0F500E501F5F0E50A35F0F536 +:1008000001E50BF503E501F502E500F582E502F5EA +:1008100083E503F002061D00120010E582F502E5F3 +:1008200002F512900004E582F510900004E583F5CE +:1008300011750000750100750C01750D00750E0035 +:10084000750F00C3750900E500F5F0E50CA4F50B84 +:10085000E500F5F0E50CA4E5F0F50AE50BF5F0E5AB +:100860000935F0F509E501F5F0E50CA4F50BE50116 +:10087000F5F0E50CA4E5F0F501E50BF5F0E50A353A +:10088000F0F50AC3C3750100E509F5F0E50E35F092 +:10089000F50EE50AF5F0E50F35F0F50FC3750A0022 +:1008A000E500F5F0E50DA4F50BE500F5F0E50DA488 +:1008B000E5F0F501E50BF5F0E50A35F0F50A750907 +:1008C00000C3C3750000E509F5F0E50E35F0F50E3F +:1008D000E50AF5F0E50F35F0F50FC3750900750A67 +:1008E00000C3C3750000E509F5F0E50E35F0F50E1F +:1008F000E50AF5F0E50F35F0F50FC3750900750A47 +:1009000000C3C3750000E509F5F0E50E35F0F50EFE +:10091000E50AF5F0E50F35F0F50FC3750000E50EBB +:10092000F5F0E51035F0F500E50FF5F0E51135F0DF +:10093000F5017509FFC3E509F5F0E51255F0F50B72 +:10094000750A00C3750900E50AF5F0E50035F0F514 +:1009500000E509F5F0E50135F0F501E50BF503E5F6 +:1009600001F502E500F582E502F583E503F00204F6 +:100970007600E506758204C39582F506E507758362 +:10098000009583F507D0E0F50875E0012506F582AE +:1009900075E0003507F583E508F0D0E0F50875E06F +:1009A000002506F58275E0003507F583E508F0754A +:1009B000E0032506F58275E0003507F583E511F0C3 +:1009C00075E0022506F58275E0003507F583E51030 +:1009D000F0900000E582F50A900000E583F50175CE +:1009E0000900C3750000E509F5F0E50A35F0F50DDD +:1009F000E500F5F0E50135F0F50E750900750AFF23 +:100A0000750B00750C00750100C3750000E501F55C +:100A1000F0E50D35F0F501E500F5F0E50E35F0F502 +:100A200000E509F503E500F502E501F582E502F5CB +:100A300083E503F0750101C3750000E501F5F0E5FC +:100A40000D35F0F501E500F5F0E50E35F0F500E5C2 +:100A50000AF503E500F502E501F582E502F583E517 +:100A600003F0750102C3750000E501F5F0E50D35F1 +:100A7000F0F501E500F5F0E50E35F0F500E50BF5D4 +:100A800003E500F502E501F582E502F583E503F0F3 +:100A9000750103C3750000E501F5F0E50D35F0F5CE +:100AA00001E500F5F0E50E35F0F500E50CF503E5A0 +:100AB00000F502E501F582E502F583E503F090001B +:100AC00004E582F50A900004E583F50B75090075CD +:100AD0000100C3750000E501F5F0E50935F0F5000A +:100AE000C3750100E500F5F0E50A35F0F500E50114 +:100AF000F5F0E50B35F0F50B750A00750900C375C7 +:100B00000100E509F5F0E50035F0F500E501F5F047 +:100B1000E50B35F0F501E50AF503E501F502E50021 +:100B2000F582E502F583E503F0120108900004E583 +:100B300082F510900004E583F51175000075010041 +:100B4000750C01750D00750E00750F00C375090059 +:100B5000E500F5F0E50CA4F50BE500F5F0E50CA4D7 +:100B6000E5F0F50AE50BF5F0E50935F0F509E501E5 +:100B7000F5F0E50CA4F50BE501F5F0E50CA4E5F0C6 +:100B8000F501E50BF5F0E50A35F0F50AC3C375018B +:100B900000E509F5F0E50E35F0F50EE50AF5F0E5AE +:100BA0000F35F0F50FC3750A00E500F5F0E50DA46B +:100BB000F50BE500F5F0E50DA4E5F0F501E50BF525 +:100BC000F0E50A35F0F50A750900C3C3750000E5C4 +:100BD00009F5F0E50E35F0F50EE50AF5F0E50F350F +:100BE000F0F50FC3750900750A00C3C3750000E571 +:100BF00009F5F0E50E35F0F50EE50AF5F0E50F35EF +:100C0000F0F50FC3750900750A00C3C3750000E550 +:100C100009F5F0E50E35F0F50EE50AF5F0E50F35CE +:100C2000F0F50FC3750000E50EF5F0E51035F0F5B1 +:100C300000E50FF5F0E51135F0F501E500F509E502 +:100C400001F50A750100C3750000E501F5F0E5093D +:100C500035F0F501E500F5F0E50A35F0F500E500C1 +:100C6000F502E501F582E502F583E0F50175000185 +:100C7000C3750900E501F5F0E50995F0F509750979 +:100C800000E509F5F0E50935F0F509E509F5F0E5C8 +:100C90000065F0F500750900750A00750B00750117 +:100CA00000E500F5F0E50145F0F501E509F5F0E5B1 +:100CB0000145F0F501E50AF5F0E50145F0F501E53E +:100CC0000BF5F0E50145F0F501E501700280030246 +:100CD0000D5A00750000750100750900750A00E5E0 +:100CE00000F502E501F503E509F504E50AF50575EA +:100CF000E0032506F58275E0003507F583E0F51180 +:100D000075E0022506F58275E0003507F583E0F50C +:100D10001075E0002506F58275E0003507F583E0E3 +:100D2000F508E508C0E075E0012506F58275E000EC +:100D30003507F583E0F508E508C0E075E004250611 +:100D4000F50675E0003507F507E502F582E503F5E0 +:100D500083E504F500E505F5012200020CD300004F +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr11864-1.s.expected b/tests/GCCTestSuite/pr11864-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr11864-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr14092-1.c b/tests/GCCTestSuite/pr14092-1.c new file mode 100644 index 0000000..927ecf6 --- /dev/null +++ b/tests/GCCTestSuite/pr14092-1.c @@ -0,0 +1,20 @@ +/* PR c/14092 + * Origin: bonzini@gnu.org + * rejects-valid + */ +/* { dg-do compile } */ + +/* Define this so that we are more portable. The testcase in the + PR failed on 64-bit hosts. */ +typedef int __attribute__ ((mode (__pointer__))) intptr_t; + +typedef struct _PLCI { + unsigned char x; + unsigned char buf[1]; +} PLCI; + +void nl_ind(PLCI * plci) +{ + plci->x = -((intptr_t)(plci->buf)) & 3; +} + diff --git a/tests/GCCTestSuite/pr14092-1.c.expected b/tests/GCCTestSuite/pr14092-1.c.expected new file mode 100644 index 0000000..927ecf6 --- /dev/null +++ b/tests/GCCTestSuite/pr14092-1.c.expected @@ -0,0 +1,20 @@ +/* PR c/14092 + * Origin: bonzini@gnu.org + * rejects-valid + */ +/* { dg-do compile } */ + +/* Define this so that we are more portable. The testcase in the + PR failed on 64-bit hosts. */ +typedef int __attribute__ ((mode (__pointer__))) intptr_t; + +typedef struct _PLCI { + unsigned char x; + unsigned char buf[1]; +} PLCI; + +void nl_ind(PLCI * plci) +{ + plci->x = -((intptr_t)(plci->buf)) & 3; +} + diff --git a/tests/GCCTestSuite/pr14092-1.hex.expected b/tests/GCCTestSuite/pr14092-1.hex.expected new file mode 100644 index 0000000..59f7086 --- /dev/null +++ b/tests/GCCTestSuite/pr14092-1.hex.expected @@ -0,0 +1,19 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F50ED0E0F50FE510F50D6E +:10002000750000C3750100E500F5F0E51F35F0F53A +:1000300000E501F5F0E51E35F0F501750A01C3751F +:100040000900E50AF5F0E51F35F0F50AE509F5F0D8 +:10005000E51E35F0F509E50AF50BE509F50C750A1D +:1000600000C3750900E50AF5F0E50B35F0F50AE582 +:1000700009F5F0E50C35F0F509E509F502E50AF5B5 +:1000800082E502F583E0F509C3E509F4F50AD375C5 +:100090000900E509F5F0E50A35F0F50A750903C32D +:1000A000E509F5F0E50A55F0F50B750A00C3750989 +:1000B00000E50AF5F0E50035F0F500E509F5F0E5B5 +:1000C0000135F0F501E50BF503E501F502E500F575 +:1000D00082E502F583E503F0750000E500F502E531 +:1000E00000F503E500F504E500F505E50DF510E57F +:1000F0000FC0E0E50EC0E075E0022506F50675E0EC +:10010000003507F507E502F582E503F583E504F51B +:1001100000E505F5012200000000000000000000DD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr14092-1.s.expected b/tests/GCCTestSuite/pr14092-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr14092-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr14475.c b/tests/GCCTestSuite/pr14475.c new file mode 100644 index 0000000..8009d46 --- /dev/null +++ b/tests/GCCTestSuite/pr14475.c @@ -0,0 +1,8 @@ +/* This used to ICE because there was no null check in + check_bitfield_type_and_width. */ + +struct tree_common +{ + enum tree_code code : 8; /* {dg-error "" "" } */ +/* { dg-warning "" "" { target *-*-* } 6 } */ +}; diff --git a/tests/GCCTestSuite/pr14475.c.expected b/tests/GCCTestSuite/pr14475.c.expected new file mode 100644 index 0000000..8009d46 --- /dev/null +++ b/tests/GCCTestSuite/pr14475.c.expected @@ -0,0 +1,8 @@ +/* This used to ICE because there was no null check in + check_bitfield_type_and_width. */ + +struct tree_common +{ + enum tree_code code : 8; /* {dg-error "" "" } */ +/* { dg-warning "" "" { target *-*-* } 6 } */ +}; diff --git a/tests/GCCTestSuite/pr14475.hex.expected b/tests/GCCTestSuite/pr14475.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pr14475.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr14475.s.expected b/tests/GCCTestSuite/pr14475.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr14475.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr14796-1.c b/tests/GCCTestSuite/pr14796-1.c new file mode 100644 index 0000000..7ddc4fe --- /dev/null +++ b/tests/GCCTestSuite/pr14796-1.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f (int a) { + return (a << 3) << 6; +} + +int g (int b) { + return (b >> 5) << 5; +} + +unsigned long long h (unsigned long long c) { + return (c << 60) >> 60; +} + +int l (int d) { + return (d << 6) >> 6; +} + +/* { dg-final { scan-tree-dump "a << 9" "gimple" } } */ +/* { dg-final { scan-tree-dump "b & -32" "gimple" } } */ +/* { dg-final { scan-tree-dump "c & 15" "gimple" } } */ +/* { dg-final { scan-tree-dump "d << 6" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/pr14796-1.c.expected b/tests/GCCTestSuite/pr14796-1.c.expected new file mode 100644 index 0000000..7ddc4fe --- /dev/null +++ b/tests/GCCTestSuite/pr14796-1.c.expected @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f (int a) { + return (a << 3) << 6; +} + +int g (int b) { + return (b >> 5) << 5; +} + +unsigned long long h (unsigned long long c) { + return (c << 60) >> 60; +} + +int l (int d) { + return (d << 6) >> 6; +} + +/* { dg-final { scan-tree-dump "a << 9" "gimple" } } */ +/* { dg-final { scan-tree-dump "b & -32" "gimple" } } */ +/* { dg-final { scan-tree-dump "c & 15" "gimple" } } */ +/* { dg-final { scan-tree-dump "d << 6" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/pr14796-2.c b/tests/GCCTestSuite/pr14796-2.c new file mode 100644 index 0000000..195530b --- /dev/null +++ b/tests/GCCTestSuite/pr14796-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f (int a) { + return (a << 31) << 6; +} + +unsigned int g (unsigned int a) { + return (a >> 7) >> 25; +} + +int h (int b) { + return (b >> 30) >> 30; +} + +long long j (long long c) { + return (c >> 35) << 35; +} +/* { dg-final { scan-tree-dump-times "= 0" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump "b >> 31" "gimple" } } */ +/* { dg-final { scan-tree-dump "c & -(34359738368|800000000)" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/pr14796-2.c.expected b/tests/GCCTestSuite/pr14796-2.c.expected new file mode 100644 index 0000000..195530b --- /dev/null +++ b/tests/GCCTestSuite/pr14796-2.c.expected @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f (int a) { + return (a << 31) << 6; +} + +unsigned int g (unsigned int a) { + return (a >> 7) >> 25; +} + +int h (int b) { + return (b >> 30) >> 30; +} + +long long j (long long c) { + return (c >> 35) << 35; +} +/* { dg-final { scan-tree-dump-times "= 0" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump "b >> 31" "gimple" } } */ +/* { dg-final { scan-tree-dump "c & -(34359738368|800000000)" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/pr15443-2.c b/tests/GCCTestSuite/pr15443-2.c new file mode 100644 index 0000000..d97fa25 --- /dev/null +++ b/tests/GCCTestSuite/pr15443-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +struct foo { + int bar; +}; + +typedef struct foo* bar; +void f () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */ +int g () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */ +int* h () __attribute__ ((__malloc__)); +void* i () __attribute__ ((__malloc__)); + +struct foo j () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */ +struct foo* k () __attribute__ ((__malloc__)); +bar l () __attribute__((malloc)); diff --git a/tests/GCCTestSuite/pr15443-2.c.expected b/tests/GCCTestSuite/pr15443-2.c.expected new file mode 100644 index 0000000..d97fa25 --- /dev/null +++ b/tests/GCCTestSuite/pr15443-2.c.expected @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +struct foo { + int bar; +}; + +typedef struct foo* bar; +void f () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */ +int g () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */ +int* h () __attribute__ ((__malloc__)); +void* i () __attribute__ ((__malloc__)); + +struct foo j () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */ +struct foo* k () __attribute__ ((__malloc__)); +bar l () __attribute__((malloc)); diff --git a/tests/GCCTestSuite/pr15443-2.hex.expected b/tests/GCCTestSuite/pr15443-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pr15443-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15443-2.s.expected b/tests/GCCTestSuite/pr15443-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15443-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-3.c b/tests/GCCTestSuite/pr15698-3.c new file mode 100644 index 0000000..15d998a --- /dev/null +++ b/tests/GCCTestSuite/pr15698-3.c @@ -0,0 +1,11 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Prototype not last declaration. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +void f(); +void f(int); /* { dg-error "error: prototype declaration" } */ +void f(); +void f(a) long a; {} /* { dg-error "error: argument 'a' doesn't match prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-3.c.expected b/tests/GCCTestSuite/pr15698-3.c.expected new file mode 100644 index 0000000..15d998a --- /dev/null +++ b/tests/GCCTestSuite/pr15698-3.c.expected @@ -0,0 +1,11 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Prototype not last declaration. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +void f(); +void f(int); /* { dg-error "error: prototype declaration" } */ +void f(); +void f(a) long a; {} /* { dg-error "error: argument 'a' doesn't match prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-3.hex.expected b/tests/GCCTestSuite/pr15698-3.hex.expected new file mode 100644 index 0000000..7af2347 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-3.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0042506F50675E0C6 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F50122000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-3.s.expected b/tests/GCCTestSuite/pr15698-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15698-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-4.c b/tests/GCCTestSuite/pr15698-4.c new file mode 100644 index 0000000..b1554f4 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-4.c @@ -0,0 +1,9 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Unprototyped built-in function with user prototype. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +int isnan(void); /* { dg-error "error: prototype declaration" } */ +int isnan(a) int a; {} /* { dg-error "error: number of arguments doesn't match prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-4.c.expected b/tests/GCCTestSuite/pr15698-4.c.expected new file mode 100644 index 0000000..b1554f4 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-4.c.expected @@ -0,0 +1,9 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Unprototyped built-in function with user prototype. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +int isnan(void); /* { dg-error "error: prototype declaration" } */ +int isnan(a) int a; {} /* { dg-error "error: number of arguments doesn't match prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-4.hex.expected b/tests/GCCTestSuite/pr15698-4.hex.expected new file mode 100644 index 0000000..c059f8b --- /dev/null +++ b/tests/GCCTestSuite/pr15698-4.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501E509F5029C +:10002000E509F503E509F504E509F505E501C0E095 +:10003000E500C0E075E0042506F50675E00035072B +:10004000F507E502F582E503F583E504F500E5052E +:10005000F501220000000000000000000000000088 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-4.s.expected b/tests/GCCTestSuite/pr15698-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15698-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-6.c b/tests/GCCTestSuite/pr15698-6.c new file mode 100644 index 0000000..bca51f2 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-6.c @@ -0,0 +1,9 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Prototyped built-in function, wrong number of + arguments. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +char *strchr(a) const char *a; { return 0; } /* { dg-warning "warning: number of arguments doesn't match built-in prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-6.c.expected b/tests/GCCTestSuite/pr15698-6.c.expected new file mode 100644 index 0000000..bca51f2 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-6.c.expected @@ -0,0 +1,9 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Prototyped built-in function, wrong number of + arguments. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +char *strchr(a) const char *a; { return 0; } /* { dg-warning "warning: number of arguments doesn't match built-in prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-6.hex.expected b/tests/GCCTestSuite/pr15698-6.hex.expected new file mode 100644 index 0000000..69b482c --- /dev/null +++ b/tests/GCCTestSuite/pr15698-6.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F500D0E0F501750900758E +:100020000A00750B00E509F502E50AF503E50BF595 +:1000300004E50BF505E501C0E0E500C0E075E00270 +:100040002506F50675E0003507F507E502F582E5BA +:1000500003F583E504F500E505F501220000000045 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-6.s.expected b/tests/GCCTestSuite/pr15698-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15698-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-7.c b/tests/GCCTestSuite/pr15698-7.c new file mode 100644 index 0000000..b75f815 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-7.c @@ -0,0 +1,10 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Prototyped built-in function, wrong number of + arguments, with explicit prototype as well. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +char *strchr(const char *, int); /* { dg-error "error: prototype declaration" } */ +char *strchr(a) const char *a; { return 0; } /* { dg-error "error: number of arguments doesn't match prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-7.c.expected b/tests/GCCTestSuite/pr15698-7.c.expected new file mode 100644 index 0000000..b75f815 --- /dev/null +++ b/tests/GCCTestSuite/pr15698-7.c.expected @@ -0,0 +1,10 @@ +/* Test diagnostics for old-style definition not matching prior + prototype are present and give correct location for that prototype + (bug 15698). Prototyped built-in function, wrong number of + arguments, with explicit prototype as well. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +char *strchr(const char *, int); /* { dg-error "error: prototype declaration" } */ +char *strchr(a) const char *a; { return 0; } /* { dg-error "error: number of arguments doesn't match prototype" } */ diff --git a/tests/GCCTestSuite/pr15698-7.hex.expected b/tests/GCCTestSuite/pr15698-7.hex.expected new file mode 100644 index 0000000..69b482c --- /dev/null +++ b/tests/GCCTestSuite/pr15698-7.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F500D0E0F501750900758E +:100020000A00750B00E509F502E50AF503E50BF595 +:1000300004E50BF505E501C0E0E500C0E075E00270 +:100040002506F50675E0003507F507E502F582E5BA +:1000500003F583E504F500E505F501220000000045 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15698-7.s.expected b/tests/GCCTestSuite/pr15698-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15698-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15784-4.c b/tests/GCCTestSuite/pr15784-4.c new file mode 100644 index 0000000..0d31697 --- /dev/null +++ b/tests/GCCTestSuite/pr15784-4.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int a (int x) { + return ~x + 1; /* -x */ +} + +int b (int x) { + return -x -1; /* ~x */ +} + +/* { dg-final { scan-tree-dump "~x;" "optimized" } } */ +/* { dg-final { scan-tree-dump "-x;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/tests/GCCTestSuite/pr15784-4.c.expected b/tests/GCCTestSuite/pr15784-4.c.expected new file mode 100644 index 0000000..0d31697 --- /dev/null +++ b/tests/GCCTestSuite/pr15784-4.c.expected @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int a (int x) { + return ~x + 1; /* -x */ +} + +int b (int x) { + return -x -1; /* ~x */ +} + +/* { dg-final { scan-tree-dump "~x;" "optimized" } } */ +/* { dg-final { scan-tree-dump "-x;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/tests/GCCTestSuite/pr15784-4.hex.expected b/tests/GCCTestSuite/pr15784-4.hex.expected new file mode 100644 index 0000000..5297a51 --- /dev/null +++ b/tests/GCCTestSuite/pr15784-4.hex.expected @@ -0,0 +1,26 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F518D0E0F519E512F50F56 +:10002000E51EF500E51DF501E51CF509E51FF4F5F4 +:100030000BE500F4F50CE501F4F50DE509F4F50E1A +:10004000750001750100750900750A00C37512007D +:10005000E500F5F0E50B35F0F500E501F5F0E50C10 +:1000600035F0F501E509F5F0E50D35F0F509E50A9E +:10007000F5F0E50E35F0F50AE500F502E501F503CA +:10008000E509F504E50AF505E50FF512E519C0E007 +:10009000E518C0E075E0042506F50675E0003507B3 +:1000A000F507E502F582E503F583E504F500E505CE +:1000B000F5012200E506758204C39582F506E50781 +:1000C0007583009583F507D0E0F518D0E0F519E5C4 +:1000D00012F50FE51EF500E51DF501E51CF509E536 +:1000E0001FF4F50BE500F4F50CE501F4F50DE50959 +:1000F000F4F50ED3750000E500F5F0E50B35F0F5ED +:100100000BE500F5F0E50C35F0F50CE500F5F0E554 +:100110000D35F0F50DE500F5F0E50E35F0F50E7551 +:100120000001750100750900750A00C3E500F5F0CE +:10013000E50B95F0F500E501F5F0E50C95F0F5011E +:10014000E509F5F0E50D95F0F509E50AF5F0E50EA0 +:1001500095F0F50AE500F502E501F503E509F5047A +:10016000E50AF505E50FF512E519C0E0E518C0E070 +:1001700075E0042506F50675E0003507F507E5028C +:10018000F582E503F583E504F500E505F5012200B8 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15784-4.s.expected b/tests/GCCTestSuite/pr15784-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15784-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15825-1.c b/tests/GCCTestSuite/pr15825-1.c new file mode 100644 index 0000000..a4b46d4 --- /dev/null +++ b/tests/GCCTestSuite/pr15825-1.c @@ -0,0 +1,18 @@ +/* PR middle-end/15825 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +unsigned int foo(long long high, int unsigned_p) +{ + int i; + if (high < 0) + if (!unsigned_p) + { + i = 1; + goto t; + } + i = 0; +t: + return i; +} + diff --git a/tests/GCCTestSuite/pr15825-1.c.expected b/tests/GCCTestSuite/pr15825-1.c.expected new file mode 100644 index 0000000..a4b46d4 --- /dev/null +++ b/tests/GCCTestSuite/pr15825-1.c.expected @@ -0,0 +1,18 @@ +/* PR middle-end/15825 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +unsigned int foo(long long high, int unsigned_p) +{ + int i; + if (high < 0) + if (!unsigned_p) + { + i = 1; + goto t; + } + i = 0; +t: + return i; +} + diff --git a/tests/GCCTestSuite/pr15825-1.hex.expected b/tests/GCCTestSuite/pr15825-1.hex.expected new file mode 100644 index 0000000..377b09a --- /dev/null +++ b/tests/GCCTestSuite/pr15825-1.hex.expected @@ -0,0 +1,91 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF50DE51EF500E51DCC +:1000D000F501E51CF509E519F517E518F516750C98 +:1000E00000750B00750A00751100E50DF519E500A6 +:1000F000F515E501F512E509F513E50CF518E50B25 +:10010000F514E50AF510750080E500F5F0E5132516 +:10011000F0F513E500F5F0E51125F0F511750C008B +:10012000750D00750E00750F00750B00750A0175D1 +:100130000001C3E511F5F0E51395F0F509E50BF5C0 +:10014000F0E50B35F0F509E509F5F0E50055F0F5BA +:1001500000E500F5F0E50C45F0F50C750001C3E590 +:1001600011F5F0E51395F0F509E50BF5F0E50B3524 +:10017000F0F509E513F5F0E51195F0F501E50BF55E +:10018000F0E50B35F0F501E501F5F0E50945F0F591 +:1001900009E50AF5F0E50965F0F509E509F5F0E589 +:1001A0000055F0F500C3E510F5F0E51295F0F509FE +:1001B000E50BF5F0E50B35F0F509E509F5F0E5009F +:1001C00055F0F500E500F5F0E50C45F0F50C75008F +:1001D00001C3E511F5F0E51395F0F509E50BF5F030 +:1001E000E50B35F0F509E513F5F0E51195F0F501AE +:1001F000E50BF5F0E50B35F0F501E501F5F0E50966 +:1002000045F0F509E50AF5F0E50965F0F509E509B8 +:10021000F5F0E50055F0F500C3E510F5F0E51295B1 +:10022000F0F509E50BF5F0E50B35F0F509E512F50C +:10023000F0E51095F0F501E50BF5F0E50B35F0F57F +:1002400001E501F5F0E50945F0F509E50AF5F0E508 +:100250000965F0F509E509F5F0E50055F0F500C38D +:10026000E514F5F0E51595F0F509E50BF5F0E50B6E +:1002700035F0F509E509F5F0E50055F0F500E50084 +:10028000F5F0E50C45F0F50C750001C3E511F5F04E +:10029000E51395F0F509E50BF5F0E50B35F0F509FB +:1002A000E513F5F0E51195F0F501E50BF5F0E50B3B +:1002B00035F0F501E501F5F0E50945F0F509E50A48 +:1002C000F5F0E50965F0F509E509F5F0E50055F00B +:1002D000F500C3E510F5F0E51295F0F509E50BF52D +:1002E000F0E50B35F0F509E512F5F0E51095F0F5C0 +:1002F00001E50BF5F0E50B35F0F501E501F5F0E56D +:100300000945F0F509E50AF5F0E50965F0F509E5B7 +:1003100009F5F0E50055F0F500C3E514F5F0E51535 +:1003200095F0F509E50BF5F0E50B35F0F509E51568 +:10033000F5F0E51495F0F501E50BF5F0E50B35F07A +:10034000F501E501F5F0E50945F0F509E50AF5F0F7 +:10035000E50965F0F509E509F5F0E50055F0F5006A +:10036000C3E518F5F0E51995F0F509E50BF5F0E5AD +:100370000B35F0F509E509F5F0E50055F0F500E578 +:1003800000F5F0E50C45F0F50C750000E50CF5F016 +:10039000E50045F0F500E50DF5F0E50045F0F50068 +:1003A000E50EF5F0E50045F0F500E50FF5F0E500A8 +:1003B00045F0F500E500700280030204AC00750012 +:1003C00000750100750900750A0000E500F502E5F9 +:1003D00001F503E509F504E50AF50575E0092506CB +:1003E000F58275E0003507F583E0F51775E008251F +:1003F00006F58275E0003507F583E0F51675E00730 +:100400002506F58275E0003507F583E0F51575E002 +:10041000062506F58275E0003507F583E0F51475CD +:10042000E0052506F58275E0003507F583E0F51354 +:1004300075E0042506F58275E0003507F583E0F5E3 +:100440001275E0032506F58275E0003507F583E0B7 +:10045000F51175E0022506F58275E0003507F58394 +:10046000E0F51075E0002506F58275E0003507F52A +:1004700083E0F508E508C0E075E0012506F5827522 +:10048000E0003507F583E0F508E508C0E075E01207 +:100490002506F50675E0003507F507E502F582E566 +:1004A00003F583E504F500E505F50122007501017A +:1004B000C3750000E51BF5F0E50095F0F50075004B +:1004C00000E500F5F0E50035F0F500E500F5F0E5B4 +:1004D0000165F0F501C3750000E51AF5F0E500953A +:1004E000F0F500750000E500F5F0E50035F0F500E9 +:1004F000E500F5F0E50165F0F501C3750000E517CD +:10050000F5F0E50095F0F500750000E500F5F0E583 +:100510000035F0F500E500F5F0E50165F0F501C303 +:10052000750000E516F5F0E50095F0F500750000A2 +:10053000E500F5F0E50035F0F500E500F5F0E50142 +:1005400065F0F501750900750A00750B007500006E +:10055000E501F5F0E50045F0F500E509F5F0E50009 +:1005600045F0F500E50AF5F0E50045F0F500E50B8E +:10057000F5F0E50045F0F500E500700280030205A6 +:1005800085000203BE007500017501007509007544 +:100590000A000203CA000000000000000000000082 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr15825-1.s.expected b/tests/GCCTestSuite/pr15825-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr15825-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17036-1.c b/tests/GCCTestSuite/pr17036-1.c new file mode 100644 index 0000000..ea2c9ca --- /dev/null +++ b/tests/GCCTestSuite/pr17036-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +int main () +{ + int R, N = 4; + unsigned int A = 2; + signed int B = 2; + ((B >> N) & 1) ? 1 : 0; + ((A >> N) & 1) ? 1 : 0; + return 0; +} diff --git a/tests/GCCTestSuite/pr17036-1.c.expected b/tests/GCCTestSuite/pr17036-1.c.expected new file mode 100644 index 0000000..ea2c9ca --- /dev/null +++ b/tests/GCCTestSuite/pr17036-1.c.expected @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +int main () +{ + int R, N = 4; + unsigned int A = 2; + signed int B = 2; + ((B >> N) & 1) ? 1 : 0; + ((A >> N) & 1) ? 1 : 0; + return 0; +} diff --git a/tests/GCCTestSuite/pr17036-1.hex.expected b/tests/GCCTestSuite/pr17036-1.hex.expected new file mode 100644 index 0000000..e5526d6 --- /dev/null +++ b/tests/GCCTestSuite/pr17036-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501750900750A00750B18 +:1000200000750C00E509F502E50AF503E50BF5049A +:10003000E50CF505E501C0E0E500C0E0E502F5826C +:10004000E503F583E504F500E505F5012200000070 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17036-1.s.expected b/tests/GCCTestSuite/pr17036-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr17036-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17319.c b/tests/GCCTestSuite/pr17319.c new file mode 100644 index 0000000..5d39e4c --- /dev/null +++ b/tests/GCCTestSuite/pr17319.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dce" } */ + +typedef unsigned long long HARD_REG_ELT_TYPE; +typedef HARD_REG_ELT_TYPE HARD_REG_SET[2]; +static HARD_REG_SET newpat_used_regs; +int try_combine (void) +{ + HARD_REG_ELT_TYPE *scan_tp_ = newpat_used_regs; + scan_tp_[0] = 0; + scan_tp_[1] = 0; +} diff --git a/tests/GCCTestSuite/pr17319.c.expected b/tests/GCCTestSuite/pr17319.c.expected new file mode 100644 index 0000000..5d39e4c --- /dev/null +++ b/tests/GCCTestSuite/pr17319.c.expected @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dce" } */ + +typedef unsigned long long HARD_REG_ELT_TYPE; +typedef HARD_REG_ELT_TYPE HARD_REG_SET[2]; +static HARD_REG_SET newpat_used_regs; +int try_combine (void) +{ + HARD_REG_ELT_TYPE *scan_tp_ = newpat_used_regs; + scan_tp_[0] = 0; + scan_tp_[1] = 0; +} diff --git a/tests/GCCTestSuite/pr17319.hex.expected b/tests/GCCTestSuite/pr17319.hex.expected new file mode 100644 index 0000000..318f5e8 --- /dev/null +++ b/tests/GCCTestSuite/pr17319.hex.expected @@ -0,0 +1,63 @@ +:1000000000D0E0F51AD0E0F51BE511F518E510F584 +:1000100019900000E582F510900000E583F5117558 +:100020000000750100750C04750D00750E00750F4C +:1000300000C3750900E500F5F0E50CA4F50BE5003B +:10004000F5F0E50CA4E5F0F50AE50BF5F0E509356A +:10005000F0F509E501F5F0E50CA4F50BE501F5F087 +:10006000E50CA4E5F0F501E50BF5F0E50A35F0F552 +:100070000AC3C3750100E509F5F0E50E35F0F50E8C +:10008000E50AF5F0E50F35F0F50FC3750A00E50058 +:10009000F5F0E50DA4F50BE500F5F0E50DA4E5F0B0 +:1000A000F501E50BF5F0E50A35F0F50A750900C331 +:1000B000C3750000E509F5F0E50E35F0F50EE50A2B +:1000C000F5F0E50F35F0F50FC3750900750A00C3AB +:1000D000C3750000E509F5F0E50E35F0F50EE50A0B +:1000E000F5F0E50F35F0F50FC3750900750A00C38B +:1000F000C3750000E509F5F0E50E35F0F50EE50AEB +:10010000F5F0E50F35F0F50FC3750000E50EF5F0DD +:10011000E51035F0F500E50FF5F0E51135F0F50ED9 +:10012000750A00750B00750C00750D00750900C38C +:10013000750100E509F5F0E50035F0F509E501F593 +:10014000F0E50E35F0F501E50AF503E501F502E508 +:1001500009F582E502F583E503F0750901C3750130 +:1001600000E509F5F0E50035F0F509E501F5F0E504 +:100170000E35F0F501E50BF503E501F502E509F5AE +:1001800082E502F583E503F0750902C3750100E518 +:1001900009F5F0E50035F0F509E501F5F0E50E3576 +:1001A000F0F501E50CF503E501F502E509F582E559 +:1001B00002F583E503F0750903C3750100E509F550 +:1001C000F0E50035F0F509E501F5F0E50E35F0F55F +:1001D00001E50DF503E501F502E509F582E502F516 +:1001E00083E503F0750001750100750C04750D00C1 +:1001F000750E00750F00C3750900E500F5F0E50CFC +:10020000A4F50BE500F5F0E50CA4E5F0F50AE50B27 +:10021000F5F0E50935F0F509E501F5F0E50CA4F593 +:100220000BE501F5F0E50CA4E5F0F501E50BF5F0C3 +:10023000E50A35F0F50AC3C3750100E509F5F0E5F7 +:100240000E35F0F50EE50AF5F0E50F35F0F50FC3C4 +:10025000750A00E500F5F0E50DA4F50BE500F5F0F5 +:10026000E50DA4E5F0F501E50BF5F0E50A35F0F54F +:100270000A750900C3C3750000E509F5F0E50E3500 +:10028000F0F50EE50AF5F0E50F35F0F50FC3750949 +:1002900000750A00C3C3750000E509F5F0E50E35E9 +:1002A000F0F50EE50AF5F0E50F35F0F50FC3750929 +:1002B00000750A00C3C3750000E509F5F0E50E35C9 +:1002C000F0F50EE50AF5F0E50F35F0F50FC3750012 +:1002D00000E50EF5F0E51035F0F500E50FF5F0E579 +:1002E0001135F0F50E750A00750B00750C00750DD3 +:1002F00000750900C3750100E509F5F0E50035F06A +:10030000F509E501F5F0E50E35F0F501E50AF5032F +:10031000E501F502E509F582E502F583E503F075EF +:100320000901C3750100E509F5F0E50035F0F509AF +:10033000E501F5F0E50E35F0F501E50BF503E50116 +:10034000F502E509F582E502F583E503F07509029A +:10035000C3750100E509F5F0E50035F0F509E501A3 +:10036000F5F0E50E35F0F501E50CF503E501F502D4 +:10037000E509F582E502F583E503F0750903C37528 +:100380000100E509F5F0E50035F0F509E501F5F0C6 +:10039000E50E35F0F501E50DF503E501F502E5099A +:1003A000F582E502F583E503F0E51CF502E51CF5B1 +:1003B00003E51CF504E51CF505E518F511E519F54F +:1003C00010E51BC0E0E51AC0E0E502F582E503F5A3 +:1003D00083E504F500E505F50122000000000000BA +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17319.s.expected b/tests/GCCTestSuite/pr17319.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr17319.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17581-1.c b/tests/GCCTestSuite/pr17581-1.c new file mode 100644 index 0000000..b63517c --- /dev/null +++ b/tests/GCCTestSuite/pr17581-1.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/17581 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (void); + +int foo(int x) +{ + unsigned long long tmp = 0; + + switch(x) { + case 21: + tmp |= 1; + tmp |= 2; + tmp |= 8; + break; + default: + break; + } + + return (int)tmp; +} + +int main() +{ + if (foo(21) != 11) + abort (); + return 0; +} + diff --git a/tests/GCCTestSuite/pr17581-1.c.expected b/tests/GCCTestSuite/pr17581-1.c.expected new file mode 100644 index 0000000..b63517c --- /dev/null +++ b/tests/GCCTestSuite/pr17581-1.c.expected @@ -0,0 +1,30 @@ +/* PR rtl-optimization/17581 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (void); + +int foo(int x) +{ + unsigned long long tmp = 0; + + switch(x) { + case 21: + tmp |= 1; + tmp |= 2; + tmp |= 8; + break; + default: + break; + } + + return (int)tmp; +} + +int main() +{ + if (foo(21) != 11) + abort (); + return 0; +} + diff --git a/tests/GCCTestSuite/pr17581-1.hex.expected b/tests/GCCTestSuite/pr17581-1.hex.expected new file mode 100644 index 0000000..f6784e7 --- /dev/null +++ b/tests/GCCTestSuite/pr17581-1.hex.expected @@ -0,0 +1,64 @@ +:1000000075812F7506FF7507FF12027202000C0042 +:1000100000E506758204C39582F506E50775830041 +:100020009583F507D0E0F51AD0E0F51BE511F5183A +:10003000E510F519750000750100750900750A00D5 +:10004000750B15750C00750D00750E00E51DF50F8F +:10005000E51CF510751100C3E50BF5F0E51F95F0F3 +:10006000F50BE50BF5F0E51145F0F511C3E50CF5E1 +:10007000F0E51E95F0F50BE50BF5F0E51145F0F513 +:1000800011C3E50DF5F0E50F95F0F50BE50BF5F077 +:10009000E51145F0F511C3E50EF5F0E51095F0F525 +:1000A0000BE50BF5F0E51145F0F511750C00750D3C +:1000B00000750E00E511F50B751101C3750F00E514 +:1000C0000BF5F0E50F95F0F50F750F00E50FF5F066 +:1000D000E50F35F0F50FE50FF5F0E51165F0F511D9 +:1000E000C3750F00E50CF5F0E50F95F0F50F750FF2 +:1000F00000E50FF5F0E50F35F0F50FE50FF5F0E54C +:100100001165F0F511C3750F00E50DF5F0E50F95DC +:10011000F0F50F750F00E50FF5F0E50F35F0F50F71 +:10012000E50FF5F0E51165F0F511C3750F00E50E6B +:10013000F5F0E50F95F0F50F750F00E50FF5F0E51B +:100140000F35F0F50FE50FF5F0E51165F0F51175D8 +:100150000C00750D00750E00750B00E511F5F0E54E +:100160000B45F0F50BE50CF5F0E50B45F0F50BE56F +:100170000DF5F0E50B45F0F50BE50EF5F0E50B455B +:10018000F0F50BE50B700280030201CE000000E5E4 +:1001900000F502E501F503E509F504E50AF505E5D5 +:1001A00018F511E519F510E51BC0E0E51AC0E0757A +:1001B000E0042506F50675E0003507F507E502F5CC +:1001C00082E503F583E504F500E505F5012200006D +:1001D000750B01750C00750D00750E00C3E50BF570 +:1001E000F0E50045F0F500E50CF5F0E50145F0F52A +:1001F00001E50DF5F0E50945F0F509E50EF5F0E549 +:100200000A45F0F50A750B02750C00750D00750EA8 +:1002100000C3E50BF5F0E50045F0F500E50CF5F061 +:10022000E50145F0F501E50DF5F0E50945F0F509C5 +:10023000E50EF5F0E50A45F0F50A750B08750C00BA +:10024000750D00750E00C3E50BF5F0E50045F0F502 +:1002500000E50CF5F0E50145F0F501E50DF5F0E5FB +:100260000945F0F509E50EF5F0E50A45F0F50A0255 +:10027000018E00E506758202C39582F506E50775D5 +:1002800083009583F507D0E0F50875E0012506F5B4 +:100290008275E0003507F583E508F0D0E0F50875D4 +:1002A000E0002506F58275E0003507F583E508F0E6 +:1002B000751F15751E00751D00751C00120010E5D8 +:1002C00082F502E583F503E500F504E501F505E5B2 +:1002D00002F50BE503F50CE504F50DE505F50E75E6 +:1002E000000B750100750900750A00750F00C3E564 +:1002F00000F5F0E50B95F0F500E500F5F0E50F45AC +:10030000F0F50FC3E501F5F0E50C95F0F500E5001B +:10031000F5F0E50F45F0F50FC3E509F5F0E50D95AE +:10032000F0F500E500F5F0E50F45F0F50FC3E50A3F +:10033000F5F0E50E95F0F500E500F5F0E50F45F078 +:10034000F50F750100750900750A00750000E50FCD +:10035000F5F0E50045F0F500E501F5F0E50045F0C4 +:10036000F500E509F5F0E50045F0F500E50AF5F0E2 +:10037000E50045F0F500E500700280030203E500AA +:10038000750000750100750900750A00E500F502A9 +:10039000E501F503E509F504E50AF50575E0002535 +:1003A00006F58275E0003507F583E0F508E508C03D +:1003B000E075E0012506F58275E0003507F583E07C +:1003C000F508E508C0E075E0022506F50675E000D1 +:1003D0003507F507E502F582E503F583E504F50049 +:1003E000E505F50122000203800000000000000086 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17581-1.s.expected b/tests/GCCTestSuite/pr17581-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr17581-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17635.c b/tests/GCCTestSuite/pr17635.c new file mode 100644 index 0000000..d2154c3 --- /dev/null +++ b/tests/GCCTestSuite/pr17635.c @@ -0,0 +1,11 @@ +/* PR 17635 */ +/* Contributed by Devang Patel */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +void foo(int i) +{ + while (1) + if (i) ++i; +} + diff --git a/tests/GCCTestSuite/pr17635.c.expected b/tests/GCCTestSuite/pr17635.c.expected new file mode 100644 index 0000000..d2154c3 --- /dev/null +++ b/tests/GCCTestSuite/pr17635.c.expected @@ -0,0 +1,11 @@ +/* PR 17635 */ +/* Contributed by Devang Patel */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +void foo(int i) +{ + while (1) + if (i) ++i; +} + diff --git a/tests/GCCTestSuite/pr17635.hex.expected b/tests/GCCTestSuite/pr17635.hex.expected new file mode 100644 index 0000000..3e9e2c6 --- /dev/null +++ b/tests/GCCTestSuite/pr17635.hex.expected @@ -0,0 +1,30 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F518D0E0F519E514F50D56 +:10002000E513F50EE512F50F750001750100750970 +:1000300000750A00750C01C3750B00E500F5F0E5CD +:100040000B95F0F50B750B00E50BF5F0E50B35F0B6 +:10005000F50BE50BF5F0E50C65F0F50CC3750B0041 +:10006000E501F5F0E50B95F0F50B750B00E50BF5EB +:10007000F0E50B35F0F50BE50BF5F0E50C65F0F56B +:100080000CC3750B00E509F5F0E50B95F0F50B7564 +:100090000B00E50BF5F0E50B35F0F50BE50BF5F096 +:1000A000E50C65F0F50CC3750B00E50AF5F0E50B02 +:1000B00095F0F50B750B00E50BF5F0E50B35F0F55C +:1000C0000BE50BF5F0E50C65F0F50C750100750915 +:1000D00000750A00750000E50CF5F0E50045F0F547 +:1000E00000E501F5F0E50045F0F500E509F5F0E57E +:1000F0000045F0F500E50AF5F0E50045F0F500E50E +:10010000007002800302017D00750000E51FF5F01C +:10011000E50045F0F500E51EF5F0E50045F0F500D9 +:10012000E51DF5F0E50045F0F500E51CF5F0E5000E +:1001300045F0F500E5007002800302014100020075 +:100140002800750001750100750900750A00C37566 +:100150000B00E500F5F0E51F35F0F51FE501F5F0C2 +:10016000E51E35F0F51EE509F5F0E51D35F0F51D48 +:10017000E50AF5F0E51C35F0F51C020028007500D5 +:1001800000E500F502E500F503E500F504E500F5FE +:1001900005E50DF514E50EF513E50FF512E519C0AB +:1001A000E0E518C0E075E0042506F50675E00035C9 +:1001B00007F507E502F582E503F583E504F500E5BB +:1001C00005F5012200000000000000000000000012 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17635.s.expected b/tests/GCCTestSuite/pr17635.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr17635.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17957.c b/tests/GCCTestSuite/pr17957.c new file mode 100644 index 0000000..ea18ea8 --- /dev/null +++ b/tests/GCCTestSuite/pr17957.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } */ +/* { dg-options "-fno-common --param ggc-min-expand=0 --param ggc-min-heapsize=0" { target hppa*-*-hpux* } } */ +__attribute__ ((vector_size (64))) unsigned char v1, v2, v3; +void +vadd (void) +{ + v1 = v2 + v3; +} +void +test_add (void) +{ + vadd (); +} +void +vsub (void) +{ + v1 = v2 - v3; +} diff --git a/tests/GCCTestSuite/pr17957.c.expected b/tests/GCCTestSuite/pr17957.c.expected new file mode 100644 index 0000000..ea18ea8 --- /dev/null +++ b/tests/GCCTestSuite/pr17957.c.expected @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } */ +/* { dg-options "-fno-common --param ggc-min-expand=0 --param ggc-min-heapsize=0" { target hppa*-*-hpux* } } */ +__attribute__ ((vector_size (64))) unsigned char v1, v2, v3; +void +vadd (void) +{ + v1 = v2 + v3; +} +void +test_add (void) +{ + vadd (); +} +void +vsub (void) +{ + v1 = v2 - v3; +} diff --git a/tests/GCCTestSuite/pr17957.hex.expected b/tests/GCCTestSuite/pr17957.hex.expected new file mode 100644 index 0000000..a740e73 --- /dev/null +++ b/tests/GCCTestSuite/pr17957.hex.expected @@ -0,0 +1,43 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F900000E582F50C900000E583F50D904F +:100020000001E582F509900001E583F50A750100FC +:10003000C3750000E501F5F0E50935F0F501E500CF +:10004000F5F0E50A35F0F500E500F502E501F58289 +:10005000E502F583E0F50B900002E582F5099000DA +:1000600002E583F50A750100C3750000E501F5F0AE +:10007000E50935F0F501E500F5F0E50A35F0F500A4 +:10008000E500F502E501F582E502F583E0F500C340 +:10009000750100E500F5F0E50B35F0F50975010097 +:1000A000C3750000E501F5F0E50C35F0F501E5005C +:1000B000F5F0E50D35F0F500E509F503E500F5028D +:1000C000E501F582E502F583E503F0750000E50042 +:1000D000F502E500F503E500F504E500F505E50E9C +:1000E000F511E50FF510E519C0E0E518C0E0E502EF +:1000F000F582E503F583E504F500E505F501220049 +:10010000E506758202C39582F506E50775830095BD +:1001100083F507D0E0F50875E0012506F58275E066 +:10012000003507F583E508F0D0E0F50875E0002517 +:1001300006F58275E0003507F583E508F01200004A +:10014000750000E500F502E500F503E500F504E5BE +:1001500000F50575E0002506F58275E0003507F528 +:1001600083E0F508E508C0E075E0012506F5827535 +:10017000E0003507F583E0F508E508C0E075E0022A +:100180002506F50675E0003507F507E502F582E579 +:1001900003F583E504F500E505F5012200D0E0F55F +:1001A00018D0E0F519E511F50EE510F50F900000F7 +:1001B000E582F50C900000E583F50D900001E582E5 +:1001C000F509900001E583F50A750100C37500008B +:1001D000E501F5F0E50935F0F501E500F5F0E50A92 +:1001E00035F0F500E500F502E501F582E502F5835D +:1001F000E0F50B900002E582F509900002E583F539 +:100200000A750100C3750000E501F5F0E50935F058 +:10021000F501E500F5F0E50A35F0F500E500F50239 +:10022000E501F582E502F583E0F500C3E500F5F0B0 +:10023000E50B95F0F509750100C3750000E501F5C2 +:10024000F0E50C35F0F501E500F5F0E50D35F0F5DC +:1002500000E509F503E500F502E501F582E502F5A3 +:1002600083E503F0750000E500F502E500F503E520 +:1002700000F504E500F505E50EF511E50FF510E5CF +:1002800019C0E0E518C0E0E502F582E503F583E575 +:1002900004F500E505F50122000000000000000063 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr17957.s.expected b/tests/GCCTestSuite/pr17957.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr17957.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18241-5.c b/tests/GCCTestSuite/pr18241-5.c new file mode 100644 index 0000000..87b06ba --- /dev/null +++ b/tests/GCCTestSuite/pr18241-5.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +void exit (int); + +int main () +{ + int a; + volatile int *b = &a; + a = 1; + if (*b != 1) + exit (1); + return 0; +} diff --git a/tests/GCCTestSuite/pr18241-5.c.expected b/tests/GCCTestSuite/pr18241-5.c.expected new file mode 100644 index 0000000..87b06ba --- /dev/null +++ b/tests/GCCTestSuite/pr18241-5.c.expected @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +void exit (int); + +int main () +{ + int a; + volatile int *b = &a; + a = 1; + if (*b != 1) + exit (1); + return 0; +} diff --git a/tests/GCCTestSuite/pr18241-5.hex.expected b/tests/GCCTestSuite/pr18241-5.hex.expected new file mode 100644 index 0000000..b93f57d --- /dev/null +++ b/tests/GCCTestSuite/pr18241-5.hex.expected @@ -0,0 +1,53 @@ +:1000000075812F7506FF7507FF12001002000C00A6 +:1000100000E506758207C39582F506E5077583003E +:100020009583F507D0E0F50875E0052506F582759E +:10003000E0003507F583E508F0D0E0F50875E00449 +:100040002506F58275E0003507F583E508F075E0D3 +:10005000062506F58275E0003507F583E510F0E525 +:1000600006F50AE507F501750900C3750000E50905 +:10007000F5F0E50A35F0F50FE500F5F0E50135F0AE +:10008000F510E506F50AE507F501750900C37500E9 +:1000900000E509F5F0E50A35F0F50DE500F5F0E5C8 +:1000A0000135F0F50E750901750A00750B00750C28 +:1000B00000750100C3750000E501F5F0E50D35F0B0 +:1000C000F501E500F5F0E50E35F0F500E509F5037D +:1000D000E500F502E501F582E502F583E503F0753B +:1000E0000101C3750000E501F5F0E50D35F0F501FE +:1000F000E500F5F0E50E35F0F500E50AF503E5005D +:10010000F502E501F582E502F583E503F0750102EC +:10011000C3750000E501F5F0E50D35F0F501E500EA +:10012000F5F0E50E35F0F500E50BF503E500F50219 +:10013000E501F582E502F583E503F0750103C3757A +:100140000000E501F5F0E50D35F0F501E500F5F00D +:10015000E50E35F0F500E50CF503E500F502E501E7 +:10016000F582E502F583E503F0E50FF500E510F50E +:1001700001750A00C3750900E50AF5F0E50035F0E0 +:10018000F50AE509F5F0E50135F0F509E509F502AF +:10019000E50AF582E502F583E0F50B750A01C37502 +:1001A0000900E50AF5F0E50035F0F50AE509F5F096 +:1001B000E50135F0F509E509F502E50AF582E50204 +:1001C000F583E0F50C750A02C3750900E50AF5F040 +:1001D000E50035F0F50AE509F5F0E50135F0F5093A +:1001E000E509F502E50AF582E502F583E0F50D750E +:1001F0000A03C3750900E50AF5F0E50035F0F50AD4 +:10020000E509F5F0E50135F0F509E509F502E50A3E +:10021000F582E502F583E0F50E75000175010075C4 +:100220000900750A00750F00C3E500F5F0E50B95B0 +:10023000F0F500E500F5F0E50F45F0F50FC3E50139 +:10024000F5F0E50C95F0F500E500F5F0E50F45F06B +:10025000F50FC3E509F5F0E50D95F0F500E500F5BE +:10026000F0E50F45F0F50FC3E50AF5F0E50E95F062 +:10027000F500E500F5F0E50F45F0F50F75010075A7 +:100280000900750A00750000E50FF5F0E50045F07E +:10029000F500E501F5F0E50045F0F500E509F5F0BC +:1002A000E50045F0F500E50AF5F0E50045F0F5005C +:1002B000E500700280030203300075000075010044 +:1002C000750900750A00E500F502E501F503E50989 +:1002D000F504E50AF50575E0062506F58275E000EA +:1002E0003507F583E0F51075E0042506F58275E025 +:1002F000003507F583E0F508E508C0E075E0052561 +:1003000006F58275E0003507F583E0F508E508C0DD +:10031000E075E0072506F50675E0003507F507E509 +:1003200002F582E503F583E504F500E505F5012214 +:1003300000751F01751E00751D00751C000202BAB4 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18241-5.s.expected b/tests/GCCTestSuite/pr18241-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr18241-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18479.c b/tests/GCCTestSuite/pr18479.c new file mode 100644 index 0000000..493574e --- /dev/null +++ b/tests/GCCTestSuite/pr18479.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +struct __attribute__ ((visibility("default"))) Foo { int foo; }; /* { dg-warning "attribute ignored on types" } */ diff --git a/tests/GCCTestSuite/pr18479.c.expected b/tests/GCCTestSuite/pr18479.c.expected new file mode 100644 index 0000000..493574e --- /dev/null +++ b/tests/GCCTestSuite/pr18479.c.expected @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +struct __attribute__ ((visibility("default"))) Foo { int foo; }; /* { dg-warning "attribute ignored on types" } */ diff --git a/tests/GCCTestSuite/pr18479.hex.expected b/tests/GCCTestSuite/pr18479.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pr18479.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18479.s.expected b/tests/GCCTestSuite/pr18479.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr18479.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18809-1.c b/tests/GCCTestSuite/pr18809-1.c new file mode 100644 index 0000000..f20f004 --- /dev/null +++ b/tests/GCCTestSuite/pr18809-1.c @@ -0,0 +1,7 @@ +/* PR c/18809 */ +/* Origin: Andrew Pinski */ + +/* { dg-do compile } */ + +void foo(enum E e) {} /* { dg-error "" } */ +void bar() { foo(0); } /* { dg-error "formal" } */ diff --git a/tests/GCCTestSuite/pr18809-1.c.expected b/tests/GCCTestSuite/pr18809-1.c.expected new file mode 100644 index 0000000..f20f004 --- /dev/null +++ b/tests/GCCTestSuite/pr18809-1.c.expected @@ -0,0 +1,7 @@ +/* PR c/18809 */ +/* Origin: Andrew Pinski */ + +/* { dg-do compile } */ + +void foo(enum E e) {} /* { dg-error "" } */ +void bar() { foo(0); } /* { dg-error "formal" } */ diff --git a/tests/GCCTestSuite/pr18809-1.hex.expected b/tests/GCCTestSuite/pr18809-1.hex.expected new file mode 100644 index 0000000..b8ad5fd --- /dev/null +++ b/tests/GCCTestSuite/pr18809-1.hex.expected @@ -0,0 +1,17 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0042506F50675E0C6 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F5012200E506758202C39582F5EB +:1000600006E5077583009583F507D0E0F50875E090 +:10007000012506F58275E0003507F583E508F0D027 +:10008000E0F50875E0002506F58275E0003507F516 +:1000900083E508F0751F00751E00751D00751C00B6 +:1000A000120000750000E500F502E500F503E5002B +:1000B000F504E500F50575E0002506F58275E0001C +:1000C0003507F583E0F508E508C0E075E001250691 +:1000D000F58275E0003507F583E0F508E508C0E036 +:1000E00075E0022506F50675E0003507F507E5021F +:1000F000F582E503F583E504F500E505F501220049 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18809-1.s.expected b/tests/GCCTestSuite/pr18809-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr18809-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18921-1.c b/tests/GCCTestSuite/pr18921-1.c new file mode 100644 index 0000000..b8c91aa --- /dev/null +++ b/tests/GCCTestSuite/pr18921-1.c @@ -0,0 +1,20 @@ +/* PR middle-end/18921 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +int foo (int k) +{ + unsigned char j = 0; + (k ? 0 : j++) == -1; + return j; +} + +int main () +{ + if (!foo (0)) + abort (); + return 0; +} + diff --git a/tests/GCCTestSuite/pr18921-1.c.expected b/tests/GCCTestSuite/pr18921-1.c.expected new file mode 100644 index 0000000..b8c91aa --- /dev/null +++ b/tests/GCCTestSuite/pr18921-1.c.expected @@ -0,0 +1,20 @@ +/* PR middle-end/18921 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +int foo (int k) +{ + unsigned char j = 0; + (k ? 0 : j++) == -1; + return j; +} + +int main () +{ + if (!foo (0)) + abort (); + return 0; +} + diff --git a/tests/GCCTestSuite/pr18921-1.hex.expected b/tests/GCCTestSuite/pr18921-1.hex.expected new file mode 100644 index 0000000..f301622 --- /dev/null +++ b/tests/GCCTestSuite/pr18921-1.hex.expected @@ -0,0 +1,40 @@ +:1000000075812F7506FF7507FF1200C302000C00F3 +:1000100000E506758204C39582F506E50775830041 +:100020009583F507D0E0F509D0E0F50A7501007574 +:100030000000E51FF5F0E50045F0F500E51EF5F0E0 +:10004000E50045F0F500E51DF5F0E50045F0F500AB +:10005000E51CF5F0E50045F0F500E50070028003D1 +:100060000200BF00E501F500750B01C3750100E555 +:100070000BF5F0E50035F0F500E500F50175000041 +:10008000E500F50BE500F50CE501F502E50BF503E0 +:10009000E50CF504E500F505E50AC0E0E509C0E07A +:1000A00075E0042506F50675E0003507F507E5025D +:1000B000F582E503F583E504F500E505F501220089 +:1000C00002007D00E506758202C39582F506E5070C +:1000D0007583009583F507D0E0F50875E0012506E6 +:1000E000F58275E0003507F583E508F0D0E0F50806 +:1000F00075E0002506F58275E0003507F583E50813 +:10010000F0751F00751E00751D00751C0012001093 +:10011000E582F502E583F503E500F504E501F50563 +:10012000E502F500E503F501E504F509E505F50A45 +:10013000750C01C3750B00E500F5F0E50B95F0F5C6 +:100140000B750B00E50BF5F0E50B35F0F50BE50B4A +:10015000F5F0E50C65F0F50CC3750B00E501F5F065 +:10016000E50B95F0F50B750B00E50BF5F0E50B35A0 +:10017000F0F50BE50BF5F0E50C65F0F50CC3750B30 +:1001800000E509F5F0E50B95F0F50B750B00E50BB7 +:10019000F5F0E50B35F0F50BE50BF5F0E50C65F04A +:1001A000F50CC3750B00E50AF5F0E50B95F0F50BC2 +:1001B000750B00E50BF5F0E50B35F0F50BE50BF5F0 +:1001C000F0E50C65F0F50C750100750900750A0085 +:1001D000750000E50CF5F0E50045F0F500E501F5EA +:1001E000F0E50045F0F500E509F5F0E50045F0F52E +:1001F00000E50AF5F0E50045F0F500E50070028045 +:100200000302026A00750000750100750900750A95 +:1002100000E500F502E501F503E509F504E50AF559 +:100220000575E0002506F58275E0003507F583E0E9 +:10023000F508E508C0E075E0012506F58275E000E7 +:100240003507F583E0F508E508C0E075E00225060E +:10025000F50675E0003507F507E502F582E503F5DB +:1002600083E504F500E505F5012200020205000022 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18921-1.s.expected b/tests/GCCTestSuite/pr18921-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr18921-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18928-1.c b/tests/GCCTestSuite/pr18928-1.c new file mode 100644 index 0000000..406b2fc --- /dev/null +++ b/tests/GCCTestSuite/pr18928-1.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/18928 */ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC" } */ + +const char *toHex( unsigned short u ) +{ + static char hexVal[5]; + int i = 3; + while ( i >= 0 ) { + unsigned short hex = (u & 0x000f); + if ( hex < 0x0a ) + hexVal[i] = '0'+hex; + else + hexVal[i] = 'A'+(hex-0x0a); + i--; + } + hexVal[4] = '\0'; + return hexVal; +} + diff --git a/tests/GCCTestSuite/pr18928-1.c.expected b/tests/GCCTestSuite/pr18928-1.c.expected new file mode 100644 index 0000000..406b2fc --- /dev/null +++ b/tests/GCCTestSuite/pr18928-1.c.expected @@ -0,0 +1,20 @@ +/* PR rtl-optimization/18928 */ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC" } */ + +const char *toHex( unsigned short u ) +{ + static char hexVal[5]; + int i = 3; + while ( i >= 0 ) { + unsigned short hex = (u & 0x000f); + if ( hex < 0x0a ) + hexVal[i] = '0'+hex; + else + hexVal[i] = 'A'+(hex-0x0a); + i--; + } + hexVal[4] = '\0'; + return hexVal; +} + diff --git a/tests/GCCTestSuite/pr18928-1.hex.expected b/tests/GCCTestSuite/pr18928-1.hex.expected new file mode 100644 index 0000000..b0553e6 --- /dev/null +++ b/tests/GCCTestSuite/pr18928-1.hex.expected @@ -0,0 +1,208 @@ +:1000000000E50675820CC39582F506E50775830049 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF51DE51EF51C75101D +:1000D000037511007512007517007518007516006C +:1000E000750E00750F00E517F513750080E500F536 +:1000F000F0E51325F0F513E500F5F0E50F25F0F533 +:100100000F750B00750C00751500750D00750A0054 +:10011000751401750001C3E50FF5F0E51395F0F5D1 +:1001200009E50AF5F0E50A35F0F509E509F5F0E528 +:100130000055F0F500E500F5F0E50B45F0F50B7521 +:100140000001C3E50FF5F0E51395F0F509E50AF5B3 +:10015000F0E50A35F0F509E513F5F0E50F95F0F552 +:1001600001E50AF5F0E50A35F0F501E501F5F0E500 +:100170000945F0F509E514F5F0E50965F0F509E53F +:1001800009F5F0E50055F0F500C3E50EF5F0E512D0 +:1001900095F0F509E50AF5F0E50A35F0F509E50908 +:1001A000F5F0E50055F0F500E500F5F0E50B45F05C +:1001B000F50B750001C3E50FF5F0E51395F0F509B2 +:1001C000E50AF5F0E50A35F0F509E513F5F0E50F78 +:1001D00095F0F501E50AF5F0E50A35F0F501E501E0 +:1001E000F5F0E50945F0F509E514F5F0E50965F0E8 +:1001F000F509E509F5F0E50055F0F500C3E50EF564 +:10020000F0E51295F0F509E50AF5F0E50A35F0F5A7 +:1002100009E512F5F0E50E95F0F501E50AF5F0E5D2 +:100220000A35F0F501E501F5F0E50945F0F509E5D8 +:1002300014F5F0E50965F0F509E509F5F0E5005577 +:10024000F0F500C3E516F5F0E51195F0F509E50ABE +:10025000F5F0E50A35F0F509E509F5F0E50055F0AA +:10026000F500E500F5F0E50B45F0F50B750001C371 +:10027000E50FF5F0E51395F0F509E50AF5F0E50A67 +:1002800035F0F509E513F5F0E50F95F0F501E50A10 +:10029000F5F0E50A35F0F501E501F5F0E50945F081 +:1002A000F509E514F5F0E50965F0F509E509F5F05E +:1002B000E50055F0F500C3E50EF5F0E51295F0F513 +:1002C00009E50AF5F0E50A35F0F509E512F5F0E57E +:1002D0000E95F0F501E50AF5F0E50A35F0F501E5D2 +:1002E00001F5F0E50945F0F509E514F5F0E50965D6 +:1002F000F0F509E509F5F0E50055F0F500C3E51660 +:10030000F5F0E51195F0F509E50AF5F0E50A35F0A7 +:10031000F509E511F5F0E51695F0F501E50AF5F0BA +:10032000E50A35F0F501E501F5F0E50945F0F509D7 +:10033000E514F5F0E50965F0F509E509F5F0E500E6 +:1003400055F0F500C3E518F5F0E51095F0F509E571 +:100350000AF5F0E50A35F0F509E509F5F0E500558F +:10036000F0F500E500F5F0E50B45F0F50BE50BF5D4 +:1003700000E515F501750B01C3750900E500F5F001 +:10038000E50995F0F509750900E509F5F0E5093588 +:10039000F0F509E509F5F0E50B65F0F50BC3750916 +:1003A00000E50CF5F0E50995F0F509750900E5099A +:1003B000F5F0E50935F0F509E509F5F0E50B65F02F +:1003C000F50BC3750900E501F5F0E50995F0F509B0 +:1003D000750900E509F5F0E50935F0F509E509F5D8 +:1003E000F0E50B65F0F50BC3750900E50DF5F0E5DB +:1003F0000995F0F509750900E509F5F0E50935F00D +:10040000F509E509F5F0E50B65F0F50B750C0075E0 +:100410001500750D00E50CF500E515F501E50DF588 +:1004200009750C01C3750A00E50BF5F0E50A95F0B6 +:10043000F50A750A00E50AF5F0E50A35F0F50AE572 +:100440000AF5F0E50C65F0F50CC3750A00E500F55A +:10045000F0E50A95F0F50A750A00E50AF5F0E50AF7 +:1004600035F0F50AE50AF5F0E50C65F0F50CC37515 +:100470000A00E501F5F0E50A95F0F50A750A00E5D0 +:100480000AF5F0E50A35F0F50AE50AF5F0E50C6540 +:10049000F0F50CC3750A00E509F5F0E50A95F0F5ED +:1004A0000A750A00E50AF5F0E50A35F0F50AE50AED +:1004B000F5F0E50C65F0F50C750100750900750A9D +:1004C00000750000E50CF5F0E50045F0F500E501EC +:1004D000F5F0E50045F0F500E509F5F0E50045F03B +:1004E000F500E50AF5F0E50045F0F500E5007002DD +:1004F0008003020ABA0075010F750000C3E501F51B +:10050000F0E51D55F0F513E500F5F0E51C55F0F5A7 +:100510000E750F00E50FF514751B0A751600750CA6 +:1005200000750D00E513F51E750080E500F5F0E59A +:100530000F25F0F50FE500F5F0E50D25F0F50D754B +:100540000B00751800751900751A00750A007515ED +:1005500001750001C3E50DF5F0E50F95F0F509E52E +:100560000AF5F0E50A35F0F509E509F5F0E500557D +:10057000F0F500E500F5F0E50B45F0F50B75000131 +:10058000C3E50DF5F0E50F95F0F509E50AF5F0E5A1 +:100590000A35F0F509E50FF5F0E50D95F0F501E503 +:1005A0000AF5F0E50A35F0F501E501F5F0E5094554 +:1005B000F0F509E515F5F0E50965F0F509E509F54A +:1005C000F0E50055F0F500C3E50CF5F0E51495F005 +:1005D000F509E50AF5F0E50A35F0F509E509F5F064 +:1005E000E50055F0F500E500F5F0E50B45F0F50BFD +:1005F000750001C3E50DF5F0E50F95F0F509E50A85 +:10060000F5F0E50A35F0F509E50FF5F0E50D95F0A3 +:10061000F501E50AF5F0E50A35F0F501E501F5F03B +:10062000E50945F0F509E515F5F0E50965F0F50989 +:10063000E509F5F0E50055F0F500C3E50CF5F0E54A +:100640001495F0F509E50AF5F0E50A35F0F509E548 +:1006500014F5F0E50C95F0F501E50AF5F0E50A353D +:10066000F0F501E501F5F0E50945F0F509E515F5C9 +:10067000F0E50965F0F509E509F5F0E50055F0F557 +:1006800000C3E516F5F0E50E95F0F509E50AF5F07D +:10069000E50A35F0F509E509F5F0E50055F0F50056 +:1006A000E500F5F0E50B45F0F50B750001C3E50D30 +:1006B000F5F0E50F95F0F509E50AF5F0E50A35F0F6 +:1006C000F509E50FF5F0E50D95F0F501E50AF5F012 +:1006D000E50A35F0F501E501F5F0E50945F0F50924 +:1006E000E515F5F0E50965F0F509E509F5F0E50032 +:1006F00055F0F500C3E50CF5F0E51495F0F509E5C6 +:100700000AF5F0E50A35F0F509E514F5F0E50C9584 +:10071000F0F501E50AF5F0E50A35F0F501E501F53A +:10072000F0E50945F0F509E515F5F0E50965F0F5A1 +:1007300009E509F5F0E50055F0F500C3E516F5F01B +:10074000E50E95F0F509E50AF5F0E50A35F0F5094D +:10075000E50EF5F0E51695F0F501E50AF5F0E50A88 +:1007600035F0F501E501F5F0E50945F0F509E51588 +:10077000F5F0E50965F0F509E509F5F0E50055F056 +:10078000F500C3E51BF5F0E51E95F0F509E50AF562 +:10079000F0E50A35F0F509E509F5F0E50055F0F565 +:1007A00000E500F5F0E50B45F0F50B750000E50BF5 +:1007B000F5F0E50045F0F500E518F5F0E50045F049 +:1007C000F500E519F5F0E50045F0F500E51AF5F05E +:1007D000E50045F0F500E5007002800302096E00B7 +:1007E000900000E582F50E900000E583F50F750995 +:1007F00001750B00750C00750D00C3750000E51048 +:10080000F5F0E509A4F50AE510F5F0E509A4E5F031 +:10081000F501E50AF5F0E50035F0F500E511F5F034 +:10082000E509A4F50AE511F5F0E509A4E5F0F509F7 +:10083000E50AF5F0E50135F0F501C3C3750900E5FA +:1008400000F5F0E50C35F0F50CE501F5F0E50D35BA +:10085000F0F50DC3750100E510F5F0E50BA4F50A00 +:10086000E510F5F0E50BA4E5F0F509E50AF5F0E58E +:100870000135F0F501750000C3C3750900E500F509 +:10088000F0E50C35F0F50CE501F5F0E50D35F0F58A +:100890000DC3750000750100C3C3750900E500F5BF +:1008A000F0E50C35F0F50CE501F5F0E50D35F0F56A +:1008B0000DC3750000750100C3C3750900E500F59F +:1008C000F0E50C35F0F50CE501F5F0E50D35F0F54A +:1008D0000DC3750000E50CF5F0E50E35F0F500E50B +:1008E0000DF5F0E50F35F0F509750141750A0AC3FC +:1008F000E50AF5F0E51395F0F50BC3750A00E50B75 +:10090000F5F0E50135F0F50B750A00C3750100E55A +:100910000AF5F0E50035F0F500E501F5F0E50935FB +:10092000F0F501E50BF503E501F502E500F582E5DB +:1009300002F583E503F07500017501007509007586 +:100940000A00C3E500F5F0E51095F0F510E501F5B6 +:10095000F0E51195F0F511E509F5F0E51295F0F5E2 +:1009600012E50AF5F0E51795F0F5170200DA0090A8 +:100970000000E582F50E900000E583F50F75090192 +:10098000750B00750C00750D00C3750000E510F5C2 +:10099000F0E509A4F50AE510F5F0E509A4E5F0F5A0 +:1009A00001E50AF5F0E50035F0F500E511F5F0E5B3 +:1009B00009A4F50AE511F5F0E509A4E5F0F509E566 +:1009C0000AF5F0E50135F0F501C3C3750900E5004E +:1009D000F5F0E50C35F0F50CE501F5F0E50D35F039 +:1009E000F50DC3750100E510F5F0E50BA4F50AE57A +:1009F00010F5F0E50BA4E5F0F509E50AF5F0E501E1 +:100A000035F0F501750000C3C3750900E500F5F088 +:100A1000E50C35F0F50CE501F5F0E50D35F0F50DDB +:100A2000C3750000750100C3C3750900E500F5F04A +:100A3000E50C35F0F50CE501F5F0E50D35F0F50DBB +:100A4000C3750000750100C3C3750900E500F5F02A +:100A5000E50C35F0F50CE501F5F0E50D35F0F50D9B +:100A6000C3750000E50CF5F0E50E35F0F500E50D79 +:100A7000F5F0E50F35F0F509750130C3750A00E5AD +:100A800013F5F0E50135F0F50B750A00C3750100AB +:100A9000E50AF5F0E50035F0F500E501F5F0E509CA +:100AA00035F0F501E50BF503E501F502E500F5820A +:100AB000E502F583E503F002093600900000E582C7 +:100AC000F510900000E583F51175000475010075BF +:100AD0000C01750D00750E00750F00C3750900E55A +:100AE00000F5F0E50CA4F50BE500F5F0E50CA4E548 +:100AF000F0F50AE50BF5F0E50935F0F509E501F546 +:100B0000F0E50CA4F50BE501F5F0E50CA4E5F0F536 +:100B100001E50BF5F0E50A35F0F50AC3C3750100F0 +:100B2000E509F5F0E50E35F0F50EE50AF5F0E50F0F +:100B300035F0F50FC3750A00E500F5F0E50DA4F5F5 +:100B40000BE500F5F0E50DA4E5F0F501E50BF5F09A +:100B5000E50A35F0F50A750900C3C3750000E5091B +:100B6000F5F0E50E35F0F50EE50AF5F0E50F35F098 +:100B7000F50FC3750900750A00C3C3750000E509C8 +:100B8000F5F0E50E35F0F50EE50AF5F0E50F35F078 +:100B9000F50FC3750900750A00C3C3750000E509A8 +:100BA000F5F0E50E35F0F50EE50AF5F0E50F35F058 +:100BB000F50FC3750000E50EF5F0E51035F0F50012 +:100BC000E50FF5F0E51135F0F50B750A0075090034 +:100BD000C3750100E509F5F0E50035F0F500E50124 +:100BE000F5F0E50B35F0F501E50AF503E501F50251 +:100BF000E500F582E502F583E503F0900000E5826B +:100C0000F501900000E583F509750000E501F502A6 +:100C1000E509F503E500F504E500F50575E00925AE +:100C200006F58275E0003507F583E0F51775E008F5 +:100C30002506F58275E0003507F583E0F51675E0C9 +:100C4000072506F58275E0003507F583E0F5157593 +:100C5000E0062506F58275E0003507F583E0F5141A +:100C600075E0052506F58275E0003507F583E0F5AA +:100C70001375E0042506F58275E0003507F583E07D +:100C8000F51275E0032506F58275E0003507F5835A +:100C9000E0F51175E0022506F58275E0003507F5EF +:100CA00083E0F51075E0002506F58275E000350754 +:100CB000F583E0F508E508C0E075E0012506F5825A +:100CC00075E0003507F583E0F508E508C0E075E05C +:100CD0000C2506F50675E0003507F507E502F582F7 +:100CE000E503F583E504F500E505F50122000000C4 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr18928-1.s.expected b/tests/GCCTestSuite/pr18928-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr18928-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20017.c b/tests/GCCTestSuite/pr20017.c new file mode 100644 index 0000000..1fd6d58 --- /dev/null +++ b/tests/GCCTestSuite/pr20017.c @@ -0,0 +1,41 @@ +/* PR rtl-optimization/20017 + + After CSE/GCSE folds a switch statement to an unconditional jump, + cfg_cleanup did not remove a dead jump table, confusing the CFG + layout code later on. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-options "-O1 -march=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +int +foo (int *buf, int *p) +{ + int result; + const int *tmp; + + if (*buf) + return 1; + + result = 2; + *buf = 2; + tmp = buf; + switch (*tmp) + { + case 3: + case 4: + case 6: + case 14: + return 1; + + case 0: + result = *p; + + /* Fall through. */ + default: + if (result) + return 1; + } + + return 0; +} diff --git a/tests/GCCTestSuite/pr20017.c.expected b/tests/GCCTestSuite/pr20017.c.expected new file mode 100644 index 0000000..1fd6d58 --- /dev/null +++ b/tests/GCCTestSuite/pr20017.c.expected @@ -0,0 +1,41 @@ +/* PR rtl-optimization/20017 + + After CSE/GCSE folds a switch statement to an unconditional jump, + cfg_cleanup did not remove a dead jump table, confusing the CFG + layout code later on. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-options "-O1 -march=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +int +foo (int *buf, int *p) +{ + int result; + const int *tmp; + + if (*buf) + return 1; + + result = 2; + *buf = 2; + tmp = buf; + switch (*tmp) + { + case 3: + case 4: + case 6: + case 14: + return 1; + + case 0: + result = *p; + + /* Fall through. */ + default: + if (result) + return 1; + } + + return 0; +} diff --git a/tests/GCCTestSuite/pr20017.hex.expected b/tests/GCCTestSuite/pr20017.hex.expected new file mode 100644 index 0000000..1b7e11a --- /dev/null +++ b/tests/GCCTestSuite/pr20017.hex.expected @@ -0,0 +1,219 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5153E +:10004000F518E514F519E513F51AE512F51B75E039 +:10005000032506F58275E0003507F583E511F07597 +:10006000E0022506F58275E0003507F583E510F01E +:10007000E51FF500E51EF501750A00C3750900E5E9 +:100080000AF5F0E50035F0F50AE509F5F0E501358A +:10009000F0F509E509F502E50AF582E502F583E0E8 +:1000A000F50B750A01C3750900E50AF5F0E50035A1 +:1000B000F0F50AE509F5F0E50135F0F509E509F592 +:1000C00002E50AF582E502F583E0F50C750A02C344 +:1000D000750900E50AF5F0E50035F0F50AE509F5E2 +:1000E000F0E50135F0F509E509F502E50AF582E5E7 +:1000F00002F583E0F50D750A03C3750900E50AF5FD +:10010000F0E50035F0F50AE509F5F0E50135F0F523 +:1001100009E509F502E50AF582E502F583E0F50A4D +:10012000750900E50BF5F0E50945F0F509E50CF575 +:10013000F0E50945F0F509E50DF5F0E50945F0F5BF +:1001400009E50AF5F0E50945F0F509E509700280D1 +:1001500003020D81007512027513007514007515E8 +:1001600000750B02750C00750D00750E00750A0008 +:10017000C3750900E50AF5F0E50035F0F50AE50973 +:10018000F5F0E50135F0F509E50BF503E509F502B4 +:10019000E50AF582E502F583E503F0750A01C3750A +:1001A0000900E50AF5F0E50035F0F50AE509F5F096 +:1001B000E50135F0F509E50CF503E509F502E50A79 +:1001C000F582E502F583E503F0750A02C3750900BF +:1001D000E50AF5F0E50035F0F50AE509F5F0E50189 +:1001E00035F0F509E50DF503E509F502E50AF582B7 +:1001F000E502F583E503F0750A03C3750900E50A16 +:10020000F5F0E50035F0F50AE509F5F0E50135F022 +:10021000F509E50EF503E509F502E50AF582E502C3 +:10022000F583E503F0E500F510E501F51175010032 +:10023000C3750000E501F5F0E51035F0F501E500C6 +:10024000F5F0E51135F0F500E500F502E501F58280 +:10025000E502F583E0F50B750101C3750000E501CA +:10026000F5F0E51035F0F501E500F5F0E51135F0B4 +:10027000F500E500F502E501F582E502F583E0F51C +:100280000C750102C3750000E501F5F0E51035F0CD +:10029000F501E500F5F0E51135F0F500E500F502B2 +:1002A000E501F582E502F583E0F50D750103C375FF +:1002B0000000E501F5F0E51035F0F501E500F5F099 +:1002C000E51135F0F500E500F502E501F582E502FE +:1002D000F583E0F50E750003750100750900750AD8 +:1002E00000750F00C3E500F5F0E50B95F0F500E5AE +:1002F00000F5F0E50F45F0F50FC3E501F5F0E50C6D +:1003000095F0F500E500F5F0E50F45F0F50FC3E5D4 +:1003100009F5F0E50D95F0F500E500F5F0E50F4580 +:10032000F0F50FC3E50AF5F0E50E95F0F500E500F0 +:10033000F5F0E50F45F0F50F750100750900750A38 +:1003400000E50FF500750F01C3750B00E500F5F032 +:10035000E50B95F0F50B750B00E50BF5F0E50B35AE +:10036000F0F50BE50BF5F0E50F65F0F50FC3750B38 +:1003700000E501F5F0E50B95F0F50B750B00E50BCD +:10038000F5F0E50B35F0F50BE50BF5F0E50F65F055 +:10039000F50FC3750B00E509F5F0E50B95F0F50BCE +:1003A000750B00E50BF5F0E50B35F0F50BE50BF5FE +:1003B000F0E50F65F0F50FC3750B00E50AF5F0E504 +:1003C0000B95F0F50B750B00E50BF5F0E50B35F033 +:1003D000F50BE50BF5F0E50F65F0F50F7501007510 +:1003E0000900750A00750000E50FF5F0E50045F01D +:1003F000F500E501F5F0E50045F0F500E509F5F05B +:10040000E50045F0F500E50AF5F0E50045F0F500FA +:10041000E50070028003020D7C00750100C37500C9 +:1004200000E501F5F0E51035F0F501E500F5F0E542 +:100430001135F0F500E500F502E501F582E502F57C +:1004400083E0F50B750101C3750000E501F5F0E5EA +:100450001035F0F501E500F5F0E51135F0F500E5B2 +:1004600000F502E501F582E502F583E0F50C750182 +:1004700002C3750000E501F5F0E51035F0F501E582 +:1004800000F5F0E51135F0F500E500F502E501F5C0 +:1004900082E502F583E0F50D750103C3750000E503 +:1004A00001F5F0E51035F0F501E500F5F0E5113561 +:1004B000F0F500E500F502E501F582E502F583E0DF +:1004C000F50E750004750100750900750A00750FB9 +:1004D00000C3E500F5F0E50B95F0F500E500F5F05B +:1004E000E50F45F0F50FC3E501F5F0E50C95F0F5E6 +:1004F00000E500F5F0E50F45F0F50FC3E509F5F06F +:10050000E50D95F0F500E500F5F0E50F45F0F50F88 +:10051000C3E50AF5F0E50E95F0F500E500F5F0E528 +:100520000F45F0F50F750100750900750A00E50F1C +:10053000F500750F01C3750B00E500F5F0E50B95AF +:10054000F0F50B750B00E50BF5F0E50B35F0F50B51 +:10055000E50BF5F0E50F65F0F50FC3750B00E50150 +:10056000F5F0E50B95F0F50B750B00E50BF5F0E5F7 +:100570000B35F0F50BE50BF5F0E50F65F0F50FC366 +:10058000750B00E509F5F0E50B95F0F50B750B0023 +:10059000E50BF5F0E50B35F0F50BE50BF5F0E50FA8 +:1005A00065F0F50FC3750B00E50AF5F0E50B95F066 +:1005B000F50B750B00E50BF5F0E50B35F0F50BE5EC +:1005C0000BF5F0E50F65F0F50F7501007509007585 +:1005D0000A00750000E50FF5F0E50045F0F500E5CF +:1005E00001F5F0E50045F0F500E509F5F0E5004519 +:1005F000F0F500E50AF5F0E50045F0F500E50070DE +:10060000028003020D7700750100C3750000E5014B +:10061000F5F0E51035F0F501E500F5F0E51135F000 +:10062000F500E500F502E501F582E502F583E0F568 +:100630000B750101C3750000E501F5F0E51035F01B +:10064000F501E500F5F0E51135F0F500E500F502FE +:10065000E501F582E502F583E0F50C750102C3754D +:100660000000E501F5F0E51035F0F501E500F5F0E5 +:10067000E51135F0F500E500F502E501F582E5024A +:10068000F583E0F50D750103C3750000E501F5F094 +:10069000E51035F0F501E500F5F0E51135F0F50070 +:1006A000E500F502E501F582E502F583E0F50E755A +:1006B0000006750100750900750A00750F00C3E595 +:1006C00000F5F0E50B95F0F500E500F5F0E50F45D8 +:1006D000F0F50FC3E501F5F0E50C95F0F500E50048 +:1006E000F5F0E50F45F0F50FC3E509F5F0E50D95DB +:1006F000F0F500E500F5F0E50F45F0F50FC3E50A6C +:10070000F5F0E50E95F0F500E500F5F0E50F45F0A4 +:10071000F50F750100750900750A00E50FF5007504 +:100720000F01C3750B00E500F5F0E50B95F0F50B37 +:10073000750B00E50BF5F0E50B35F0F50BE50BF56A +:10074000F0E50F65F0F50FC3750B00E501F5F0E579 +:100750000B95F0F50B750B00E50BF5F0E50B35F09F +:10076000F50BE50BF5F0E50F65F0F50FC3750B0024 +:10077000E509F5F0E50B95F0F50B750B00E50BF5CC +:10078000F0E50B35F0F50BE50BF5F0E50F65F0F551 +:100790000FC3750B00E50AF5F0E50B95F0F50B7549 +:1007A0000B00E50BF5F0E50B35F0F50BE50BF5F07F +:1007B000E50F65F0F50F750100750900750A007504 +:1007C0000000E50FF5F0E50045F0F500E501F5F076 +:1007D000E50045F0F500E509F5F0E50045F0F50028 +:1007E000E50AF5F0E50045F0F500E500700280034C +:1007F000020D7200750100C3750000E501F5F0E51A +:100800001035F0F501E500F5F0E51135F0F500E5FE +:1008100000F502E501F582E502F583E0F50B7501CF +:1008200001C3750000E501F5F0E51035F0F501E5CF +:1008300000F5F0E51135F0F500E500F502E501F50C +:1008400082E502F583E0F50C750102C3750000E551 +:1008500001F5F0E51035F0F501E500F5F0E51135AD +:10086000F0F500E500F502E501F582E502F583E02B +:10087000F50D750103C3750000E501F5F0E51035D0 +:10088000F0F501E500F5F0E51135F0F500E500F5CE +:1008900002E501F582E502F583E0F50E75000E75BF +:1008A0000100750900750A00750F00C3E500F5F039 +:1008B000E50B95F0F500E500F5F0E50F45F0F50FD7 +:1008C000C3E501F5F0E50C95F0F500E500F5F0E580 +:1008D0000F45F0F50FC3E509F5F0E50D95F0F500CE +:1008E000E500F5F0E50F45F0F50FC3E50AF5F0E595 +:1008F0000E95F0F500E500F5F0E50F45F0F50F7504 +:100900000100750900750A00E50FF500750F01C3B8 +:10091000750B00E500F5F0E50B95F0F50B750B0098 +:10092000E50BF5F0E50B35F0F50BE50BF5F0E50F14 +:1009300065F0F50FC3750B00E501F5F0E50B95F0DB +:10094000F50B750B00E50BF5F0E50B35F0F50BE558 +:100950000BF5F0E50F65F0F50FC3750B00E509F534 +:10096000F0E50B95F0F50B750B00E50BF5F0E50BDD +:1009700035F0F50BE50BF5F0E50F65F0F50FC375F8 +:100980000B00E50AF5F0E50B95F0F50B750B00E5AE +:100990000BF5F0E50B35F0F50BE50BF5F0E50F6524 +:1009A000F0F50F750100750900750A00750000E586 +:1009B0000FF5F0E50045F0F500E501F5F0E500453F +:1009C000F0F500E509F5F0E50045F0F500E50AF57C +:1009D000F0E50045F0F500E50070028003020D61CE +:1009E00000E510F500E511F501750A00C375090071 +:1009F000E50AF5F0E50035F0F50AE509F5F0E50161 +:100A000035F0F509E509F502E50AF582E502F58319 +:100A1000E0F50B750A01C3750900E50AF5F0E5007C +:100A200035F0F50AE509F5F0E50135F0F509E509D8 +:100A3000F502E50AF582E502F583E0F50C750A0298 +:100A4000C3750900E50AF5F0E50035F0F50AE5099A +:100A5000F5F0E50135F0F509E509F502E50AF5825D +:100A6000E502F583E0F50D750A03C3750900E50A93 +:100A7000F5F0E50035F0F50AE509F5F0E50135F0AA +:100A8000F509E509F502E50AF582E502F583E0F5E9 +:100A90000E750000750100750900750A00750F00DC +:100AA000C3E500F5F0E50B95F0F500E500F5F0E5A0 +:100AB0000F45F0F50FC3E501F5F0E50C95F0F500F5 +:100AC000E500F5F0E50F45F0F50FC3E509F5F0E5B4 +:100AD0000D95F0F500E500F5F0E50F45F0F50FC3D5 +:100AE000E50AF5F0E50E95F0F500E500F5F0E50F07 +:100AF00045F0F50F750100750900750A00E50FF561 +:100B000000750F01C3750B00E500F5F0E50B95F0DE +:100B1000F50B750B00E50BF5F0E50B35F0F50BE586 +:100B20000BF5F0E50F65F0F50FC3750B00E501F56A +:100B3000F0E50B95F0F50B750B00E50BF5F0E50B0B +:100B400035F0F50BE50BF5F0E50F65F0F50FC37526 +:100B50000B00E509F5F0E50B95F0F50B750B00E5DD +:100B60000BF5F0E50B35F0F50BE50BF5F0E50F6552 +:100B7000F0F50FC3750B00E50AF5F0E50B95F0F500 +:100B80000B750B00E50BF5F0E50B35F0F50BE50B00 +:100B9000F5F0E50F65F0F50F750100750900750AB0 +:100BA00000750000E50FF5F0E50045F0F500E50102 +:100BB000F5F0E50045F0F500E509F5F0E50045F054 +:100BC000F500E50AF5F0E50045F0F500E5007002F6 +:100BD0008003020CB40000750000E512F5F0E5009A +:100BE00045F0F500E513F5F0E50045F0F500E514F6 +:100BF000F5F0E50045F0F500E515F5F0E50045F008 +:100C0000F500E50070028003020CA40000750000EE +:100C1000750100750900750A00E500F502E501F5AA +:100C200003E509F504E50AF505E518F515E519F5F7 +:100C300014E51AF513E51BF51275E0032506F58298 +:100C400075E0003507F583E0F51175E0022506F53E +:100C50008275E0003507F583E0F51075E0002506A4 +:100C6000F58275E0003507F583E0F508E508C0E09A +:100C700075E0012506F58275E0003507F583E0F59E +:100C800008E508C0E075E0082506F50675E00035C2 +:100C900007F507E502F582E503F583E504F500E5D0 +:100CA00005F5012200750001750100750900750A3E +:100CB00000020C190000750100C3750000E501F584 +:100CC000F0E51D35F0F501E500F5F0E51C35F0F532 +:100CD00000E500F502E501F582E502F583E0F51295 +:100CE000750101C3750000E501F5F0E51D35F0F56E +:100CF00001E500F5F0E51C35F0F500E500F502E54D +:100D000001F582E502F583E0F513750102C3750074 +:100D100000E501F5F0E51D35F0F501E500F5F0E53C +:100D20001C35F0F500E500F502E501F582E502F578 +:100D300083E0F514750103C3750000E501F5F0E5E6 +:100D40001D35F0F501E500F5F0E51C35F0F500E5A1 +:100D500000F502E501F582E502F583E0F515020BE9 +:100D6000D60000750001750100750900750A0002C2 +:100D70000C190000020D620000020D730000020D4C +:100D80007800750001750100750900750A00020CF4 +:100D9000190000000000000000000000000000003A +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20017.s.expected b/tests/GCCTestSuite/pr20017.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr20017.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20115-1.c b/tests/GCCTestSuite/pr20115-1.c new file mode 100644 index 0000000..60313cd --- /dev/null +++ b/tests/GCCTestSuite/pr20115-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom1" } */ + +extern int foo (void) __attribute__((pure)); + +int bar() +{ + int a = foo (); + a += foo (); + return a; +} + +/* Check that we only have one call to foo. */ +/* { dg-final { scan-tree-dump-times "foo" 1 "dom1" } } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */ diff --git a/tests/GCCTestSuite/pr20115-1.c.expected b/tests/GCCTestSuite/pr20115-1.c.expected new file mode 100644 index 0000000..60313cd --- /dev/null +++ b/tests/GCCTestSuite/pr20115-1.c.expected @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom1" } */ + +extern int foo (void) __attribute__((pure)); + +int bar() +{ + int a = foo (); + a += foo (); + return a; +} + +/* Check that we only have one call to foo. */ +/* { dg-final { scan-tree-dump-times "foo" 1 "dom1" } } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */ diff --git a/tests/GCCTestSuite/pr20115-1.hex.expected b/tests/GCCTestSuite/pr20115-1.hex.expected new file mode 100644 index 0000000..9c64b9f --- /dev/null +++ b/tests/GCCTestSuite/pr20115-1.hex.expected @@ -0,0 +1,26 @@ +:100000000000E506758206C39582F506E50775834F +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0052506F58275E0003507F583E513F038 +:1000500075E0042506F58275E0003507F583E512A5 +:10006000F075E0032506F58275E0003507F583E5B8 +:1000700011F075E0022506F58275E0003507F5837D +:10008000E510F0E582F502E583F503E500F504E50A +:1000900001F505E502F510E503F511E504F512E5B6 +:1000A00005F513E582F502E583F503E500F504E5C2 +:1000B00001F505E502F500E503F501E504F509E5BF +:1000C00005F50AC3750B00E500F5F0E51035F0F510 +:1000D00010E501F5F0E51135F0F511E509F5F0E56C +:1000E0001235F0F512E50AF5F0E51335F0F513E5F4 +:1000F00010F502E511F503E512F504E513F50575B4 +:10010000E0052506F58275E0003507F583E0F51377 +:1001100075E0042506F58275E0003507F583E0F506 +:100120001275E0032506F58275E0003507F583E0DA +:10013000F51175E0022506F58275E0003507F583B7 +:10014000E0F51075E0002506F58275E0003507F54D +:1001500083E0F508E508C0E075E0012506F5827545 +:10016000E0003507F583E0F508E508C0E075E00636 +:100170002506F50675E0003507F507E502F582E589 +:1001800003F583E504F500E505F501220000000014 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20115-1.s.expected b/tests/GCCTestSuite/pr20115-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr20115-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20115.c b/tests/GCCTestSuite/pr20115.c new file mode 100644 index 0000000..cea4b48 --- /dev/null +++ b/tests/GCCTestSuite/pr20115.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int func_pure (void); +void func_other (int); +int global_int; +int func_pure (void) { return global_int; } +void func_other (int a) +{ + global_int = a + 1; +} +int f(void) +{ + int a; + a = func_pure(); + func_other (a); + a = func_pure (); // We were removing this function call + return a; +} +void abort (void); + +int main(void) +{ + global_int = 10; + if (f() != 11) + abort (); + return 0; +} diff --git a/tests/GCCTestSuite/pr20115.c.expected b/tests/GCCTestSuite/pr20115.c.expected new file mode 100644 index 0000000..cea4b48 --- /dev/null +++ b/tests/GCCTestSuite/pr20115.c.expected @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int func_pure (void); +void func_other (int); +int global_int; +int func_pure (void) { return global_int; } +void func_other (int a) +{ + global_int = a + 1; +} +int f(void) +{ + int a; + a = func_pure(); + func_other (a); + a = func_pure (); // We were removing this function call + return a; +} +void abort (void); + +int main(void) +{ + global_int = 10; + if (f() != 11) + abort (); + return 0; +} diff --git a/tests/GCCTestSuite/pr20115.hex.expected b/tests/GCCTestSuite/pr20115.hex.expected new file mode 100644 index 0000000..63c2865 --- /dev/null +++ b/tests/GCCTestSuite/pr20115.hex.expected @@ -0,0 +1,91 @@ +:1000000075812F7506FF7507FF12035402000C005F +:10001000D0E0F518D0E0F519E511F50EE510F50F73 +:10002000900000E582F509900000E583F50A75016E +:1000300000C3750000E501F5F0E50935F0F501E5CF +:1000400000F5F0E50A35F0F500E500F502E501F50B +:1000500082E502F583E0F50B750101C3750000E54B +:1000600001F5F0E50935F0F501E500F5F0E50A35B3 +:10007000F0F500E500F502E501F582E502F583E023 +:10008000F50C750102C3750000E501F5F0E50935D1 +:10009000F0F501E500F5F0E50A35F0F500E500F5CD +:1000A00002E501F582E502F583E0F50D750103C374 +:1000B000750000E501F5F0E50935F0F501E500F51D +:1000C000F0E50A35F0F500E500F502E501F582E519 +:1000D00002F583E0F500E50BF502E50CF503E50D0F +:1000E000F504E500F505E50EF511E50FF510E51948 +:1000F000C0E0E518C0E0E502F582E503F583E5041C +:10010000F500E505F5012200E506758204C3958238 +:10011000F506E5077583009583F507D0E0F519D05E +:10012000E0F51AE514F50DE513F50EE510F5189058 +:100130000000E582F50B900000E583F50C750001E9 +:10014000750100750900750A00C3750F00E500F51B +:10015000F0E51F35F0F500E501F5F0E51E35F0F5A9 +:1001600001E509F5F0E51D35F0F509E50AF5F0E5DD +:100170001C35F0F510750F00C3750A00E50FF5F09A +:10018000E50B35F0F50FE50AF5F0E50C35F0F50A6D +:10019000E500F503E50AF502E50FF582E502F583D2 +:1001A000E503F0750F01C3750000E50FF5F0E50BF1 +:1001B00035F0F50FE500F5F0E50C35F0F50AE50151 +:1001C000F503E50AF502E50FF582E502F583E5039F +:1001D000F0750F02C3750000E50FF5F0E50B35F083 +:1001E000F50FE500F5F0E50C35F0F50AE509F50346 +:1001F000E50AF502E50FF582E502F583E503F07502 +:100200000F03C3750000E50FF5F0E50B35F0F50FB2 +:10021000E500F5F0E50C35F0F50AE510F503E50A23 +:10022000F502E50FF582E502F583E503F0750000C0 +:10023000E500F502E500F503E500F504E500F50548 +:10024000E50DF514E50EF513E518F510E51AC0E017 +:10025000E519C0E075E0042506F50675E0003507F0 +:10026000F507E502F582E503F583E504F500E5050C +:10027000F5012200E506758202C39582F506E507C1 +:100280007583009583F507D0E0F50875E001250634 +:10029000F58275E0003507F583E508F0D0E0F50854 +:1002A00075E0002506F58275E0003507F583E50861 +:1002B000F012000FE582F502E583F503E500F50491 +:1002C000E501F505E502F51FE503F51EE504F51D5D +:1002D000E505F51C12010712000FE582F502E58322 +:1002E000F503E500F504E501F505E502F51FE50375 +:1002F000F51EE504F51DE505F51CE51FF502E51EF7 +:10030000F503E51DF504E51CF50575E0002506F58A +:100310008275E0003507F583E0F508E508C0E07573 +:10032000E0012506F58275E0003507F583E0F50864 +:10033000E508C0E075E0022506F50675E000350722 +:10034000F507E502F582E503F583E504F500E5052B +:10035000F501220000E506758202C39582F506E5E7 +:10036000077583009583F507D0E0F50875E0012552 +:1003700006F58275E0003507F583E508F0D0E0F575 +:100380000875E0002506F58275E0003507F583E580 +:1003900008F0900000E582F50D900000E583F50E71 +:1003A00075090A750A00750B00750C00750100C30C +:1003B000750000E501F5F0E50D35F0F501E500F516 +:1003C000F0E50E35F0F500E509F503E500F502E589 +:1003D00001F582E502F583E503F0750101C37500BF +:1003E00000E501F5F0E50D35F0F501E500F5F0E586 +:1003F0000E35F0F500E50AF503E500F502E501F537 +:1004000082E502F583E503F0750102C3750000E59E +:1004100001F5F0E50D35F0F501E500F5F0E50E35F7 +:10042000F0F500E50BF503E500F502E501F582E5E1 +:1004300002F583E503F0750103C3750000E501F5DE +:10044000F0E50D35F0F501E500F5F0E50E35F0F5D8 +:1004500000E50CF503E500F502E501F582E502F59E +:1004600083E503F0120273E582F502E583F503E507 +:1004700000F504E501F505E502F50BE503F50CE5EE +:1004800004F50DE505F50E75000B75010075090005 +:10049000750A00750F00C3E500F5F0E50B95F0F562 +:1004A00000E500F5F0E50F45F0F50FC3E501F5F0C7 +:1004B000E50C95F0F500E500F5F0E50F45F0F50FDA +:1004C000C3E509F5F0E50D95F0F500E500F5F0E57B +:1004D0000F45F0F50FC3E50AF5F0E50E95F0F500D0 +:1004E000E500F5F0E50F45F0F50F75010075090021 +:1004F000750A00750000E50FF5F0E50045F0F50020 +:10050000E501F5F0E50045F0F500E509F5F0E50059 +:1005100045F0F500E50AF5F0E50045F0F500E500E9 +:100520007002800302058D007500007501007509D9 +:1005300000750A00E500F502E501F503E509F5049B +:10054000E50AF50575E0002506F58275E00035073A +:10055000F583E0F508E508C0E075E0012506F582C1 +:1005600075E0003507F583E0F508E508C0E075E0C3 +:10057000022506F50675E0003507F507E502F58268 +:10058000E503F583E504F500E505F5012200020524 +:100590002800000000000000000000000000000033 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20115.s.expected b/tests/GCCTestSuite/pr20115.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr20115.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20130-1.c b/tests/GCCTestSuite/pr20130-1.c new file mode 100644 index 0000000..9763725 --- /dev/null +++ b/tests/GCCTestSuite/pr20130-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ +int z (int a) { + return a * -1; +} + +int x (int a) { + return -1 * a; +} + +int y (int a) { + return -(-1 * -a); +} +/* { dg-final { scan-tree-dump-times "-a" 3 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/pr20130-1.c.expected b/tests/GCCTestSuite/pr20130-1.c.expected new file mode 100644 index 0000000..9763725 --- /dev/null +++ b/tests/GCCTestSuite/pr20130-1.c.expected @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ +int z (int a) { + return a * -1; +} + +int x (int a) { + return -1 * a; +} + +int y (int a) { + return -(-1 * -a); +} +/* { dg-final { scan-tree-dump-times "-a" 3 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/tests/GCCTestSuite/pr20130-1.hex.expected b/tests/GCCTestSuite/pr20130-1.hex.expected new file mode 100644 index 0000000..d0a84f7 --- /dev/null +++ b/tests/GCCTestSuite/pr20130-1.hex.expected @@ -0,0 +1,183 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5173C +:10004000F518E516F519E515F51AE514F51B75E033 +:10005000052506F58275E0003507F583E513F07593 +:10006000E0042506F58275E0003507F583E512F01A +:1000700075E0032506F58275E0003507F583E51187 +:10008000F075E0022506F58275E0003507F583E599 +:1000900010F0E51FF500E51EF501E51DF509E51C6D +:1000A000F517750D01750C00750B00750A00E50D4F +:1000B000F4F511E50CF4F512E50BF4F513E50AF48B +:1000C000F515D3750A00E50AF5F0E51135F0F511DF +:1000D000E50AF5F0E51235F0F512E50AF5F0E5135D +:1000E00035F0F513E50AF5F0E51535F0F515E50100 +:1000F000F514E509F516750D00750E00750F007500 +:100100001000C3750100E500F5F0E511A4F50CE55C +:1001100000F5F0E511A4E5F0F509E50CF5F0E501D1 +:1001200035F0F501E514F5F0E511A4F50CE514F54D +:10013000F0E511A4E5F0F50AE50CF5F0E50935F078 +:10014000F509E516F5F0E511A4F50CE516F5F0E571 +:1001500011A4E5F0F50BE50CF5F0E50A35F0F50A2C +:10016000E517F5F0E511A4F50CE517F5F0E511A498 +:10017000E5F0F511E50CF5F0E50B35F0F50BC3C333 +:10018000750C00E501F5F0E50D35F0F50DE509F527 +:10019000F0E50E35F0F50EE50AF5F0E50F35F0F572 +:1001A0000FE50BF5F0E51035F0F510C3750900E526 +:1001B00000F5F0E512A4F50CE500F5F0E512A4E574 +:1001C000F0F50AE50CF5F0E50935F0F509E514F56B +:1001D000F0E512A4F50CE514F5F0E512A4E5F0F550 +:1001E0000BE50CF5F0E50A35F0F50AE516F5F0E556 +:1001F00012A4F50CE516F5F0E512A4E5F0F511E50D +:100200000CF5F0E50B35F0F50B750100C3C3750C6B +:1002100000E501F5F0E50D35F0F50DE509F5F0E542 +:100220000E35F0F50EE50AF5F0E50F35F0F50FE5C2 +:100230000BF5F0E51035F0F510C3750A00E500F593 +:10024000F0E513A4F50CE500F5F0E513A4E5F0F5F1 +:100250000BE50CF5F0E50A35F0F50AE514F5F0E5E7 +:1002600013A4F50CE514F5F0E513A4E5F0F511E59C +:100270000CF5F0E50B35F0F50B750100750900C3C1 +:10028000C3750C00E501F5F0E50D35F0F50DE50958 +:10029000F5F0E50E35F0F50EE50AF5F0E50F35F071 +:1002A000F50FE50BF5F0E51035F0F510C3750B0013 +:1002B000E500F5F0E515A4F50CE500F5F0E515A46D +:1002C000E5F0F511E50CF5F0E50B35F0F50B7501F2 +:1002D00000750900750A00C3C3750000E501F5F05B +:1002E000E50D35F0F50DE509F5F0E50E35F0F50E07 +:1002F000E50AF5F0E50F35F0F50FE50BF5F0E51043 +:1003000035F0F510E50DF502E50EF503E50FF50402 +:10031000E510F505E518F517E519F516E51AF515D3 +:10032000E51BF51475E0052506F58275E000350737 +:10033000F583E0F51375E0042506F58275E00035D8 +:1003400007F583E0F51275E0032506F58275E000F8 +:100350003507F583E0F51175E0022506F58275E0B5 +:10036000003507F583E0F51075E0002506F5827588 +:10037000E0003507F583E0F508E508C0E075E00129 +:100380002506F58275E0003507F583E0F508E508F8 +:10039000C0E075E00A2506F50675E0003507F507AB +:1003A000E502F582E503F583E504F500E505F501D1 +:1003B0002200E506758209C39582F506E507758377 +:1003C000009583F507D0E0F50875E0012506F58274 +:1003D00075E0003507F583E508F0D0E0F50875E035 +:1003E000002506F58275E0003507F583E508F0E5A0 +:1003F00016F518E515F519E514F51AE513F51B754D +:10040000E0042506F58275E0003507F583E512F076 +:1004100075E0032506F58275E0003507F583E511E3 +:10042000F075E0022506F58275E0003507F583E5F5 +:1004300010F0E51EF513E51DF515E51CF516750024 +:1004400001750100750900750A00E500F4F500E585 +:1004500001F4F501E509F4F509E50AF4F514D3759D +:100460000A00E50AF5F0E50035F0F500E50AF5F0DB +:10047000E50135F0F501E50AF5F0E50935F0F50996 +:10048000E50AF5F0E51435F0F514750F0075100068 +:10049000751100751200C3750A00E500F5F0E51F3F +:1004A000A4F50EE500F5F0E51FA4E5F0F50BE50E6B +:1004B000F5F0E50A35F0F50AE501F5F0E51FA4F5DC +:1004C0000EE501F5F0E51FA4E5F0F50CE50EF5F0FD +:1004D000E50B35F0F50BE509F5F0E51FA4F50EE5A4 +:1004E00009F5F0E51FA4E5F0F50DE50EF5F0E50CD6 +:1004F00035F0F50CE514F5F0E51FA4F50EE514F55F +:10050000F0E51FA4E5F0F514E50EF5F0E50D35F086 +:10051000F50DC3C3750E00E50AF5F0E50F35F0F5EE +:100520000FE50BF5F0E51035F0F510E50CF5F0E50D +:100530001135F0F511E50DF5F0E51235F0F512C3C2 +:10054000750B00E500F5F0E513A4F50EE500F5F0F8 +:10055000E513A4E5F0F50CE50EF5F0E50B35F0F547 +:100560000BE501F5F0E513A4F50EE501F5F0E51353 +:10057000A4E5F0F50DE50EF5F0E50C35F0F50CE52C +:1005800009F5F0E513A4F50EE509F5F0E513A4E58A +:10059000F0F514E50EF5F0E50D35F0F50D750A00F2 +:1005A000C3C3750900E50AF5F0E50F35F0F50FE571 +:1005B0000BF5F0E51035F0F510E50CF5F0E511352B +:1005C000F0F511E50DF5F0E51235F0F512C3750CF7 +:1005D00000E500F5F0E515A4F50EE500F5F0E515EC +:1005E000A4E5F0F50DE50EF5F0E50C35F0F50CE5BC +:1005F00001F5F0E515A4F50EE501F5F0E515A4E526 +:10060000F0F514E50EF5F0E50D35F0F50D750A0081 +:10061000750B00C3C3750100E50AF5F0E50F35F071 +:10062000F50FE50BF5F0E51035F0F510E50CF5F0FC +:10063000E51135F0F511E50DF5F0E51235F0F5129F +:10064000C3750D00E500F5F0E516A4F50EE500F51F +:10065000F0E516A4E5F0F514E50EF5F0E50D35F03E +:10066000F50D750A00750B00750C00C3C37500000D +:10067000E50AF5F0E50F35F0F50FE50BF5F0E510BF +:1006800035F0F510E50CF5F0E51135F0F511E50D57 +:10069000F5F0E51235F0F512E50FF502E510F5037A +:1006A000E511F504E512F505E518F516E519F5155A +:1006B000E51AF514E51BF51375E0042506F58275BA +:1006C000E0003507F583E0F51275E0032506F582B5 +:1006D00075E0003507F583E0F51175E0022506F5B4 +:1006E0008275E0003507F583E0F51075E00025061A +:1006F000F58275E0003507F583E0F508E508C0E010 +:1007000075E0012506F58275E0003507F583E0F513 +:1007100008E508C0E075E0092506F50675E0003536 +:1007200007F507E502F582E503F583E504F500E545 +:1007300005F5012200E50675820AC39582F506E5F6 +:10074000077583009583F507D0E0F50875E001256E +:1007500006F58275E0003507F583E508F0D0E0F591 +:100760000875E0002506F58275E0003507F583E59C +:1007700008F0E517F518E516F519E515F51AE5146D +:10078000F51B75E0052506F58275E0003507F58354 +:10079000E513F075E0042506F58275E0003507F5F0 +:1007A00083E512F075E0032506F58275E000350754 +:1007B000F583E511F075E0022506F58275E0003558 +:1007C00007F583E510F0E51FF509E51EF50AE51DBF +:1007D000F50BE51CF50C750001750100750E007533 +:1007E0000D00E500F4F500E501F4F501E50EF4F582 +:1007F00014E50DF4F516D3750D00E50DF5F0E500E3 +:1008000035F0F500E50DF5F0E50135F0F501E50D04 +:10081000F5F0E51435F0F514E50DF5F0E51635F0D5 +:10082000F516E509F4F50EE50AF4F50FE50BF4F518 +:1008300015E50CF4F517D3750900E509F5F0E50E9B +:1008400035F0F50EE509F5F0E50F35F0F50FE509A2 +:10085000F5F0E51535F0F515E509F5F0E51735F096 +:10086000F517751000751100751200751300C3752A +:100870000900E500F5F0E50EA4F50DE500F5F0E55D +:100880000EA4E5F0F50AE50DF5F0E50935F0F509FA +:10089000E501F5F0E50EA4F50DE501F5F0E50EA492 +:1008A000E5F0F50BE50DF5F0E50A35F0F50AE51490 +:1008B000F5F0E50EA4F50DE514F5F0E50EA4E5F070 +:1008C000F50CE50DF5F0E50B35F0F50BE516F5F05B +:1008D000E50EA4F50DE516F5F0E50EA4E5F0F50E30 +:1008E000E50DF5F0E50C35F0F50CC3C3750D00E52D +:1008F00009F5F0E51035F0F510E50AF5F0E51135EC +:10090000F0F511E50BF5F0E51235F0F512E50CF513 +:10091000F0E51335F0F513C3750A00E500F5F0E5D1 +:100920000FA4F50DE500F5F0E50FA4E5F0F50BE5F6 +:100930000DF5F0E50A35F0F50AE501F5F0E50FA44F +:10094000F50DE501F5F0E50FA4E5F0F50CE50DF585 +:10095000F0E50B35F0F50BE514F5F0E50FA4F50D1A +:10096000E514F5F0E50FA4E5F0F50EE50DF5F0E57D +:100970000C35F0F50C750900C3C3750D00E509F5DC +:10098000F0E51035F0F510E50AF5F0E51135F0F574 +:1009900011E50BF5F0E51235F0F512E50CF5F0E593 +:1009A0001335F0F513C3750B00E500F5F0E515A45C +:1009B000F50DE500F5F0E515A4E5F0F50CE50DF510 +:1009C000F0E50B35F0F50BE501F5F0E515A4F50DB7 +:1009D000E501F5F0E515A4E5F0F50EE50DF5F0E51A +:1009E0000C35F0F50C750900750A00C3C3750100DC +:1009F000E509F5F0E51035F0F510E50AF5F0E5113B +:100A000035F0F511E50BF5F0E51235F0F512E50CD2 +:100A1000F5F0E51335F0F513C3750C00E500F5F0BE +:100A2000E517A4F50DE500F5F0E517A4E5F0F50EE2 +:100A3000E50DF5F0E50C35F0F50C750900750A00CB +:100A4000750B00C3C3750000E509F5F0E51035F03E +:100A5000F510E50AF5F0E51135F0F511E50BF5F0C7 +:100A6000E51235F0F512E50CF5F0E51335F0F51368 +:100A7000E510F4F500E511F4F501E512F4F509E5EA +:100A800013F4F50BD3750A00E50AF5F0E50035F02F +:100A9000F500E50AF5F0E50135F0F501E50AF5F0B8 +:100AA000E50935F0F509E50AF5F0E50B35F0F50B4C +:100AB000E500F502E501F503E509F504E50BF505AB +:100AC000E518F517E519F516E51AF515E51BF51402 +:100AD00075E0052506F58275E0003507F583E0F53C +:100AE0001375E0042506F58275E0003507F583E00F +:100AF000F51275E0032506F58275E0003507F583EC +:100B0000E0F51175E0022506F58275E0003507F580 +:100B100083E0F51075E0002506F58275E0003507E5 +:100B2000F583E0F508E508C0E075E0012506F582EB +:100B300075E0003507F583E0F508E508C0E075E0ED +:100B40000A2506F50675E0003507F507E502F5828A +:100B5000E503F583E504F500E505F5012200000055 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr20130-1.s.expected b/tests/GCCTestSuite/pr20130-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr20130-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr21085.c b/tests/GCCTestSuite/pr21085.c new file mode 100644 index 0000000..6a51adb --- /dev/null +++ b/tests/GCCTestSuite/pr21085.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* This used to cause excessive use, or a stack overflow, depending on which + came first. */ +void foo (void) +{ + int maxstringlen = 1; + int limit = 0, maxblock = 0, maxblockrem = 0; + maxblockrem = (maxstringlen) % (2147483647 + 1); /* { dg-warning "overflow" } */ +} diff --git a/tests/GCCTestSuite/pr21085.c.expected b/tests/GCCTestSuite/pr21085.c.expected new file mode 100644 index 0000000..6a51adb --- /dev/null +++ b/tests/GCCTestSuite/pr21085.c.expected @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* This used to cause excessive use, or a stack overflow, depending on which + came first. */ +void foo (void) +{ + int maxstringlen = 1; + int limit = 0, maxblock = 0, maxblockrem = 0; + maxblockrem = (maxstringlen) % (2147483647 + 1); /* { dg-warning "overflow" } */ +} diff --git a/tests/GCCTestSuite/pr21085.hex.expected b/tests/GCCTestSuite/pr21085.hex.expected new file mode 100644 index 0000000..ef312fd --- /dev/null +++ b/tests/GCCTestSuite/pr21085.hex.expected @@ -0,0 +1,395 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758217C31E +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0062506F58275E0003507F583E5A7 +:1006600008F0D0E0F50875E0052506F58275E00094 +:100670003507F583E508F075E00E2506F58275E08F +:10068000003507F583E517F075E00D2506F5827551 +:10069000E0003507F583E516F075E00C2506F582D8 +:1006A00075E0003507F583E515F075E00B2506F5D7 +:1006B0008275E0003507F583E514F075E00A25063C +:1006C000F58275E0003507F583E513F075E009253F +:1006D00006F58275E0003507F583E512F075E00850 +:1006E0002506F58275E0003507F583E511F075E024 +:1006F000072506F58275E0003507F583E510F0E57E +:100700001FF511E51BF512E51AF513E519F514753A +:10071000E0042506F58275E0003507F583E511F064 +:1007200075E0032506F58275E0003507F583E51EC3 +:10073000F075E0022506F58275E0003507F583E5E2 +:100740001DF075E0012506F58275E0003507F5839B +:10075000E51CF07515017516007517007508007514 +:10076000E0002506F58275E0003507F583E508F021 +:10077000751900750D00750E00750F00E51CF5105C +:10078000750080E500F5F0E51025F0F510E500F5C1 +:10079000F0E50F25F0F50F750C00751A00751B00BC +:1007A000751F00750B00750A01750001C3E50FF593 +:1007B000F0E51095F0F509E50BF5F0E50B35F0F5F2 +:1007C00009E509F5F0E50055F0F500E500F5F0E57F +:1007D0000C45F0F50C750001C3E50FF5F0E510953B +:1007E000F0F509E50BF5F0E50B35F0F509E510F549 +:1007F000F0E50F95F0F501E50BF5F0E50B35F0F5BB +:1008000001E501F5F0E50945F0F509E50AF5F0E542 +:100810000965F0F509E509F5F0E50055F0F500C3C7 +:10082000E50EF5F0E51D95F0F509E50BF5F0E50BA6 +:1008300035F0F509E509F5F0E50055F0F500E500BE +:10084000F5F0E50C45F0F50C750001C3E50FF5F08A +:10085000E51095F0F509E50BF5F0E50B35F0F50938 +:10086000E510F5F0E50F95F0F501E50BF5F0E50B7A +:1008700035F0F501E501F5F0E50945F0F509E50A82 +:10088000F5F0E50965F0F509E509F5F0E50055F045 +:10089000F500C3E50EF5F0E51D95F0F509E50BF55E +:1008A000F0E50B35F0F509E51DF5F0E50E95F0F5F1 +:1008B00001E50BF5F0E50B35F0F501E501F5F0E5A7 +:1008C0000945F0F509E50AF5F0E50965F0F509E5F2 +:1008D00009F5F0E50055F0F500C3E50DF5F0E51E6E +:1008E00095F0F509E50BF5F0E50B35F0F509E509AF +:1008F000F5F0E50055F0F500E500F5F0E50C45F004 +:10090000F50C750001C3E50FF5F0E51095F0F5095C +:10091000E50BF5F0E50B35F0F509E510F5F0E50F21 +:1009200095F0F501E50BF5F0E50B35F0F501E50186 +:10093000F5F0E50945F0F509E50AF5F0E50965F09A +:10094000F509E509F5F0E50055F0F500C3E50EF50C +:10095000F0E51D95F0F509E50BF5F0E50B35F0F543 +:1009600009E51DF5F0E50E95F0F501E50BF5F0E56F +:100970000B35F0F501E501F5F0E50945F0F509E580 +:100980000AF5F0E50965F0F509E509F5F0E500552A +:10099000F0F500C3E50DF5F0E51E95F0F509E50B62 +:1009A000F5F0E50B35F0F509E51EF5F0E50D95F0F0 +:1009B000F501E50BF5F0E50B35F0F501E501F5F096 +:1009C000E50945F0F509E50AF5F0E50965F0F509F1 +:1009D000E509F5F0E50055F0F500C3E519F5F0E59A +:1009E0001195F0F509E50BF5F0E50B35F0F509E5A6 +:1009F00009F5F0E50055F0F500E500F5F0E50C45EA +:100A0000F0F50CE51AF501E51BF509E51FF50A758A +:100A10000000E50CF5F0E50045F0F500E501F5F026 +:100A2000E50045F0F500E509F5F0E50045F0F500D5 +:100A3000E50AF5F0E50045F0F500E50070028003F9 +:100A400002116B00751900750D00750E00750F0011 +:100A5000E512F51BE513F51AE514F510E518F51187 +:100A6000750080E500F5F0E51125F0F511E500F5DC +:100A7000F0E50F25F0F50F750C00751C00751D00D5 +:100A8000751E00750B00750A01750001C3E50FF5B1 +:100A9000F0E51195F0F509E50BF5F0E50B35F0F50E +:100AA00009E509F5F0E50055F0F500E500F5F0E59C +:100AB0000C45F0F50C750001C3E50FF5F0E5119557 +:100AC000F0F509E50BF5F0E50B35F0F509E511F565 +:100AD000F0E50F95F0F501E50BF5F0E50B35F0F5D8 +:100AE00001E501F5F0E50945F0F509E50AF5F0E560 +:100AF0000965F0F509E509F5F0E50055F0F500C3E5 +:100B0000E50EF5F0E51095F0F509E50BF5F0E50BD0 +:100B100035F0F509E509F5F0E50055F0F500E500DB +:100B2000F5F0E50C45F0F50C750001C3E50FF5F0A7 +:100B3000E51195F0F509E50BF5F0E50B35F0F50954 +:100B4000E511F5F0E50F95F0F501E50BF5F0E50B96 +:100B500035F0F501E501F5F0E50945F0F509E50A9F +:100B6000F5F0E50965F0F509E509F5F0E50055F062 +:100B7000F500C3E50EF5F0E51095F0F509E50BF588 +:100B8000F0E50B35F0F509E510F5F0E50E95F0F51B +:100B900001E50BF5F0E50B35F0F501E501F5F0E5C4 +:100BA0000945F0F509E50AF5F0E50965F0F509E50F +:100BB00009F5F0E50055F0F500C3E50DF5F0E51A8F +:100BC00095F0F509E50BF5F0E50B35F0F509E509CC +:100BD000F5F0E50055F0F500E500F5F0E50C45F021 +:100BE000F50C750001C3E50FF5F0E51195F0F50979 +:100BF000E50BF5F0E50B35F0F509E511F5F0E50F3E +:100C000095F0F501E50BF5F0E50B35F0F501E501A3 +:100C1000F5F0E50945F0F509E50AF5F0E50965F0B7 +:100C2000F509E509F5F0E50055F0F500C3E50EF529 +:100C3000F0E51095F0F509E50BF5F0E50B35F0F56D +:100C400009E510F5F0E50E95F0F501E50BF5F0E599 +:100C50000B35F0F501E501F5F0E50945F0F509E59D +:100C60000AF5F0E50965F0F509E509F5F0E5005547 +:100C7000F0F500C3E50DF5F0E51A95F0F509E50B83 +:100C8000F5F0E50B35F0F509E51AF5F0E50D95F011 +:100C9000F501E50BF5F0E50B35F0F501E501F5F0B3 +:100CA000E50945F0F509E50AF5F0E50965F0F5090E +:100CB000E509F5F0E50055F0F500C3E519F5F0E5B7 +:100CC0001B95F0F509E50BF5F0E50B35F0F509E5B9 +:100CD00009F5F0E50055F0F500E500F5F0E50C4507 +:100CE000F0F50CE51CF501E51DF509E51EF50A75A5 +:100CF0000000E50CF5F0E50045F0F500E501F5F044 +:100D0000E50045F0F500E509F5F0E50045F0F500F2 +:100D1000E50AF5F0E50045F0F500E5007002800316 +:100D20000210A30075E0042506F58275E000350782 +:100D3000F583E0F51F75E0032506F58275E00035C3 +:100D400007F583E0F51E75E0022506F58275E000E3 +:100D50003507F583E0F51D75E0012506F58275E0A0 +:100D6000003507F583E0F51CE512F51BE513F51AD0 +:100D7000E514F519120000E582F502E583F503E5B7 +:100D800000F504E501F505E502F511E503F512E5C9 +:100D900004F513E505F514E515F500E516F515E57B +:100DA00017F51675E0002506F58275E0003507F5A4 +:100DB00083E0F517750D00750E00750F00751000B6 +:100DC000C3750100E500F5F0E511A4F50CE500F5AB +:100DD000F0E511A4E5F0F509E50CF5F0E50135F0D5 +:100DE000F501E515F5F0E511A4F50CE515F5F0E5CF +:100DF00011A4E5F0F50AE50CF5F0E50935F0F50983 +:100E0000E516F5F0E511A4F50CE516F5F0E511A4ED +:100E1000E5F0F50BE50CF5F0E50A35F0F50AE51718 +:100E2000F5F0E511A4F50CE517F5F0E511A4E5F0F2 +:100E3000F511E50CF5F0E50B35F0F50BC3C3750CBA +:100E400000E501F5F0E50D35F0F50DE509F5F0E506 +:100E50000E35F0F50EE50AF5F0E50F35F0F50FE586 +:100E60000BF5F0E51035F0F510C3750900E500F558 +:100E7000F0E512A4F50CE500F5F0E512A4E5F0F5B7 +:100E80000AE50CF5F0E50935F0F509E515F5F0E5AD +:100E900012A4F50CE515F5F0E512A4E5F0F50BE567 +:100EA0000CF5F0E50A35F0F50AE516F5F0E512A4C3 +:100EB000F50CE516F5F0E512A4E5F0F511E50CF5F5 +:100EC000F0E50B35F0F50B750100C3C3750C00E5BB +:100ED00001F5F0E50D35F0F50DE509F5F0E50E3518 +:100EE000F0F50EE50AF5F0E50F35F0F50FE50BF539 +:100EF000F0E51035F0F510C3750A00E500F5F0E5F2 +:100F000013A4F50CE500F5F0E513A4E5F0F50BE509 +:100F10000CF5F0E50A35F0F50AE515F5F0E513A452 +:100F2000F50CE515F5F0E513A4E5F0F511E50CF584 +:100F3000F0E50B35F0F50B750100750900C3C375BD +:100F40000C00E501F5F0E50D35F0F50DE509F5F0DE +:100F5000E50E35F0F50EE50AF5F0E50F35F0F50F85 +:100F6000E50BF5F0E51035F0F510C3750B00E50065 +:100F7000F5F0E514A4F50CE500F5F0E514A4E5F0B2 +:100F8000F511E50CF5F0E50B35F0F50B7501007585 +:100F90000900750A00C3C3750000E501F5F0E50D11 +:100FA00035F0F50DE509F5F0E50E35F0F50EE50A3D +:100FB000F5F0E50F35F0F50FE50BF5F0E51035F040 +:100FC000F510E50DF502E50EF503E50FF504E51066 +:100FD000F50575E00E2506F58275E0003507F58309 +:100FE000E0F51775E00D2506F58275E0003507F58B +:100FF00083E0F51675E00C2506F58275E0003507EF +:10100000F583E0F51575E00B2506F58275E00035F2 +:1010100007F583E0F51475E00A2506F58275E00012 +:101020003507F583E0F51375E0092506F58275E0CF +:10103000003507F583E0F51275E0082506F58275A1 +:10104000E0003507F583E0F51175E0072506F58228 +:1010500075E0003507F583E0F51075E0052506F528 +:101060008275E0003507F583E0F508E508C0E07516 +:10107000E0062506F58275E0003507F583E0F50802 +:10108000E508C0E075E0172506F50675E0003507B0 +:10109000F507E502F582E503F583E504F500E505CE +:1010A000F5012200E512F4F512E513F4F513E51449 +:1010B000F4F514E518F4F518D3750000E500F5F023 +:1010C000E51235F0F512E500F5F0E51335F0F5130E +:1010D000E500F5F0E51435F0F514E500F5F0E51858 +:1010E00035F0F518E515F4F515E516F4F516E517E0 +:1010F000F4F51775E0002506F58275E0003507F573 +:1011000083E0F508E508F4F50875E0002506F582AA +:1011100075E0003507F583E508F0D3750000E500BC +:10112000F5F0E51535F0F515E500F5F0E51635F0C7 +:10113000F516E500F5F0E51735F0F517E500F5F0E3 +:1011400075E0002506F58275E0003507F583E0F5CA +:1011500008E50835F0F50875E0002506F58275E02C +:10116000003507F583E508F0020D2400E511F4F5DC +:1011700000E51EF4F501E51DF4F509E51CF4F50B99 +:10118000D3750A00E50AF5F0E50035F0F500E50A4B +:10119000F5F0E50135F0F501E50AF5F0E50935F082 +:1011A000F509E50AF5F0E50B35F0F50B75E00425DA +:1011B00006F58275E0003507F583E500F075E0037C +:1011C0002506F58275E0003507F583E501F075E049 +:1011D000022506F58275E0003507F583E509F0750F +:1011E000E0012506F58275E0003507F583E50BF093 +:1011F000E515F4F515E516F4F516E517F4F517758C +:10120000E0002506F58275E0003507F583E0F50876 +:10121000E508F4F50875E0002506F58275E000356F +:1012200007F583E508F0D3750000E500F5F0E51556 +:1012300035F0F515E500F5F0E51635F0F516E500A5 +:10124000F5F0E51735F0F517E500F5F075E0002548 +:1012500006F58275E0003507F583E0F508E5083509 +:10126000F0F50875E0002506F58275E0003507F514 +:1012700083E508F0020A4400E506758216C39582EC +:10128000F506E5077583009583F507D0E0F5087549 +:10129000E0052506F58275E0003507F583E508F0E1 +:1012A000D0E0F50875E0042506F58275E000350705 +:1012B000F583E508F075E00D2506F58275E000354B +:1012C00007F583E517F075E00C2506F58275E0005B +:1012D0003507F583E516F075E00B2506F58275E018 +:1012E000003507F583E515F075E00A2506F58275EA +:1012F000E0003507F583E514F075E0092506F58271 +:1013000075E0003507F583E513F075E0082506F56F +:101310008275E0003507F583E512F075E0072506D4 +:10132000F58275E0003507F583E511F075E00625D7 +:1013300006F58275E0003507F583E510F075E003EA +:101340002506F58275E0003507F583E51FF075E0A9 +:10135000022506F58275E0003507F583E51EF07578 +:10136000E0012506F58275E0003507F583E51DF0FF +:1013700075E0002506F58275E0003507F583E51C6C +:10138000F0E51BF514E51AF515E519F516E518F560 +:101390001775E0032506F58275E0003507F583E053 +:1013A000F51F75E0022506F58275E0003507F58327 +:1013B000E0F51E75E0012506F58275E0003507F5BC +:1013C00083E0F51D75E0002506F58275E000350720 +:1013D000F583E0F51CE514F51BE515F51AE516F5A2 +:1013E00019E517F518120639E582F502E583F503CC +:1013F000E500F504E501F505E502F500E503F50175 +:10140000E504F509E505F50A75100075110075127A +:1014100000751300C3750B00E500F5F0E514A4F5A5 +:101420000FE500F5F0E514A4E5F0F50CE50FF5F097 +:10143000E50B35F0F50BE501F5F0E514A4F50FE546 +:1014400001F5F0E514A4E5F0F50DE50FF5F0E50C78 +:1014500035F0F50CE509F5F0E514A4F50FE509F50F +:10146000F0E514A4E5F0F50EE50FF5F0E50D35F027 +:10147000F50DE50AF5F0E514A4F50FE50AF5F0E53C +:1014800014A4E5F0F50AE50FF5F0E50E35F0F50EDC +:10149000C3C3750A00E50BF5F0E51035F0F510E56E +:1014A0000CF5F0E51135F0F511E50DF5F0E5123527 +:1014B000F0F512E50EF5F0E51335F0F513C3750CF4 +:1014C00000E500F5F0E515A4F50FE500F5F0E515EC +:1014D000A4E5F0F50DE50FF5F0E50C35F0F50CE5BC +:1014E00001F5F0E515A4F50FE501F5F0E515A4E526 +:1014F000F0F50EE50FF5F0E50D35F0F50DE509F524 +:10150000F0E515A4F50FE509F5F0E515A4E5F0F50E +:101510000AE50FF5F0E50E35F0F50E750B00C3C3C7 +:10152000750900E50BF5F0E51035F0F510E50CF563 +:10153000F0E51135F0F511E50DF5F0E51235F0F5B2 +:1015400012E50EF5F0E51335F0F513C3750D00E562 +:1015500000F5F0E516A4F50FE500F5F0E516A4E5B5 +:10156000F0F50EE50FF5F0E50D35F0F50DE501F5BB +:10157000F0E516A4F50FE501F5F0E516A4E5F0F5A4 +:101580000AE50FF5F0E50E35F0F50E750B00750C5C +:1015900000C3C3750100E50BF5F0E51035F0F5105B +:1015A000E50CF5F0E51135F0F511E50DF5F0E51276 +:1015B00035F0F512E50EF5F0E51335F0F513C375CA +:1015C0000E00E500F5F0E517A4F50FE500F5F0E5F0 +:1015D00017A4E5F0F50AE50FF5F0E50E35F0F50E88 +:1015E000750B00750C00750D00C3C3750000E50B8D +:1015F000F5F0E51035F0F510E50CF5F0E51135F0F6 +:10160000F511E50DF5F0E51235F0F512E50EF5F002 +:10161000E51335F0F513C3E510F5F075E003250685 +:10162000F58275E0003507F583E0F508E50895F0EB +:10163000F500E511F5F075E0022506F58275E0008C +:101640003507F583E0F508E50895F0F501E512F5B5 +:10165000F075E0012506F58275E0003507F583E0B9 +:10166000F508E50895F0F509E513F5F075E00025B6 +:1016700006F58275E0003507F583E0F508E5089585 +:10168000F0F50AE500F502E501F503E509F504E5E5 +:101690000AF50575E00D2506F58275E0003507F5BC +:1016A00083E0F51775E00C2506F58275E000350737 +:1016B000F583E0F51675E00B2506F58275E000353B +:1016C00007F583E0F51575E00A2506F58275E0005B +:1016D0003507F583E0F51475E0092506F58275E018 +:1016E000003507F583E0F51375E0082506F58275EA +:1016F000E0003507F583E0F51275E0072506F58271 +:1017000075E0003507F583E0F51175E0062506F56F +:101710008275E0003507F583E0F51075E0042506D5 +:10172000F58275E0003507F583E0F508E508C0E0CF +:1017300075E0052506F58275E0003507F583E0F5CF +:1017400008E508C0E075E0162506F50675E00035E9 +:1017500007F507E502F582E503F583E504F500E505 +:1017600005F5012200E506758202C39582F506E5BE +:10177000077583009583F507D0E0F50875E001252E +:1017800006F58275E0003507F583E508F0D0E0F551 +:101790000875E0002506F58275E0003507F583E55C +:1017A00008F0751F01751E00751D00751C00750A77 +:1017B00001750900750100750000E50AF4F50EE5F4 +:1017C00009F4F50CE501F4F50AE500F4F501D3752B +:1017D0000000E500F5F0E50E35F0F50EE500F5F05A +:1017E000E50C35F0F50CE500F5F0E50A35F0F50A05 +:1017F000E500F5F0E50135F0F501750D01750B001B +:10180000750900750000C3750F00E50DF5F0E50ED4 +:1018100035F0F51BE50BF5F0E50C35F0F51AE509AB +:10182000F5F0E50A35F0F519E500F5F0E50135F0DC +:10183000F518121277750000E500F502E500F503D2 +:10184000E500F504E500F50575E0002506F582756F +:10185000E0003507F583E0F508E508C0E075E00134 +:101860002506F58275E0003507F583E0F508E50803 +:10187000C0E075E0022506F50675E0003507F507BE +:10188000E502F582E503F583E504F500E505F501DC +:101890002200000000000000000000000000000026 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr21085.s.expected b/tests/GCCTestSuite/pr21085.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr21085.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22308-1.c b/tests/GCCTestSuite/pr22308-1.c new file mode 100644 index 0000000..bcbb294 --- /dev/null +++ b/tests/GCCTestSuite/pr22308-1.c @@ -0,0 +1,13 @@ +/* Bug 22308: C_TYPE_FIELDS_READONLY not updated on type variants. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct foo s; +volatile struct foo t; +struct foo { const int z; }; + +void +bar (void) +{ + t = s; /* { dg-error "error: assignment of read-only variable 't'" } */ +} diff --git a/tests/GCCTestSuite/pr22308-1.c.expected b/tests/GCCTestSuite/pr22308-1.c.expected new file mode 100644 index 0000000..bcbb294 --- /dev/null +++ b/tests/GCCTestSuite/pr22308-1.c.expected @@ -0,0 +1,13 @@ +/* Bug 22308: C_TYPE_FIELDS_READONLY not updated on type variants. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct foo s; +volatile struct foo t; +struct foo { const int z; }; + +void +bar (void) +{ + t = s; /* { dg-error "error: assignment of read-only variable 't'" } */ +} diff --git a/tests/GCCTestSuite/pr22308-1.hex.expected b/tests/GCCTestSuite/pr22308-1.hex.expected new file mode 100644 index 0000000..0ff08c4 --- /dev/null +++ b/tests/GCCTestSuite/pr22308-1.hex.expected @@ -0,0 +1,32 @@ +:1000000000D0E0F518D0E0F519900004E582F50A7B +:10001000900004E583F501750900C3750000E5094A +:10002000F5F0E50A35F0F50EE500F5F0E50135F0FF +:10003000F50F900000E582F509900000E583F50AD0 +:10004000750100C3750000E501F5F0E50935F0F52F +:1000500001E500F5F0E50A35F0F500E501F509E503 +:1000600000F50A750100C3750000E501F5F0E5092A +:1000700035F0F501E500F5F0E50A35F0F500E500AD +:10008000F502E501F582E502F583E0F50B75010166 +:10009000C3750000E501F5F0E50935F0F501E5006F +:1000A000F5F0E50A35F0F500E500F502E501F58229 +:1000B000E502F583E0F50C750102C3750000E5016A +:1000C000F5F0E50935F0F501E500F5F0E50A35F064 +:1000D000F500E500F502E501F582E502F583E0F5BE +:1000E0000D750103C3750000E501F5F0E50935F074 +:1000F000F501E500F5F0E50A35F0F500E500F5025B +:10010000E501F582E502F583E0F509750100C375A7 +:100110000000E501F5F0E50E35F0F501E500F5F03C +:10012000E50F35F0F500E50BF503E500F502E50117 +:10013000F582E502F583E503F0750101C375000062 +:10014000E501F5F0E50E35F0F501E500F5F0E50F18 +:1001500035F0F500E50CF503E500F502E501F58263 +:10016000E502F583E503F0750102C3750000E501C2 +:10017000F5F0E50E35F0F501E500F5F0E50F35F0A9 +:10018000F500E50DF503E500F502E501F582E50270 +:10019000F583E503F0750103C3750000E501F5F093 +:1001A000E50E35F0F501E500F5F0E50F35F0F50069 +:1001B000E509F503E500F502E501F582E502F583C1 +:1001C000E503F0750000E500F502E500F503E50044 +:1001D000F504E500F505E519C0E0E518C0E0E50225 +:1001E000F582E503F583E504F500E505F501220058 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22308-1.s.expected b/tests/GCCTestSuite/pr22308-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr22308-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22311-1.c b/tests/GCCTestSuite/pr22311-1.c new file mode 100644 index 0000000..4eec5ce --- /dev/null +++ b/tests/GCCTestSuite/pr22311-1.c @@ -0,0 +1,6 @@ +/* Bug 22311: ICE with -fshort-enums on shortened operations. */ +/* { dg-do compile } */ +/* { dg-options "-fshort-enums" } */ + +typedef enum { A = 1 } E; +void f(E e, unsigned char c) { c |= e; } diff --git a/tests/GCCTestSuite/pr22311-1.c.expected b/tests/GCCTestSuite/pr22311-1.c.expected new file mode 100644 index 0000000..4eec5ce --- /dev/null +++ b/tests/GCCTestSuite/pr22311-1.c.expected @@ -0,0 +1,6 @@ +/* Bug 22311: ICE with -fshort-enums on shortened operations. */ +/* { dg-do compile } */ +/* { dg-options "-fshort-enums" } */ + +typedef enum { A = 1 } E; +void f(E e, unsigned char c) { c |= e; } diff --git a/tests/GCCTestSuite/pr22311-1.hex.expected b/tests/GCCTestSuite/pr22311-1.hex.expected new file mode 100644 index 0000000..1e1030b --- /dev/null +++ b/tests/GCCTestSuite/pr22311-1.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758205C39582F506E50775830050 +:100010009583F507D0E0F500D0E0F501C375090040 +:10002000E509F502E509F503E509F504E509F50536 +:10003000E501C0E0E500C0E075E0052506F50675C0 +:10004000E0003507F507E502F582E503F583E504F1 +:10005000F500E505F50122000000000000000000A9 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22311-1.s.expected b/tests/GCCTestSuite/pr22311-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr22311-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22329.c b/tests/GCCTestSuite/pr22329.c new file mode 100644 index 0000000..94e32d6 --- /dev/null +++ b/tests/GCCTestSuite/pr22329.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +int f(int i) +{ + int k = 0; + if (i == 0) + k = i == 0; + return k; +} diff --git a/tests/GCCTestSuite/pr22329.c.expected b/tests/GCCTestSuite/pr22329.c.expected new file mode 100644 index 0000000..94e32d6 --- /dev/null +++ b/tests/GCCTestSuite/pr22329.c.expected @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +int f(int i) +{ + int k = 0; + if (i == 0) + k = i == 0; + return k; +} diff --git a/tests/GCCTestSuite/pr22329.hex.expected b/tests/GCCTestSuite/pr22329.hex.expected new file mode 100644 index 0000000..a708d0f --- /dev/null +++ b/tests/GCCTestSuite/pr22329.hex.expected @@ -0,0 +1,45 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F519D0E0F51AE510F5184D +:10002000750C00750D00750E00750F0075000075DC +:100030000100750900750A00750B00C3E500F5F0B5 +:10004000E51F95F0F500E500F5F0E50B45F0F50B43 +:10005000C3E501F5F0E51E95F0F500E500F5F0E5E6 +:100060000B45F0F50BC3E509F5F0E51D95F0F5003E +:10007000E500F5F0E50B45F0F50BC3E50AF5F0E515 +:100080001C95F0F500E500F5F0E50B45F0F50B7576 +:100090000000750100750900E50BF510750B01C333 +:1000A000750A00E510F5F0E50A95F0F50A750A0005 +:1000B000E50AF5F0E50A35F0F50AE50AF5F0E50B95 +:1000C00065F0F50BC3750A00E500F5F0E50A95F05B +:1000D000F50A750A00E50AF5F0E50A35F0F50AE5D6 +:1000E0000AF5F0E50B65F0F50BC3750A00E501F5BF +:1000F000F0E50A95F0F50A750A00E50AF5F0E50A5B +:1001000035F0F50AE50AF5F0E50B65F0F50BC3757A +:100110000A00E509F5F0E50A95F0F50A750A00E52B +:100120000AF5F0E50A35F0F50AE50AF5F0E50B65A4 +:10013000F0F50B750000750100750900750A00E502 +:100140000BF5F0E50A45F0F50AE500F5F0E50A459E +:10015000F0F50AE501F5F0E50A45F0F50AE509F5DF +:10016000F0E50A45F0F50AE50A700280030201ACE9 +:1001700000E50CF502E50DF503E50EF504E50FF5D8 +:1001800005E518F510E51AC0E0E519C0E075E004D2 +:100190002506F50675E0003507F507E502F582E569 +:1001A00003F583E504F500E505F50122007500007F +:1001B000750100750900750A00750C00C3E500F5AE +:1001C000F0E51F95F0F500E500F5F0E50C45F0F5DC +:1001D0000CC3E501F5F0E51E95F0F500E500F5F03E +:1001E000E50C45F0F50CC3E509F5F0E51D95F0F5D6 +:1001F00000E500F5F0E50C45F0F50CC3E50AF5F077 +:10020000E51C95F0F500E500F5F0E50C45F0F50C82 +:10021000750D00750E00750F00E50CF500750C01ED +:10022000C3750100E500F5F0E50195F0F5017501F4 +:1002300000E501F5F0E50135F0F501E501F5F0E542 +:100240000C65F0F50CC3750100E50DF5F0E50195C1 +:10025000F0F501750100E501F5F0E50135F0F50176 +:10026000E501F5F0E50C65F0F50CC3750100E50E50 +:10027000F5F0E50195F0F501750100E501F5F0E512 +:100280000135F0F501E501F5F0E50C65F0F50CC37D +:10029000750100E50FF5F0E50195F0F50175010038 +:1002A000E501F5F0E50135F0F501E501F5F0E50CC6 +:1002B00065F0F50C750D00750E00750F00020171EB +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22329.s.expected b/tests/GCCTestSuite/pr22329.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr22329.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22335-1.c b/tests/GCCTestSuite/pr22335-1.c new file mode 100644 index 0000000..a2a760b --- /dev/null +++ b/tests/GCCTestSuite/pr22335-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdelete-null-pointer-checks" } */ +int t(int *a) +{ + int i; + *a = 1; + i = a == 0; + return i; +} + diff --git a/tests/GCCTestSuite/pr22335-1.c.expected b/tests/GCCTestSuite/pr22335-1.c.expected new file mode 100644 index 0000000..a2a760b --- /dev/null +++ b/tests/GCCTestSuite/pr22335-1.c.expected @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdelete-null-pointer-checks" } */ +int t(int *a) +{ + int i; + *a = 1; + i = a == 0; + return i; +} + diff --git a/tests/GCCTestSuite/pr22335-1.hex.expected b/tests/GCCTestSuite/pr22335-1.hex.expected new file mode 100644 index 0000000..8b84783 --- /dev/null +++ b/tests/GCCTestSuite/pr22335-1.hex.expected @@ -0,0 +1,35 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F518D0E0F519E512F50D58 +:10002000E511F50EE510F50F750901750A00750B60 +:1000300000750C00750100C3750000E501F5F0E5E1 +:100040001F35F0F501E500F5F0E51E35F0F500E5AA +:1000500009F503E500F502E501F582E502F583E522 +:1000600003F0750101C3750000E501F5F0E51F35EA +:10007000F0F501E500F5F0E51E35F0F500E50AF5CF +:1000800003E500F502E501F582E502F583E503F0FD +:10009000750102C3750000E501F5F0E51F35F0F5C7 +:1000A00001E500F5F0E51E35F0F500E50BF503E59B +:1000B00000F502E501F582E502F583E503F075013F +:1000C00003C3750000E501F5F0E51F35F0F501E526 +:1000D00000F5F0E51E35F0F500E50CF503E500F55B +:1000E00002E501F582E502F583E503F07509007587 +:1000F0000A00E51FF500E51EF501750C00C3E509D2 +:10010000F5F0E50095F0F500E500F5F0E50C45F0BB +:10011000F50CC3E50AF5F0E50195F0F500E500F50D +:10012000F0E50C45F0F50C750100750900750A0045 +:10013000E50CF500750C01C3750B00E500F5F0E565 +:100140000B95F0F50B750B00E50BF5F0E50B35F0B5 +:10015000F50BE50BF5F0E50C65F0F50CC3750B0040 +:10016000E501F5F0E50B95F0F50B750B00E50BF5EA +:10017000F0E50B35F0F50BE50BF5F0E50C65F0F56A +:100180000CC3750B00E509F5F0E50B95F0F50B7563 +:100190000B00E50BF5F0E50B35F0F50BE50BF5F095 +:1001A000E50C65F0F50CC3750B00E50AF5F0E50B01 +:1001B00095F0F50B750B00E50BF5F0E50B35F0F55B +:1001C0000BE50BF5F0E50C65F0F50C750100750914 +:1001D00000750A00E50CF502E501F503E509F504F3 +:1001E000E50AF505E50DF512E50EF511E50FF5103B +:1001F000E519C0E0E518C0E075E0022506F50675D2 +:10020000E0003507F507E502F582E503F583E5042F +:10021000F500E505F50122000000000000000000E7 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22335-1.s.expected b/tests/GCCTestSuite/pr22335-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr22335-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22335-2.c b/tests/GCCTestSuite/pr22335-2.c new file mode 100644 index 0000000..afba955 --- /dev/null +++ b/tests/GCCTestSuite/pr22335-2.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +void abort(void) __attribute__((__noreturn__)); +typedef struct { + int container; +} edge_iterator; +struct ls_expr +{ + int index; + int stores; + struct ls_expr * next; +}; +struct ls_expr * pre_ldst_mems; +edge_iterator ei; +void +store_motion (void) +{ + struct ls_expr * ptr, **prev_next_ptr_ptr; + edge_iterator ei1; + edge_iterator ei2; + int a = ptr != ((void *)0); + for (ptr = pre_ldst_mems, prev_next_ptr_ptr = &pre_ldst_mems; + ptr != ((void *)0); + ptr = *prev_next_ptr_ptr) + if (!((ptr)->stores)) + *prev_next_ptr_ptr = ptr->next; + else + prev_next_ptr_ptr = &ptr->next; + + for (ptr = pre_ldst_mems; ptr != 0; ptr = ptr->next) + ; + ei1 = ei; + ei2 = ei1; + if (!ei2.container) + abort (); + ei2 = ei1; + if (!ei2.container) + abort (); +} diff --git a/tests/GCCTestSuite/pr22335-2.c.expected b/tests/GCCTestSuite/pr22335-2.c.expected new file mode 100644 index 0000000..afba955 --- /dev/null +++ b/tests/GCCTestSuite/pr22335-2.c.expected @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +void abort(void) __attribute__((__noreturn__)); +typedef struct { + int container; +} edge_iterator; +struct ls_expr +{ + int index; + int stores; + struct ls_expr * next; +}; +struct ls_expr * pre_ldst_mems; +edge_iterator ei; +void +store_motion (void) +{ + struct ls_expr * ptr, **prev_next_ptr_ptr; + edge_iterator ei1; + edge_iterator ei2; + int a = ptr != ((void *)0); + for (ptr = pre_ldst_mems, prev_next_ptr_ptr = &pre_ldst_mems; + ptr != ((void *)0); + ptr = *prev_next_ptr_ptr) + if (!((ptr)->stores)) + *prev_next_ptr_ptr = ptr->next; + else + prev_next_ptr_ptr = &ptr->next; + + for (ptr = pre_ldst_mems; ptr != 0; ptr = ptr->next) + ; + ei1 = ei; + ei2 = ei1; + if (!ei2.container) + abort (); + ei2 = ei1; + if (!ei2.container) + abort (); +} diff --git a/tests/GCCTestSuite/pr22335-2.hex.expected b/tests/GCCTestSuite/pr22335-2.hex.expected new file mode 100644 index 0000000..129f8ac --- /dev/null +++ b/tests/GCCTestSuite/pr22335-2.hex.expected @@ -0,0 +1,263 @@ +:100000000000E50675820CC39582F506E507758349 +:10001000009583F507D0E0F50875E0092506F5821F +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000082506F58275E0003507F583E508F075BB +:10004000E00B2506F58275E0003507F583E511F034 +:1000500075E00A2506F58275E0003507F583E510A1 +:10006000F0C3C3900000E582F509900000E583F538 +:100070000A750100C3750000E501F5F0E50935F0EA +:10008000F501E500F5F0E50A35F0F500E500F502CB +:10009000E501F582E502F583E0F50E750101C37512 +:1000A0000000E501F5F0E50935F0F501E500F5F0B2 +:1000B000E50A35F0F500E500F502E501F582E50217 +:1000C000F583E0F50F900000E582F510900000E563 +:1000D00083F511750100750900750000C3E501F590 +:1000E000F0E50E95F0F501E501F5F0E50045F0F5D8 +:1000F00000C3E509F5F0E50F95F0F501E501F5F030 +:10010000E50045F0F500750100750900750A0075F8 +:100110000C01C3750B00E500F5F0E50B95F0F50B50 +:10012000750B00E50BF5F0E50B35F0F50BE50BF580 +:10013000F0E50C65F0F50CC3750B00E501F5F0E595 +:100140000B95F0F50B750B00E50BF5F0E50B35F0B5 +:10015000F50BE50BF5F0E50C65F0F50CC3750B0040 +:10016000E509F5F0E50B95F0F50B750B00E50BF5E2 +:10017000F0E50B35F0F50BE50BF5F0E50C65F0F56A +:100180000CC3750B00E50AF5F0E50B95F0F50B7562 +:100190000B00E50BF5F0E50B35F0F50BE50BF5F095 +:1001A000E50C65F0F50C750100750900750A007520 +:1001B0000000E50CF5F0E50045F0F500E501F5F08F +:1001C000E50045F0F500E509F5F0E50045F0F5003E +:1001D000E50AF5F0E50045F0F500E5007002800362 +:1001E0000204C500750104C3750000E501F5F0E5E2 +:1001F0000E35F0F509E500F5F0E50F35F0F50A7577 +:100200000100C3750000E501F5F0E50935F0F501E1 +:10021000E500F5F0E50A35F0F500E500F502E50149 +:10022000F582E502F583E0F50B750101C375000069 +:10023000E501F5F0E50935F0F501E500F5F0E50A31 +:1002400035F0F500E500F502E501F582E502F583FC +:10025000E0F50C750102C3750000E501F5F0E50954 +:1002600035F0F501E500F5F0E50A35F0F500E500BB +:10027000F502E501F582E502F583E0F50D75010370 +:10028000C3750000E501F5F0E50935F0F501E5007D +:10029000F5F0E50A35F0F500E500F502E501F58237 +:1002A000E502F583E0F500750901C3750100E50B72 +:1002B000F5F0E50195F0F501750100E501F5F0E5D2 +:1002C0000135F0F501E501F5F0E50965F0F509C343 +:1002D000750100E50CF5F0E50195F0F501750100FB +:1002E000E501F5F0E50135F0F501E501F5F0E50989 +:1002F00065F0F509C3750100E50DF5F0E50195F030 +:10030000F501750100E501F5F0E50135F0F501E5D0 +:1003100001F5F0E50965F0F509C3750100E500F5A3 +:10032000F0E50195F0F501750100E501F5F0E50155 +:1003300035F0F501E501F5F0E50965F0F509750120 +:1003400000750A00750B00750000E509F5F0E50081 +:1003500045F0F500E501F5F0E50045F0F500E50AAA +:10036000F5F0E50045F0F500E50BF5F0E50045F0AA +:10037000F500E500700280030203EE00750108C37A +:10038000750000E501F5F0E50E35F0F510E500F536 +:10039000F0E50F35F0F511750100C3750000E501BA +:1003A000F5F0E51035F0F501E500F5F0E51135F073 +:1003B000F500E500F502E501F582E502F583E0F5DB +:1003C0000E750101C3750000E501F5F0E51035F08B +:1003D000F501E500F5F0E51135F0F500E500F50271 +:1003E000E501F582E502F583E0F50F0200D3007523 +:1003F0000108C3750000E501F5F0E50E35F0F501E3 +:10040000E500F5F0E50F35F0F500E501F509E5004B +:10041000F50A750100C3750000E501F5F0E5093541 +:10042000F0F501E500F5F0E50A35F0F500E500F539 +:1004300002E501F582E502F583E0F50B750101C3E4 +:10044000750000E501F5F0E50935F0F501E500F589 +:10045000F0E50A35F0F500E500F502E501F582E585 +:1004600002F583E0F509750100C3750000E501F5AB +:10047000F0E51035F0F501E500F5F0E51135F0F5A2 +:1004800000E50BF503E500F502E501F582E502F56F +:1004900083E503F0750101C3750000E501F5F0E5A2 +:1004A0001035F0F501E500F5F0E51135F0F500E562 +:1004B00009F503E500F502E501F582E502F583E5BE +:1004C00003F002039700900000E582F50990000018 +:1004D000E583F50A750100C3750000E501F5F0E557 +:1004E0000935F0F501E500F5F0E50A35F0F500E530 +:1004F00000F502E501F582E502F583E0F50E7501F0 +:1005000001C3750000E501F5F0E50935F0F501E5F9 +:1005100000F5F0E50A35F0F500E500F502E501F536 +:1005200082E502F583E0F50F75010075090075009D +:1005300000C3E501F5F0E50E95F0F501E501F5F0F4 +:10054000E50045F0F500C3E509F5F0E50F95F0F598 +:1005500001E501F5F0E50045F0F5007501007509CC +:1005600000750A00750C01C3750B00E500F5F0E598 +:100570000B95F0F50B750B00E50BF5F0E50B35F081 +:10058000F50BE50BF5F0E50C65F0F50CC3750B000C +:10059000E501F5F0E50B95F0F50B750B00E50BF5B6 +:1005A000F0E50B35F0F50BE50BF5F0E50C65F0F536 +:1005B0000CC3750B00E509F5F0E50B95F0F50B752F +:1005C0000B00E50BF5F0E50B35F0F50BE50BF5F061 +:1005D000E50C65F0F50CC3750B00E50AF5F0E50BCD +:1005E00095F0F50B750B00E50BF5F0E50B35F0F527 +:1005F0000BE50BF5F0E50C65F0F50C7501007509E0 +:1006000000750A00750000E50CF5F0E50045F0F511 +:1006100000E501F5F0E50045F0F500E509F5F0E548 +:100620000045F0F500E50AF5F0E50045F0F500E5D8 +:1006300000700280030206B300750108C375000054 +:10064000E501F5F0E50E35F0F501E500F5F0E50F13 +:1006500035F0F500E501F509E500F50A750100C37F +:10066000750000E501F5F0E50935F0F501E500F567 +:10067000F0E50A35F0F500E500F502E501F582E563 +:1006800002F583E0F50E750101C3750000E501F583 +:10069000F0E50935F0F501E500F5F0E50A35F0F58E +:1006A00000E500F502E501F582E502F583E0F50FCE +:1006B00002052800E506F509E507F50A750100C3FE +:1006C000750000E501F5F0E50935F0F501E500F507 +:1006D000F0E50A35F0F509750A00C3750000E50A72 +:1006E000F5F0E50135F0F50EE500F5F0E50935F03A +:1006F000F50F900002E582F509900002E583F50A06 +:10070000750100C3750000E501F5F0E50935F0F568 +:1007100001E500F5F0E50A35F0F500E501F509E53C +:1007200000F50A750100C3750000E501F5F0E50963 +:1007300035F0F501E500F5F0E50A35F0F500E500E6 +:10074000F502E501F582E502F583E0F50B7501019F +:10075000C3750000E501F5F0E50935F0F501E500A8 +:10076000F5F0E50A35F0F500E500F502E501F58262 +:10077000E502F583E0F50C750102C3750000E501A3 +:10078000F5F0E50935F0F501E500F5F0E50A35F09D +:10079000F500E500F502E501F582E502F583E0F5F7 +:1007A0000D750103C3750000E501F5F0E50935F0AD +:1007B000F501E500F5F0E50A35F0F500E500F50294 +:1007C000E501F582E502F583E0F509750100C375E1 +:1007D0000000E501F5F0E50E35F0F501E500F5F076 +:1007E000E50F35F0F500E50BF503E500F502E50151 +:1007F000F582E502F583E503F0750101C37500009C +:10080000E501F5F0E50E35F0F501E500F5F0E50F51 +:1008100035F0F500E50CF503E500F502E501F5829C +:10082000E502F583E503F0750102C3750000E501FB +:10083000F5F0E50E35F0F501E500F5F0E50F35F0E2 +:10084000F500E50DF503E500F502E501F582E502A9 +:10085000F583E503F0750103C3750000E501F5F0CC +:10086000E50E35F0F501E500F5F0E50F35F0F500A2 +:10087000E509F503E500F502E501F582E502F583FA +:10088000E503F0E506F509E507F50A750104C3750A +:100890000000E501F5F0E50935F0F501E500F5F0BA +:1008A000E50A35F0F509750A00C3750000E50AF59B +:1008B000F0E50135F0F50EE500F5F0E50935F0F568 +:1008C0000FE506F509E507F50A750100C375000097 +:1008D000E501F5F0E50935F0F501E500F5F0E50A8B +:1008E00035F0F50A750900C3750000E509F5F0E576 +:1008F0000135F0F501E500F5F0E50A35F0F500E524 +:1009000001F509E500F50A750100C3750000E50170 +:10091000F5F0E50935F0F501E500F5F0E50A35F00B +:10092000F500E500F502E501F582E502F583E0F565 +:100930000B750101C3750000E501F5F0E50935F01F +:10094000F501E500F5F0E50A35F0F500E500F50202 +:10095000E501F582E502F583E0F50C750102C3754A +:100960000000E501F5F0E50935F0F501E500F5F0E9 +:10097000E50A35F0F500E500F502E501F582E5024E +:10098000F583E0F50D750103C3750000E501F5F091 +:10099000E50935F0F501E500F5F0E50A35F0F5007B +:1009A000E500F502E501F582E502F583E0F509755C +:1009B0000100C3750000E501F5F0E50E35F0F50125 +:1009C000E500F5F0E50F35F0F500E50BF503E50082 +:1009D000F502E501F582E502F583E503F075010115 +:1009E000C3750000E501F5F0E50E35F0F501E50011 +:1009F000F5F0E50F35F0F500E50CF503E500F5023F +:100A0000E501F582E502F583E503F0750102C375A2 +:100A10000000E501F5F0E50E35F0F501E500F5F033 +:100A2000E50F35F0F500E50DF503E500F502E5010C +:100A3000F582E502F583E503F0750103C375000057 +:100A4000E501F5F0E50E35F0F501E500F5F0E50F0F +:100A500035F0F500E509F503E500F502E501F5825D +:100A6000E502F583E503F0E506F509E507F50A7506 +:100A70000104C3750000E501F5F0E50935F0F50165 +:100A8000E500F5F0E50A35F0F50A750900C37500D3 +:100A900000E509F5F0E50135F0F501E500F5F0E5D3 +:100AA0000A35F0F500E501F509E500F50A750100E4 +:100AB000C3750000E501F5F0E50935F0F501E50045 +:100AC000F5F0E50A35F0F500E500F502E501F582FF +:100AD000E502F583E0F50B750101C3750000E50142 +:100AE000F5F0E50935F0F501E500F5F0E50A35F03A +:100AF000F500E500F502E501F582E502F583E0F594 +:100B00000C750102C3750000E501F5F0E50935F04B +:100B1000F501E500F5F0E50A35F0F500E500F50230 +:100B2000E501F582E502F583E0F50D750103C37576 +:100B30000000E501F5F0E50935F0F501E500F5F017 +:100B4000E50A35F0F500E500F502E501F582E5027C +:100B5000F583E0F500750901C3750100E50BF5F0BB +:100B6000E50195F0F501750100E501F5F0E50135C8 +:100B7000F0F501E501F5F0E50965F0F509C375014A +:100B800000E50CF5F0E50195F0F501750100E501D2 +:100B9000F5F0E50135F0F501E501F5F0E50965F061 +:100BA000F509C3750100E50DF5F0E50195F0F501D6 +:100BB000750100E501F5F0E50135F0F501E501F518 +:100BC000F0E50965F0F509C3750100E500F5F0E50C +:100BD0000195F0F501750100E501F5F0E50135F04D +:100BE000F501E501F5F0E50965F0F5097501007518 +:100BF0000A00750B00750000E509F5F0E50045F009 +:100C0000F500E501F5F0E50045F0F500E50AF5F041 +:100C1000E50045F0F500E50BF5F0E50045F0F500E1 +:100C2000E5007002800302105300E506F509E507B0 +:100C3000F50A750104C3750000E501F5F0E5093515 +:100C4000F0F501E500F5F0E50A35F0F509750A0063 +:100C5000C3750000E50AF5F0E50135F0F50EE50095 +:100C6000F5F0E50935F0F50FE506F509E507F50AB4 +:100C7000750100C3750000E501F5F0E50935F0F5F3 +:100C800001E500F5F0E50A35F0F50A750900C375D0 +:100C90000000E509F5F0E50135F0F501E500F5F0B6 +:100CA000E50A35F0F500E501F509E500F50A7501FD +:100CB00000C3750000E501F5F0E50935F0F501E543 +:100CC00000F5F0E50A35F0F500E500F502E501F57F +:100CD00082E502F583E0F50B750101C3750000E5BF +:100CE00001F5F0E50935F0F501E500F5F0E50A3527 +:100CF000F0F500E500F502E501F582E502F583E097 +:100D0000F50C750102C3750000E501F5F0E5093544 +:100D1000F0F501E500F5F0E50A35F0F500E500F540 +:100D200002E501F582E502F583E0F50D750103C3E7 +:100D3000750000E501F5F0E50935F0F501E500F590 +:100D4000F0E50A35F0F500E500F502E501F582E58C +:100D500002F583E0F509750100C3750000E501F5B2 +:100D6000F0E50E35F0F501E500F5F0E50F35F0F5AD +:100D700000E50BF503E500F502E501F582E502F576 +:100D800083E503F0750101C3750000E501F5F0E5A9 +:100D90000E35F0F501E500F5F0E50F35F0F500E56D +:100DA0000CF503E500F502E501F582E502F583E5C2 +:100DB00003F0750102C3750000E501F5F0E50E359D +:100DC000F0F501E500F5F0E50F35F0F500E50DF57E +:100DD00003E500F502E501F582E502F583E503F0A0 +:100DE000750103C3750000E501F5F0E50E35F0F57A +:100DF00001E500F5F0E50F35F0F500E509F503E54F +:100E000000F502E501F582E502F583E503F0E5066C +:100E1000F509E507F50A750104C3750000E501F55C +:100E2000F0E50935F0F501E500F5F0E50A35F0F5F6 +:100E30000A750900C3750000E509F5F0E50135F014 +:100E4000F501E500F5F0E50A35F0F500E501F509F5 +:100E5000E500F50A750100C3750000E501F5F0E550 +:100E60000935F0F501E500F5F0E50A35F0F500E5A6 +:100E700000F502E501F582E502F583E0F50B750169 +:100E800001C3750000E501F5F0E50935F0F501E570 +:100E900000F5F0E50A35F0F500E500F502E501F5AD +:100EA00082E502F583E0F50C750102C3750000E5EB +:100EB00001F5F0E50935F0F501E500F5F0E50A3555 +:100EC000F0F500E500F502E501F582E502F583E0C5 +:100ED000F50D750103C3750000E501F5F0E5093571 +:100EE000F0F501E500F5F0E50A35F0F500E500F56F +:100EF00002E501F582E502F583E0F500750901C31D +:100F0000750100E50BF5F0E50195F0F501750100BF +:100F1000E501F5F0E50135F0F501E501F5F0E5094C +:100F200065F0F509C3750100E50CF5F0E50195F0F4 +:100F3000F501750100E501F5F0E50135F0F501E594 +:100F400001F5F0E50965F0F509C3750100E50DF55A +:100F5000F0E50195F0F501750100E501F5F0E50119 +:100F600035F0F501E501F5F0E50965F0F509C37522 +:100F70000100E500F5F0E50195F0F501750100E5EA +:100F800001F5F0E50135F0F501E501F5F0E509655C +:100F9000F0F509750100750A00750B00750000E594 +:100FA00009F5F0E50045F0F500E501F5F0E500454F +:100FB000F0F500E50AF5F0E50045F0F500E50BF584 +:100FC000F0E50045F0F500E5007002800302104FE7 +:100FD00000750000E500F502E500F503E500F50405 +:100FE000E500F50575E00B2506F58275E00035078F +:100FF000F583E0F51175E00A2506F58275E0003508 +:1010000007F583E0F51075E0082506F58275E00028 +:101010003507F583E0F508E508C0E075E009250629 +:10102000F58275E0003507F583E0F508E508C0E0D6 +:1010300075E00C2506F50675E0003507F507E502B5 +:10104000F582E503F583E504F500E505F5012200E9 +:10105000020FD100020C2A00000000000000000076 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr22335-2.s.expected b/tests/GCCTestSuite/pr22335-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr22335-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr23049.c b/tests/GCCTestSuite/pr23049.c new file mode 100644 index 0000000..0a71cec --- /dev/null +++ b/tests/GCCTestSuite/pr23049.c @@ -0,0 +1,26 @@ +/* This was an ICE in fold where we tried to fold something like, + + a = 0 == 0 ? 0 : 3988292384 + + after doing if-conversion for the vectorizer. Folding "0 == 0" + should have been done before calling fold on the whole rhs of + the above expression. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -ftree-vectorize" } */ + +static unsigned short int crc_table[256]; +void AC3_encode_init(void) +{ + unsigned int c, n, k; + for(n=0; n<256; n++) + { + c = n << 8; + for (k = 0; k < 8; k++) + { + if (c & (1 << 15)) + c = ((c << 1) & 0xffff) ^ (((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16)) & 0xffff); + } + crc_table[n] = c; + } +} diff --git a/tests/GCCTestSuite/pr23049.c.expected b/tests/GCCTestSuite/pr23049.c.expected new file mode 100644 index 0000000..0a71cec --- /dev/null +++ b/tests/GCCTestSuite/pr23049.c.expected @@ -0,0 +1,26 @@ +/* This was an ICE in fold where we tried to fold something like, + + a = 0 == 0 ? 0 : 3988292384 + + after doing if-conversion for the vectorizer. Folding "0 == 0" + should have been done before calling fold on the whole rhs of + the above expression. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -ftree-vectorize" } */ + +static unsigned short int crc_table[256]; +void AC3_encode_init(void) +{ + unsigned int c, n, k; + for(n=0; n<256; n++) + { + c = n << 8; + for (k = 0; k < 8; k++) + { + if (c & (1 << 15)) + c = ((c << 1) & 0xffff) ^ (((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16)) & 0xffff); + } + crc_table[n] = c; + } +} diff --git a/tests/GCCTestSuite/pr23165.c b/tests/GCCTestSuite/pr23165.c new file mode 100644 index 0000000..2c63eb1 --- /dev/null +++ b/tests/GCCTestSuite/pr23165.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wextra" } */ +void foo (void) +{ + if (0) + a: ; /* { dg-warning "empty body in an if-statement" } */ + + +} diff --git a/tests/GCCTestSuite/pr23165.c.expected b/tests/GCCTestSuite/pr23165.c.expected new file mode 100644 index 0000000..2c63eb1 --- /dev/null +++ b/tests/GCCTestSuite/pr23165.c.expected @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wextra" } */ +void foo (void) +{ + if (0) + a: ; /* { dg-warning "empty body in an if-statement" } */ + + +} diff --git a/tests/GCCTestSuite/pr23165.hex.expected b/tests/GCCTestSuite/pr23165.hex.expected new file mode 100644 index 0000000..bf8b056 --- /dev/null +++ b/tests/GCCTestSuite/pr23165.hex.expected @@ -0,0 +1,9 @@ +:1000000000D0E0F500D0E0F50D750900750A007527 +:100010000B00750C00750100E509F5F0E50145F0F0 +:10002000F501E50AF5F0E50145F0F501E50BF5F020 +:10003000E50145F0F501E50CF5F0E50145F0F501C8 +:10004000E5017002800302007600750100E501F50C +:1000500002E501F503E501F504E501F505E50DC04F +:10006000E0E500C0E0E502F582E503F583E504F58F +:1000700000E505F50122000002004A000000000032 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr23165.s.expected b/tests/GCCTestSuite/pr23165.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr23165.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr23584.c b/tests/GCCTestSuite/pr23584.c new file mode 100644 index 0000000..691a119 --- /dev/null +++ b/tests/GCCTestSuite/pr23584.c @@ -0,0 +1,21 @@ +/* Regression test for PR middle-end/23584 */ +/* Verify that dereferencing an absolute address inside of a function + makes that function impure. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-ipa-pure-const" } */ + +int test1 (void) +{ + return * (volatile int *) 0x1234; +} + +int test2 (void) +{ + int local = * (volatile int *) 0x1234; + return local; +} + +/* { dg-final { scan-ipa-dump-not "found to be pure: test1" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be pure: test2" "pure-const" } } */ +/* { dg-final { cleanup-ipa-dump "pure-const" } } */ diff --git a/tests/GCCTestSuite/pr23584.c.expected b/tests/GCCTestSuite/pr23584.c.expected new file mode 100644 index 0000000..691a119 --- /dev/null +++ b/tests/GCCTestSuite/pr23584.c.expected @@ -0,0 +1,21 @@ +/* Regression test for PR middle-end/23584 */ +/* Verify that dereferencing an absolute address inside of a function + makes that function impure. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-ipa-pure-const" } */ + +int test1 (void) +{ + return * (volatile int *) 0x1234; +} + +int test2 (void) +{ + int local = * (volatile int *) 0x1234; + return local; +} + +/* { dg-final { scan-ipa-dump-not "found to be pure: test1" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be pure: test2" "pure-const" } } */ +/* { dg-final { cleanup-ipa-dump "pure-const" } } */ diff --git a/tests/GCCTestSuite/pr23584.hex.expected b/tests/GCCTestSuite/pr23584.hex.expected new file mode 100644 index 0000000..d86dfa2 --- /dev/null +++ b/tests/GCCTestSuite/pr23584.hex.expected @@ -0,0 +1,31 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F750934750A12750100C3750000E501FA +:10002000F5F0E50935F0F501E500F5F0E50A35F004 +:10003000F500E500F502E501F582E502F583E0F55E +:100040000B750101C3750000E501F5F0E50935F018 +:10005000F501E500F5F0E50A35F0F500E500F502FB +:10006000E501F582E502F583E0F50C750102C37543 +:100070000000E501F5F0E50935F0F501E500F5F0E2 +:10008000E50A35F0F500E500F502E501F582E50247 +:10009000F583E0F50D750103C3750000E501F5F08A +:1000A000E50935F0F501E500F5F0E50A35F0F50074 +:1000B000E500F502E501F582E502F583E0F500E5EE +:1000C0000BF502E50CF503E50DF504E500F505E596 +:1000D0000EF511E50FF510E519C0E0E518C0E0E5F3 +:1000E00002F582E503F583E504F500E505F5012257 +:1000F00000D0E0F518D0E0F519E511F50EE510F5A2 +:100100000F750934750A12750100C3750000E50109 +:10011000F5F0E50935F0F501E500F5F0E50A35F013 +:10012000F500E500F502E501F582E502F583E0F56D +:100130000B750101C3750000E501F5F0E50935F027 +:10014000F501E500F5F0E50A35F0F500E500F5020A +:10015000E501F582E502F583E0F50C750102C37552 +:100160000000E501F5F0E50935F0F501E500F5F0F1 +:10017000E50A35F0F500E500F502E501F582E50256 +:10018000F583E0F50D750103C3750000E501F5F099 +:10019000E50935F0F501E500F5F0E50A35F0F50083 +:1001A000E500F502E501F582E502F583E0F500E5FD +:1001B0000BF502E50CF503E50DF504E500F505E5A5 +:1001C0000EF511E50FF510E519C0E0E518C0E0E502 +:1001D00002F582E503F583E504F500E505F5012266 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr23584.s.expected b/tests/GCCTestSuite/pr23584.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr23584.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr23625.c b/tests/GCCTestSuite/pr23625.c new file mode 100644 index 0000000..aaeddb2 --- /dev/null +++ b/tests/GCCTestSuite/pr23625.c @@ -0,0 +1,27 @@ +/* Test case for PR23625 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-loop-linear" } */ + +typedef long INT32; +void find_best_colors () +{ +int ic0, ic1, ic2; +INT32 * bptr; +INT32 dist1; +INT32 dist2; +INT32 xx1; +for (ic0 = (1<<(5 -3))-1;ic0 >= 0;ic0--) +{ + for (ic1 = (1<<(6 -3))-1;ic1 >= 0;ic1--) + { + dist2 = dist1; + for (ic2 = (1<<(5 -3))-1;ic2 >= 0;ic2--) + { + *bptr = dist2; + bptr++; + } + dist1 += xx1; + } +} +} + diff --git a/tests/GCCTestSuite/pr23625.c.expected b/tests/GCCTestSuite/pr23625.c.expected new file mode 100644 index 0000000..aaeddb2 --- /dev/null +++ b/tests/GCCTestSuite/pr23625.c.expected @@ -0,0 +1,27 @@ +/* Test case for PR23625 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-loop-linear" } */ + +typedef long INT32; +void find_best_colors () +{ +int ic0, ic1, ic2; +INT32 * bptr; +INT32 dist1; +INT32 dist2; +INT32 xx1; +for (ic0 = (1<<(5 -3))-1;ic0 >= 0;ic0--) +{ + for (ic1 = (1<<(6 -3))-1;ic1 >= 0;ic1--) + { + dist2 = dist1; + for (ic2 = (1<<(5 -3))-1;ic2 >= 0;ic2--) + { + *bptr = dist2; + bptr++; + } + dist1 += xx1; + } +} +} + diff --git a/tests/GCCTestSuite/pr23625.hex.expected b/tests/GCCTestSuite/pr23625.hex.expected new file mode 100644 index 0000000..55d5e41 --- /dev/null +++ b/tests/GCCTestSuite/pr23625.hex.expected @@ -0,0 +1,474 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51BF51EE519F516E51809 +:1000E000F51FE500F50FE501F510E509F511E50A45 +:1000F000F512751900751500751300751D00E51DC5 +:10010000F50EE51FF50D750080E500F5F0E50E250F +:10011000F0F50EE500F5F0E50D25F0F50D750C0098 +:10012000751400751700751800750B00750A0175B8 +:100130000001C3E50DF5F0E50E95F0F509E50BF5C9 +:10014000F0E50B35F0F509E509F5F0E50055F0F5BA +:1001500000E500F5F0E50C45F0F50C750001C3E590 +:100160000DF5F0E50E95F0F509E50BF5F0E50B352D +:10017000F0F509E50EF5F0E50D95F0F501E50BF567 +:10018000F0E50B35F0F501E501F5F0E50945F0F591 +:1001900009E50AF5F0E50965F0F509E509F5F0E589 +:1001A0000055F0F500C3E516F5F0E51395F0F509F7 +:1001B000E50BF5F0E50B35F0F509E509F5F0E5009F +:1001C00055F0F500E500F5F0E50C45F0F50C75008F +:1001D00001C3E50DF5F0E50E95F0F509E50BF5F039 +:1001E000E50B35F0F509E50EF5F0E50D95F0F501B7 +:1001F000E50BF5F0E50B35F0F501E501F5F0E50966 +:1002000045F0F509E50AF5F0E50965F0F509E509B8 +:10021000F5F0E50055F0F500C3E516F5F0E51395AA +:10022000F0F509E50BF5F0E50B35F0F509E513F50B +:10023000F0E51695F0F501E50BF5F0E50B35F0F579 +:1002400001E501F5F0E50945F0F509E50AF5F0E508 +:100250000965F0F509E509F5F0E50055F0F500C38D +:10026000E51AF5F0E51595F0F509E50BF5F0E50B68 +:1002700035F0F509E509F5F0E50055F0F500E50084 +:10028000F5F0E50C45F0F50C750001C3E50DF5F052 +:10029000E50E95F0F509E50BF5F0E50B35F0F50900 +:1002A000E50EF5F0E50D95F0F501E50BF5F0E50B44 +:1002B00035F0F501E501F5F0E50945F0F509E50A48 +:1002C000F5F0E50965F0F509E509F5F0E50055F00B +:1002D000F500C3E516F5F0E51395F0F509E50BF526 +:1002E000F0E50B35F0F509E513F5F0E51695F0F5B9 +:1002F00001E50BF5F0E50B35F0F501E501F5F0E56D +:100300000945F0F509E50AF5F0E50965F0F509E5B7 +:1003100009F5F0E50055F0F500C3E51AF5F0E5152F +:1003200095F0F509E50BF5F0E50B35F0F509E51568 +:10033000F5F0E51A95F0F501E50BF5F0E50B35F074 +:10034000F501E501F5F0E50945F0F509E50AF5F0F7 +:10035000E50965F0F509E509F5F0E50055F0F5006A +:10036000C3E51EF5F0E51995F0F509E50BF5F0E5A7 +:100370000B35F0F509E509F5F0E50055F0F500E578 +:1003800000F5F0E50C45F0F50CE50CF50AE514F583 +:1003900000E517F501E518F509E50AF50C750B01FF +:1003A000C3750A00E50CF5F0E50A95F0F50A750A43 +:1003B00000E50AF5F0E50A35F0F50AE50AF5F0E59D +:1003C0000B65F0F50BC3750A00E500F5F0E50A953D +:1003D000F0F50A750A00E50AF5F0E50A35F0F50AC8 +:1003E000E50AF5F0E50B65F0F50BC3750A00E501CC +:1003F000F5F0E50A95F0F50A750A00E50AF5F0E56D +:100400000A35F0F50AE50AF5F0E50B65F0F50BC3E2 +:10041000750A00E509F5F0E50A95F0F50A750A0098 +:10042000E50AF5F0E50A35F0F50AE50AF5F0E50B21 +:1004300065F0F50B750100750900750A007500007F +:10044000E50BF5F0E50045F0F500E501F5F0E50018 +:1004500045F0F500E509F5F0E50045F0F500E50AA1 +:10046000F5F0E50045F0F500E500700280030206B6 +:10047000D700750D02750E00751700751B00E50F8E +:10048000F500E510F514E511F518E512F51C750FEA +:1004900000751000751100751200C3750100E500AC +:1004A000F5F0E50DA4F50CE500F5F0E50DA4E5F09B +:1004B000F509E50CF5F0E50135F0F501E514F5F089 +:1004C000E50DA4F50CE514F5F0E50DA4E5F0F50A4D +:1004D000E50CF5F0E50935F0F509E518F5F0E50D61 +:1004E000A4F50CE518F5F0E50DA4E5F0F50BE50C29 +:1004F000F5F0E50A35F0F50AE51CF5F0E50DA4F593 +:100500000CE51CF5F0E50DA4E5F0F50DE50CF5F0B6 +:10051000E50B35F0F50BC3C3750C00E501F5F0E50F +:100520000F35F0F50FE509F5F0E51035F0F510E5BC +:100530000AF5F0E51135F0F511E50BF5F0E51235AA +:10054000F0F512C3750900E500F5F0E50EA4F50C11 +:10055000E500F5F0E50EA4E5F0F50AE50CF5F0E5AB +:100560000935F0F509E514F5F0E50EA4F50CE514F0 +:10057000F5F0E50EA4E5F0F50BE50CF5F0E50A3530 +:10058000F0F50AE518F5F0E50EA4F50CE518F5F020 +:10059000E50EA4E5F0F50DE50CF5F0E50B35F0F50D +:1005A0000B750100C3C3750C00E501F5F0E50F35CF +:1005B000F0F50FE509F5F0E51035F0F510E50AF571 +:1005C000F0E51135F0F511E50BF5F0E51235F0F534 +:1005D00012C3750A00E500F5F0E517A4F50CE50077 +:1005E000F5F0E517A4E5F0F50BE50CF5F0E50A35B7 +:1005F000F0F50AE514F5F0E517A4F50CE514F5F0AF +:10060000E517A4E5F0F50DE50CF5F0E50B35F0F593 +:100610000B750100750900C3C3750C00E501F5F009 +:10062000E50F35F0F50FE509F5F0E51035F0F510BB +:10063000E50AF5F0E51135F0F511E50BF5F0E512F9 +:1006400035F0F512C3750B00E500F5F0E51BA4F5D8 +:100650000CE500F5F0E51BA4E5F0F50DE50CF5F073 +:10066000E50B35F0F50B750100750900750A00C33F +:10067000C3750000E501F5F0E50F35F0F50FE5096C +:10068000F5F0E51035F0F510E50AF5F0E51135F077 +:10069000F511E50BF5F0E51235F0F5127500017571 +:1006A0000100750900750A00C3750B00E500F5F03F +:1006B000E51935F0F519E501F5F0E51535F0F51515 +:1006C000E509F5F0E51335F0F513E50AF5F0E51D5C +:1006D00035F0F51D0200FE00E50FF502E510F5030B +:1006E000E511F504E512F50575E0092506F58275B5 +:1006F000E0003507F583E0F51775E0082506F5827B +:1007000075E0003507F583E0F51675E0072506F579 +:100710008275E0003507F583E0F51575E0062506DE +:10072000F58275E0003507F583E0F51475E00525E1 +:1007300006F58275E0003507F583E0F51375E004F2 +:100740002506F58275E0003507F583E0F51275E0C2 +:10075000032506F58275E0003507F583E0F5117590 +:10076000E0022506F58275E0003507F583E0F51017 +:1007700075E0002506F58275E0003507F583E0F5A4 +:1007800008E508C0E075E0012506F58275E0003552 +:1007900007F583E0F508E508C0E075E0122506F5E9 +:1007A0000675E0003507F507E502F582E503F583F8 +:1007B000E504F500E505F5012200E506758216C39E +:1007C0009582F506E5077583009583F507D0E0F57A +:1007D0000875E00D2506F58275E0003507F583E51F +:1007E00008F0D0E0F50875E00C2506F58275E0000C +:1007F0003507F583E508F075E0152506F58275E007 +:10080000003507F583E517F075E0142506F58275C8 +:10081000E0003507F583E516F075E0132506F5824F +:1008200075E0003507F583E515F075E0122506F54E +:100830008275E0003507F583E514F075E0112506B3 +:10084000F58275E0003507F583E513F075E01025B6 +:1008500006F58275E0003507F583E512F075E00FC7 +:100860002506F58275E0003507F583E511F075E0A2 +:100870000E2506F58275E0003507F583E510F07565 +:100880001F01751E00751D00751C00750E05750C89 +:1008900000750A00750100750D03750B00750900E0 +:1008A000750000C3E50DF5F0E50E95F0F51BE50BC1 +:1008B000F5F0E50C95F0F51AE509F5F0E50A95F087 +:1008C000F519E500F5F0E50195F0F518120000E5E1 +:1008D00082F502E583F503E500F504E501F505E59C +:1008E00002F50EE503F50CE504F50AE505F50175DD +:1008F0000D01750B00750900750000C3E50DF5F0DD +:10090000E50E95F0F50875E00B2506F58275E0001B +:100910003507F583E508F0E50BF5F0E50C95F0F506 +:100920000875E00A2506F58275E0003507F583E5D0 +:1009300008F0E509F5F0E50A95F0F516E500F5F0A3 +:10094000E50195F0F50875E0062506F58275E000ED +:100950003507F583E508F075140075100075110072 +:1009600075120075E0062506F58275E0003507F57D +:1009700083E0F513750080E500F5F0E51325F0F54B +:1009800013E500F5F0E51225F0F512750C00750D74 +:1009900000750E00750F00750B00750A01750001DA +:1009A000C3E512F5F0E51395F0F509E50BF5F0E573 +:1009B0000B35F0F509E509F5F0E50055F0F500E532 +:1009C00000F5F0E50C45F0F50C750001C3E512F5F6 +:1009D000F0E51395F0F509E50BF5F0E50B35F0F5CD +:1009E00009E513F5F0E51295F0F501E50BF5F0E5F5 +:1009F0000B35F0F501E501F5F0E50945F0F509E500 +:100A00000AF5F0E50965F0F509E509F5F0E50055A9 +:100A1000F0F500C3E511F5F0E51695F0F509E50BE5 +:100A2000F5F0E50B35F0F509E509F5F0E50055F0D1 +:100A3000F500E500F5F0E50C45F0F50C750001C397 +:100A4000E512F5F0E51395F0F509E50BF5F0E50B8A +:100A500035F0F509E513F5F0E51295F0F501E50B34 +:100A6000F5F0E50B35F0F501E501F5F0E50945F0A8 +:100A7000F509E50AF5F0E50965F0F509E509F5F090 +:100A8000E50055F0F500C3E511F5F0E51695F0F534 +:100A900009E50BF5F0E50B35F0F509E516F5F0E5A0 +:100AA0001195F0F501E50BF5F0E50B35F0F501E5F5 +:100AB00001F5F0E50945F0F509E50AF5F0E5096508 +:100AC000F0F509E509F5F0E50055F0F500C3E5108E +:100AD000F5F075E00A2506F58275E0003507F58327 +:100AE000E0F508E50895F0F509E50BF5F0E50B35BF +:100AF000F0F509E509F5F0E50055F0F500E500F53C +:100B0000F0E50C45F0F50C750001C3E512F5F0E5D4 +:100B10001395F0F509E50BF5F0E50B35F0F509E572 +:100B200013F5F0E51295F0F501E50BF5F0E50B3561 +:100B3000F0F501E501F5F0E50945F0F509E50AF5FF +:100B4000F0E50965F0F509E509F5F0E50055F0F582 +:100B500000C3E511F5F0E51695F0F509E50BF5F0A4 +:100B6000E50B35F0F509E516F5F0E51195F0F50121 +:100B7000E50BF5F0E50B35F0F501E501F5F0E509DC +:100B800045F0F509E50AF5F0E50965F0F509E5092F +:100B9000F5F0E50055F0F500C3E510F5F075E00A55 +:100BA0002506F58275E0003507F583E0F508E508D0 +:100BB00095F0F509E50BF5F0E50B35F0F50975E075 +:100BC0000A2506F58275E0003507F583E0F508E5AE +:100BD00008F5F0E51095F0F501E50BF5F0E50B35BE +:100BE000F0F501E501F5F0E50945F0F509E50AF54F +:100BF000F0E50965F0F509E509F5F0E50055F0F5D2 +:100C000000C3E514F5F075E00B2506F58275E000EC +:100C10003507F583E0F508E50895F0F509E50BF5EE +:100C2000F0E50B35F0F509E509F5F0E50055F0F5CF +:100C300000E500F5F0E50C45F0F50CE50CF500E5F8 +:100C40000EF501750C01C3750900E500F5F0E50925 +:100C500095F0F509750900E509F5F0E50935F0F5B8 +:100C600009E509F5F0E50C65F0F50CC3750900E53B +:100C70000DF5F0E50995F0F509750900E509F5F0C0 +:100C8000E50935F0F509E509F5F0E50C65F0F50C39 +:100C9000C3750900E501F5F0E50995F0F509750959 +:100CA00000E509F5F0E50935F0F509E509F5F0E5A8 +:100CB0000C65F0F50CC3750900E50FF5F0E5099535 +:100CC000F0F509750900E509F5F0E50935F0F509D4 +:100CD000E509F5F0E50C65F0F50C750D00750E00F5 +:100CE000750F00E50DF500E50EF501E50FF5097549 +:100CF0000B01C3750A00E50CF5F0E50A95F0F50A5D +:100D0000750A00E50AF5F0E50A35F0F50AE50AF599 +:100D1000F0E50B65F0F50BC3750A00E500F5F0E5AD +:100D20000A95F0F50A750A00E50AF5F0E50A35F0CE +:100D3000F50AE50AF5F0E50B65F0F50BC3750A0059 +:100D4000E501F5F0E50A95F0F50A750A00E50AF502 +:100D5000F0E50A35F0F50AE50AF5F0E50B65F0F582 +:100D60000BC3750A00E509F5F0E50A95F0F50A757B +:100D70000A00E50AF5F0E50A35F0F50AE50AF5F0AE +:100D8000E50B65F0F50B750100750900750A007536 +:100D90000000E50BF5F0E50045F0F500E501F5F0A4 +:100DA000E50045F0F500E509F5F0E50045F0F50052 +:100DB000E50AF5F0E50045F0F500E5007002800376 +:100DC000021CA300751F01751E00751D00751C0017 +:100DD000750E06750C00750A00750100750D03751A +:100DE0000B00750900750000C3E50DF5F0E50E95E3 +:100DF000F0F51BE50BF5F0E50C95F0F51AE509F5B6 +:100E0000F0E50A95F0F519E500F5F0E50195F0F546 +:100E100018120000E582F502E583F503E500F5040C +:100E2000E501F505E502F50EE503F50CE504F50A27 +:100E3000E505F501750D01750B00750900750000DC +:100E4000C3E50DF5F0E50E95F0F50875E00925060A +:100E5000F58275E0003507F583E508F0E50BF5F060 +:100E6000E50C95F0F517E509F5F0E50A95F0F514B0 +:100E7000E500F5F0E50195F0F50875E0072506F5C4 +:100E80008275E0003507F583E508F07515007510EB +:100E90000075110075120075E0072506F58275E0F2 +:100EA000003507F583E0F513750080E500F5F0E502 +:100EB0001325F0F513E500F5F0E51225F0F51275B0 +:100EC0000C00750D00750E00750F00750B00750A8E +:100ED00001750001C3E512F5F0E51395F0F509E59C +:100EE0000BF5F0E50B35F0F509E509F5F0E50055F2 +:100EF000F0F500E500F5F0E50C45F0F50C750001A6 +:100F0000C3E512F5F0E51395F0F509E50BF5F0E50D +:100F10000B35F0F509E513F5F0E51295F0F501E56F +:100F20000BF5F0E50B35F0F501E501F5F0E50945C8 +:100F3000F0F509E50AF5F0E50965F0F509E509F5CB +:100F4000F0E50055F0F500C3E511F5F0E51495F076 +:100F5000F509E50BF5F0E50B35F0F509E509F5F0D8 +:100F6000E50055F0F500E500F5F0E50C45F0F50C71 +:100F7000750001C3E512F5F0E51395F0F509E50BF1 +:100F8000F5F0E50B35F0F509E513F5F0E51295F010 +:100F9000F501E50BF5F0E50B35F0F501E501F5F0B0 +:100FA000E50945F0F509E50AF5F0E50965F0F5090B +:100FB000E509F5F0E50055F0F500C3E511F5F0E5BC +:100FC0001495F0F509E50BF5F0E50B35F0F509E5BD +:100FD00014F5F0E51195F0F501E50BF5F0E50B35AD +:100FE000F0F501E501F5F0E50945F0F509E50AF54B +:100FF000F0E50965F0F509E509F5F0E50055F0F5CE +:1010000000C3E510F5F0E51795F0F509E50BF5F0EF +:10101000E50B35F0F509E509F5F0E50055F0F500CB +:10102000E500F5F0E50C45F0F50C750001C3E5129F +:10103000F5F0E51395F0F509E50BF5F0E50B35F066 +:10104000F509E513F5F0E51295F0F501E50BF5F07E +:10105000E50B35F0F501E501F5F0E50945F0F50999 +:10106000E50AF5F0E50965F0F509E509F5F0E500B3 +:1010700055F0F500C3E511F5F0E51495F0F509E537 +:101080000BF5F0E50B35F0F509E514F5F0E51195F4 +:10109000F0F501E50BF5F0E50B35F0F501E501F5AF +:1010A000F0E50945F0F509E50AF5F0E50965F0F523 +:1010B00009E509F5F0E50055F0F500C3E510F5F098 +:1010C000E51795F0F509E50BF5F0E50B35F0F509B9 +:1010D000E517F5F0E51095F0F501E50BF5F0E50BFA +:1010E00035F0F501E501F5F0E50945F0F509E50A0A +:1010F000F5F0E50965F0F509E509F5F0E50055F0CD +:10110000F500C3E515F5F075E0092506F58275E0F3 +:10111000003507F583E0F508E50895F0F509E50BDE +:10112000F5F0E50B35F0F509E509F5F0E50055F0CA +:10113000F500E500F5F0E50C45F0F50CE50CF500E3 +:10114000E50EF501750C01C3750900E500F5F0E544 +:101150000995F0F509750900E509F5F0E50935F09F +:10116000F509E509F5F0E50C65F0F50CC375090026 +:10117000E50DF5F0E50995F0F509750900E509F5C6 +:10118000F0E50935F0F509E509F5F0E50C65F0F550 +:101190000CC3750900E501F5F0E50995F0F5097551 +:1011A0000900E509F5F0E50935F0F509E509F5F07F +:1011B000E50C65F0F50CC3750900E50FF5F0E509E0 +:1011C00095F0F509750900E509F5F0E50935F0F543 +:1011D00009E509F5F0E50C65F0F50C750D00750EE7 +:1011E00000750F00E50DF500E50EF501E50FF509B9 +:1011F000750B01C3750A00E50CF5F0E50A95F0F5ED +:101200000A750A00E50AF5F0E50A35F0F50AE50A7F +:10121000F5F0E50B65F0F50BC3750A00E500F5F098 +:10122000E50A95F0F50A750A00E50AF5F0E50A35D4 +:10123000F0F50AE50AF5F0E50B65F0F50BC3750A64 +:1012400000E501F5F0E50A95F0F50A750A00E50AF2 +:10125000F5F0E50A35F0F50AE50AF5F0E50B65F07D +:10126000F50BC3750A00E509F5F0E50A95F0F50AF6 +:10127000750A00E50AF5F0E50A35F0F50AE50AF524 +:10128000F0E50B65F0F50B750100750900750A00B6 +:10129000750000E50BF5F0E50045F0F500E501F51A +:1012A000F0E50045F0F500E509F5F0E50045F0F55D +:1012B00000E50AF5F0E50045F0F500E50070028074 +:1012C00003021C0400751F01751E00750F007510C8 +:1012D00000750E05750C00750A00750100750D038B +:1012E000750B00750900750000C3E50DF5F0E50EFE +:1012F00095F0F51BE50BF5F0E50C95F0F51AE50911 +:10130000F5F0E50A95F0F519E500F5F0E50195F041 +:10131000F518E50FF51DE510F51C120000E582F546 +:1013200002E583F503E500F504E501F505E502F5C1 +:101330000EE503F50CE504F50AE505F501750D016B +:10134000750B00750900750000C3E50DF5F0E50E9D +:1013500095F0F511E50BF5F0E50C95F0F512E509C2 +:10136000F5F0E50A95F0F513E500F5F0E50195F0E7 +:10137000F518751500750D00750E00750F00E51850 +:10138000F510750080E500F5F0E51025F0F510E5A5 +:1013900000F5F0E50F25F0F50F750C0075190075D7 +:1013A0001A00751B00750B00750A01750001C3E575 +:1013B0000FF5F0E51095F0F509E50BF5F0E50B35C7 +:1013C000F0F509E509F5F0E50055F0F500E500F563 +:1013D000F0E50C45F0F50C750001C3E50FF5F0E5FF +:1013E0001095F0F509E50BF5F0E50B35F0F509E59D +:1013F00010F5F0E50F95F0F501E50BF5F0E50B358F +:10140000F0F501E501F5F0E50945F0F509E50AF526 +:10141000F0E50965F0F509E509F5F0E50055F0F5A9 +:1014200000C3E50EF5F0E51395F0F509E50BF5F0D1 +:10143000E50B35F0F509E509F5F0E50055F0F500A7 +:10144000E500F5F0E50C45F0F50C750001C3E50F7E +:10145000F5F0E51095F0F509E50BF5F0E50B35F045 +:10146000F509E510F5F0E50F95F0F501E50BF5F060 +:10147000E50B35F0F501E501F5F0E50945F0F50975 +:10148000E50AF5F0E50965F0F509E509F5F0E5008F +:1014900055F0F500C3E50EF5F0E51395F0F509E517 +:1014A0000BF5F0E50B35F0F509E513F5F0E50E95D4 +:1014B000F0F501E50BF5F0E50B35F0F501E501F58B +:1014C000F0E50945F0F509E50AF5F0E50965F0F5FF +:1014D00009E509F5F0E50055F0F500C3E50DF5F077 +:1014E000E51295F0F509E50BF5F0E50B35F0F5099A +:1014F000E509F5F0E50055F0F500E500F5F0E50C3F +:1015000045F0F50C750001C3E50FF5F0E51095F019 +:10151000F509E50BF5F0E50B35F0F509E510F5F00B +:10152000E50F95F0F501E50BF5F0E50B35F0F5016C +:10153000E501F5F0E50945F0F509E50AF5F0E509FD +:1015400065F0F509E509F5F0E50055F0F500C3E5AE +:101550000EF5F0E51395F0F509E50BF5F0E50B3523 +:10156000F0F509E513F5F0E50E95F0F501E50BF55D +:10157000F0E50B35F0F501E501F5F0E50945F0F58D +:1015800009E50AF5F0E50965F0F509E509F5F0E585 +:101590000055F0F500C3E50DF5F0E51295F0F509FD +:1015A000E50BF5F0E50B35F0F509E512F5F0E50D85 +:1015B00095F0F501E50BF5F0E50B35F0F501E501EA +:1015C000F5F0E50945F0F509E50AF5F0E50965F0FE +:1015D000F509E509F5F0E50055F0F500C3E515F569 +:1015E000F0E51195F0F509E50BF5F0E50B35F0F5B3 +:1015F00009E509F5F0E50055F0F500E500F5F0E541 +:101600000C45F0F50CE519F50AE51AF500E51BF5B2 +:1016100001E50CF509750C01C3750B00E509F5F042 +:10162000E50B95F0F50B750B00E50BF5F0E50B35CB +:10163000F0F50BE50BF5F0E50C65F0F50CC3750B5B +:1016400000E50AF5F0E50B95F0F50B750B00E50BE1 +:10165000F5F0E50B35F0F50BE50BF5F0E50C65F075 +:10166000F50CC3750B00E500F5F0E50B95F0F50BF7 +:10167000750B00E50BF5F0E50B35F0F50BE50BF51B +:10168000F0E50C65F0F50CC3750B00E501F5F0E530 +:101690000B95F0F50B750B00E50BF5F0E50B35F050 +:1016A000F50BE50BF5F0E50C65F0F50C750A00752A +:1016B0000000750100E50AF509750B01C3750A0004 +:1016C000E50CF5F0E50A95F0F50A750A00E50AF56E +:1016D000F0E50A35F0F50AE50AF5F0E50B65F0F5F9 +:1016E0000BC3750A00E509F5F0E50A95F0F50A75F2 +:1016F0000A00E50AF5F0E50A35F0F50AE50AF5F025 +:10170000E50B65F0F50BC3750A00E500F5F0E50A99 +:1017100095F0F50A750A00E50AF5F0E50A35F0F5E9 +:101720000AE50AF5F0E50B65F0F50BC3750A00E56F +:1017300001F5F0E50A95F0F50A750A00E50AF5F0FD +:10174000E50A35F0F50AE50AF5F0E50B65F0F50B6D +:10175000750100750900750A00750000E50BF5F0CC +:10176000E50045F0F500E501F5F0E50045F0F50090 +:10177000E509F5F0E50045F0F500E50AF5F0E500CE +:1017800045F0F500E50070028003021A8F00750134 +:1017900000C3750000E501F5F075E0012506F5824E +:1017A00075E0003507F583E0F508E50835F0F5014B +:1017B000E500F5F075E0002506F58275E0003507D7 +:1017C000F583E0F508E50835F0F50075E005250638 +:1017D000F58275E0003507F583E0F508E508F503C7 +:1017E000E500F502E501F582E502F583E503F07514 +:1017F0000101C3750000E501F5F075E0012506F56E +:101800008275E0003507F583E0F508E50835F0F569 +:1018100001E500F5F075E0002506F58275E000357C +:1018200007F583E0F508E50835F0F50075E00425D7 +:1018300006F58275E0003507F583E0F508E508F563 +:1018400003E500F502E501F582E502F583E503F025 +:10185000750102C3750000E501F5F075E00125068C +:10186000F58275E0003507F583E0F508E50835F009 +:10187000F501E500F5F075E0002506F58275E0005C +:101880003507F583E0F508E50835F0F50075E00368 +:101890002506F58275E0003507F583E0F508E508D3 +:1018A000F503E500F502E501F582E502F583E503C0 +:1018B000F0750103C3750000E501F5F075E0012541 +:1018C00006F58275E0003507F583E0F508E5083593 +:1018D000F0F501E500F5F075E0002506F58275E00C +:1018E000003507F583E0F508E50835F0F50075E00B +:1018F000022506F58275E0003507F583E0F508E579 +:1019000008F503E500F502E501F582E502F583E55A +:1019100003F0750001750100750C04750D00750E5E +:1019200000750F00C3750900E500F5F0E50CA4F59E +:101930000BE500F5F0E50CA4E5F0F50AE50BF5F094 +:10194000E50935F0F509E501F5F0E50CA4F50BE541 +:1019500001F5F0E50CA4E5F0F501E50BF5F0E50A7D +:1019600035F0F50AC3C3750100E509F5F0E50E355C +:10197000F0F50EE50AF5F0E50F35F0F50FC3750A41 +:1019800000E500F5F0E50DA4F50BE500F5F0E50D3B +:10199000A4E5F0F501E50BF5F0E50A35F0F50A757B +:1019A0000900C3C3750000E509F5F0E50E35F0F553 +:1019B0000EE50AF5F0E50F35F0F50FC37509007572 +:1019C0000A00C3C3750000E509F5F0E50E35F0F532 +:1019D0000EE50AF5F0E50F35F0F50FC37509007552 +:1019E0000A00C3C3750000E509F5F0E50E35F0F512 +:1019F0000EE50AF5F0E50F35F0F50FC3750000E5CB +:101A00000EF5F075E0012506F58275E0003507F565 +:101A100083E0F508E50835F0F50875E0012506F5E1 +:101A20008275E0003507F583E508F0E50FF5F07500 +:101A3000E0002506F58275E0003507F583E0F5083E +:101A4000E50835F0F50875E0002506F58275E0003B +:101A50003507F583E508F07500017501007509008B +:101A6000750A00C3E500F5F0E51195F0F511E50103 +:101A7000F5F0E51295F0F512E509F5F0E51395F0AE +:101A8000F513E50AF5F0E51895F0F5180213720064 +:101A9000C375000075E0082506F58275E00035077E +:101AA000F583E0F508E508F5F075E0052506F58213 +:101AB00075E0003507F583E0F508E50835F0F50831 +:101AC00075E0052506F58275E0003507F583E50824 +:101AD000F075E0082506F58275E0003507F583E02E +:101AE000F508E508F5F075E0042506F58275E000D7 +:101AF0003507F583E0F508E50835F0F50875E004ED +:101B00002506F58275E0003507F583E508F075E0F8 +:101B1000082506F58275E0003507F583E0F508E550 +:101B200008F5F075E0032506F58275E0003507F548 +:101B300083E0F508E50835F0F50875E0032506F5BE +:101B40008275E0003507F583E508F075E0082506A5 +:101B5000F58275E0003507F583E0F508E508F5F056 +:101B600075E0022506F58275E0003507F583E0F59E +:101B700008E50835F0F50875E0022506F58275E000 +:101B8000003507F583E508F075000175010075095A +:101B900000750A00C3E500F5F075E0092506F58239 +:101BA00075E0003507F583E0F508E50895F0F508E0 +:101BB00075E0092506F58275E0003507F583E5082F +:101BC000F0E501F5F0E51795F0F517E509F5F0E515 +:101BD0001495F0F514E50AF5F075E0072506F58291 +:101BE00075E0003507F583E0F508E50895F0F508A0 +:101BF00075E0072506F58275E0003507F583E508F1 +:101C0000F0020E8B00750001750100750900750A60 +:101C100000C3E500F5F075E00B2506F58275E000E0 +:101C20003507F583E0F508E50895F0F50875E00B54 +:101C30002506F58275E0003507F583E508F0E50136 +:101C4000F5F075E00A2506F58275E0003507F583A5 +:101C5000E0F508E50895F0F50875E00A2506F58237 +:101C600075E0003507F583E508F0E509F5F0E516C0 +:101C700095F0F516E50AF5F075E0062506F582758E +:101C8000E0003507F583E0F508E50895F0F50875FF +:101C9000E0062506F58275E0003507F583E508F0D6 +:101CA00002095700750000E500F502E500F503E5BF +:101CB00000F504E500F50575E0152506F58275E0EB +:101CC000003507F583E0F51775E0142506F58275F4 +:101CD000E0003507F583E0F51675E0132506F5827B +:101CE00075E0003507F583E0F51575E0122506F57A +:101CF0008275E0003507F583E0F51475E0112506DF +:101D0000F58275E0003507F583E0F51375E01025E1 +:101D100006F58275E0003507F583E0F51275E00FF2 +:101D20002506F58275E0003507F583E0F51175E0CD +:101D30000E2506F58275E0003507F583E0F5107590 +:101D4000E00C2506F58275E0003507F583E0F5081F +:101D5000E508C0E075E00D2506F58275E000350761 +:101D6000F583E0F508E508C0E075E0162506F50600 +:101D700075E0003507F507E502F582E503F583E533 +:101D800004F500E505F50122000000000000000058 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr23625.s.expected b/tests/GCCTestSuite/pr23625.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr23625.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24367.c b/tests/GCCTestSuite/pr24367.c new file mode 100644 index 0000000..6486719 --- /dev/null +++ b/tests/GCCTestSuite/pr24367.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC -funroll-loops" } */ + +char * +test (const char *parent, const char *child) +{ + static char rtn_path[1024]; + char *s = rtn_path; + char *s_end = rtn_path + sizeof (rtn_path); + const char *s2 = child; + + while (*s != '\0') + s++; + while ((s < s_end) && (*s2 != '\0')) + *s++ = *s2++; + return (rtn_path); +} diff --git a/tests/GCCTestSuite/pr24367.c.expected b/tests/GCCTestSuite/pr24367.c.expected new file mode 100644 index 0000000..6486719 --- /dev/null +++ b/tests/GCCTestSuite/pr24367.c.expected @@ -0,0 +1,17 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC -funroll-loops" } */ + +char * +test (const char *parent, const char *child) +{ + static char rtn_path[1024]; + char *s = rtn_path; + char *s_end = rtn_path + sizeof (rtn_path); + const char *s2 = child; + + while (*s != '\0') + s++; + while ((s < s_end) && (*s2 != '\0')) + *s++ = *s2++; + return (rtn_path); +} diff --git a/tests/GCCTestSuite/pr24367.hex.expected b/tests/GCCTestSuite/pr24367.hex.expected new file mode 100644 index 0000000..0990d8e --- /dev/null +++ b/tests/GCCTestSuite/pr24367.hex.expected @@ -0,0 +1,160 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5173C +:10004000F518E516F519E515F51AE514F51BE51390 +:10005000F51EE512F51F75E0032506F58275E00033 +:100060003507F583E511F075E0022506F58275E0A8 +:10007000003507F583E510F0E51DF515E51CF514D1 +:10008000900000E582F512900000E583F5139000E2 +:1000900000E582F510900000E583F511750000750C +:1000A0000104750C01750D00750E00750F00C37508 +:1000B0000900E500F5F0E50CA4F50BE500F5F0E529 +:1000C0000CA4E5F0F50AE50BF5F0E50935F0F509C6 +:1000D000E501F5F0E50CA4F50BE501F5F0E50CA460 +:1000E000E5F0F501E50BF5F0E50A35F0F50AC3C3D7 +:1000F000750100E509F5F0E50E35F0F50EE50AF5B8 +:10010000F0E50F35F0F50FC3750A00E500F5F0E5F1 +:100110000DA4F50BE500F5F0E50DA4E5F0F501E51E +:100120000BF5F0E50A35F0F50A750900C3C3750053 +:1001300000E509F5F0E50E35F0F50EE50AF5F0E518 +:100140000F35F0F50FC3750900750A00C3C37500BC +:1001500000E509F5F0E50E35F0F50EE50AF5F0E5F8 +:100160000F35F0F50FC3750900750A00C3C375009C +:1001700000E509F5F0E50E35F0F50EE50AF5F0E5D8 +:100180000F35F0F50FC3750000E50EF5F0E51035FD +:10019000F0F517E50FF5F0E51135F0F516E515F575 +:1001A00000E514F501750A00C3750900E50AF5F0CC +:1001B000E51235F0F50AE509F5F0E51335F0F50936 +:1001C000E509F502E50AF582E502F583E0F50D752E +:1001D0001000E510F50EE510F50F750900750A0021 +:1001E000750B00750C00751100C3E509F5F0E50D00 +:1001F00095F0F509E509F5F0E51145F0F511C3E5D0 +:100200000AF5F0E50E95F0F509E509F5F0E511457B +:10021000F0F511C3E50BF5F0E50F95F0F509E509EB +:10022000F5F0E51145F0F511C3E50CF5F0E5109595 +:10023000F0F509E509F5F0E51145F0F5117509004E +:10024000750A00750B00750D01C3750C00E511F5FD +:10025000F0E50C95F0F50C750C00E50CF5F0E50CEF +:1002600035F0F50CE50CF5F0E50D65F0F50DC37511 +:100270000C00E509F5F0E50C95F0F50C750C00E5C2 +:100280000CF5F0E50C35F0F50CE50CF5F0E50D6539 +:10029000F0F50DC3750C00E50AF5F0E50C95F0F5E9 +:1002A0000C750C00E50CF5F0E50C35F0F50CE50CE3 +:1002B000F5F0E50D65F0F50DC3750C00E50BF5F0F7 +:1002C000E50C95F0F50C750C00E50CF5F0E50C353A +:1002D000F0F50CE50CF5F0E50D65F0F50D750A008F +:1002E000750B00750C00750900E50DF5F0E5094585 +:1002F000F0F509E50AF5F0E50945F0F509E50BF536 +:10030000F0E50945F0F509E50CF5F0E50945F0F5EE +:1003100009E5097002800302041F00750901750ACE +:1003200000750E01750F00751000751100C3750B77 +:1003300000E509F5F0E50EA4F50DE509F5F0E50E8B +:10034000A4E5F0F50CE50DF5F0E50B35F0F50BE562 +:100350000AF5F0E50EA4F50DE50AF5F0E50EA4E5C5 +:10036000F0F50AE50DF5F0E50C35F0F50CC3C375B5 +:100370000A00E50BF5F0E51035F0F510E50CF5F0A9 +:10038000E51135F0F511C3750C00E509F5F0E50F41 +:10039000A4F50DE509F5F0E50FA4E5F0F50AE50D86 +:1003A000F5F0E50C35F0F50C750B00C3C3750900CD +:1003B000E50BF5F0E51035F0F510E50CF5F0E5117D +:1003C00035F0F511C3750B00750C00C3C37509003A +:1003D000E50BF5F0E51035F0F510E50CF5F0E5115D +:1003E00035F0F511C3750B00750C00C3C37509001A +:1003F000E50BF5F0E51035F0F510E50CF5F0E5113D +:1004000035F0F511C3750900E510F5F0E51235F08A +:10041000F512E511F5F0E51335F0F5130201A5002D +:10042000750E00750F00751000751100750D0075C3 +:100430000C01750901C3E516F5F0E51395F0F50B10 +:10044000E50DF5F0E50D35F0F50BE50BF5F0E509FB +:1004500055F0F509E509F5F0E50E45F0F50E7509DD +:1004600001C3E516F5F0E51395F0F50BE50DF5F094 +:10047000E50D35F0F50BE513F5F0E51695F0F50A09 +:10048000E50DF5F0E50D35F0F50AE50AF5F0E50BBB +:1004900045F0F50BE50CF5F0E50B65F0F50BE50B1C +:1004A000F5F0E50955F0F509C3E517F5F0E5129506 +:1004B000F0F50BE50DF5F0E50D35F0F50BE50BF579 +:1004C000F0E50955F0F509E509F5F0E50E45F0F51B +:1004D0000E750900E50EF5F0E50945F0F509E50FA3 +:1004E000F5F0E50945F0F509E510F5F0E50945F009 +:1004F000F509E511F5F0E50945F0F509E5097002A2 +:1005000080030208F900750900750A00750B007573 +:100510000C00750E01C3750D00E509F5F0E50D95AC +:10052000F0F50D750D00E50DF5F0E50D35F0F50D67 +:10053000E50DF5F0E50E65F0F50EC3750D00E50A65 +:10054000F5F0E50D95F0F50D750D00E50DF5F0E50F +:100550000D35F0F50DE50DF5F0E50E65F0F50EC382 +:10056000750D00E50BF5F0E50D95F0F50D750D0039 +:10057000E50DF5F0E50D35F0F50DE50DF5F0E50EC1 +:1005800065F0F50EC3750D00E50CF5F0E50D95F081 +:10059000F50D750D00E50DF5F0E50D35F0F50DE502 +:1005A0000DF5F0E50E65F0F50E750A00750B00759A +:1005B0000C00750900E50EF5F0E50945F0F509E5D3 +:1005C0000AF5F0E50945F0F509E50BF5F0E5094513 +:1005D000F0F509E50CF5F0E50945F0F509E50970D8 +:1005E00002800302085400E512F514E513F51575B1 +:1005F0000A01750B00750F01751000751100750962 +:1006000000C3750C00E50AF5F0E50FA4F50EE50A48 +:10061000F5F0E50FA4E5F0F50DE50EF5F0E50C3588 +:10062000F0F50CE50BF5F0E50FA4F50EE50BF5F094 +:10063000E50FA4E5F0F50BE50EF5F0E50D35F0F569 +:100640000DC3C3750B00E50CF5F0E51135F0F511A0 +:10065000E50DF5F0E50935F0F509C3750D00E50A7E +:10066000F5F0E510A4F50EE50AF5F0E510A4E5F0C7 +:10067000F50BE50EF5F0E50D35F0F50D750C00C345 +:10068000C3750A00E50CF5F0E51135F0F511E50D3F +:10069000F5F0E50935F0F509C3750C00750D00C3DB +:1006A000C3750A00E50CF5F0E51135F0F511E50D1F +:1006B000F5F0E50935F0F509C3750C00750D00C3BB +:1006C000C3750A00E50CF5F0E51135F0F511E50DFF +:1006D000F5F0E50935F0F509C3750A00E511F5F007 +:1006E000E51435F0F512E509F5F0E51535F0F513EB +:1006F000E500F510E501F511750001750100750CB7 +:1007000001750D00750E00750F00C3750900E50039 +:10071000F5F0E50CA4F50BE500F5F0E50CA4E5F02B +:10072000F50AE50BF5F0E50935F0F509E501F5F019 +:10073000E50CA4F50BE501F5F0E50CA4E5F0F501F9 +:10074000E50BF5F0E50A35F0F50AC3C3750100E5E0 +:1007500009F5F0E50E35F0F50EE50AF5F0E50F3593 +:10076000F0F50FC3750A00E500F5F0E50DA4F50BF3 +:10077000E500F5F0E50DA4E5F0F501E50BF5F0E594 +:100780000A35F0F50A750900C3C3750000E509F5DF +:10079000F0E50E35F0F50EE50AF5F0E50F35F0F56C +:1007A0000FC3750900750A00C3C3750000E509F59C +:1007B000F0E50E35F0F50EE50AF5F0E50F35F0F54C +:1007C0000FC3750900750A00C3C3750000E509F57C +:1007D000F0E50E35F0F50EE50AF5F0E50F35F0F52C +:1007E0000FC3750000E50EF5F0E51035F0F500E5F6 +:1007F0000FF5F0E51135F0F501750A00C375090034 +:10080000E50AF5F0E51035F0F50AE509F5F0E51132 +:1008100035F0F509E509F502E50AF582E502F5830B +:10082000E0F50B750A00C3750900E50AF5F0E5145B +:1008300035F0F50AE509F5F0E51535F0F509E50BB4 +:10084000F503E509F502E50AF582E502F583E5031E +:10085000F002042000900000E582F501900000E520 +:1008600083F509750000E501F502E509F503E500EA +:10087000F504E500F505E518F517E519F516E51A8F +:10088000F515E51BF514E51EF513E51FF51275E0EA +:10089000032506F58275E0003507F583E0F511754F +:1008A000E0022506F58275E0003507F583E0F510D6 +:1008B00075E0002506F58275E0003507F583E0F563 +:1008C00008E508C0E075E0012506F58275E0003511 +:1008D00007F583E0F508E508C0E075E0082506F5B2 +:1008E0000675E0003507F507E502F582E503F583B7 +:1008F000E504F500E505F5012200750A00C3750958 +:1009000000E50AF5F0E50035F0F50AE509F5F0E552 +:100910000135F0F509E509F502E50AF582E502F58C +:1009200083E0F50D751000E510F50EE510F50F7577 +:100930000900750A00750B00750C00751100C3E500 +:1009400009F5F0E50D95F0F509E509F5F0E5114536 +:10095000F0F511C3E50AF5F0E50E95F0F509E509A6 +:10096000F5F0E51145F0F511C3E50BF5F0E50F9550 +:10097000F0F509E509F5F0E51145F0F511C3E50CD1 +:10098000F5F0E51095F0F509E509F5F0E51145F00C +:10099000F511750A00750B00750C00750900E5115D +:1009A000F5F0E50945F0F509E50AF5F0E50945F04A +:1009B000F509E50BF5F0E50945F0F509E50CF5F06D +:1009C000E50945F0F509E509700280030209DF0039 +:1009D000750900750A00750B00750C000205120000 +:1009E000750901750A00750B00750C0002051200EF +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24367.s.expected b/tests/GCCTestSuite/pr24367.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr24367.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24445.c b/tests/GCCTestSuite/pr24445.c new file mode 100644 index 0000000..f34784c --- /dev/null +++ b/tests/GCCTestSuite/pr24445.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O1 -fpic" } */ +extern int *bar (void) __attribute__ ((__pure__)); +extern char *baz; +void +foo (void) +{ + baz = (char *) bar (); +} diff --git a/tests/GCCTestSuite/pr24445.c.expected b/tests/GCCTestSuite/pr24445.c.expected new file mode 100644 index 0000000..f34784c --- /dev/null +++ b/tests/GCCTestSuite/pr24445.c.expected @@ -0,0 +1,9 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O1 -fpic" } */ +extern int *bar (void) __attribute__ ((__pure__)); +extern char *baz; +void +foo (void) +{ + baz = (char *) bar (); +} diff --git a/tests/GCCTestSuite/pr24445.hex.expected b/tests/GCCTestSuite/pr24445.hex.expected new file mode 100644 index 0000000..0cdd748 --- /dev/null +++ b/tests/GCCTestSuite/pr24445.hex.expected @@ -0,0 +1,19 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F0E553 +:1000400082F502E583F503E502F50BE503F50C9077 +:100050000000E582F509900000E583F50A750100CE +:10006000C3750000E501F5F0E50935F0F501E5009F +:10007000F5F0E50A35F0F500E50BF503E500F502CE +:10008000E501F582E502F583E503F0750101C3752D +:100090000000E501F5F0E50935F0F501E500F5F0C2 +:1000A000E50A35F0F500E50CF503E500F502E5019C +:1000B000F582E502F583E503F0750000E500F50241 +:1000C000E500F503E500F504E500F50575E000251C +:1000D00006F58275E0003507F583E0F508E508C010 +:1000E000E075E0012506F58275E0003507F583E04F +:1000F000F508E508C0E075E0022506F50675E000A4 +:100100003507F507E502F582E503F583E504F5001B +:10011000E505F501220000000000000000000000DD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24445.s.expected b/tests/GCCTestSuite/pr24445.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr24445.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24600.c b/tests/GCCTestSuite/pr24600.c new file mode 100644 index 0000000..62bb7ca --- /dev/null +++ b/tests/GCCTestSuite/pr24600.c @@ -0,0 +1,16 @@ +/* This used to ICE on s390 due to a old-loop bug. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +char *strcpy (char *dest, const char *src); + +void test (char *Line, int len) +{ + int z; + + for (z = 1; z <= len; z++) + if (Line[z - 1]) + strcpy (Line + z + 1, Line); +} + diff --git a/tests/GCCTestSuite/pr24600.c.expected b/tests/GCCTestSuite/pr24600.c.expected new file mode 100644 index 0000000..62bb7ca --- /dev/null +++ b/tests/GCCTestSuite/pr24600.c.expected @@ -0,0 +1,16 @@ +/* This used to ICE on s390 due to a old-loop bug. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +char *strcpy (char *dest, const char *src); + +void test (char *Line, int len) +{ + int z; + + for (z = 1; z <= len; z++) + if (Line[z - 1]) + strcpy (Line + z + 1, Line); +} + diff --git a/tests/GCCTestSuite/pr24600.hex.expected b/tests/GCCTestSuite/pr24600.hex.expected new file mode 100644 index 0000000..f972680 --- /dev/null +++ b/tests/GCCTestSuite/pr24600.hex.expected @@ -0,0 +1,165 @@ +:100000000000E506758214C39582F506E507758341 +:10001000009583F507D0E0F50875E0052506F58223 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000042506F58275E0003507F583E508F075BF +:10004000E00D2506F58275E0003507F583E517F02C +:1000500075E00C2506F58275E0003507F583E51699 +:10006000F075E00B2506F58275E0003507F583E5B0 +:1000700015F075E00A2506F58275E0003507F58371 +:10008000E514F075E0092506F58275E0003507F501 +:1000900083E513F075E0082506F58275E000350765 +:1000A000F583E512F075E0072506F58275E0003569 +:1000B00007F583E511F075E0062506F58275E00089 +:1000C0003507F583E510F075E0012506F58275E04A +:1000D000003507F583E51FF075E0002506F582750C +:1000E000E0003507F583E51EF075E0032506F5828F +:1000F00075E0003507F583E51DF0E51CF517E51BF8 +:10010000F51575E0022506F58275E0003507F583E3 +:10011000E51AF0751001751100751200751600755D +:10012000E0022506F58275E0003507F583E0F5135A +:10013000E516F50F750080E500F5F0E51325F0F5FF +:1001400013E500F5F0E50F25F0F50F750C00750DC2 +:1001500000751400750E00750B00750A017500011D +:10016000C3E50FF5F0E51395F0F509E50BF5F0E5BE +:100170000B35F0F509E509F5F0E50055F0F500E57A +:1001800000F5F0E50C45F0F50C750001C3E50FF541 +:10019000F0E51395F0F509E50BF5F0E50B35F0F515 +:1001A00009E513F5F0E50F95F0F501E50BF5F0E540 +:1001B0000B35F0F501E501F5F0E50945F0F509E548 +:1001C0000AF5F0E50965F0F509E509F5F0E50055F2 +:1001D000F0F500C3E512F5F0E51595F0F509E50B2E +:1001E000F5F0E50B35F0F509E509F5F0E50055F01A +:1001F000F500E500F5F0E50C45F0F50C750001C3E0 +:10020000E50FF5F0E51395F0F509E50BF5F0E50BD5 +:1002100035F0F509E513F5F0E50F95F0F501E50B7F +:10022000F5F0E50B35F0F501E501F5F0E50945F0F0 +:10023000F509E50AF5F0E50965F0F509E509F5F0D8 +:10024000E50055F0F500C3E512F5F0E51595F0F57C +:1002500009E50BF5F0E50B35F0F509E515F5F0E5E9 +:100260001295F0F501E50BF5F0E50B35F0F501E53C +:1002700001F5F0E50945F0F509E50AF5F0E5096550 +:10028000F0F509E509F5F0E50055F0F500C3E511D5 +:10029000F5F0E51795F0F509E50BF5F0E50B35F010 +:1002A000F509E509F5F0E50055F0F500E500F5F094 +:1002B000E50C45F0F50C750001C3E50FF5F0E5130D +:1002C00095F0F509E50BF5F0E50B35F0F509E513CB +:1002D000F5F0E50F95F0F501E50BF5F0E50B35F0E0 +:1002E000F501E501F5F0E50945F0F509E50AF5F058 +:1002F000E50965F0F509E509F5F0E50055F0F500CB +:10030000C3E512F5F0E51595F0F509E50BF5F0E517 +:100310000B35F0F509E515F5F0E51295F0F501E579 +:100320000BF5F0E50B35F0F501E501F5F0E50945D4 +:10033000F0F509E50AF5F0E50965F0F509E509F5D7 +:10034000F0E50055F0F500C3E511F5F0E51795F07F +:10035000F509E50BF5F0E50B35F0F509E517F5F0D6 +:10036000E51195F0F501E50BF5F0E50B35F0F5013C +:10037000E501F5F0E50945F0F509E50AF5F0E509CF +:1003800065F0F509E509F5F0E50055F0F500C3E580 +:1003900010F5F075E0032506F58275E0003507F5E8 +:1003A00083E0F508E50895F0F509E50BF5F0E50BB8 +:1003B00035F0F509E509F5F0E50055F0F500E50043 +:1003C000F5F0E50C45F0F50CE50CF500E514F5014C +:1003D000750C01C3750900E500F5F0E50995F0F528 +:1003E00009750900E509F5F0E50935F0F509E509B4 +:1003F000F5F0E50C65F0F50CC3750900E50DF5F0B9 +:10040000E50995F0F509750900E509F5F0E5093507 +:10041000F0F509E509F5F0E50C65F0F50CC3750993 +:1004200000E501F5F0E50995F0F509750900E50924 +:10043000F5F0E50935F0F509E509F5F0E50C65F0AD +:10044000F50CC3750900E50EF5F0E50995F0F50921 +:10045000750900E509F5F0E50935F0F509E509F557 +:10046000F0E50C65F0F50C750D00751400750E00C7 +:10047000E50DF500E514F501E50EF509750B01C371 +:10048000750A00E50CF5F0E50A95F0F50A750A0025 +:10049000E50AF5F0E50A35F0F50AE50AF5F0E50BB1 +:1004A00065F0F50BC3750A00E500F5F0E50A95F077 +:1004B000F50A750A00E50AF5F0E50A35F0F50AE5F2 +:1004C0000AF5F0E50B65F0F50BC3750A00E501F5DB +:1004D000F0E50A95F0F50A750A00E50AF5F0E50A77 +:1004E00035F0F50AE50AF5F0E50B65F0F50BC37597 +:1004F0000A00E509F5F0E50A95F0F50A750A00E548 +:100500000AF5F0E50A35F0F50AE50AF5F0E50B65C0 +:10051000F0F50B750100750900750A00750000E51E +:100520000BF5F0E50045F0F500E501F5F0E50045D7 +:10053000F0F500E509F5F0E50045F0F500E50AF510 +:10054000F0E50045F0F500E5007002800302095572 +:1005500000750001750100C3E500F5F0E51095F0A8 +:10056000F500E501F5F0E51195F0F501750C017563 +:100570000D00750E00750F00C3750900E500F5F05C +:10058000E50CA4F50BE500F5F0E50CA4E5F0F50AA3 +:10059000E50BF5F0E50935F0F509E501F5F0E50CB9 +:1005A000A4F50BE501F5F0E50CA4E5F0F501E50B8C +:1005B000F5F0E50A35F0F50AC3C3750100E509F564 +:1005C000F0E50E35F0F50EE50AF5F0E50F35F0F53E +:1005D0000FC3750A00E500F5F0E50DA4F50BE50085 +:1005E000F5F0E50DA4E5F0F501E50BF5F0E50A35CC +:1005F000F0F50A750900C3C3750000E509F5F0E5DB +:100600000E35F0F50EE50AF5F0E50F35F0F50FC300 +:10061000750900750A00C3C3750000E509F5F0E52A +:100620000E35F0F50EE50AF5F0E50F35F0F50FC3E0 +:10063000750900750A00C3C3750000E509F5F0E50A +:100640000E35F0F50EE50AF5F0E50F35F0F50FC3C0 +:10065000750000E50EF5F075E0012506F58275E000 +:10066000003507F583E0F508E50835F0F500E50FFE +:10067000F5F075E0002506F58275E0003507F58395 +:10068000E0F508E50835F0F50AE500F50975010023 +:10069000C3750000E501F5F0E50935F0F501E50069 +:1006A000F5F0E50A35F0F500E500F502E501F58223 +:1006B000E502F583E0F501750000E501F5F0E500E0 +:1006C00045F0F500E500700280030207090075019E +:1006D00001750900750A00750B00C3750000E5017E +:1006E000F5F0E51035F0F510E509F5F0E51135F018 +:1006F000F511E50AF5F0E51235F0F512E50BF5F028 +:10070000E51635F0F51602011F00750A01750C009B +:10071000750D00750000C3750100E510F5F0E50AE0 +:10072000A4F50BE510F5F0E50AA4E5F0F509E50BF5 +:10073000F5F0E50135F0F501E511F5F0E50AA4F570 +:100740000BE511F5F0E50AA4E5F0F50AE50BF5F087 +:10075000E50935F0F509C3C3750A00E501F5F0E5D3 +:100760000D35F0F50DE509F5F0E50035F0F500C3C0 +:10077000750900E510F5F0E50CA4F50BE510F5F0B2 +:10078000E50CA4E5F0F50AE50BF5F0E50935F0F523 +:1007900009750100C3C3750A00E501F5F0E50D35E3 +:1007A000F0F50DE509F5F0E50035F0F500C375014C +:1007B00000750900C3C3750A00E501F5F0E50D35C4 +:1007C000F0F50DE509F5F0E50035F0F500C375012C +:1007D00000750900C3C3750A00E501F5F0E50D35A4 +:1007E000F0F50DE509F5F0E50035F0F500C375010C +:1007F00000E50DF5F075E0012506F58275E00035A0 +:1008000007F583E0F508E50835F0F513E500F5F0A8 +:1008100075E0002506F58275E0003507F583E0F503 +:1008200008E50835F0F514750001750100750C0137 +:10083000750D00750E00750F00C3750900E500F514 +:10084000F0E50CA4F50BE500F5F0E50CA4E5F0F5FA +:100850000AE50BF5F0E50935F0F509E501F5F0E5F8 +:100860000CA4F50BE501F5F0E50CA4E5F0F501E5C8 +:100870000BF5F0E50A35F0F50AC3C3750100E5098B +:10088000F5F0E50E35F0F50EE50AF5F0E50F35F07B +:10089000F50FC3750A00E500F5F0E50DA4F50BE5CD +:1008A00000F5F0E50DA4E5F0F501E50BF5F0E50A3E +:1008B00035F0F50A750900C3C3750000E509F5F0C8 +:1008C000E50E35F0F50EE50AF5F0E50F35F0F50F1C +:1008D000C3750900750A00C3C3750000E509F5F08A +:1008E000E50E35F0F50EE50AF5F0E50F35F0F50FFC +:1008F000C3750900750A00C3C3750000E509F5F06A +:10090000E50E35F0F50EE50AF5F0E50F35F0F50FDB +:10091000C3750000E50EF5F0E51335F0F500E50FC1 +:10092000F5F0E51435F0F501E500F51FE501F51EDC +:1009300075E0012506F58275E0003507F583E0F5E1 +:100940001D75E0002506F58275E0003507F583E0AA +:10095000F51C0206CE00750000E500F502E500F585 +:1009600003E500F504E500F50575E00D2506F582C3 +:1009700075E0003507F583E0F51775E00C2506F501 +:100980008275E0003507F583E0F51675E00B250666 +:10099000F58275E0003507F583E0F51575E00A2569 +:1009A00006F58275E0003507F583E0F51475E0097A +:1009B0002506F58275E0003507F583E0F51375E04F +:1009C000082506F58275E0003507F583E0F5127518 +:1009D000E0072506F58275E0003507F583E0F5119F +:1009E00075E0062506F58275E0003507F583E0F52C +:1009F0001075E0042506F58275E0003507F583E003 +:100A0000F508E508C0E075E0052506F58275E0000B +:100A10003507F583E0F508E508C0E075E014250624 +:100A2000F50675E0003507F507E502F582E503F503 +:100A300083E504F500E505F5012200000000000053 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24600.s.expected b/tests/GCCTestSuite/pr24600.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr24600.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24615.c b/tests/GCCTestSuite/pr24615.c new file mode 100644 index 0000000..9e42911 --- /dev/null +++ b/tests/GCCTestSuite/pr24615.c @@ -0,0 +1,27 @@ + +/* { dg-do compile { target fpic } } */ +/* { dg-options "-Os -fPIC" } */ + +void *memset (void *, int, __SIZE_TYPE__); +void *memcpy (void *, const void *, __SIZE_TYPE__); + +char *alloc (int); + +char * +test (int type, int size, char *data, int len) +{ + char *block = alloc (size); + char *bp = block; + + *bp++ = type; + switch (type) + { + case 0: + case 1: + memset (bp, type == 0 ? 0x00 : 0xff, size); + memcpy (bp, data, len); + } + + return block; +} + diff --git a/tests/GCCTestSuite/pr24615.c.expected b/tests/GCCTestSuite/pr24615.c.expected new file mode 100644 index 0000000..9e42911 --- /dev/null +++ b/tests/GCCTestSuite/pr24615.c.expected @@ -0,0 +1,27 @@ + +/* { dg-do compile { target fpic } } */ +/* { dg-options "-Os -fPIC" } */ + +void *memset (void *, int, __SIZE_TYPE__); +void *memcpy (void *, const void *, __SIZE_TYPE__); + +char *alloc (int); + +char * +test (int type, int size, char *data, int len) +{ + char *block = alloc (size); + char *bp = block; + + *bp++ = type; + switch (type) + { + case 0: + case 1: + memset (bp, type == 0 ? 0x00 : 0xff, size); + memcpy (bp, data, len); + } + + return block; +} + diff --git a/tests/GCCTestSuite/pr24615.hex.expected b/tests/GCCTestSuite/pr24615.hex.expected new file mode 100644 index 0000000..c28e7d6 --- /dev/null +++ b/tests/GCCTestSuite/pr24615.hex.expected @@ -0,0 +1,170 @@ +:1000000000000000E506758228C39582F506E50725 +:100010007583009583F507D0E0F50875E011250696 +:10002000F58275E0003507F583E508F0D0E0F508C6 +:1000300075E0102506F58275E0003507F583E508C3 +:10004000F075E0192506F58275E0003507F583E5C2 +:1000500017F075E0182506F58275E0003507F58381 +:10006000E516F075E0172506F58275E0003507F511 +:1000700083E515F075E0162506F58275E000350775 +:10008000F583E514F075E0152506F58275E0003579 +:1000900007F583E513F075E0142506F58275E00099 +:1000A0003507F583E512F075E0132506F58275E056 +:1000B000003507F583E511F075E0122506F5827528 +:1000C000E0003507F583E510F0E51FF510E51EF5B6 +:1000D00011E51DF512E51CF51375E0092506F582FD +:1000E00075E0003507F583E51BF075E0082506F59A +:1000F0008275E0003507F583E51AF075E0072506FF +:10010000F58275E0003507F583E519F075E0062501 +:1001100006F58275E0003507F583E518F0750928C6 +:10012000750001E500F5F0E50995F0F509E506F53E +:1001300000E500F5F0E50925F0F509750100E50792 +:10014000F500E500F5F0E50135F0F501E501F50212 +:10015000E509F582E502F583E0F50875E00B250673 +:10016000F58275E0003507F583E508F07509287517 +:100170000002E500F5F0E50995F0F509E506F50062 +:10018000E500F5F0E50925F0F509750100E507F54D +:1001900000E500F5F0E50135F0F501E501F502E5D2 +:1001A00009F582E502F583E0F50875E00A2506F514 +:1001B0008275E0003507F583E508F07509287500BC +:1001C00003E500F5F0E50995F0F509E506F500E52C +:1001D00000F5F0E50925F0F509750100E507F500E2 +:1001E000E500F5F0E50135F0F501E501F502E50979 +:1001F000F582E502F583E0F50875E00F2506F58246 +:1002000075E0003507F583E508F0750928750004E9 +:10021000E500F5F0E50995F0F509E506F500E500DE +:10022000F5F0E50925F0F509750100E507F500E5AC +:1002300000F5F0E50135F0F501E501F502E509F518 +:1002400082E502F583E0F50875E00E2506F5827576 +:10025000E0003507F583E508F0750928750005E528 +:1002600000F5F0E50995F0F509E506F500E500F57E +:10027000F0E50925F0F509750100E507F500E50051 +:10028000F5F0E50135F0F501E501F502E509F58246 +:10029000E502F583E0F50875E00D2506F58275E0C9 +:1002A000003507F583E508F0750928750006E500B7 +:1002B000F5F0E50995F0F509E506F500E500F5F03E +:1002C000E50925F0F509750100E507F500E500F5FC +:1002D000F0E50135F0F501E501F502E509F582E506 +:1002E00002F583E0F50875E00C2506F58275E0005F +:1002F0003507F583E508F075E0092506F58275E018 +:10030000003507F583E0F51F75E0082506F58275D1 +:10031000E0003507F583E0F51E75E0072506F58258 +:1003200075E0003507F583E0F51D75E0062506F557 +:100330008275E0003507F583E0F51CE582F502E5FE +:1003400083F503E502F514E503F515E514F517E566 +:1003500015F516E517F518E516F51975000175017F +:1003600000750C01750D00750E00750F00C3750941 +:1003700000E500F5F0E50CA4F50BE500F5F0E50C63 +:10038000A4E5F0F50AE50BF5F0E50935F0F509E52A +:1003900001F5F0E50CA4F50BE501F5F0E50CA4E59D +:1003A000F0F501E50BF5F0E50A35F0F50AC3C37584 +:1003B0000100E509F5F0E50E35F0F50EE50AF5F07A +:1003C000E50F35F0F50FC3750A00E500F5F0E50D12 +:1003D000A4F50BE500F5F0E50DA4E5F0F501E50B5E +:1003E000F5F0E50A35F0F50A750900C3C37500009C +:1003F000E509F5F0E50E35F0F50EE50AF5F0E50F47 +:1004000035F0F50FC3750900750A00C3C375000008 +:10041000E509F5F0E50E35F0F50EE50AF5F0E50F26 +:1004200035F0F50FC3750900750A00C3C3750000E8 +:10043000E509F5F0E50E35F0F50EE50AF5F0E50F06 +:1004400035F0F50FC3750000E50EF5F0E51835F051 +:10045000F517E50FF5F0E51935F0F516750100C350 +:10046000750000E501F5F0E51835F0F501E500F55A +:10047000F0E51935F0F500E510F503E500F502E5C6 +:1004800001F582E502F583E503F0750000750100D2 +:10049000750900750A00750B00C3E500F5F0E5105D +:1004A00095F0F500E500F5F0E50B45F0F50BC3E53B +:1004B00001F5F0E51195F0F500E500F5F0E50B45E7 +:1004C000F0F50BC3E509F5F0E51295F0F500E50050 +:1004D000F5F0E50B45F0F50BC3E50AF5F0E51395EE +:1004E000F0F500E500F5F0E50B45F0F50B750000C3 +:1004F000750100750900E50BF50C750B01C3750A54 +:1005000000E50CF5F0E50A95F0F50A750A00E50A34 +:10051000F5F0E50A35F0F50AE50AF5F0E50B65F0CA +:10052000F50BC3750A00E500F5F0E50A95F0F50A4C +:10053000750A00E50AF5F0E50A35F0F50AE50AF571 +:10054000F0E50B65F0F50BC3750A00E501F5F0E584 +:100550000A95F0F50A750A00E50AF5F0E50A35F0A6 +:10056000F50AE50AF5F0E50B65F0F50BC3750A0031 +:10057000E509F5F0E50A95F0F50A750A00E50AF5D2 +:10058000F0E50A35F0F50AE50AF5F0E50B65F0F55A +:100590000B750000750100750900750A00E50BF583 +:1005A000F0E50A45F0F50AE500F5F0E50A45F0F555 +:1005B0000AE501F5F0E50A45F0F50AE509F5F0E58B +:1005C0000A45F0F50AE50A70028003020A86007502 +:1005D0000001750100750900750A00750B00C3E57F +:1005E00000F5F0E51095F0F500E500F5F0E50B45B8 +:1005F000F0F50BC3E501F5F0E51195F0F500E50028 +:10060000F5F0E50B45F0F50BC3E509F5F0E51295BE +:10061000F0F500E500F5F0E50B45F0F50BC3E50A54 +:10062000F5F0E51395F0F500E500F5F0E50B45F084 +:10063000F50B750000750100750900E50BF50C75EB +:100640000B01C3750A00E50CF5F0E50A95F0F50A13 +:10065000750A00E50AF5F0E50A35F0F50AE50AF550 +:10066000F0E50B65F0F50BC3750A00E500F5F0E564 +:100670000A95F0F50A750A00E50AF5F0E50A35F085 +:10068000F50AE50AF5F0E50B65F0F50BC3750A0010 +:10069000E501F5F0E50A95F0F50A750A00E50AF5B9 +:1006A000F0E50A35F0F50AE50AF5F0E50B65F0F539 +:1006B0000BC3750A00E509F5F0E50A95F0F50A7532 +:1006C0000A00E50AF5F0E50A35F0F50AE50AF5F065 +:1006D000E50B65F0F50B75000075010075090075F7 +:1006E0000A00E50BF5F0E50A45F0F50AE500F5F03E +:1006F000E50A45F0F50AE501F5F0E50A45F0F50AE9 +:10070000E509F5F0E50A45F0F50AE50A700280030F +:100710000207FA000000750000E514F502E515F582 +:1007200003E500F504E500F50575E0192506F582F9 +:1007300075E0003507F583E0F51775E0182506F537 +:100740008275E0003507F583E0F51675E01725069C +:10075000F58275E0003507F583E0F51575E016259F +:1007600006F58275E0003507F583E0F51475E015B0 +:100770002506F58275E0003507F583E0F51375E091 +:10078000142506F58275E0003507F583E0F512754E +:10079000E0132506F58275E0003507F583E0F511D5 +:1007A00075E0122506F58275E0003507F583E0F562 +:1007B0001075E0102506F58275E0003507F583E039 +:1007C000F508E508C0E075E0112506F58275E00042 +:1007D0003507F583E0F508E508C0E075E028250653 +:1007E000F50675E0003507F507E502F582E503F546 +:1007F00083E504F500E505F50122000075000075AC +:100800000100750900750A00750B00C3E500F5F0DD +:10081000E51095F0F500E500F5F0E50B45F0F50B7A +:10082000C3E501F5F0E51195F0F500E500F5F0E51B +:100830000B45F0F50BC3E509F5F0E51295F0F50071 +:10084000E500F5F0E50B45F0F50BC3E50AF5F0E53D +:100850001395F0F500E500F5F0E50B45F0F50B75A7 +:100860000100750900750A00E50BF500750B01C361 +:10087000750C00E500F5F0E50C95F0F50C750C0035 +:10088000E50CF5F0E50C35F0F50CE50CF5F0E50BB5 +:1008900065F0F50BC3750C00E501F5F0E50C95F07E +:1008A000F50C750C00E50CF5F0E50C35F0F50CE5F4 +:1008B0000CF5F0E50B65F0F50BC3750C00E509F5DB +:1008C000F0E50C95F0F50C750C00E50CF5F0E50C79 +:1008D00035F0F50CE50CF5F0E50B65F0F50BC3759F +:1008E0000C00E50AF5F0E50C95F0F50C750C00E54B +:1008F0000CF5F0E50C35F0F50CE50CF5F0E50B65C5 +:10090000F0F50B750100750900750A00750000E52A +:100910000BF5F0E50045F0F500E501F5F0E50045E3 +:10092000F0F500E509F5F0E50045F0F500E50AF51C +:10093000F0E50045F0F500E50070028003020A765C +:1009400000751DFF751C00751B00751A0075E00908 +:100950002506F58275E0003507F583E0F51975E0A9 +:10096000082506F58275E0003507F583E0F5187572 +:10097000E0072506F58275E0003507F583E0F50A06 +:1009800075E0062506F58275E0003507F583E0F58C +:100990000BE517F51FE516F51E750901E506F500CF +:1009A000C3E509F5F0E50095F0F509E507F50075F3 +:1009B0000100E501F5F0E50095F0F501E50AF50324 +:1009C000E501F502E509F582E502F583E503F07539 +:1009D0000902E506F500C3E509F5F0E50095F0F537 +:1009E00009E507F500750100E501F5F0E50095F072 +:1009F000F501E50BF503E501F502E509F582E502F0 +:100A0000F583E503F0E517F51FE516F51E75E00B18 +:100A10002506F58275E0003507F583E0F51D75E0E4 +:100A20000A2506F58275E0003507F583E0F51C75AB +:100A3000E00F2506F58275E0003507F583E0F51B2C +:100A400075E00E2506F58275E0003507F583E0F5C3 +:100A50001A75E00D2506F58275E0003507F583E08F +:100A6000F51975E00C2506F58275E0003507F5836C +:100A7000E0F51802071400751D00751C00751B00B9 +:100A8000751A0002094D00000207FB00000000007B +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24615.s.expected b/tests/GCCTestSuite/pr24615.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr24615.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24620.c b/tests/GCCTestSuite/pr24620.c new file mode 100644 index 0000000..926a524 --- /dev/null +++ b/tests/GCCTestSuite/pr24620.c @@ -0,0 +1,27 @@ +/* This used to ICE due to a backend problem on s390. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct rgba +{ + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; +}; + +void g (struct rgba); + +void f (void) +{ + struct rgba x; + + x.r = 0; + x.g = 128; + x.b = 128; + x.a = 26; + + g (x); +} + diff --git a/tests/GCCTestSuite/pr24620.c.expected b/tests/GCCTestSuite/pr24620.c.expected new file mode 100644 index 0000000..926a524 --- /dev/null +++ b/tests/GCCTestSuite/pr24620.c.expected @@ -0,0 +1,27 @@ +/* This used to ICE due to a backend problem on s390. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct rgba +{ + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; +}; + +void g (struct rgba); + +void f (void) +{ + struct rgba x; + + x.r = 0; + x.g = 128; + x.b = 128; + x.a = 26; + + g (x); +} + diff --git a/tests/GCCTestSuite/pr24620.hex.expected b/tests/GCCTestSuite/pr24620.hex.expected new file mode 100644 index 0000000..48dcb96 --- /dev/null +++ b/tests/GCCTestSuite/pr24620.hex.expected @@ -0,0 +1,42 @@ +:100000000000E506758206C39582F506E50775834F +:10001000009583F507D0E0F50875E0052506F58223 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000042506F58275E0003507F583E508F0E54F +:1000400006F509E507F50A750100C3750000E5012D +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F509750A00C3750000E50AF5F0E50135EC +:10007000F0F50AE500F5F0E50935F0F50B75090036 +:10008000750100C3750000E501F5F0E50A35F0F5EE +:1000900001E500F5F0E50B35F0F500E509F503E5C0 +:1000A00000F502E501F582E502F583E503F0E506DA +:1000B000F509E507F50A750100C3750000E501F5CE +:1000C000F0E50935F0F501E500F5F0E50A35F0F564 +:1000D00009750A01C3750000E50AF5F0E50135F080 +:1000E000F50AE500F5F0E50935F0F50B75098075C1 +:1000F0000100C3750000E501F5F0E50A35F0F501F2 +:10010000E500F5F0E50B35F0F500E509F503E50050 +:10011000F502E501F582E502F583E503F0E506F574 +:1001200009E507F50A750100C3750000E501F5F062 +:10013000E50935F0F501E500F5F0E50A35F0F509DA +:10014000750A02C3750000E50AF5F0E50135F0F522 +:100150000AE500F5F0E50935F0F50B750980750144 +:1001600000C3750000E501F5F0E50A35F0F501E59D +:1001700000F5F0E50B35F0F500E509F503E500F5D0 +:1001800002E501F582E502F583E503F0E506F509F0 +:10019000E507F50A750100C3750000E501F5F0E516 +:1001A0000935F0F501E500F5F0E50A35F0F50975DA +:1001B0000A03C3750000E50AF5F0E50135F0F50A1C +:1001C000E500F5F0E50935F0F50B75091A75010044 +:1001D000C3750000E501F5F0E50A35F0F501E5002D +:1001E000F5F0E50B35F0F500E509F503E500F5025E +:1001F000E501F582E502F583E503F0E506F509E59D +:1002000007F50A750100C3750000E501F5F0E50981 +:1002100035F0F501E500F5F0E50A35F0F500E5010A +:10022000F51FE500F51E750000E500F502E500F597 +:1002300003E500F504E500F50575E0042506F58203 +:1002400075E0003507F583E0F508E508C0E075E0E6 +:10025000052506F58275E0003507F583E0F508E52C +:1002600008C0E075E0062506F50675E0003507F5DF +:1002700007E502F582E503F583E504F500E505F5FC +:10028000012200000000000000000000000000004B +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24620.s.expected b/tests/GCCTestSuite/pr24620.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr24620.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr24683.c b/tests/GCCTestSuite/pr24683.c new file mode 100644 index 0000000..79d3210 --- /dev/null +++ b/tests/GCCTestSuite/pr24683.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC" } */ +int *block; +void final(unsigned int j) +{ + unsigned int i; + unsigned char *data = (unsigned char *)"\0"; + for (i = 0; i < 8; i++) + for (; j + 63 < 1; j += 64) + block = (int *) &data[j]; +} diff --git a/tests/GCCTestSuite/pr24683.c.expected b/tests/GCCTestSuite/pr24683.c.expected new file mode 100644 index 0000000..79d3210 --- /dev/null +++ b/tests/GCCTestSuite/pr24683.c.expected @@ -0,0 +1,11 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC" } */ +int *block; +void final(unsigned int j) +{ + unsigned int i; + unsigned char *data = (unsigned char *)"\0"; + for (i = 0; i < 8; i++) + for (; j + 63 < 1; j += 64) + block = (int *) &data[j]; +} diff --git a/tests/GCCTestSuite/pr25196.c b/tests/GCCTestSuite/pr25196.c new file mode 100644 index 0000000..6ea3a6f --- /dev/null +++ b/tests/GCCTestSuite/pr25196.c @@ -0,0 +1,34 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-march=i386 -O3 -fomit-frame-pointer" } */ + +/* For this test case, we used to do an invalid load motion after + reload, because we missed autoincrements of the stack pointer. */ + +extern void exit (int); + +static int j; + +static void __attribute__((noinline)) +f1 (int a, int b, int c, int d, int e) +{ + j = a; +} + +int __attribute__((noinline)) +f2 (int a, int b, int c, int d, int e) +{ + if ((b & 0x1111) != 1) + f1 (a, b, c, d, e); + return 0; +} + +int +main (void) +{ + int tmp = f2 (123, 0, 0, 0, 0); + if (j != 123) + exit (1); + return 0; +} + diff --git a/tests/GCCTestSuite/pr25196.c.expected b/tests/GCCTestSuite/pr25196.c.expected new file mode 100644 index 0000000..6ea3a6f --- /dev/null +++ b/tests/GCCTestSuite/pr25196.c.expected @@ -0,0 +1,34 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-march=i386 -O3 -fomit-frame-pointer" } */ + +/* For this test case, we used to do an invalid load motion after + reload, because we missed autoincrements of the stack pointer. */ + +extern void exit (int); + +static int j; + +static void __attribute__((noinline)) +f1 (int a, int b, int c, int d, int e) +{ + j = a; +} + +int __attribute__((noinline)) +f2 (int a, int b, int c, int d, int e) +{ + if ((b & 0x1111) != 1) + f1 (a, b, c, d, e); + return 0; +} + +int +main (void) +{ + int tmp = f2 (123, 0, 0, 0, 0); + if (j != 123) + exit (1); + return 0; +} + diff --git a/tests/GCCTestSuite/pr25196.hex.expected b/tests/GCCTestSuite/pr25196.hex.expected new file mode 100644 index 0000000..afb77e0 --- /dev/null +++ b/tests/GCCTestSuite/pr25196.hex.expected @@ -0,0 +1,259 @@ +:1000000075812F7506FF7507FF120A7402000C0038 +:1000100000E506758220C39582F506E50775830025 +:100020009583F507D0E0F50ED0E0F50FE512F50B5E +:10003000E511F50CE510F50D900000E582F509904D +:100040000000E583F50A750100C3750000E501F5C0 +:10005000F0E50935F0F501E500F5F0E50A35F0F5D4 +:1000600000E51FF503E500F502E501F582E502F57F +:1000700083E503F0750101C3750000E501F5F0E5C6 +:100080000935F0F501E500F5F0E50A35F0F500E594 +:100090001EF503E500F502E501F582E502F583E5CD +:1000A00003F0750102C3750000E501F5F0E50935BF +:1000B000F0F501E500F5F0E50A35F0F500E51DF590 +:1000C00003E500F502E501F582E502F583E503F0BD +:1000D000750103C3750000E501F5F0E50935F0F59C +:1000E00001E500F5F0E50A35F0F500E51CF503E55E +:1000F00000F502E501F582E502F583E503F0750000 +:1001000000E500F502E500F503E500F504E500F57E +:1001100005E50BF512E50CF511E50DF510E50FC041 +:10012000E0E50EC0E075E0202506F50675E0003537 +:1001300007F507E502F582E503F583E504F500E53B +:1001400005F5012200E506758232C39582F506E5C4 +:10015000077583009583F507D0E0F50875E0152550 +:1001600006F58275E0003507F583E508F0D0E0F587 +:100170000875E0142506F58275E0003507F583E57E +:1001800008F075E01D2506F58275E0003507F5835A +:10019000E517F075E01C2506F58275E0003507F5DA +:1001A00083E516F075E01B2506F58275E00035073E +:1001B000F583E515F075E01A2506F58275E0003542 +:1001C00007F583E514F075E0192506F58275E00062 +:1001D0003507F583E513F075E0182506F58275E01F +:1001E000003507F583E512F075E0172506F58275F1 +:1001F000E0003507F583E511F075E0162506F58278 +:1002000075E0003507F583E510F0E51FF510E51EF4 +:10021000F511E51DF512E51CF513750932750001A0 +:10022000E500F5F0E50995F0F509E506F500E500CE +:10023000F5F0E50925F0F509750100E507F500E59C +:1002400000F5F0E50135F0F501E501F502E509F508 +:1002500082E502F583E0F516750932750002E500C6 +:10026000F5F0E50995F0F509E506F500E500F5F08E +:10027000E50925F0F509750100E507F500E500F54C +:10028000F0E50135F0F501E501F502E509F582E556 +:1002900002F583E0F517750932750003E500F5F006 +:1002A000E50995F0F509E506F500E500F5F0E50945 +:1002B00025F0F509750100E507F500E500F5F0E525 +:1002C0000135F0F501E501F502E509F582E502F5F4 +:1002D00083E0F50875E00D2506F58275E000350729 +:1002E000F583E508F0750932750004E500F5F0E5E1 +:1002F0000995F0F509E506F500E500F5F0E50925B5 +:10030000F0F509750100E507F500E500F5F0E501F8 +:1003100035F0F501E501F502E509F582E502F58321 +:10032000E0F50875E00C2506F58275E0003507F567 +:1003300083E508F0750932750005E500F5F0E5097B +:1003400095F0F509E506F500E500F5F0E50925F07D +:10035000F509750100E507F500E500F5F0E5013563 +:10036000F0F501E501F502E509F582E502F583E026 +:10037000F50875E0112506F58275E0003507F5836F +:10038000E508F0750932750006E500F5F0E5099518 +:10039000F0F509E506F500E500F5F0E50925F0F5CD +:1003A00009750100E507F500E500F5F0E50135F018 +:1003B000F501E501F502E509F582E502F583E0F5D1 +:1003C0000875E0102506F58275E0003507F583E530 +:1003D00008F0750932750007E500F5F0E50995F0BC +:1003E000F509E506F500E500F5F0E50925F0F50964 +:1003F000750100E507F500E500F5F0E50135F0F5DC +:1004000001E501F502E509F582E502F583E0F5086D +:1004100075E00F2506F58275E0003507F583E508E0 +:10042000F0750932750008E500F5F0E50995F0F57D +:1004300009E506F500E500F5F0E50925F0F5097593 +:100440000100E507F500E500F5F0E50135F0F501FF +:10045000E501F502E509F582E502F583E0F50875A9 +:10046000E00E2506F58275E0003507F583E508F016 +:10047000750932750009E500F5F0E50995F0F50913 +:10048000E506F500E500F5F0E50925F0F50975014B +:1004900000E507F500E500F5F0E50135F0F501E5CB +:1004A00001F502E509F582E502F583E0F50875E05E +:1004B000132506F58275E0003507F583E508F0752C +:1004C000093275000AE500F5F0E50995F0F509E552 +:1004D00006F500E500F5F0E50925F0F509750100E0 +:1004E000E507F500E500F5F0E50135F0F501E5017A +:1004F000F502E509F582E502F583E0F50875E012FD +:100500002506F58275E0003507F583E508F07509E5 +:100510003275000BE500F5F0E50995F0F509E50603 +:10052000F500E500F5F0E50925F0F509750100E5B0 +:1005300007F500E500F5F0E50135F0F501E501F519 +:1005400002E509F582E502F583E0F51475093275D7 +:10055000000CE500F5F0E50995F0F509E506F50074 +:10056000E500F5F0E50925F0F509750100E507F569 +:1005700000E500F5F0E50135F0F501E501F502E5EE +:1005800009F582E502F583E0F515750A1175091183 +:10059000750100750000C3E50AF5F0E51B55F0F59F +:1005A0000BE509F5F0E51A55F0F50CE501F5F0E578 +:1005B0001955F0F50DE500F5F0E51855F0F50E7557 +:1005C0000001750100750900750A00750F00C3E58B +:1005D00000F5F0E50B95F0F500E500F5F0E50F45C9 +:1005E000F0F50FC3E501F5F0E50C95F0F500E50039 +:1005F000F5F0E50F45F0F50FC3E509F5F0E50D95CC +:10060000F0F500E500F5F0E50F45F0F50FC3E50A5C +:10061000F5F0E50E95F0F500E500F5F0E50F45F095 +:10062000F50F750100750900750A00750000E50FEA +:10063000F5F0E50045F0F500E501F5F0E50045F0E1 +:10064000F500E509F5F0E50045F0F500E50AF5F0FF +:10065000E50045F0F500E5007002800302074D005B +:10066000750000750100750900750A00E500F502C6 +:10067000E501F503E509F504E50AF50575E01D2535 +:1006800006F58275E0003507F583E0F51775E01C87 +:100690002506F58275E0003507F583E0F51675E06F +:1006A0001B2506F58275E0003507F583E0F5157525 +:1006B000E01A2506F58275E0003507F583E0F514AC +:1006C00075E0192506F58275E0003507F583E0F53C +:1006D0001375E0182506F58275E0003507F583E00F +:1006E000F51275E0172506F58275E0003507F583EC +:1006F000E0F51175E0162506F58275E0003507F581 +:1007000083E0F51075E0142506F58275E0003507E5 +:10071000F583E0F508E508C0E075E0152506F582EB +:1007200075E0003507F583E0F508E508C0E075E001 +:10073000322506F50675E0003507F507E502F58276 +:10074000E503F583E504F500E505F5012200E51074 +:10075000F51FE511F51EE512F51DE513F51C7509EC +:1007600001E506F500C3E509F5F0E50095F0F509AA +:10077000E507F500750100E501F5F0E50095F0F5F8 +:1007800001E516F503E501F502E509F582E502F557 +:1007900083E503F0750902E506F500C3E509F5F008 +:1007A000E50095F0F509E507F500750100E501F5AF +:1007B000F0E50095F0F501E517F503E501F502E533 +:1007C00009F582E502F583E503F0750903E506F511 +:1007D00000C3E509F5F0E50095F0F509E507F5003A +:1007E000750100E501F5F0E50095F0F50175E00D06 +:1007F0002506F58275E0003507F583E0F508E50884 +:10080000F503E501F502E509F582E502F583E50367 +:10081000F0750904E506F500C3E509F5F0E5009576 +:10082000F0F509E507F500750100E501F5F0E500D3 +:1008300095F0F50175E00C2506F58275E0003507A9 +:10084000F583E0F508E508F503E501F502E509F5AE +:1008500082E502F583E503F0750905E506F500C3B9 +:10086000E509F5F0E50095F0F509E507F5007501F6 +:1008700000E501F5F0E50095F0F50175E0112506BC +:10088000F58275E0003507F583E0F508E508F50326 +:10089000E501F502E509F582E502F583E503F0756A +:1008A0000906E506F500C3E509F5F0E50095F0F564 +:1008B00009E507F500750100E501F5F0E50095F0A3 +:1008C000F50175E0102506F58275E0003507F58322 +:1008D000E0F508E508F503E501F502E509F582E52F +:1008E00002F583E503F0750907E506F500C3E509A0 +:1008F000F5F0E50095F0F509E507F500750100E56F +:1009000001F5F0E50095F0F50175E00F2506F5829B +:1009100075E0003507F583E0F508E508F503E50126 +:10092000F502E509F582E502F583E503F0750908AE +:10093000E506F500C3E509F5F0E50095F0F509E5F4 +:1009400007F500750100E501F5F0E50095F0F5010A +:1009500075E00E2506F58275E0003507F583E0F5B4 +:1009600008E508F503E501F502E509F582E502F57C +:1009700083E503F0750909E506F500C3E509F5F01F +:10098000E50095F0F509E507F500750100E501F5CD +:10099000F0E50095F0F50175E0132506F58275E0A8 +:1009A000003507F583E0F508E508F503E501F502F4 +:1009B000E509F582E502F583E503F075090AE50628 +:1009C000F500C3E509F5F0E50095F0F509E507F553 +:1009D00000750100E501F5F0E50095F0F50175E021 +:1009E000122506F58275E0003507F583E0F508E588 +:1009F00008F503E501F502E509F582E502F583E571 +:100A000003F075090BE506F500C3E509F5F0E5000F +:100A100095F0F509E507F500750100E501F5F0E54C +:100A20000095F0F501E514F503E501F502E509F59A +:100A300082E502F583E503F075090CE506F500C3D0 +:100A4000E509F5F0E50095F0F509E507F500750114 +:100A500000E501F5F0E50095F0F501E515F503E594 +:100A600001F502E509F582E502F583E503F01200E0 +:100A70001002066000E506758208C39582F506E55A +:100A8000077583009583F507D0E0F50875E001252B +:100A900006F58275E0003507F583E508F0D0E0F54E +:100AA0000875E0002506F58275E0003507F583E559 +:100AB00008F075E0072506F58275E0003507F58337 +:100AC000E515F075E0062506F58275E0003507F5B9 +:100AD00083E514F075E0052506F58275E00035071D +:100AE000F583E513F075E0042506F58275E0003521 +:100AF00007F583E512F075E0032506F58275E00041 +:100B00003507F583E511F075E0022506F58275E0FD +:100B1000003507F583E510F0751F7B751E00751D08 +:100B200000751C00751B00751A00751900751800FA +:100B3000750C00750D00750E00750F0075100075B1 +:100B40001100751200751300750A00750B007514FD +:100B500000751500750901E506F500C3E509F5F016 +:100B6000E50095F0F509E507F500750100E501F5EB +:100B7000F0E50095F0F501E50CF503E501F502E57A +:100B800009F582E502F583E503F0750902E506F54E +:100B900000C3E509F5F0E50095F0F509E507F50076 +:100BA000750100E501F5F0E50095F0F501E50DF5BD +:100BB00003E501F502E509F582E502F583E503F0B9 +:100BC000750903E506F500C3E509F5F0E50095F0C4 +:100BD000F509E507F500750100E501F5F0E500957B +:100BE000F0F501E50EF503E501F502E509F582E50D +:100BF00002F583E503F0750904E506F500C3E50990 +:100C0000F5F0E50095F0F509E507F500750100E55B +:100C100001F5F0E50095F0F501E50FF503E501F5C7 +:100C200002E509F582E502F583E503F0750905E5BE +:100C300006F500C3E509F5F0E50095F0F509E507CF +:100C4000F500750100E501F5F0E50095F0F501E529 +:100C500010F503E501F502E509F582E502F583E506 +:100C600003F0750906E506F500C3E509F5F0E500B2 +:100C700095F0F509E507F500750100E501F5F0E5EA +:100C80000095F0F501E511F503E501F502E509F53B +:100C900082E502F583E503F0750907E506F500C373 +:100CA000E509F5F0E50095F0F509E507F5007501B2 +:100CB00000E501F5F0E50095F0F501E512F503E535 +:100CC00001F502E509F582E502F583E503F0750912 +:100CD00008E506F500C3E509F5F0E50095F0F5092E +:100CE000E507F500750100E501F5F0E50095F0F583 +:100CF00001E513F503E501F502E509F582E502F5E5 +:100D000083E503F0750909E506F500C3E509F5F08B +:100D1000E50095F0F509E507F500750100E501F539 +:100D2000F0E50095F0F501E50AF503E501F502E5CA +:100D300009F582E502F583E503F075090AE506F594 +:100D400000C3E509F5F0E50095F0F509E507F500C4 +:100D5000750100E501F5F0E50095F0F501E50BF50D +:100D600003E501F502E509F582E502F583E503F007 +:100D700075090BE506F500C3E509F5F0E50095F00A +:100D8000F509E507F500750100E501F5F0E50095C9 +:100D9000F0F501E514F503E501F502E509F582E555 +:100DA00002F583E503F075090CE506F500C3E509D6 +:100DB000F5F0E50095F0F509E507F500750100E5AA +:100DC00001F5F0E50095F0F501E515F503E501F510 +:100DD00002E509F582E502F583E503F0120144908E +:100DE0000000E582F509900000E583F50A75010031 +:100DF000C3750000E501F5F0E50935F0F501E50002 +:100E0000F5F0E50A35F0F500E500F502E501F582BB +:100E1000E502F583E0F50B750101C3750000E501FE +:100E2000F5F0E50935F0F501E500F5F0E50A35F0F6 +:100E3000F500E500F502E501F582E502F583E0F550 +:100E40000C750102C3750000E501F5F0E50935F008 +:100E5000F501E500F5F0E50A35F0F500E500F502ED +:100E6000E501F582E502F583E0F50D750103C37533 +:100E70000000E501F5F0E50935F0F501E500F5F0D4 +:100E8000E50A35F0F500E500F502E501F582E50239 +:100E9000F583E0F50E75007B750100750900750A94 +:100EA00000750F00C3E500F5F0E50B95F0F500E5E2 +:100EB00000F5F0E50F45F0F50FC3E501F5F0E50CA1 +:100EC00095F0F500E500F5F0E50F45F0F50FC3E509 +:100ED00009F5F0E50D95F0F500E500F5F0E50F45B5 +:100EE000F0F50FC3E50AF5F0E50E95F0F500E50025 +:100EF000F5F0E50F45F0F50F750100750900750A6D +:100F000000750000E50FF5F0E50045F0F500E5019E +:100F1000F5F0E50045F0F500E509F5F0E50045F0F0 +:100F2000F500E50AF5F0E50045F0F500E500700292 +:100F3000800302100100750000750100750900753D +:100F40000A00E500F502E501F503E509F504E50A07 +:100F5000F50575E0072506F58275E0003507F58390 +:100F6000E0F51575E0062506F58275E0003507F514 +:100F700083E0F51475E0052506F58275E000350778 +:100F8000F583E0F51375E0042506F58275E000357C +:100F900007F583E0F51275E0032506F58275E0009C +:100FA0003507F583E0F51175E0022506F58275E059 +:100FB000003507F583E0F51075E0002506F582752C +:100FC000E0003507F583E0F508E508C0E075E001CD +:100FD0002506F58275E0003507F583E0F508E5089C +:100FE000C0E075E0082506F50675E0003507F50751 +:100FF000E502F582E503F583E504F500E505F50175 +:101000002200751F01751E00751D00751C00020F62 +:10101000360000000000000000000000000000009A +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25196.s.expected b/tests/GCCTestSuite/pr25196.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr25196.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25559.c b/tests/GCCTestSuite/pr25559.c new file mode 100644 index 0000000..7879a15 --- /dev/null +++ b/tests/GCCTestSuite/pr25559.c @@ -0,0 +1,10 @@ +/* PR c/25559 */ +/* { dg-do compile } */ + +#define vs(n) __attribute__((vector_size (n))) +int vs (-1) a; /* { dg-warning "attribute ignored" } */ +int vs (0) b; /* { dg-error "zero vector size" } */ +int vs (1) c; /* { dg-error "multiple of component size" } */ +int vs (sizeof (int) / 2) d; /* { dg-error "multiple of component size" } */ +int vs (sizeof (int)) e; +int vs (sizeof (int) * 2) f; diff --git a/tests/GCCTestSuite/pr25559.c.expected b/tests/GCCTestSuite/pr25559.c.expected new file mode 100644 index 0000000..7879a15 --- /dev/null +++ b/tests/GCCTestSuite/pr25559.c.expected @@ -0,0 +1,10 @@ +/* PR c/25559 */ +/* { dg-do compile } */ + +#define vs(n) __attribute__((vector_size (n))) +int vs (-1) a; /* { dg-warning "attribute ignored" } */ +int vs (0) b; /* { dg-error "zero vector size" } */ +int vs (1) c; /* { dg-error "multiple of component size" } */ +int vs (sizeof (int) / 2) d; /* { dg-error "multiple of component size" } */ +int vs (sizeof (int)) e; +int vs (sizeof (int) * 2) f; diff --git a/tests/GCCTestSuite/pr25559.hex.expected b/tests/GCCTestSuite/pr25559.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pr25559.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25559.s.expected b/tests/GCCTestSuite/pr25559.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr25559.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25795-1.c b/tests/GCCTestSuite/pr25795-1.c new file mode 100644 index 0000000..e568b25 --- /dev/null +++ b/tests/GCCTestSuite/pr25795-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fwhole-program" } */ +/* { dg-final { scan-assembler-not "mystr" } } */ + + +extern const char *mystr; /* normally in a header */ +const char *mystr; +main() +{ +} diff --git a/tests/GCCTestSuite/pr25795-1.c.expected b/tests/GCCTestSuite/pr25795-1.c.expected new file mode 100644 index 0000000..e568b25 --- /dev/null +++ b/tests/GCCTestSuite/pr25795-1.c.expected @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fwhole-program" } */ +/* { dg-final { scan-assembler-not "mystr" } } */ + + +extern const char *mystr; /* normally in a header */ +const char *mystr; +main() +{ +} diff --git a/tests/GCCTestSuite/pr25795-1.hex.expected b/tests/GCCTestSuite/pr25795-1.hex.expected new file mode 100644 index 0000000..923c6d3 --- /dev/null +++ b/tests/GCCTestSuite/pr25795-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501E509F502E509F503CA +:10002000E509F504E509F505E501C0E0E500C0E0F6 +:10003000E502F582E503F583E504F500E505F50144 +:10004000220000000000000000000000000000008E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25795-1.s.expected b/tests/GCCTestSuite/pr25795-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr25795-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25795.c b/tests/GCCTestSuite/pr25795.c new file mode 100644 index 0000000..decbe54 --- /dev/null +++ b/tests/GCCTestSuite/pr25795.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fwhole-program" } */ +/* { dg-final { scan-assembler "mystr" } } */ + + +extern const char *mystr; /* normally in a header */ +const char *mystr __attribute__ ((externally_visible)); +main() +{ +} diff --git a/tests/GCCTestSuite/pr25795.c.expected b/tests/GCCTestSuite/pr25795.c.expected new file mode 100644 index 0000000..decbe54 --- /dev/null +++ b/tests/GCCTestSuite/pr25795.c.expected @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fwhole-program" } */ +/* { dg-final { scan-assembler "mystr" } } */ + + +extern const char *mystr; /* normally in a header */ +const char *mystr __attribute__ ((externally_visible)); +main() +{ +} diff --git a/tests/GCCTestSuite/pr25795.hex.expected b/tests/GCCTestSuite/pr25795.hex.expected new file mode 100644 index 0000000..923c6d3 --- /dev/null +++ b/tests/GCCTestSuite/pr25795.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501E509F502E509F503CA +:10002000E509F504E509F505E501C0E0E500C0E0F6 +:10003000E502F582E503F583E504F500E505F50144 +:10004000220000000000000000000000000000008E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25795.s.expected b/tests/GCCTestSuite/pr25795.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr25795.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25993.c b/tests/GCCTestSuite/pr25993.c new file mode 100644 index 0000000..c771966 --- /dev/null +++ b/tests/GCCTestSuite/pr25993.c @@ -0,0 +1,14 @@ +/* { dg-do assemble { target i?86-*-* x86_64-*-* } } */ +/* { dg-skip-if "" { "*-*-darwin*" } { "*" } { "" } } */ +/* { dg-options "-std=c99 -x assembler-with-cpp" } */ + +#ifndef __ASSEMBLER__ +extern int func(void); +#else +.global func +.type func,%function +.align 4 +func: + ret +.size func,.-func +#endif diff --git a/tests/GCCTestSuite/pr25993.c.expected b/tests/GCCTestSuite/pr25993.c.expected new file mode 100644 index 0000000..c771966 --- /dev/null +++ b/tests/GCCTestSuite/pr25993.c.expected @@ -0,0 +1,14 @@ +/* { dg-do assemble { target i?86-*-* x86_64-*-* } } */ +/* { dg-skip-if "" { "*-*-darwin*" } { "*" } { "" } } */ +/* { dg-options "-std=c99 -x assembler-with-cpp" } */ + +#ifndef __ASSEMBLER__ +extern int func(void); +#else +.global func +.type func,%function +.align 4 +func: + ret +.size func,.-func +#endif diff --git a/tests/GCCTestSuite/pr25993.hex.expected b/tests/GCCTestSuite/pr25993.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pr25993.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr25993.s.expected b/tests/GCCTestSuite/pr25993.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr25993.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr26004.c b/tests/GCCTestSuite/pr26004.c new file mode 100644 index 0000000..35e6a2f --- /dev/null +++ b/tests/GCCTestSuite/pr26004.c @@ -0,0 +1,11 @@ +/* PR c/26004 */ +/* Bug: the return slot optimization was taking the address of s_3, + causing an error. */ + +struct s_3 { short s[3]; } z_3, s_3; +struct s_3 add_struct_3 (struct s_3 s){} +wack_struct_3 (void) +{ + int i; register struct s_3 u = z_3; + u = add_struct_3 (u); +} diff --git a/tests/GCCTestSuite/pr26004.c.expected b/tests/GCCTestSuite/pr26004.c.expected new file mode 100644 index 0000000..35e6a2f --- /dev/null +++ b/tests/GCCTestSuite/pr26004.c.expected @@ -0,0 +1,11 @@ +/* PR c/26004 */ +/* Bug: the return slot optimization was taking the address of s_3, + causing an error. */ + +struct s_3 { short s[3]; } z_3, s_3; +struct s_3 add_struct_3 (struct s_3 s){} +wack_struct_3 (void) +{ + int i; register struct s_3 u = z_3; + u = add_struct_3 (u); +} diff --git a/tests/GCCTestSuite/pr26004.hex.expected b/tests/GCCTestSuite/pr26004.hex.expected new file mode 100644 index 0000000..782e4b4 --- /dev/null +++ b/tests/GCCTestSuite/pr26004.hex.expected @@ -0,0 +1,400 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F51ED0E0F51FE513F51840 +:10002000E512F519E511F51AE510F51BE506F509D8 +:10003000E507F50A750100C3750000E501F5F0E577 +:100040000935F0F501E500F5F0E50A35F0F50A753A +:100050000900C3750000E509F5F0E50135F0F5018B +:10006000E500F5F0E50A35F0F500E501F509E500F4 +:10007000F50A750100C3750000E501F5F0E50935E5 +:10008000F0F501E500F5F0E50A35F0F500E500F5DD +:1000900002E501F582E502F583E0F511750101C382 +:1000A000750000E501F5F0E50935F0F501E500F52D +:1000B000F0E50A35F0F500E500F502E501F582E529 +:1000C00002F583E0F501750900750A00750E0275E9 +:1000D0000F00751000750000C3750B00E509F5F001 +:1000E000E50EA4F50DE509F5F0E50EA4E5F0F50C37 +:1000F000E50DF5F0E50B35F0F50BE50AF5F0E50E4D +:10010000A4F50DE50AF5F0E50EA4E5F0F50AE50D18 +:10011000F5F0E50C35F0F50CC3C3750A00E50BF5F9 +:10012000F0E51035F0F510E50CF5F0E50035F0F5EB +:1001300000C3750C00E509F5F0E50FA4F50DE50920 +:10014000F5F0E50FA4E5F0F50AE50DF5F0E50C3561 +:10015000F0F50C750B00C3C3750900E50BF5F0E570 +:100160001035F0F510E50CF5F0E50035F0F500C3BD +:10017000750B00750C00C3C3750900E50BF5F0E5C0 +:100180001035F0F510E50CF5F0E50035F0F500C39D +:10019000750B00750C00C3C3750900E50BF5F0E5A0 +:1001A0001035F0F510E50CF5F0E50035F0F500C37D +:1001B000750900E510F5F0E51135F0F510E500F5ED +:1001C000F0E50135F0F511750100C3750000E5019A +:1001D000F5F0E51D35F0F509E500F5F0E51C35F025 +:1001E000F50A750100C3750000E501F5F0E5093574 +:1001F000F0F501E500F5F0E50A35F0F500E500F56C +:1002000002E501F582E502F583E0F512750101C30F +:10021000750000E501F5F0E50935F0F501E500F5BB +:10022000F0E50A35F0F500E500F502E501F582E5B7 +:1002300002F583E0F513750000750100750C027579 +:100240000D00750E00750F00C3750900E500F5F08F +:10025000E50CA4F50BE500F5F0E50CA4E5F0F50AD6 +:10026000E50BF5F0E50935F0F509E501F5F0E50CEC +:10027000A4F50BE501F5F0E50CA4E5F0F501E50BBF +:10028000F5F0E50A35F0F50AC3C3750100E509F597 +:10029000F0E50E35F0F50EE50AF5F0E50F35F0F571 +:1002A0000FC3750A00E500F5F0E50DA4F50BE500B8 +:1002B000F5F0E50DA4E5F0F501E50BF5F0E50A35FF +:1002C000F0F50A750900C3C3750000E509F5F0E50E +:1002D0000E35F0F50EE50AF5F0E50F35F0F50FC334 +:1002E000750900750A00C3C3750000E509F5F0E55E +:1002F0000E35F0F50EE50AF5F0E50F35F0F50FC314 +:10030000750900750A00C3C3750000E509F5F0E53D +:100310000E35F0F50EE50AF5F0E50F35F0F50FC3F3 +:10032000750000E50EF5F0E51235F0F500E50FF586 +:10033000F0E51335F0F501E500F509E501F50A757D +:100340000100C3750000E501F5F0E50935F0F501A0 +:10035000E500F5F0E50A35F0F500E500F502E50108 +:10036000F582E502F583E0F50B750101C375000028 +:10037000E501F5F0E50935F0F501E500F5F0E50AF0 +:1003800035F0F500E500F502E501F582E502F583BB +:10039000E0F509750100C3750000E501F5F0E51011 +:1003A00035F0F501E500F5F0E51135F0F500E50B68 +:1003B000F503E500F502E501F582E502F583E503C5 +:1003C000F0750101C3750000E501F5F0E51035F0A9 +:1003D000F501E500F5F0E51135F0F500E509F50367 +:1003E000E500F502E501F582E502F583E503F0E5B8 +:1003F00006F509E507F50A750100C3750000E5017A +:10040000F5F0E50935F0F501E500F5F0E50A35F020 +:10041000F50A750900C3750000E509F5F0E5013539 +:10042000F0F501E500F5F0E50A35F0F500E501F538 +:1004300009E500F50A750100C3750000E501F5F056 +:10044000E50935F0F501E500F5F0E50A35F0F500D0 +:10045000E500F502E501F582E502F583E0F51175A9 +:100460000101C3750000E501F5F0E50935F0F5017E +:10047000E500F5F0E50A35F0F500E500F502E501E7 +:10048000F582E502F583E0F501750901750A00754D +:100490000E02750F00751000750000C3750B00E5A6 +:1004A00009F5F0E50EA4F50DE509F5F0E50EA4E576 +:1004B000F0F50CE50DF5F0E50B35F0F50BE50AF57B +:1004C000F0E50EA4F50DE50AF5F0E50EA4E5F0F56E +:1004D0000AE50DF5F0E50C35F0F50CC3C3750A001F +:1004E000E50BF5F0E51035F0F510E50CF5F0E5005D +:1004F00035F0F500C3750C00E509F5F0E50FA4F53E +:100500000DE509F5F0E50FA4E5F0F50AE50DF5F0C8 +:10051000E50C35F0F50C750B00C3C3750900E50B50 +:10052000F5F0E51035F0F510E50CF5F0E50035F0E7 +:10053000F500C3750B00750C00C3C3750900E50B0E +:10054000F5F0E51035F0F510E50CF5F0E50035F0C7 +:10055000F500C3750B00750C00C3C3750900E50BEE +:10056000F5F0E51035F0F510E50CF5F0E50035F0A7 +:10057000F500C3750900E510F5F0E51135F0F5104B +:10058000E500F5F0E50135F0F511750100C37500E2 +:1005900000E501F5F0E51D35F0F509E500F5F0E5BC +:1005A0001C35F0F50A750100C3750000E501F5F092 +:1005B000E50935F0F501E500F5F0E50A35F0F5005F +:1005C000E500F502E501F582E502F583E0F5127537 +:1005D0000101C3750000E501F5F0E50935F0F5010D +:1005E000E500F5F0E50A35F0F500E500F502E50176 +:1005F000F582E502F583E0F51375000175010075DC +:100600000C02750D00750E00750F00C3750900E52D +:1006100000F5F0E50CA4F50BE500F5F0E50CA4E51C +:10062000F0F50AE50BF5F0E50935F0F509E501F51A +:10063000F0E50CA4F50BE501F5F0E50CA4E5F0F50B +:1006400001E50BF5F0E50A35F0F50AC3C3750100C5 +:10065000E509F5F0E50E35F0F50EE50AF5F0E50FE4 +:1006600035F0F50FC3750A00E500F5F0E50DA4F5CA +:100670000BE500F5F0E50DA4E5F0F501E50BF5F06F +:10068000E50A35F0F50A750900C3C3750000E509F0 +:10069000F5F0E50E35F0F50EE50AF5F0E50F35F06D +:1006A000F50FC3750900750A00C3C3750000E5099D +:1006B000F5F0E50E35F0F50EE50AF5F0E50F35F04D +:1006C000F50FC3750900750A00C3C3750000E5097D +:1006D000F5F0E50E35F0F50EE50AF5F0E50F35F02D +:1006E000F50FC3750000E50EF5F0E51235F0F500E5 +:1006F000E50FF5F0E51335F0F501E500F509E50145 +:10070000F50A750100C3750000E501F5F0E509354E +:10071000F0F501E500F5F0E50A35F0F500E500F546 +:1007200002E501F582E502F583E0F50B750101C3F1 +:10073000750000E501F5F0E50935F0F501E500F596 +:10074000F0E50A35F0F500E500F502E501F582E592 +:1007500002F583E0F509750100C3750000E501F5B8 +:10076000F0E51035F0F501E500F5F0E51135F0F5AF +:1007700000E50BF503E500F502E501F582E502F57C +:1007800083E503F0750101C3750000E501F5F0E5AF +:100790001035F0F501E500F5F0E51135F0F500E56F +:1007A00009F503E500F502E501F582E502F583E5CB +:1007B00003F0E506F509E507F50A750100C37500C4 +:1007C00000E501F5F0E50935F0F501E500F5F0E5A6 +:1007D0000A35F0F50A750900C3750000E509F5F062 +:1007E000E50135F0F501E500F5F0E50A35F0F50035 +:1007F000E501F509E500F50A750100C3750000E59E +:1008000001F5F0E50935F0F501E500F5F0E50A350B +:10081000F0F500E500F502E501F582E502F583E07B +:10082000F510750101C3750000E501F5F0E5093526 +:10083000F0F501E500F5F0E50A35F0F500E500F525 +:1008400002E501F582E502F583E0F5117500027518 +:100850000100750C02750D00750E00750F00C37553 +:100860000900E500F5F0E50CA4F50BE500F5F0E571 +:100870000CA4E5F0F50AE50BF5F0E50935F0F5090E +:10088000E501F5F0E50CA4F50BE501F5F0E50CA4A8 +:10089000E5F0F501E50BF5F0E50A35F0F50AC3C31F +:1008A000750100E509F5F0E50E35F0F50EE50AF500 +:1008B000F0E50F35F0F50FC3750A00E500F5F0E53A +:1008C0000DA4F50BE500F5F0E50DA4E5F0F501E567 +:1008D0000BF5F0E50A35F0F50A750900C3C375009C +:1008E00000E509F5F0E50E35F0F50EE50AF5F0E561 +:1008F0000F35F0F50FC3750900750A00C3C3750005 +:1009000000E509F5F0E50E35F0F50EE50AF5F0E540 +:100910000F35F0F50FC3750900750A00C3C37500E4 +:1009200000E509F5F0E50E35F0F50EE50AF5F0E520 +:100930000F35F0F50FC3750000E50EF5F0E5103545 +:10094000F0F500E50FF5F0E51135F0F501750A0059 +:10095000C3750900E50AF5F0E51D35F0F50AE5096E +:10096000F5F0E51C35F0F509E50AF50BE509F50CA0 +:10097000750A00C3750900E50AF5F0E50B35F0F5D9 +:100980000AE509F5F0E50C35F0F509E509F502E5AC +:100990000AF582E502F583E0F512750A01C37509CF +:1009A00000E50AF5F0E50B35F0F50AE509F5F0E5A7 +:1009B0000C35F0F509E509F502E50AF582E502F5E1 +:1009C00083E0F513750902750A00750E02750F00B4 +:1009D000751000751100C3750B00E509F5F0E50E03 +:1009E000A4F50DE509F5F0E50EA4E5F0F50CE50D2F +:1009F000F5F0E50B35F0F50BE50AF5F0E50EA4F59D +:100A00000DE50AF5F0E50EA4E5F0F50AE50DF5F0C3 +:100A1000E50C35F0F50CC3C3750A00E50BF5F0E500 +:100A20001035F0F510E50CF5F0E51135F0F511C3D2 +:100A3000750C00E509F5F0E50FA4F50DE509F5F0F5 +:100A4000E50FA4E5F0F50AE50DF5F0E50C35F0F558 +:100A50000C750B00C3C3750900E50BF5F0E5103507 +:100A6000F0F510E50CF5F0E51135F0F511C3750B57 +:100A700000750C00C3C3750900E50BF5F0E51035F2 +:100A8000F0F510E50CF5F0E51135F0F511C3750B37 +:100A900000750C00C3C3750900E50BF5F0E51035D2 +:100AA000F0F510E50CF5F0E51135F0F511C3750919 +:100AB00000E510F5F0E51235F0F509E511F5F0E582 +:100AC0001335F0F50AE509F50BE50AF50C750A0092 +:100AD000C3750900E50AF5F0E50B35F0F50AE509FF +:100AE000F5F0E50C35F0F509E509F502E50AF582C2 +:100AF000E502F583E0F50D750A01C3750900E50A05 +:100B0000F5F0E50B35F0F50AE509F5F0E50C35F003 +:100B1000F509E509F502E50AF582E502F583E0F558 +:100B20000B750A00C3750900E50AF5F0E50035F01C +:100B3000F50AE509F5F0E50135F0F509E50DF503F0 +:100B4000E509F502E50AF582E502F583E503F075AE +:100B50000A01C3750900E50AF5F0E50035F0F50A6C +:100B6000E509F5F0E50135F0F509E50BF503E509D3 +:100B7000F502E50AF582E502F583E503F07500006C +:100B8000E500F502E500F503E500F504E500F505EF +:100B9000E518F513E519F512E51AF511E51BF51041 +:100BA000E51FC0E0E51EC0E075E00A2506F5067504 +:100BB000E0003507F507E502F582E503F583E50476 +:100BC000F500E505F5012200E50675820DC3958265 +:100BD000F506E5077583009583F507D0E0F5087500 +:100BE000E0082506F58275E0003507F583E508F095 +:100BF000D0E0F50875E0072506F58275E0003507B9 +:100C0000F583E508F075E00C2506F58275E0003502 +:100C100007F583E513F075E00B2506F58275E00016 +:100C20003507F583E512F075E00A2506F58275E0D3 +:100C3000003507F583E511F075E0092506F58275A5 +:100C4000E0003507F583E510F0E506F509E507F561 +:100C50000A750100C3750000E501F5F0E50935F0FE +:100C6000F501E500F5F0E50A35F0F50A750900C370 +:100C7000750000E509F5F0E50135F0F501E500F551 +:100C8000F0E50A35F0F500E501F509E500F50A752E +:100C90000100C3750000E501F5F0E50935F0F50147 +:100CA000E500F5F0E50A35F0F500E500F502E501AF +:100CB000F582E502F583E0F511750101C3750000C9 +:100CC000E501F5F0E50935F0F501E500F5F0E50A97 +:100CD00035F0F500E500F502E501F582E502F58362 +:100CE000E0F501750900750A00750E02750F0075B3 +:100CF0001000750000C3750B00E509F5F0E50EA4C2 +:100D0000F50DE509F5F0E50EA4E5F0F50CE50DF5BA +:100D1000F0E50B35F0F50BE50AF5F0E50EA4F50D61 +:100D2000E50AF5F0E50EA4E5F0F50AE50DF5F0E5C8 +:100D30000C35F0F50CC3C3750A00E50BF5F0E510B2 +:100D400035F0F510E50CF5F0E50035F0F500C3756C +:100D50000C00E509F5F0E50FA4F50DE509F5F0E562 +:100D60000FA4E5F0F50AE50DF5F0E50C35F0F50C0E +:100D7000750B00C3C3750900E50BF5F0E51035F000 +:100D8000F510E50CF5F0E50035F0F500C3750B0046 +:100D9000750C00C3C3750900E50BF5F0E51035F0DF +:100DA000F510E50CF5F0E50035F0F500C3750B0026 +:100DB000750C00C3C3750900E50BF5F0E51035F0BF +:100DC000F510E50CF5F0E50035F0F500C375090008 +:100DD000E510F5F0E51135F0F512E500F5F0E50167 +:100DE00035F0F513900000E582F509900000E583E9 +:100DF000F50A750100C3750000E501F5F0E5093558 +:100E0000F0F501E500F5F0E50A35F0F500E501F54E +:100E100009E500F50A750100C3750000E501F5F06C +:100E2000E50935F0F501E500F5F0E50A35F0F500E6 +:100E3000E500F502E501F582E502F583E0F51075C0 +:100E40000101C3750000E501F5F0E50935F0F50194 +:100E5000E500F5F0E50A35F0F500E500F502E501FD +:100E6000F582E502F583E0F5117500007501007566 +:100E70000C02750D00750E00750F00C3750900E5B5 +:100E800000F5F0E50CA4F50BE500F5F0E50CA4E5A4 +:100E9000F0F50AE50BF5F0E50935F0F509E501F5A2 +:100EA000F0E50CA4F50BE501F5F0E50CA4E5F0F593 +:100EB00001E50BF5F0E50A35F0F50AC3C37501004D +:100EC000E509F5F0E50E35F0F50EE50AF5F0E50F6C +:100ED00035F0F50FC3750A00E500F5F0E50DA4F552 +:100EE0000BE500F5F0E50DA4E5F0F501E50BF5F0F7 +:100EF000E50A35F0F50A750900C3C3750000E50978 +:100F0000F5F0E50E35F0F50EE50AF5F0E50F35F0F4 +:100F1000F50FC3750900750A00C3C3750000E50924 +:100F2000F5F0E50E35F0F50EE50AF5F0E50F35F0D4 +:100F3000F50FC3750900750A00C3C3750000E50904 +:100F4000F5F0E50E35F0F50EE50AF5F0E50F35F0B4 +:100F5000F50FC3750000E50EF5F0E51035F0F5006E +:100F6000E50FF5F0E51135F0F501E500F509E501CE +:100F7000F50A750100C3750000E501F5F0E50935D6 +:100F8000F0F501E500F5F0E50A35F0F500E500F5CE +:100F900002E501F582E502F583E0F50B750101C379 +:100FA000750000E501F5F0E50935F0F501E500F51E +:100FB000F0E50A35F0F500E500F502E501F582E51A +:100FC00002F583E0F509750100C3750000E501F540 +:100FD000F0E51235F0F501E500F5F0E51335F0F533 +:100FE00000E50BF503E500F502E501F582E502F504 +:100FF00083E503F0750101C3750000E501F5F0E537 +:101000001235F0F501E500F5F0E51335F0F500E5F2 +:1010100009F503E500F502E501F582E502F583E552 +:1010200003F0E506F509E507F50A750100C375004B +:1010300000E501F5F0E50935F0F501E500F5F0E52D +:101040000A35F0F50A750900C3750000E509F5F0E9 +:10105000E50135F0F501E500F5F0E50A35F0F500BC +:10106000E501F509E500F50A750100C3750000E525 +:1010700001F5F0E50935F0F501E500F5F0E50A3593 +:10108000F0F500E500F502E501F582E502F583E003 +:10109000F511750101C3750000E501F5F0E50935AD +:1010A000F0F501E500F5F0E50A35F0F500E500F5AD +:1010B00002E501F582E502F583E0F50175090175A8 +:1010C0000A00750E02750F00751000750000C375DB +:1010D0000B00E509F5F0E50EA4F50DE509F5F0E5E1 +:1010E0000EA4E5F0F50CE50DF5F0E50B35F0F50B8C +:1010F000E50AF5F0E50EA4F50DE50AF5F0E50EA418 +:10110000E5F0F50AE50DF5F0E50C35F0F50CC3C397 +:10111000750A00E50BF5F0E51035F0F510E50CF576 +:10112000F0E50035F0F500C3750C00E509F5F0E5D4 +:101130000FA4F50DE509F5F0E50FA4E5F0F50AE5D6 +:101140000DF5F0E50C35F0F50C750B00C3C3750912 +:1011500000E50BF5F0E51035F0F510E50CF5F0E5E0 +:101160000035F0F500C3750B00750C00C3C375099D +:1011700000E50BF5F0E51035F0F510E50CF5F0E5C0 +:101180000035F0F500C3750B00750C00C3C375097D +:1011900000E50BF5F0E51035F0F510E50CF5F0E5A0 +:1011A0000035F0F500C3750900E510F5F0E51135DF +:1011B000F0F512E500F5F0E50135F0F513900000CB +:1011C000E582F509900000E583F50A750100C37515 +:1011D0000000E501F5F0E50935F0F501E500F5F071 +:1011E000E50A35F0F500E501F509E500F50A7501B8 +:1011F00000C3750000E501F5F0E50935F0F501E5FE +:1012000000F5F0E50A35F0F500E500F502E501F539 +:1012100082E502F583E0F510750101C3750000E574 +:1012200001F5F0E50935F0F501E500F5F0E50A35E1 +:10123000F0F500E500F502E501F582E502F583E051 +:10124000F511750001750100750C02750D00750E24 +:1012500000750F00C3750900E500F5F0E50CA4F575 +:101260000BE500F5F0E50CA4E5F0F50AE50BF5F06B +:10127000E50935F0F509E501F5F0E50CA4F50BE518 +:1012800001F5F0E50CA4E5F0F501E50BF5F0E50A54 +:1012900035F0F50AC3C3750100E509F5F0E50E3533 +:1012A000F0F50EE50AF5F0E50F35F0F50FC3750A18 +:1012B00000E500F5F0E50DA4F50BE500F5F0E50D12 +:1012C000A4E5F0F501E50BF5F0E50A35F0F50A7552 +:1012D0000900C3C3750000E509F5F0E50E35F0F52A +:1012E0000EE50AF5F0E50F35F0F50FC37509007549 +:1012F0000A00C3C3750000E509F5F0E50E35F0F509 +:101300000EE50AF5F0E50F35F0F50FC37509007528 +:101310000A00C3C3750000E509F5F0E50E35F0F5E8 +:101320000EE50AF5F0E50F35F0F50FC3750000E5A1 +:101330000EF5F0E51035F0F500E50FF5F0E51135A7 +:10134000F0F501E500F509E501F50A750100C37541 +:101350000000E501F5F0E50935F0F501E500F5F0EF +:10136000E50A35F0F500E500F502E501F582E50254 +:10137000F583E0F50B750101C3750000E501F5F09B +:10138000E50935F0F501E500F5F0E50A35F0F50081 +:10139000E500F502E501F582E502F583E0F5097562 +:1013A0000100C3750000E501F5F0E51235F0F50127 +:1013B000E500F5F0E51335F0F500E50BF503E50084 +:1013C000F502E501F582E502F583E503F07501011B +:1013D000C3750000E501F5F0E51235F0F501E50013 +:1013E000F5F0E51335F0F500E509F503E500F50244 +:1013F000E501F582E502F583E503F0E506F509E58B +:1014000007F50A750100C3750000E501F5F0E5096F +:1014100035F0F501E500F5F0E50A35F0F50A750956 +:1014200000C3750000E509F5F0E50135F0F501E5CB +:1014300000F5F0E50A35F0F500E501F509E500F500 +:101440000A750100C3750000E501F5F0E50935F006 +:10145000F501E500F5F0E50A35F0F500E500F502E7 +:10146000E501F582E502F583E0F511750101C3752B +:101470000000E501F5F0E50935F0F501E500F5F0CE +:10148000E50A35F0F500E500F502E501F582E50233 +:10149000F583E0F501750902750A00750E02750FF6 +:1014A00000751000750000C3750B00E509F5F0E547 +:1014B0000EA4F50DE509F5F0E50EA4E5F0F50CE553 +:1014C0000DF5F0E50B35F0F50BE50AF5F0E50EA4AA +:1014D000F50DE50AF5F0E50EA4E5F0F50AE50DF5E4 +:1014E000F0E50C35F0F50CC3C3750A00E50BF5F01B +:1014F000E51035F0F510E50CF5F0E50035F0F500F8 +:10150000C3750C00E509F5F0E50FA4F50DE509F547 +:10151000F0E50FA4E5F0F50AE50DF5F0E50C35F082 +:10152000F50C750B00C3C3750900E50BF5F0E5106C +:1015300035F0F510E50CF5F0E50035F0F500C37574 +:101540000B00750C00C3C3750900E50BF5F0E51041 +:1015500035F0F510E50CF5F0E50035F0F500C37554 +:101560000B00750C00C3C3750900E50BF5F0E51021 +:1015700035F0F510E50CF5F0E50035F0F500C37534 +:101580000900E510F5F0E51135F0F512E500F5F08C +:10159000E50135F0F513900000E582F509900000B3 +:1015A000E583F50A750100C3750000E501F5F0E576 +:1015B0000935F0F501E500F5F0E50A35F0F500E54F +:1015C00001F509E500F50A750100C3750000E501A4 +:1015D000F5F0E50935F0F501E500F5F0E50A35F03F +:1015E000F500E500F502E501F582E502F583E0F599 +:1015F00010750101C3750000E501F5F0E50935F04E +:10160000F501E500F5F0E50A35F0F500E500F50235 +:10161000E501F582E502F583E0F51175000275013B +:1016200000750C02750D00750E00750F00C375096D +:1016300000E500F5F0E50CA4F50BE500F5F0E50C90 +:10164000A4E5F0F50AE50BF5F0E50935F0F509E557 +:1016500001F5F0E50CA4F50BE501F5F0E50CA4E5CA +:10166000F0F501E50BF5F0E50A35F0F50AC3C375B1 +:101670000100E509F5F0E50E35F0F50EE50AF5F0A7 +:10168000E50F35F0F50FC3750A00E500F5F0E50D3F +:10169000A4F50BE500F5F0E50DA4E5F0F501E50B8B +:1016A000F5F0E50A35F0F50A750900C3C3750000C9 +:1016B000E509F5F0E50E35F0F50EE50AF5F0E50F74 +:1016C00035F0F50FC3750900750A00C3C375000036 +:1016D000E509F5F0E50E35F0F50EE50AF5F0E50F54 +:1016E00035F0F50FC3750900750A00C3C375000016 +:1016F000E509F5F0E50E35F0F50EE50AF5F0E50F34 +:1017000035F0F50FC3750000E50EF5F0E51035F086 +:10171000F500E50FF5F0E51135F0F501E500F50907 +:10172000E501F50A750100C3750000E501F5F0E576 +:101730000935F0F501E500F5F0E50A35F0F500E5CD +:1017400000F502E501F582E502F583E0F50B750190 +:1017500001C3750000E501F5F0E50935F0F501E597 +:1017600000F5F0E50A35F0F500E500F502E501F5D4 +:1017700082E502F583E0F509750100C3750000E517 +:1017800001F5F0E51235F0F501E500F5F0E513356A +:10179000F0F500E50BF503E500F502E501F582E55E +:1017A00002F583E503F0750101C3750000E501F55D +:1017B000F0E51235F0F501E500F5F0E51335F0F54B +:1017C00000E509F503E500F502E501F582E502F51E +:1017D00083E503F0E506F50AE507F501750900C3A1 +:1017E000750000E509F5F0E50A35F0F51FE500F5AF +:1017F000F0E50135F0F51EE506F50AE507F501759A +:101800000900C3750000E509F5F0E50A35F0F51D9E +:10181000E500F5F0E50135F0F51C12000075E00675 +:101820002506F58275E0003507F583E0F50275E0E1 +:10183000062506F58275E0003507F583E0F50375AA +:10184000E0062506F58275E0003507F583E0F5042E +:1018500075E0062506F58275E0003507F583E0F5AD +:101860000575E00C2506F58275E0003507F583E087 +:10187000F51375E00B2506F58275E0003507F58355 +:10188000E0F51275E00A2506F58275E0003507F5EA +:1018900083E0F51175E0092506F58275E00035074E +:1018A000F583E0F51075E0072506F58275E0003553 +:1018B00007F583E0F508E508C0E075E0082506F5C2 +:1018C0008275E0003507F583E0F508E508C0E075AE +:1018D000E00D2506F50675E0003507F507E502F58C +:1018E00082E503F583E504F500E505F50122000036 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr26004.s.expected b/tests/GCCTestSuite/pr26004.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr26004.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr26570.c b/tests/GCCTestSuite/pr26570.c new file mode 100644 index 0000000..999b240 --- /dev/null +++ b/tests/GCCTestSuite/pr26570.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-generate -fprofile-use" } */ + +unsigned test (unsigned a, unsigned b) +{ + return a / b; +} /* { dg-warning "execution counts estimated" } */ diff --git a/tests/GCCTestSuite/pr26570.c.expected b/tests/GCCTestSuite/pr26570.c.expected new file mode 100644 index 0000000..999b240 --- /dev/null +++ b/tests/GCCTestSuite/pr26570.c.expected @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-generate -fprofile-use" } */ + +unsigned test (unsigned a, unsigned b) +{ + return a / b; +} /* { dg-warning "execution counts estimated" } */ diff --git a/tests/GCCTestSuite/pr26570.hex.expected b/tests/GCCTestSuite/pr26570.hex.expected new file mode 100644 index 0000000..4b31e39 --- /dev/null +++ b/tests/GCCTestSuite/pr26570.hex.expected @@ -0,0 +1,113 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E50675820AC32B +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0012506F58275E0003507F583E5AC +:1006600008F0D0E0F50875E0002506F58275E00099 +:100670003507F583E508F0120000E582F502E58311 +:10068000F503E500F504E501F505E502F500E503F0 +:10069000F501E504F509E505F50AE500F502E501D2 +:1006A000F503E509F504E50AF50575E0002506F50D +:1006B0008275E0003507F583E0F508E508C0E075D0 +:1006C000E0012506F58275E0003507F583E0F508C1 +:1006D000E508C0E075E00A2506F50675E000350777 +:1006E000F507E502F582E503F583E504F500E50588 +:1006F000F5012200000000000000000000000000E2 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr26570.s.expected b/tests/GCCTestSuite/pr26570.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr26570.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr26961-1.c b/tests/GCCTestSuite/pr26961-1.c new file mode 100644 index 0000000..56907d8 --- /dev/null +++ b/tests/GCCTestSuite/pr26961-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +long long foo(int i, int j) +{ + return i ? (long long)(!j) : 0; +} + diff --git a/tests/GCCTestSuite/pr26961-1.c.expected b/tests/GCCTestSuite/pr26961-1.c.expected new file mode 100644 index 0000000..56907d8 --- /dev/null +++ b/tests/GCCTestSuite/pr26961-1.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +long long foo(int i, int j) +{ + return i ? (long long)(!j) : 0; +} + diff --git a/tests/GCCTestSuite/pr26961-1.hex.expected b/tests/GCCTestSuite/pr26961-1.hex.expected new file mode 100644 index 0000000..5646c95 --- /dev/null +++ b/tests/GCCTestSuite/pr26961-1.hex.expected @@ -0,0 +1,28 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E51241 +:10004000F501E511F509E510F50F750000E51FF55F +:10005000F0E50045F0F500E51EF5F0E50045F0F5AA +:1000600000E51DF5F0E50045F0F500E51CF5F0E5CF +:100070000045F0F500E500700280030200F0007515 +:100080000E00750000750A00750B00E50EF502E51F +:1000900000F503E50AF504E50BF505E501F512E5C4 +:1000A00009F511E50FF51075E0002506F58275E0FC +:1000B000003507F583E0F508E508C0E075E00125A7 +:1000C00006F58275E0003507F583E0F508E508C020 +:1000D000E075E00A2506F50675E0003507F507E549 +:1000E00002F582E503F583E504F500E505F5012257 +:1000F00000E51BF500E51AF50AE519F50BE518F51D +:100100000C750E01C3750D00E500F5F0E50D95F0D9 +:10011000F50D750D00E50DF5F0E50D35F0F50DE586 +:100120000DF5F0E50E65F0F50EC3750D00E50AF569 +:10013000F0E50D95F0F50D750D00E50DF5F0E50D0B +:1001400035F0F50DE50DF5F0E50E65F0F50EC3752E +:100150000D00E50BF5F0E50D95F0F50D750D00E5DD +:100160000DF5F0E50D35F0F50DE50DF5F0E50E6555 +:10017000F0F50EC3750D00E50CF5F0E50D95F0F505 +:100180000D750D00E50DF5F0E50D35F0F50DE50DFE +:10019000F5F0E50E65F0F50E750000750A00750BBB +:1001A0000002008B000000000000000000000000C2 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr26961-1.s.expected b/tests/GCCTestSuite/pr26961-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr26961-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr28187.c b/tests/GCCTestSuite/pr28187.c new file mode 100644 index 0000000..bc3b62d --- /dev/null +++ b/tests/GCCTestSuite/pr28187.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vrp -fwrapv" } */ + +extern void bar(int); +void checkgroups(int last, int verbose) +{ + int window = 0; + int outstanding = 0; + while (window < last || outstanding) { + while (outstanding < 47 && window < last) { + if (window < last) { + outstanding++; + if (verbose) + bar(window); + bar(window++); + } + } + if (outstanding > 0) + bar(0); + } +} + diff --git a/tests/GCCTestSuite/pr28187.c.expected b/tests/GCCTestSuite/pr28187.c.expected new file mode 100644 index 0000000..bc3b62d --- /dev/null +++ b/tests/GCCTestSuite/pr28187.c.expected @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vrp -fwrapv" } */ + +extern void bar(int); +void checkgroups(int last, int verbose) +{ + int window = 0; + int outstanding = 0; + while (window < last || outstanding) { + while (outstanding < 47 && window < last) { + if (window < last) { + outstanding++; + if (verbose) + bar(window); + bar(window++); + } + } + if (outstanding > 0) + bar(0); + } +} + diff --git a/tests/GCCTestSuite/pr28187.hex.expected b/tests/GCCTestSuite/pr28187.hex.expected new file mode 100644 index 0000000..ece8215 --- /dev/null +++ b/tests/GCCTestSuite/pr28187.hex.expected @@ -0,0 +1,336 @@ +:100000000000E50675821BC39582F506E50775833A +:10001000009583F507D0E0F50875E00A2506F5821E +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000092506F58275E0003507F583E508F075BA +:10004000E0122506F58275E0003507F583E517F027 +:1000500075E0112506F58275E0003507F583E51694 +:10006000F075E0102506F58275E0003507F583E5AB +:1000700015F075E00F2506F58275E0003507F5836C +:10008000E514F075E00E2506F58275E0003507F5FC +:1000900083E513F075E00D2506F58275E000350760 +:1000A000F583E512F075E00C2506F58275E0003564 +:1000B00007F583E511F075E00B2506F58275E00084 +:1000C0003507F583E510F075E0072506F58275E044 +:1000D000003507F583E51FF0E51EF514E51DF51164 +:1000E00075E0002506F58275E0003507F583E51C0F +:1000F000F075E0042506F58275E0003507F583E527 +:100100001BF075E0032506F58275E0003507F583E1 +:10011000E51AF075E0022506F58275E0003507F571 +:1001200083E519F075E0012506F58275E0003507D5 +:10013000F583E518F0751700751200751000750845 +:100140000075E0062506F58275E0003507F583E5C4 +:1001500008F075080075E0082506F58275E00035A1 +:1001600007F583E508F0751600751300750800752E +:10017000E0052506F58275E0003507F583E508F012 +:1001800075E0062506F58275E0003507F583E0F594 +:100190000E75E0002506F58275E0003507F583E071 +:1001A000F50D750080E500F5F0E50E25F0F50EE59E +:1001B00000F5F0E50D25F0F50D750C00750F0075D7 +:1001C0001500751800750B00750A01750001C3E56F +:1001D0000DF5F0E50E95F0F509E50BF5F0E50B35BD +:1001E000F0F509E509F5F0E50055F0F500E500F555 +:1001F000F0E50C45F0F50C750001C3E50DF5F0E5F3 +:100200000E95F0F509E50BF5F0E50B35F0F509E590 +:100210000EF5F0E50D95F0F501E50BF5F0E50B3584 +:10022000F0F501E501F5F0E50945F0F509E50AF518 +:10023000F0E50965F0F509E509F5F0E50055F0F59B +:1002400000C3E511F5F0E51095F0F509E50BF5F0C3 +:10025000E50B35F0F509E509F5F0E50055F0F50099 +:10026000E500F5F0E50C45F0F50C750001C3E50D72 +:10027000F5F0E50E95F0F509E50BF5F0E50B35F039 +:10028000F509E50EF5F0E50D95F0F501E50BF5F056 +:10029000E50B35F0F501E501F5F0E50945F0F50967 +:1002A000E50AF5F0E50965F0F509E509F5F0E50081 +:1002B00055F0F500C3E511F5F0E51095F0F509E509 +:1002C0000BF5F0E50B35F0F509E510F5F0E51195C6 +:1002D000F0F501E50BF5F0E50B35F0F501E501F57D +:1002E000F0E50945F0F509E50AF5F0E50965F0F5F1 +:1002F00009E509F5F0E50055F0F500C3E514F5F062 +:10030000E51295F0F509E50BF5F0E50B35F0F5098B +:10031000E509F5F0E50055F0F500E500F5F0E50C30 +:1003200045F0F50C750001C3E50DF5F0E50E95F00F +:10033000F509E50BF5F0E50B35F0F509E50EF5F0FF +:10034000E50D95F0F501E50BF5F0E50B35F0F50160 +:10035000E501F5F0E50945F0F509E50AF5F0E509EF +:1003600065F0F509E509F5F0E50055F0F500C3E5A0 +:1003700011F5F0E51095F0F509E50BF5F0E50B3515 +:10038000F0F509E510F5F0E51195F0F501E50BF54F +:10039000F0E50B35F0F501E501F5F0E50945F0F57F +:1003A00009E50AF5F0E50965F0F509E509F5F0E577 +:1003B0000055F0F500C3E514F5F0E51295F0F509E8 +:1003C000E50BF5F0E50B35F0F509E512F5F0E51470 +:1003D00095F0F501E50BF5F0E50B35F0F501E501DC +:1003E000F5F0E50945F0F509E50AF5F0E50965F0F0 +:1003F000F509E509F5F0E50055F0F500C375E007EE +:100400002506F58275E0003507F583E0F508E50877 +:10041000F5F0E51795F0F509E50BF5F0E50B35F08E +:10042000F509E509F5F0E50055F0F500E500F5F012 +:10043000E50C45F0F50C750000E50CF5F0E5004520 +:10044000F0F500E50FF5F0E50045F0F500E515F5F0 +:10045000F0E50045F0F500E518F5F0E50045F0F5AC +:1004600000E500700280030214D20075000075E000 +:10047000082506F58275E0003507F583E0F508E507 +:1004800008F5F0E50045F0F500E516F5F0E5004566 +:10049000F0F500E513F5F0E50045F0F50075E00531 +:1004A0002506F58275E0003507F583E0F508E508D7 +:1004B000F5F0E50045F0F500E50070028003021458 +:1004C000C200750000750100750900750A00750C01 +:1004D00001C3750B00E500F5F0E50B95F0F50B7524 +:1004E0000B00E50BF5F0E50B35F0F50BE50BF5F042 +:1004F000E50C65F0F50CC3750B00E501F5F0E50BB7 +:1005000095F0F50B750B00E50BF5F0E50B35F0F507 +:100510000BE50BF5F0E50C65F0F50CC3750B00E58C +:1005200009F5F0E50B95F0F50B750B00E50BF5F013 +:10053000E50B35F0F50BE50BF5F0E50C65F0F50C8A +:10054000C3750B00E50AF5F0E50B95F0F50B750B9F +:1005500000E50BF5F0E50B35F0F50BE50BF5F0E5F7 +:100560000C65F0F50C750100750900750A00750041 +:1005700000E50CF5F0E50045F0F500E501F5F0E5E6 +:100580000045F0F500E509F5F0E50045F0F500E57A +:100590000AF5F0E50045F0F500E500700280030281 +:1005A00013DD00751B2F751500750C00750D00759A +:1005B000E0052506F58275E0003507F583E0F50EC8 +:1005C000750080E500F5F0E50E25F0F50EE500F587 +:1005D000F0E50D25F0F50D750B0075180075190087 +:1005E000751A00750A00750F01750001C3E50DF558 +:1005F000F0E50E95F0F509E50AF5F0E50A35F0F5B8 +:1006000009E509F5F0E50055F0F500E500F5F0E540 +:100610000B45F0F50B750001C3E50DF5F0E50E9502 +:10062000F0F509E50AF5F0E50A35F0F509E50EF50E +:10063000F0E50D95F0F501E50AF5F0E50A35F0F580 +:1006400001E501F5F0E50945F0F509E50FF5F0E5FF +:100650000965F0F509E509F5F0E50055F0F500C389 +:10066000E50CF5F0E51395F0F509E50AF5F0E50A76 +:1006700035F0F509E509F5F0E50055F0F500E50080 +:10068000F5F0E50B45F0F50B750001C3E50DF5F050 +:10069000E50E95F0F509E50AF5F0E50A35F0F509FE +:1006A000E50EF5F0E50D95F0F501E50AF5F0E50A42 +:1006B00035F0F501E501F5F0E50945F0F509E50F3F +:1006C000F5F0E50965F0F509E509F5F0E50055F007 +:1006D000F500C3E50CF5F0E51395F0F509E50AF52D +:1006E000F0E50A35F0F509E513F5F0E50C95F0F5C0 +:1006F00001E50AF5F0E50A35F0F501E501F5F0E56B +:100700000945F0F509E50FF5F0E50965F0F509E5AE +:1007100009F5F0E50055F0F500C3E515F5F0E5162F +:1007200095F0F509E50AF5F0E50A35F0F509E50972 +:10073000F5F0E50055F0F500E500F5F0E50B45F0C6 +:10074000F50B750001C3E50DF5F0E50E95F0F50923 +:10075000E50AF5F0E50A35F0F509E50EF5F0E50DE9 +:1007600095F0F501E50AF5F0E50A35F0F501E5014A +:10077000F5F0E50945F0F509E50FF5F0E50965F057 +:10078000F509E509F5F0E50055F0F500C3E50CF5D0 +:10079000F0E51395F0F509E50AF5F0E50A35F0F511 +:1007A00009E513F5F0E50C95F0F501E50AF5F0E53E +:1007B0000A35F0F501E501F5F0E50945F0F509E543 +:1007C0000FF5F0E50965F0F509E509F5F0E50055E7 +:1007D000F0F500C3E515F5F0E51695F0F509E50A25 +:1007E000F5F0E50A35F0F509E516F5F0E51595F0B3 +:1007F000F501E50AF5F0E50A35F0F501E501F5F05A +:10080000E50945F0F509E50FF5F0E50965F0F509AD +:10081000E509F5F0E50055F0F500C3E51BF5F075C9 +:10082000E0082506F58275E0003507F583E0F50858 +:10083000E50895F0F509E50AF5F0E50A35F0F50962 +:10084000E509F5F0E50055F0F500E500F5F0E50BFC +:1008500045F0F50B750000E50BF5F0E50045F0F50A +:1008600000E518F5F0E50045F0F500E519F5F0E5CF +:100870000045F0F500E51AF5F0E50045F0F500E576 +:1008800000700280030210D200750000750100752F +:100890000900750A00750C01C3750B00E500F5F041 +:1008A000E50B95F0F50B750B00E50BF5F0E50B3559 +:1008B000F0F50BE50BF5F0E50C65F0F50CC3750BE9 +:1008C00000E501F5F0E50B95F0F50B750B00E50B78 +:1008D000F5F0E50B35F0F50BE50BF5F0E50C65F003 +:1008E000F50CC3750B00E509F5F0E50B95F0F50B7C +:1008F000750B00E50BF5F0E50B35F0F50BE50BF5A9 +:10090000F0E50C65F0F50CC3750B00E50AF5F0E5B4 +:100910000B95F0F50B750B00E50BF5F0E50B35F0DD +:10092000F50BE50BF5F0E50C65F0F50C75010075C0 +:100930000900750A00750000E50CF5F0E50045F0CA +:10094000F500E501F5F0E50045F0F500E509F5F005 +:10095000E50045F0F500E50AF5F0E50045F0F500A5 +:10096000E50070028003020DD80075E0062506F54B +:100970008275E0003507F583E0F50E75E000250689 +:10098000F58275E0003507F583E0F50D750080E52B +:1009900000F5F0E50E25F0F50EE500F5F0E50D2586 +:1009A000F0F50D750C00750F0075150075180075C4 +:1009B0000B00750A01750001C3E50DF5F0E50E9514 +:1009C000F0F509E50BF5F0E50B35F0F509E509F56E +:1009D000F0E50055F0F500E500F5F0E50C45F0F523 +:1009E0000C750001C3E50DF5F0E50E95F0F509E590 +:1009F0000BF5F0E50B35F0F509E50EF5F0E50D9595 +:100A0000F0F501E50BF5F0E50B35F0F501E501F545 +:100A1000F0E50945F0F509E50AF5F0E50965F0F5B9 +:100A200009E509F5F0E50055F0F500C3E511F5F02D +:100A3000E51095F0F509E50BF5F0E50B35F0F50956 +:100A4000E509F5F0E50055F0F500E500F5F0E50CF9 +:100A500045F0F50C750001C3E50DF5F0E50E95F0D8 +:100A6000F509E50BF5F0E50B35F0F509E50EF5F0C8 +:100A7000E50D95F0F501E50BF5F0E50B35F0F50129 +:100A8000E501F5F0E50945F0F509E50AF5F0E509B8 +:100A900065F0F509E509F5F0E50055F0F500C3E569 +:100AA00011F5F0E51095F0F509E50BF5F0E50B35DE +:100AB000F0F509E510F5F0E51195F0F501E50BF518 +:100AC000F0E50B35F0F501E501F5F0E50945F0F548 +:100AD00009E50AF5F0E50965F0F509E509F5F0E540 +:100AE0000055F0F500C3E514F5F0E51295F0F509B1 +:100AF000E50BF5F0E50B35F0F509E509F5F0E50056 +:100B000055F0F500E500F5F0E50C45F0F50C750045 +:100B100001C3E50DF5F0E50E95F0F509E50BF5F0EF +:100B2000E50B35F0F509E50EF5F0E50D95F0F5016D +:100B3000E50BF5F0E50B35F0F501E501F5F0E5091C +:100B400045F0F509E50AF5F0E50965F0F509E5096F +:100B5000F5F0E50055F0F500C3E511F5F0E5109569 +:100B6000F0F509E50BF5F0E50B35F0F509E510F5C5 +:100B7000F0E51195F0F501E50BF5F0E50B35F0F535 +:100B800001E501F5F0E50945F0F509E50AF5F0E5BF +:100B90000965F0F509E509F5F0E50055F0F500C344 +:100BA000E514F5F0E51295F0F509E50BF5F0E50B28 +:100BB00035F0F509E512F5F0E51495F0F501E50BD2 +:100BC000F5F0E50B35F0F501E501F5F0E50945F047 +:100BD000F509E50AF5F0E50965F0F509E509F5F02F +:100BE000E50055F0F500C375E0072506F58275E0D0 +:100BF000003507F583E0F508E508F5F0E51795F011 +:100C0000F509E50BF5F0E50B35F0F509E509F5F02B +:100C1000E50055F0F500E500F5F0E50C45F0F50CC4 +:100C2000750000E50CF5F0E50045F0F500E50FF581 +:100C3000F0E50045F0F500E515F5F0E50045F0F5C7 +:100C400000E518F5F0E50045F0F500E500700280DC +:100C500003020C58000205A3007500017501007520 +:100C60000900750A00C3750B00E500F5F075E00892 +:100C70002506F58275E0003507F583E0F508E508FF +:100C800035F0F50875E0082506F58275E0003507B2 +:100C9000F583E508F0E501F5F0E51635F0F516E524 +:100CA00009F5F0E51335F0F513E50AF5F075E00503 +:100CB0002506F58275E0003507F583E0F508E508BF +:100CC00035F0F50875E0052506F58275E000350775 +:100CD000F583E508F075000075E0042506F58275DA +:100CE000E0003507F583E0F508E508F5F0E5004597 +:100CF000F0F50075E0032506F58275E0003507F58F +:100D000083E0F508E508F5F0E50045F0F50075E04D +:100D1000022506F58275E0003507F583E0F508E564 +:100D200008F5F0E50045F0F50075E0012506F582CF +:100D300075E0003507F583E0F508E508F5F0E50016 +:100D400045F0F500E50070028003020DB700E517DD +:100D5000F51FE512F51EE510F51D75E0062506F5F3 +:100D60008275E0003507F583E0F51C750901750112 +:100D700000750000750A00C3750B00E509F5F0E584 +:100D80001F35F0F517E501F5F0E51E35F0F512E534 +:100D900000F5F0E51D35F0F510E50AF5F0E51C3538 +:100DA000F0F50875E0062506F58275E0003507F5D3 +:100DB00083E508F00205A300E517F51FE512F51E0F +:100DC000E510F51D75E0062506F58275E00035078E +:100DD000F583E0F51C020D4E00751B0075150075BE +:100DE0000D00750E0075E0052506F58275E00035ED +:100DF00007F583E0F50C750080E500F5F0E50E25BC +:100E0000F0F50EE500F5F0E50C25F0F50C750B009E +:100E1000751800751900751A00750A00750F0175AF +:100E20000001C3E50CF5F0E50E95F0F509E50AF5CE +:100E3000F0E50A35F0F509E509F5F0E50055F0F5BE +:100E400000E500F5F0E50B45F0F50B750001C3E595 +:100E50000CF5F0E50E95F0F509E50AF5F0E50A3533 +:100E6000F0F509E50EF5F0E50C95F0F501E50AF56C +:100E7000F0E50A35F0F501E501F5F0E50945F0F595 +:100E800009E50FF5F0E50965F0F509E509F5F0E587 +:100E90000055F0F500C3E513F5F0E50D95F0F50903 +:100EA000E50AF5F0E50A35F0F509E509F5F0E500A4 +:100EB00055F0F500E500F5F0E50B45F0F50B750094 +:100EC00001C3E50CF5F0E50E95F0F509E50AF5F03E +:100ED000E50A35F0F509E50EF5F0E50C95F0F501BC +:100EE000E50AF5F0E50A35F0F501E501F5F0E5096B +:100EF00045F0F509E50FF5F0E50965F0F509E509B7 +:100F0000F5F0E50055F0F500C3E513F5F0E50D95B6 +:100F1000F0F509E50AF5F0E50A35F0F509E50DF516 +:100F2000F0E51395F0F501E50AF5F0E50A35F0F581 +:100F300001E501F5F0E50945F0F509E50FF5F0E506 +:100F40000965F0F509E509F5F0E50055F0F500C390 +:100F5000E516F5F0E51595F0F509E50AF5F0E50A71 +:100F600035F0F509E509F5F0E50055F0F500E50087 +:100F7000F5F0E50B45F0F50B750001C3E50CF5F058 +:100F8000E50E95F0F509E50AF5F0E50A35F0F50905 +:100F9000E50EF5F0E50C95F0F501E50AF5F0E50A4A +:100FA00035F0F501E501F5F0E50945F0F509E50F46 +:100FB000F5F0E50965F0F509E509F5F0E50055F00E +:100FC000F500C3E513F5F0E50D95F0F509E50AF533 +:100FD000F0E50A35F0F509E50DF5F0E51395F0F5C6 +:100FE00001E50AF5F0E50A35F0F501E501F5F0E572 +:100FF0000945F0F509E50FF5F0E50965F0F509E5B6 +:1010000009F5F0E50055F0F500C3E516F5F0E51536 +:1010100095F0F509E50AF5F0E50A35F0F509E5156D +:10102000F5F0E51695F0F501E50AF5F0E50A35F07D +:10103000F501E501F5F0E50945F0F509E50FF5F0F5 +:10104000E50965F0F509E509F5F0E50055F0F5006D +:10105000C375E0082506F58275E0003507F583E0E5 +:10106000F508E508F5F0E51B95F0F509E50AF5F05A +:10107000E50A35F0F509E509F5F0E50055F0F5006C +:10108000E500F5F0E50B45F0F50B750000E50BF517 +:10109000F0E50045F0F500E518F5F0E50045F0F560 +:1010A00000E519F5F0E50045F0F500E51AF5F0E585 +:1010B0000045F0F500E500700280030210C2000256 +:1010C000018000751F00751E00751D00751C000253 +:1010D00001800075E0062506F58275E0003507F50C +:1010E00083E0F50E75E0002506F58275E000350712 +:1010F000F583E0F50D750080E500F5F0E50E25F0CF +:10110000F50EE500F5F0E50D25F0F50D750C007513 +:101110000F00751500751800750B00750A01750034 +:1011200001C3E50DF5F0E50E95F0F509E50BF5F0D9 +:10113000E50B35F0F509E509F5F0E50055F0F500AA +:10114000E500F5F0E50C45F0F50C750001C3E50D83 +:10115000F5F0E50E95F0F509E50BF5F0E50B35F04A +:10116000F509E50EF5F0E50D95F0F501E50BF5F067 +:10117000E50B35F0F501E501F5F0E50945F0F50978 +:10118000E50AF5F0E50965F0F509E509F5F0E50092 +:1011900055F0F500C3E511F5F0E51095F0F509E51A +:1011A0000BF5F0E50B35F0F509E509F5F0E500552F +:1011B000F0F500E500F5F0E50C45F0F50C750001E3 +:1011C000C3E50DF5F0E50E95F0F509E50BF5F0E555 +:1011D0000B35F0F509E50EF5F0E50D95F0F501E5B7 +:1011E0000BF5F0E50B35F0F501E501F5F0E5094506 +:1011F000F0F509E50AF5F0E50965F0F509E509F509 +:10120000F0E50055F0F500C3E511F5F0E51095F0B7 +:10121000F509E50BF5F0E50B35F0F509E510F5F00E +:10122000E51195F0F501E50BF5F0E50B35F0F5016D +:10123000E501F5F0E50945F0F509E50AF5F0E50900 +:1012400065F0F509E509F5F0E50055F0F500C3E5B1 +:1012500014F5F0E51295F0F509E50BF5F0E50B3521 +:10126000F0F509E509F5F0E50055F0F500E500F5C4 +:10127000F0E50C45F0F50C750001C3E50DF5F0E562 +:101280000E95F0F509E50BF5F0E50B35F0F509E500 +:101290000EF5F0E50D95F0F501E50BF5F0E50B35F4 +:1012A000F0F501E501F5F0E50945F0F509E50AF588 +:1012B000F0E50965F0F509E509F5F0E50055F0F50B +:1012C00000C3E511F5F0E51095F0F509E50BF5F033 +:1012D000E50B35F0F509E510F5F0E51195F0F501B0 +:1012E000E50BF5F0E50B35F0F501E501F5F0E50965 +:1012F00045F0F509E50AF5F0E50965F0F509E509B8 +:10130000F5F0E50055F0F500C3E514F5F0E51295AC +:10131000F0F509E50BF5F0E50B35F0F509E512F50B +:10132000F0E51495F0F501E50BF5F0E50B35F0F57A +:1013300001E501F5F0E50945F0F509E50AF5F0E507 +:101340000965F0F509E509F5F0E50055F0F500C38C +:1013500075E0072506F58275E0003507F583E0F5B1 +:1013600008E508F5F0E51795F0F509E50BF5F0E56A +:101370000B35F0F509E509F5F0E50055F0F500E568 +:1013800000F5F0E50C45F0F50C750000E50CF5F006 +:10139000E50045F0F500E50FF5F0E50045F0F50056 +:1013A000E515F5F0E50045F0F500E518F5F0E50088 +:1013B00045F0F500E500700280030213CD007500D2 +:1013C00000750100750900750A0002089500750096 +:1013D00001750100750900750A0002089500750085 +:1013E00000E500F502E500F503E500F504E500F58C +:1013F0000575E0122506F58275E0003507F583E0F6 +:10140000F51775E0112506F58275E0003507F583BF +:10141000E0F51675E0102506F58275E0003507F554 +:1014200083E0F51575E00F2506F58275E0003507B8 +:10143000F583E0F51475E00E2506F58275E00035BC +:1014400007F583E0F51375E00D2506F58275E000DC +:101450003507F583E0F51275E00C2506F58275E099 +:10146000003507F583E0F51175E00B2506F582756B +:10147000E0003507F583E0F51075E0092506F582F3 +:1014800075E0003507F583E0F508E508C0E075E094 +:101490000A2506F58275E0003507F583E0F508E5D5 +:1014A00008C0E075E01B2506F50675E0003507F578 +:1014B00007E502F582E503F583E504F500E505F5AA +:1014C000012200750001750100750900750A00020E +:1014D00004CE00750001750100750900750A00024F +:1014E00004CE00000000000000000000000000002A +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr28187.s.expected b/tests/GCCTestSuite/pr28187.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr28187.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr28402.c b/tests/GCCTestSuite/pr28402.c new file mode 100644 index 0000000..1368ac7 --- /dev/null +++ b/tests/GCCTestSuite/pr28402.c @@ -0,0 +1,22 @@ +/* { dg-options "" } */ +typedef long long ll; +typedef unsigned long long ull; + +int global; + +#define A(BASE, OP, AMT) \ + ll BASE ## AMT (ll x) { return x OP AMT; } \ + ull BASE ## AMT ## u (ull x) { return x OP AMT; } + +#define B(BASE, OP) \ + A (BASE, OP, 1) \ + A (BASE, OP, 10) \ + A (BASE, OP, 31) \ + A (BASE, OP, 33) \ + A (BASE, OP, 61) \ + A (BASE, OP, global) + +B (left, <<) +B (right, >>) + +/* { dg-final { scan-assembler-not "__\[a-z\]*si3" } } */ diff --git a/tests/GCCTestSuite/pr28402.c.expected b/tests/GCCTestSuite/pr28402.c.expected new file mode 100644 index 0000000..1368ac7 --- /dev/null +++ b/tests/GCCTestSuite/pr28402.c.expected @@ -0,0 +1,22 @@ +/* { dg-options "" } */ +typedef long long ll; +typedef unsigned long long ull; + +int global; + +#define A(BASE, OP, AMT) \ + ll BASE ## AMT (ll x) { return x OP AMT; } \ + ull BASE ## AMT ## u (ull x) { return x OP AMT; } + +#define B(BASE, OP) \ + A (BASE, OP, 1) \ + A (BASE, OP, 10) \ + A (BASE, OP, 31) \ + A (BASE, OP, 33) \ + A (BASE, OP, 61) \ + A (BASE, OP, global) + +B (left, <<) +B (right, >>) + +/* { dg-final { scan-assembler-not "__\[a-z\]*si3" } } */ diff --git a/tests/GCCTestSuite/pr29581-1.c b/tests/GCCTestSuite/pr29581-1.c new file mode 100644 index 0000000..b213872 --- /dev/null +++ b/tests/GCCTestSuite/pr29581-1.c @@ -0,0 +1,44 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-85.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void exit (int); + +#define N 16 + +int main1 (int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + k = i + N; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < N; j++) + if (a[j] != i + N - 1) + exit(1); + + for (j = 0; j < N; j++) + if (b[j] != j + N) + exit(1); + + return 0; +} + +int main (void) +{ + int a[N] __attribute__ ((__aligned__(16))); + + int tmp = main1 (a); + + return 0; +} diff --git a/tests/GCCTestSuite/pr29581-1.c.expected b/tests/GCCTestSuite/pr29581-1.c.expected new file mode 100644 index 0000000..b213872 --- /dev/null +++ b/tests/GCCTestSuite/pr29581-1.c.expected @@ -0,0 +1,44 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-85.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void exit (int); + +#define N 16 + +int main1 (int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + k = i + N; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < N; j++) + if (a[j] != i + N - 1) + exit(1); + + for (j = 0; j < N; j++) + if (b[j] != j + N) + exit(1); + + return 0; +} + +int main (void) +{ + int a[N] __attribute__ ((__aligned__(16))); + + int tmp = main1 (a); + + return 0; +} diff --git a/tests/GCCTestSuite/pr29581-1.hex.expected b/tests/GCCTestSuite/pr29581-1.hex.expected new file mode 100644 index 0000000..78bd3c1 --- /dev/null +++ b/tests/GCCTestSuite/pr29581-1.hex.expected @@ -0,0 +1,449 @@ +:1000000075812F7506FF7507FF121B2E02000C006D +:1000100000E506758250C39582F506E507758300F5 +:100020009583F507D0E0F50875E0452506F582755E +:10003000E0003507F583E508F0D0E0F50875E04409 +:100040002506F58275E0003507F583E508F075E0D3 +:100050004D2506F58275E0003507F583E517F07547 +:10006000E04C2506F58275E0003507F583E516F0CE +:1000700075E04B2506F58275E0003507F583E5153B +:10008000F075E04A2506F58275E0003507F583E551 +:1000900014F075E0492506F58275E0003507F58313 +:1000A000E513F075E0482506F58275E0003507F5A3 +:1000B00083E512F075E0472506F58275E000350707 +:1000C000F583E511F075E0462506F58275E000350B +:1000D00007F583E510F075E0412506F58275E0002F +:1000E0003507F583E51FF075E0402506F58275E0DC +:1000F000003507F583E51EF07513007514007508CB +:100100000075E0432506F58275E0003507F583E5C7 +:1001100008F075080075E0422506F58275E00035A7 +:1001200007F583E508F0751610751500750F007555 +:10013000100075E0422506F58275E0003507F5836D +:10014000E0F511750080E500F5F0E51125F0F511F9 +:10015000E500F5F0E51025F0F510750C00750D00C3 +:10016000750E00751200750B00750A01750001C34C +:10017000E510F5F0E51195F0F509E50BF5F0E50B67 +:1001800035F0F509E509F5F0E50055F0F500E50075 +:10019000F5F0E50C45F0F50C750001C3E510F5F040 +:1001A000E51195F0F509E50BF5F0E50B35F0F509EE +:1001B000E511F5F0E51095F0F501E50BF5F0E50B2F +:1001C00035F0F501E501F5F0E50945F0F509E50A39 +:1001D000F5F0E50965F0F509E509F5F0E50055F0FC +:1001E000F500C3E50FF5F075E0432506F58275E0EF +:1001F000003507F583E0F508E50895F0F509E50B0E +:10020000F5F0E50B35F0F509E509F5F0E50055F0F9 +:10021000F500E500F5F0E50C45F0F50C750001C3BF +:10022000E510F5F0E51195F0F509E50BF5F0E50BB6 +:1002300035F0F509E511F5F0E51095F0F501E50B60 +:10024000F5F0E50B35F0F501E501F5F0E50945F0D0 +:10025000F509E50AF5F0E50965F0F509E509F5F0B8 +:10026000E50055F0F500C3E50FF5F075E043250610 +:10027000F58275E0003507F583E0F508E50895F0AF +:10028000F509E50BF5F0E50B35F0F50975E04325CB +:1002900006F58275E0003507F583E0F508E508F519 +:1002A000F0E50F95F0F501E50BF5F0E50B35F0F510 +:1002B00001E501F5F0E50945F0F509E50AF5F0E598 +:1002C0000965F0F509E509F5F0E50055F0F500C31D +:1002D000E515F5F0E51495F0F509E50BF5F0E50BFE +:1002E00035F0F509E509F5F0E50055F0F500E50014 +:1002F000F5F0E50C45F0F50C750001C3E510F5F0DF +:10030000E51195F0F509E50BF5F0E50B35F0F5098C +:10031000E511F5F0E51095F0F501E50BF5F0E50BCD +:1003200035F0F501E501F5F0E50945F0F509E50AD7 +:10033000F5F0E50965F0F509E509F5F0E50055F09A +:10034000F500C3E50FF5F075E0432506F58275E08D +:10035000003507F583E0F508E50895F0F509E50BAC +:10036000F5F0E50B35F0F50975E0432506F58275E6 +:10037000E0003507F583E0F508E508F5F0E50F95B1 +:10038000F0F501E50BF5F0E50B35F0F501E501F5CC +:10039000F0E50945F0F509E50AF5F0E50965F0F540 +:1003A00009E509F5F0E50055F0F500C3E515F5F0B0 +:1003B000E51495F0F509E50BF5F0E50B35F0F509D9 +:1003C000E514F5F0E51595F0F501E50BF5F0E50B15 +:1003D00035F0F501E501F5F0E50945F0F509E50A27 +:1003E000F5F0E50965F0F509E509F5F0E50055F0EA +:1003F000F500C3E516F5F0E51395F0F509E50BF505 +:10040000F0E50B35F0F509E509F5F0E50055F0F5F7 +:1004100000E500F5F0E50C45F0F50C750101C3753C +:100420000000E50CF5F0E50095F0F500750000E53D +:1004300000F5F0E50035F0F500E500F5F0E50165C3 +:10044000F0F501C3750000E50DF5F0E50095F0F558 +:1004500000750000E500F5F0E50035F0F500E50079 +:10046000F5F0E50165F0F501C3750000E50EF5F066 +:10047000E50095F0F500750000E500F5F0E50035C4 +:10048000F0F500E500F5F0E50165F0F501C3750054 +:1004900000E512F5F0E50095F0F500750000E500C7 +:1004A000F5F0E50035F0F500E500F5F0E50165F063 +:1004B000F501750900750A00750B00750000E5016E +:1004C000F5F0E50045F0F500E509F5F0E50045F04B +:1004D000F500E50AF5F0E50045F0F500E50BF5F06F +:1004E000E50045F0F500E50070028003020D2400F0 +:1004F000751000751100751200751500751A1075CC +:100500001900750C00750D00E515F50E750080E5F8 +:1005100000F5F0E50E25F0F50EE500F5F0E50D250A +:10052000F0F50D750B007516007517007518007540 +:100530000A00750F01750001C3E50DF5F0E50E9594 +:10054000F0F509E50AF5F0E50A35F0F509E509F5F4 +:10055000F0E50055F0F500E500F5F0E50B45F0F5A8 +:100560000B750001C3E50DF5F0E50E95F0F509E515 +:100570000AF5F0E50A35F0F509E50EF5F0E50D951B +:10058000F0F501E50AF5F0E50A35F0F501E501F5CC +:10059000F0E50945F0F509E50FF5F0E50965F0F539 +:1005A00009E509F5F0E50055F0F500C3E50CF5F0B7 +:1005B000E51295F0F509E50AF5F0E50A35F0F509DB +:1005C000E509F5F0E50055F0F500E500F5F0E50B7F +:1005D00045F0F50B750001C3E50DF5F0E50E95F05E +:1005E000F509E50AF5F0E50A35F0F509E50EF5F04F +:1005F000E50D95F0F501E50AF5F0E50A35F0F501B0 +:10060000E501F5F0E50945F0F509E50FF5F0E50937 +:1006100065F0F509E509F5F0E50055F0F500C3E5ED +:100620000CF5F0E51295F0F509E50AF5F0E50A3567 +:10063000F0F509E512F5F0E50C95F0F501E50AF5A0 +:10064000F0E50A35F0F501E501F5F0E50945F0F5CD +:1006500009E50FF5F0E50965F0F509E509F5F0E5BF +:100660000055F0F500C3E519F5F0E51195F0F50931 +:10067000E50AF5F0E50A35F0F509E509F5F0E500DC +:1006800055F0F500E500F5F0E50B45F0F50B7500CC +:1006900001C3E50DF5F0E50E95F0F509E50AF5F075 +:1006A000E50A35F0F509E50EF5F0E50D95F0F501F3 +:1006B000E50AF5F0E50A35F0F501E501F5F0E509A3 +:1006C00045F0F509E50FF5F0E50965F0F509E509EF +:1006D000F5F0E50055F0F500C3E50CF5F0E51295F1 +:1006E000F0F509E50AF5F0E50A35F0F509E512F54A +:1006F000F0E50C95F0F501E50AF5F0E50A35F0F5C1 +:1007000001E501F5F0E50945F0F509E50FF5F0E53E +:100710000965F0F509E509F5F0E50055F0F500C3C8 +:10072000E519F5F0E51195F0F509E50AF5F0E50AAA +:1007300035F0F509E511F5F0E51995F0F501E50A53 +:10074000F5F0E50A35F0F501E501F5F0E50945F0CC +:10075000F509E50FF5F0E50965F0F509E509F5F0AE +:10076000E50055F0F500C3E51AF5F0E51095F0F554 +:1007700009E50AF5F0E50A35F0F509E509F5F0E5D2 +:100780000055F0F500E500F5F0E50B45F0F50B75CB +:100790000101C3750000E50BF5F0E50095F0F500EB +:1007A000750000E500F5F0E50035F0F500E500F531 +:1007B000F0E50165F0F501C3750000E516F5F0E51B +:1007C0000095F0F500750000E500F5F0E50035F066 +:1007D000F500E500F5F0E50165F0F501C3750000F1 +:1007E000E517F5F0E50095F0F500750000E500F57A +:1007F000F0E50035F0F500E500F5F0E50165F0F510 +:1008000001C3750000E518F5F0E50095F0F50075F9 +:100810000000E500F5F0E50035F0F500E500F5F045 +:10082000E50165F0F501750900750A00750B0075A5 +:100830000000E501F5F0E50045F0F500E509F5F00B +:10084000E50045F0F500E50AF5F0E50045F0F500B6 +:10085000E50BF5F0E50045F0F500E50070028003DA +:10086000020ACE00750B10750900750100750000B5 +:10087000C3750A00E50BF5F0E51335F0F51BE50946 +:10088000F5F0E51435F0F51CE501F5F075E04325CC +:1008900006F58275E0003507F583E0F508E50835D3 +:1008A000F0F51DE500F5F075E0422506F58275E0EE +:1008B000003507F583E0F508E50835F0F51E750904 +:1008C00004750B00750C00750D00C3750000E51074 +:1008D000F5F0E509A4F50AE510F5F0E509A4E5F061 +:1008E000F501E50AF5F0E50035F0F500E511F5F064 +:1008F000E509A4F50AE511F5F0E509A4E5F0F50927 +:10090000E50AF5F0E50135F0F501C3C3750900E529 +:1009100000F5F0E50C35F0F50CE501F5F0E50D35E9 +:10092000F0F50DC3750100E510F5F0E50BA4F50A2F +:10093000E510F5F0E50BA4E5F0F509E50AF5F0E5BD +:100940000135F0F501750000C3C3750900E500F538 +:10095000F0E50C35F0F50CE501F5F0E50D35F0F5B9 +:100960000DC3750000750100C3C3750900E500F5EE +:10097000F0E50C35F0F50CE501F5F0E50D35F0F599 +:100980000DC3750000750100C3C3750900E500F5CE +:10099000F0E50C35F0F50CE501F5F0E50D35F0F579 +:1009A0000DC3750000E50CF5F075E0412506F582F4 +:1009B00075E0003507F583E0F508E50835F0F5004A +:1009C000E50DF5F075E0402506F58275E000350788 +:1009D000F583E0F508E50835F0F50A750900C375FB +:1009E0000100E509F5F0E50035F0F509E501F5F060 +:1009F000E50A35F0F501E51BF503E501F502E5092A +:100A0000F582E502F583E503F0750901C375010080 +:100A1000E509F5F0E50035F0F509E501F5F0E50A41 +:100A200035F0F501E51CF503E501F502E509F58270 +:100A3000E502F583E503F0750902C3750100E509D8 +:100A4000F5F0E50035F0F509E501F5F0E50A35F0DA +:100A5000F501E51DF503E501F502E509F582E5027D +:100A6000F583E503F0750903C3750100E509F5F0A9 +:100A7000E50035F0F509E501F5F0E50A35F0F50199 +:100A8000E51EF503E501F502E509F582E502F583CA +:100A9000E503F0750101750900750A00750B00C3C7 +:100AA000750000E501F5F0E51035F0F510E509F504 +:100AB000F0E51135F0F511E50AF5F0E51235F0F540 +:100AC00012E50BF5F0E51535F0F5150204FC00E52F +:100AD00006F50AE507F501750900C3750000E5098B +:100AE000F5F0E50A35F0F50EE500F5F0E50135F035 +:100AF000F50F750904750B00750C00750D00C375B5 +:100B00000000E513F5F0E509A4F50AE513F5F0E5B5 +:100B100009A4E5F0F501E50AF5F0E50035F0F5008A +:100B2000E514F5F0E509A4F50AE514F5F0E509A4E6 +:100B3000E5F0F509E50AF5F0E50135F0F501C3C387 +:100B4000750900E500F5F0E50C35F0F50CE501F56B +:100B5000F0E50D35F0F50DC3750100E513F5F0E591 +:100B60000BA4F50AE513F5F0E50BA4E5F0F509E5AE +:100B70000AF5F0E50135F0F501750000C3C375090C +:100B800000E500F5F0E50C35F0F50CE501F5F0E5D4 +:100B90000D35F0F50DC3750000750100C3C375096F +:100BA00000E500F5F0E50C35F0F50CE501F5F0E5B4 +:100BB0000D35F0F50DC3750000750100C3C375094F +:100BC00000E500F5F0E50C35F0F50CE501F5F0E594 +:100BD0000D35F0F50DC3750000E50CF5F0E50E35AB +:100BE000F0F500E50DF5F0E50F35F0F50A750900B3 +:100BF000C3750100E509F5F0E50035F0F509E501FB +:100C0000F5F0E50A35F0F501E51BF503E501F50220 +:100C1000E509F582E502F583E503F0750901C37581 +:100C20000100E509F5F0E50035F0F509E501F5F01D +:100C3000E50A35F0F501E51CF503E501F502E509E6 +:100C4000F582E502F583E503F0750902C37501003D +:100C5000E509F5F0E50035F0F509E501F5F0E50AFF +:100C600035F0F501E51DF503E501F502E509F5822D +:100C7000E502F583E503F0750903C3750100E50995 +:100C8000F5F0E50035F0F509E501F5F0E50A35F098 +:100C9000F501E51EF503E501F502E509F582E5023A +:100CA000F583E503F0750101750900750A00750B00 +:100CB00000C3750000E501F5F0E51335F0F513E527 +:100CC00009F5F0E51435F0F514E50AF5F075E043A3 +:100CD0002506F58275E0003507F583E0F508E5089F +:100CE00035F0F50875E0432506F58275E000350717 +:100CF000F583E508F0E50BF5F075E0422506F58291 +:100D000075E0003507F583E0F508E50835F0F508EE +:100D100075E0422506F58275E0003507F583E508A4 +:100D2000F00201260075100075110075120075158E +:100D300000751A10751900750C00750D00E515F594 +:100D40000E750080E500F5F0E50E25F0F50EE500E6 +:100D5000F5F0E50D25F0F50D750B0075160075170E +:100D600000751800750A00750F01750001C3E50DC7 +:100D7000F5F0E50E95F0F509E50AF5F0E50A35F030 +:100D8000F509E509F5F0E50055F0F500E500F5F0A9 +:100D9000E50B45F0F50B750001C3E50DF5F0E50E2B +:100DA00095F0F509E50AF5F0E50A35F0F509E50EE7 +:100DB000F5F0E50D95F0F501E50AF5F0E50A35F0F9 +:100DC000F501E501F5F0E50945F0F509E50FF5F068 +:100DD000E50965F0F509E509F5F0E50055F0F500E0 +:100DE000C3E50CF5F0E51295F0F509E50AF5F0E537 +:100DF0000A35F0F509E509F5F0E50055F0F500E5EF +:100E000000F5F0E50B45F0F50B750001C3E50DF5B8 +:100E1000F0E50E95F0F509E50AF5F0E50A35F0F58F +:100E200009E50EF5F0E50D95F0F501E50AF5F0E5BB +:100E30000A35F0F501E501F5F0E50945F0F509E5BC +:100E40000FF5F0E50965F0F509E509F5F0E5005560 +:100E5000F0F500C3E50CF5F0E51295F0F509E50AAB +:100E6000F5F0E50A35F0F509E512F5F0E50C95F039 +:100E7000F501E50AF5F0E50A35F0F501E501F5F0D3 +:100E8000E50945F0F509E50FF5F0E50965F0F50927 +:100E9000E509F5F0E50055F0F500C3E519F5F0E5D5 +:100EA0001195F0F509E50AF5F0E50A35F0F509E5E3 +:100EB00009F5F0E50055F0F500E500F5F0E50B4526 +:100EC000F0F50B750001C3E50DF5F0E50E95F0F5B5 +:100ED00009E50AF5F0E50A35F0F509E50EF5F0E566 +:100EE0000D95F0F501E50AF5F0E50A35F0F501E5B7 +:100EF00001F5F0E50945F0F509E50FF5F0E50965BF +:100F0000F0F509E509F5F0E50055F0F500C3E50C4D +:100F1000F5F0E51295F0F509E50AF5F0E50A35F08A +:100F2000F509E512F5F0E50C95F0F501E50AF5F0A7 +:100F3000E50A35F0F501E501F5F0E50945F0F509BB +:100F4000E50FF5F0E50965F0F509E509F5F0E500CF +:100F500055F0F500C3E519F5F0E51195F0F509E553 +:100F60000AF5F0E50A35F0F509E511F5F0E5199512 +:100F7000F0F501E50AF5F0E50A35F0F501E501F5D2 +:100F8000F0E50945F0F509E50FF5F0E50965F0F53F +:100F900009E509F5F0E50055F0F500C3E51AF5F0AF +:100FA000E51095F0F509E50AF5F0E50A35F0F509E3 +:100FB000E509F5F0E50055F0F500E500F5F0E50B85 +:100FC00045F0F50B750101C3750000E50BF5F0E583 +:100FD0000095F0F500750000E500F5F0E50035F04E +:100FE000F500E500F5F0E50165F0F501C3750000D9 +:100FF000E516F5F0E50095F0F500750000E500F563 +:10100000F0E50035F0F500E500F5F0E50165F0F5F7 +:1010100001C3750000E517F5F0E50095F0F50075E2 +:101020000000E500F5F0E50035F0F500E500F5F02D +:10103000E50165F0F501C3750000E518F5F0E50080 +:1010400095F0F500750000E500F5F0E50035F0F5E8 +:1010500000E500F5F0E50165F0F501750900750A98 +:1010600000750B00750000E501F5F0E50045F0F5B1 +:1010700000E509F5F0E50045F0F500E50AF5F0E5D5 +:101080000045F0F500E50BF5F0E50045F0F500E56D +:1010900000700280030213E500750904750B0075EA +:1010A0000C00750D00C3750000E510F5F0E509A40E +:1010B000F50AE510F5F0E509A4E5F0F501E50AF516 +:1010C000F0E50035F0F500E511F5F0E509A4F50AC5 +:1010D000E511F5F0E509A4E5F0F509E50AF5F0E517 +:1010E0000135F0F501C3C3750900E500F5F0E50C25 +:1010F00035F0F50CE501F5F0E50D35F0F50DC375AE +:101100000100E510F5F0E50BA4F50AE510F5F0E5B2 +:101110000BA4E5F0F509E50AF5F0E50135F0F50178 +:10112000750000C3C3750900E500F5F0E50C35F066 +:10113000F50CE501F5F0E50D35F0F50DC375000092 +:10114000750100C3C3750900E500F5F0E50C35F045 +:10115000F50CE501F5F0E50D35F0F50DC375000072 +:10116000750100C3C3750900E500F5F0E50C35F025 +:10117000F50CE501F5F0E50D35F0F50DC375000052 +:10118000E50CF5F075E0412506F58275E0003507C0 +:10119000F583E0F508E50835F0F500E50DF5F075A7 +:1011A000E0402506F58275E0003507F583E0F50897 +:1011B000E50835F0F50AE500F509750100C375008D +:1011C00000E501F5F0E50935F0F501E500F5F0E59C +:1011D0000A35F0F500E500F502E501F582E502F5D6 +:1011E00083E0F517750101C3750000E501F5F0E531 +:1011F0000935F0F501E500F5F0E50A35F0F500E513 +:1012000000F502E501F582E502F583E0F5187501C8 +:1012100002C3750000E501F5F0E50935F0F501E5DB +:1012200000F5F0E50A35F0F500E500F502E501F519 +:1012300082E502F583E0F519750103C3750000E549 +:1012400001F5F0E50935F0F501E500F5F0E50A35C1 +:10125000F0F500E500F502E501F582E502F583E031 +:10126000F50F750A10750900750100750000C3754A +:101270000B00E50AF5F0E51335F0F50BE509F5F09F +:10128000E51435F0F50CE501F5F075E0432506F5BC +:101290008275E0003507F583E0F508E50835F0F5DF +:1012A0000DE500F5F075E0422506F58275E00035A4 +:1012B00007F583E0F508E50835F0F50E75000175D2 +:1012C0000100750900750A00C3E500F5F0E50B950E +:1012D000F0F516E501F5F0E50C95F0F50CE509F5EE +:1012E000F0E50D95F0F500E50AF5F0E50E95F0F561 +:1012F0000AE517F50BE518F50DE519F50EE516F5F8 +:1013000001E50CF509750C00C3E501F5F0E50B9559 +:10131000F0F501E501F5F0E50C45F0F50CC3E50944 +:10132000F5F0E50D95F0F501E501F5F0E50C45F07A +:10133000F50CC3E500F5F0E50E95F0F501E501F5D6 +:10134000F0E50C45F0F50CC3E50AF5F0E50F95F076 +:10135000F501E501F5F0E50C45F0F50C75010075BA +:101360000900750A00750000E50CF5F0E50045F090 +:10137000F500E501F5F0E50045F0F500E509F5F0CB +:10138000E50045F0F500E50AF5F0E50045F0F5006B +:10139000E500700280030213D50075010175090094 +:1013A000750A00750B00C3750000E501F5F0E51046 +:1013B00035F0F510E509F5F0E51135F0F511E50A20 +:1013C000F5F0E51235F0F512E50BF5F0E51535F021 +:1013D000F515020D3100751F01751E00751D007594 +:1013E0001C0002139A00751000751100751200752B +:1013F0001500751810751700750D00750E00E515B0 +:10140000F50F750080E500F5F0E50F25F0F50FE527 +:1014100000F5F0E50E25F0F50E750C00751300755E +:101420001400751600750B00750A01750001C3E5FF +:101430000EF5F0E50F95F0F509E50BF5F0E50B3548 +:10144000F0F509E509F5F0E50055F0F500E500F5E2 +:10145000F0E50C45F0F50C750001C3E50EF5F0E57F +:101460000F95F0F509E50BF5F0E50B35F0F509E51D +:101470000FF5F0E50E95F0F501E50BF5F0E50B3510 +:10148000F0F501E501F5F0E50945F0F509E50AF5A6 +:10149000F0E50965F0F509E509F5F0E50055F0F529 +:1014A00000C3E50DF5F0E51295F0F509E50BF5F053 +:1014B000E50B35F0F509E509F5F0E50055F0F50027 +:1014C000E500F5F0E50C45F0F50C750001C3E50EFF +:1014D000F5F0E50F95F0F509E50BF5F0E50B35F0C6 +:1014E000F509E50FF5F0E50E95F0F501E50BF5F0E2 +:1014F000E50B35F0F501E501F5F0E50945F0F509F5 +:10150000E50AF5F0E50965F0F509E509F5F0E5000E +:1015100055F0F500C3E50DF5F0E51295F0F509E598 +:101520000BF5F0E50B35F0F509E512F5F0E50D9555 +:10153000F0F501E50BF5F0E50B35F0F501E501F50A +:10154000F0E50945F0F509E50AF5F0E50965F0F57E +:1015500009E509F5F0E50055F0F500C3E517F5F0EC +:10156000E51195F0F509E50BF5F0E50B35F0F5091A +:10157000E509F5F0E50055F0F500E500F5F0E50CBE +:1015800045F0F50C750001C3E50EF5F0E50F95F09B +:10159000F509E50BF5F0E50B35F0F509E50FF5F08C +:1015A000E50E95F0F501E50BF5F0E50B35F0F501ED +:1015B000E501F5F0E50945F0F509E50AF5F0E5097D +:1015C00065F0F509E509F5F0E50055F0F500C3E52E +:1015D0000DF5F0E51295F0F509E50BF5F0E50B35A5 +:1015E000F0F509E512F5F0E50D95F0F501E50BF5DF +:1015F000F0E50B35F0F501E501F5F0E50945F0F50D +:1016000009E50AF5F0E50965F0F509E509F5F0E504 +:101610000055F0F500C3E517F5F0E51195F0F50973 +:10162000E50BF5F0E50B35F0F509E511F5F0E517FB +:1016300095F0F501E50BF5F0E50B35F0F501E50169 +:10164000F5F0E50945F0F509E50AF5F0E50965F07D +:10165000F509E509F5F0E50055F0F500C3E518F5E5 +:10166000F0E51095F0F509E50BF5F0E50B35F0F533 +:1016700009E509F5F0E50055F0F500E500F5F0E5C0 +:101680000C45F0F50C750101C3750000E50CF5F093 +:10169000E50095F0F500750000E500F5F0E5003592 +:1016A000F0F500E500F5F0E50165F0F501C3750022 +:1016B00000E513F5F0E50095F0F500750000E50094 +:1016C000F5F0E50035F0F500E500F5F0E50165F031 +:1016D000F501C3750000E514F5F0E50095F0F5009F +:1016E000750000E500F5F0E50035F0F500E500F5E2 +:1016F000F0E50165F0F501C3750000E516F5F0E5CC +:101700000095F0F500750000E500F5F0E50035F016 +:10171000F500E500F5F0E50165F0F50175090075E6 +:101720000A00750B00750000E501F5F0E50045F0D5 +:10173000F500E509F5F0E50045F0F500E50AF5F0FE +:10174000E50045F0F500E50BF5F0E50045F0F500A6 +:10175000E50070028003021A4000E506F50AE5077D +:10176000F501750900C3750000E509F5F0E50A35D6 +:10177000F0F50EE500F5F0E50135F0F50F7509041B +:10178000750B00750C00750D00C3750000E510F5B4 +:10179000F0E509A4F50AE510F5F0E509A4E5F0F592 +:1017A00001E50AF5F0E50035F0F500E511F5F0E5A5 +:1017B00009A4F50AE511F5F0E509A4E5F0F509E558 +:1017C0000AF5F0E50135F0F501C3C3750900E50040 +:1017D000F5F0E50C35F0F50CE501F5F0E50D35F02B +:1017E000F50DC3750100E510F5F0E50BA4F50AE56C +:1017F00010F5F0E50BA4E5F0F509E50AF5F0E501D3 +:1018000035F0F501750000C3C3750900E500F5F07A +:10181000E50C35F0F50CE501F5F0E50D35F0F50DCD +:10182000C3750000750100C3C3750900E500F5F03C +:10183000E50C35F0F50CE501F5F0E50D35F0F50DAD +:10184000C3750000750100C3C3750900E500F5F01C +:10185000E50C35F0F50CE501F5F0E50D35F0F50D8D +:10186000C3750000E50CF5F0E50E35F0F500E50D6B +:10187000F5F0E50F35F0F501E500F509E501F50AAC +:10188000750100C3750000E501F5F0E50935F0F5D7 +:1018900001E500F5F0E50A35F0F500E500F502E5B3 +:1018A00001F582E502F583E0F50B750101C37500D2 +:1018B00000E501F5F0E50935F0F501E500F5F0E5A5 +:1018C0000A35F0F500E500F502E501F582E502F5DF +:1018D00083E0F50C750102C3750000E501F5F0E544 +:1018E0000935F0F501E500F5F0E50A35F0F500E51C +:1018F00000F502E501F582E502F583E0F50D7501DD +:1019000003C3750000E501F5F0E50935F0F501E5E3 +:1019100000F5F0E50A35F0F500E500F502E501F522 +:1019200082E502F583E0F50E750F1075010075096B +:1019300000750A00C3750000E50FF5F0E51035F0FD +:10194000F500E501F5F0E51135F0F501E509F5F0F3 +:10195000E51235F0F509E50AF5F0E51535F0F50A7B +:10196000750F00C3E500F5F0E50B95F0F500E50017 +:10197000F5F0E50F45F0F50FC3E501F5F0E50C9541 +:10198000F0F500E500F5F0E50F45F0F50FC3E509CA +:10199000F5F0E50D95F0F500E500F5F0E50F45F003 +:1019A000F50FC3E50AF5F0E50E95F0F500E500F555 +:1019B000F0E50F45F0F50F750100750900750A0097 +:1019C000750000E50FF5F0E50045F0F500E501F5DF +:1019D000F0E50045F0F500E509F5F0E50045F0F526 +:1019E00000E50AF5F0E50045F0F500E5007002803D +:1019F00003021A3000750101750900750A00750BA4 +:101A000000C3750000E501F5F0E51035F0F510E5CF +:101A100009F5F0E51135F0F511E50AF5F0E51235B7 +:101A2000F0F512E50BF5F0E51535F0F5150213F2BA +:101A300000751F01751E00751D00751C000219F54B +:101A400000750000750100750900750A00E500F5D4 +:101A500002E501F503E509F504E50AF50575E04D34 +:101A60002506F58275E0003507F583E0F51775E08A +:101A70004C2506F58275E0003507F583E0F516750F +:101A8000E04B2506F58275E0003507F583E0F51596 +:101A900075E04A2506F58275E0003507F583E0F527 +:101AA0001475E0492506F58275E0003507F583E0F9 +:101AB000F51375E0482506F58275E0003507F583D6 +:101AC000E0F51275E0472506F58275E0003507F56B +:101AD00083E0F51175E0462506F58275E0003507CF +:101AE000F583E0F51075E0442506F58275E00035D4 +:101AF00007F583E0F508E508C0E075E0452506F543 +:101B00008275E0003507F583E0F508E508C0E0756B +:101B1000E0502506F50675E0003507F507E502F506 +:101B200082E503F583E504F500E505F5012200E50E +:101B300006758242C39582F506E507758300958395 +:101B4000F507D0E0F50875E0412506F58275E0005F +:101B50003507F583E508F0D0E0F50875E040250687 +:101B6000F58275E0003507F583E508F0E506F5092F +:101B7000E507F50A750100C3750000E501F5F0E51C +:101B80000935F0F501E500F5F0E50A35F0F500E579 +:101B900001F51FE500F51E1200107500007501002B +:101BA000750900750A00E500F502E501F503E50990 +:101BB000F504E50AF50575E0402506F58275E000B7 +:101BC0003507F583E0F508E508C0E075E041250636 +:101BD000F58275E0003507F583E0F508E508C0E01B +:101BE00075E0422506F50675E0003507F507E502C4 +:101BF000F582E503F583E504F500E505F50122002E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29581-1.s.expected b/tests/GCCTestSuite/pr29581-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr29581-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29581-3.c b/tests/GCCTestSuite/pr29581-3.c new file mode 100644 index 0000000..a6c8d19 --- /dev/null +++ b/tests/GCCTestSuite/pr29581-3.c @@ -0,0 +1,48 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-87.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void exit (int); + +#define N 16 + +int main1 (int n, int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + k = i + n; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < n; j++) + if (a[j] != i + n - 1) + exit(1); + + for (j = 0; j < n; j++) + if (b[j] != j + n) + exit(1); + + return 0; +} + +int main (void) +{ + int a[N] __attribute__ ((__aligned__(16))); +int tmp; + tmp=main1 (N, a); + tmp=main1 (0, a); + tmp=main1 (1, a); + tmp=main1 (2, a); + tmp=main1 (N-1, a); + + return 0; +} diff --git a/tests/GCCTestSuite/pr29581-3.c.expected b/tests/GCCTestSuite/pr29581-3.c.expected new file mode 100644 index 0000000..a6c8d19 --- /dev/null +++ b/tests/GCCTestSuite/pr29581-3.c.expected @@ -0,0 +1,48 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-87.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void exit (int); + +#define N 16 + +int main1 (int n, int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + k = i + n; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < n; j++) + if (a[j] != i + n - 1) + exit(1); + + for (j = 0; j < n; j++) + if (b[j] != j + n) + exit(1); + + return 0; +} + +int main (void) +{ + int a[N] __attribute__ ((__aligned__(16))); +int tmp; + tmp=main1 (N, a); + tmp=main1 (0, a); + tmp=main1 (1, a); + tmp=main1 (2, a); + tmp=main1 (N-1, a); + + return 0; +} diff --git a/tests/GCCTestSuite/pr29581-3.hex.expected b/tests/GCCTestSuite/pr29581-3.hex.expected new file mode 100644 index 0000000..d538336 --- /dev/null +++ b/tests/GCCTestSuite/pr29581-3.hex.expected @@ -0,0 +1,480 @@ +:1000000075812F7506FF7507FF121C1202000C0088 +:1000100000E506758256C39582F506E507758300EF +:100020009583F507D0E0F50875E0472506F582755C +:10003000E0003507F583E508F0D0E0F50875E04607 +:100040002506F58275E0003507F583E508F075E0D3 +:100050004F2506F58275E0003507F583E517F07545 +:10006000E04E2506F58275E0003507F583E516F0CC +:1000700075E04D2506F58275E0003507F583E51539 +:10008000F075E04C2506F58275E0003507F583E54F +:1000900014F075E04B2506F58275E0003507F58311 +:1000A000E513F075E04A2506F58275E0003507F5A1 +:1000B00083E512F075E0492506F58275E000350705 +:1000C000F583E511F075E0482506F58275E0003509 +:1000D00007F583E510F075E0452506F58275E0002B +:1000E0003507F583E51FF0E51EF514E51DF51375DD +:1000F000E0402506F58275E0003507F583E51CF044 +:1001000075E0422506F58275E0003507F583E51BAD +:10011000F075E0412506F58275E0003507F583E5C9 +:100120001AF075150075160075080075E04425066F +:10013000F58275E0003507F583E508F07508007570 +:10014000E0432506F58275E0003507F583E508F004 +:1001500075E0432506F58275E0003507F583E0F587 +:100160001075E0402506F58275E0003507F583E05F +:10017000F50F750080E500F5F0E51025F0F510E5C8 +:1001800000F5F0E50F25F0F50F750C00750D007505 +:100190000E00751100750B00750A01750001C3E5AD +:1001A0000FF5F0E51095F0F509E50BF5F0E50B35E9 +:1001B000F0F509E509F5F0E50055F0F500E500F585 +:1001C000F0E50C45F0F50C750001C3E50FF5F0E521 +:1001D0001095F0F509E50BF5F0E50B35F0F509E5BF +:1001E00010F5F0E50F95F0F501E50BF5F0E50B35B1 +:1001F000F0F501E501F5F0E50945F0F509E50AF549 +:10020000F0E50965F0F509E509F5F0E50055F0F5CB +:1002100000C3E513F5F075E0442506F58275E000AE +:100220003507F583E0F508E50895F0F509E50BF5E8 +:10023000F0E50B35F0F509E509F5F0E50055F0F5C9 +:1002400000E500F5F0E50C45F0F50C750001C3E59F +:100250000FF5F0E51095F0F509E50BF5F0E50B3538 +:10026000F0F509E510F5F0E50F95F0F501E50BF572 +:10027000F0E50B35F0F501E501F5F0E50945F0F5A0 +:1002800009E50AF5F0E50965F0F509E509F5F0E598 +:100290000055F0F500C3E513F5F075E0442506F5CB +:1002A0008275E0003507F583E0F508E50895F0F57F +:1002B00009E50BF5F0E50B35F0F50975E044250689 +:1002C000F58275E0003507F583E0F508E508F5F0FF +:1002D000E51395F0F501E50BF5F0E50B35F0F501CB +:1002E000E501F5F0E50945F0F509E50AF5F0E50960 +:1002F00065F0F509E509F5F0E50055F0F500C3E511 +:1003000014F5F0E51695F0F509E50BF5F0E50B357C +:10031000F0F509E509F5F0E50055F0F500E500F523 +:10032000F0E50C45F0F50C750001C3E50FF5F0E5BF +:100330001095F0F509E50BF5F0E50B35F0F509E55D +:1003400010F5F0E50F95F0F501E50BF5F0E50B354F +:10035000F0F501E501F5F0E50945F0F509E50AF5E7 +:10036000F0E50965F0F509E509F5F0E50055F0F56A +:1003700000C3E513F5F075E0442506F58275E0004D +:100380003507F583E0F508E50895F0F509E50BF587 +:10039000F0E50B35F0F50975E0442506F58275E0CA +:1003A000003507F583E0F508E508F5F0E51395F06D +:1003B000F501E50BF5F0E50B35F0F501E501F5F09C +:1003C000E50945F0F509E50AF5F0E50965F0F509F7 +:1003D000E509F5F0E50055F0F500C3E514F5F0E5A5 +:1003E0001695F0F509E50BF5F0E50B35F0F509E5A7 +:1003F00016F5F0E51495F0F501E50BF5F0E50B3594 +:10040000F0F501E501F5F0E50945F0F509E50AF536 +:10041000F0E50965F0F509E509F5F0E50055F0F5B9 +:1004200000C375E0452506F58275E0003507F583C4 +:10043000E0F508E508F5F0E51595F0F509E50BF5AB +:10044000F0E50B35F0F509E509F5F0E50055F0F5B7 +:1004500000E500F5F0E50C45F0F50C750101C375FC +:100460000000E50CF5F0E50095F0F500750000E5FD +:1004700000F5F0E50035F0F500E500F5F0E5016583 +:10048000F0F501C3750000E50DF5F0E50095F0F518 +:1004900000750000E500F5F0E50035F0F500E50039 +:1004A000F5F0E50165F0F501C3750000E50EF5F026 +:1004B000E50095F0F500750000E500F5F0E5003584 +:1004C000F0F500E500F5F0E50165F0F501C3750014 +:1004D00000E511F5F0E50095F0F500750000E50088 +:1004E000F5F0E50035F0F500E500F5F0E50165F023 +:1004F000F501750900750A00750B00750000E5012E +:10050000F5F0E50045F0F500E509F5F0E50045F00A +:10051000F500E50AF5F0E50045F0F500E50BF5F02E +:10052000E50045F0F500E50070028003020D9C0037 +:10053000751000751100751200751700E517F50D9F +:1005400075E0402506F58275E0003507F583E0F596 +:100550000C750080E500F5F0E50D25F0F50DE500E2 +:10056000F5F0E50C25F0F50C750B00750F0075180E +:1005700000751900750A00750E01750001C3E50CC0 +:10058000F5F0E50D95F0F509E50AF5F0E50A35F029 +:10059000F509E509F5F0E50055F0F500E500F5F0A1 +:1005A000E50B45F0F50B750001C3E50CF5F0E50D25 +:1005B00095F0F509E50AF5F0E50A35F0F509E50DE0 +:1005C000F5F0E50C95F0F501E50AF5F0E50A35F0F2 +:1005D000F501E501F5F0E50945F0F509E50EF5F061 +:1005E000E50965F0F509E509F5F0E50055F0F500D8 +:1005F000C3E513F5F0E51295F0F509E50AF5F0E528 +:100600000A35F0F509E509F5F0E50055F0F500E5E6 +:1006100000F5F0E50B45F0F50B750001C3E50CF5B1 +:10062000F0E50D95F0F509E50AF5F0E50A35F0F588 +:1006300009E50DF5F0E50C95F0F501E50AF5F0E5B5 +:100640000A35F0F501E501F5F0E50945F0F509E5B4 +:100650000EF5F0E50965F0F509E509F5F0E5005559 +:10066000F0F500C3E513F5F0E51295F0F509E50A9C +:10067000F5F0E50A35F0F509E512F5F0E51395F02A +:10068000F501E50AF5F0E50A35F0F501E501F5F0CB +:10069000E50945F0F509E50EF5F0E50965F0F50920 +:1006A000E509F5F0E50055F0F500C3E514F5F0E5D2 +:1006B0001195F0F509E50AF5F0E50A35F0F509E5DB +:1006C00009F5F0E50055F0F500E500F5F0E50B451E +:1006D000F0F50B750001C3E50CF5F0E50D95F0F5AF +:1006E00009E50AF5F0E50A35F0F509E50DF5F0E55F +:1006F0000C95F0F501E50AF5F0E50A35F0F501E5B0 +:1007000001F5F0E50945F0F509E50EF5F0E50965B7 +:10071000F0F509E509F5F0E50055F0F500C3E5133E +:10072000F5F0E51295F0F509E50AF5F0E50A35F082 +:10073000F509E512F5F0E51395F0F501E50AF5F098 +:10074000E50A35F0F501E501F5F0E50945F0F509B3 +:10075000E50EF5F0E50965F0F509E509F5F0E500C8 +:1007600055F0F500C3E514F5F0E51195F0F509E550 +:100770000AF5F0E50A35F0F509E511F5F0E514950F +:10078000F0F501E50AF5F0E50A35F0F501E501F5CA +:10079000F0E50945F0F509E50EF5F0E50965F0F538 +:1007A00009E509F5F0E50055F0F500C375E04525CC +:1007B00006F58275E0003507F583E0F508E508F5F4 +:1007C000F0E51095F0F509E50AF5F0E50A35F0F5E4 +:1007D00009E509F5F0E50055F0F500E500F5F0E56F +:1007E0000B45F0F50BE50FF500E518F501E519F5FA +:1007F0000C750A01C3750900E50BF5F0E50995F0E4 +:10080000F509750900E509F5F0E50935F0F509E5A3 +:1008100009F5F0E50A65F0F50AC3750900E500F58C +:10082000F0E50995F0F509750900E509F5F0E50928 +:1008300035F0F509E509F5F0E50A65F0F50AC37547 +:100840000900E501F5F0E50995F0F509750900E500 +:1008500009F5F0E50935F0F509E509F5F0E50A6572 +:10086000F0F50AC3750900E50CF5F0E50995F0F51A +:1008700009750900E509F5F0E50935F0F509E5091F +:10088000F5F0E50A65F0F50A750100750900750BCC +:1008900000750000E50AF5F0E50045F0F500E5011A +:1008A000F5F0E50045F0F500E509F5F0E50045F067 +:1008B000F500E50BF5F0E50045F0F500E500700208 +:1008C0008003020B4600C375000075E0452506F560 +:1008D0008275E0003507F583E0F508E508F5F0E5F9 +:1008E0001535F0F51AE514F5F0E51635F0F51BE5CC +:1008F00013F5F075E0442506F58275E0003507F53F +:1009000083E0F508E50835F0F51C75E0402506F5AF +:100910008275E0003507F583E0F508E508F5F07528 +:10092000E0432506F58275E0003507F583E0F5081C +:10093000E50835F0F51D750904750B00750C00759B +:100940000D00C3750000E510F5F0E509A4F50AE512 +:1009500010F5F0E509A4E5F0F501E50AF5F0E5008C +:1009600035F0F500E511F5F0E509A4F50AE511F516 +:10097000F0E509A4E5F0F509E50AF5F0E50135F043 +:10098000F501C3C3750900E500F5F0E50C35F0F598 +:100990000CE501F5F0E50D35F0F50DC3750100E549 +:1009A00010F5F0E50BA4F50AE510F5F0E50BA4E56C +:1009B000F0F509E50AF5F0E50135F0F501750000FF +:1009C000C3C3750900E500F5F0E50C35F0F50CE55D +:1009D00001F5F0E50D35F0F50DC37500007501006A +:1009E000C3C3750900E500F5F0E50C35F0F50CE53D +:1009F00001F5F0E50D35F0F50DC37500007501004A +:100A0000C3C3750900E500F5F0E50C35F0F50CE51C +:100A100001F5F0E50D35F0F50DC3750000E50CF5B9 +:100A2000F075E0422506F58275E0003507F583E0B4 +:100A3000F508E50835F0F500E50DF5F075E0412520 +:100A400006F58275E0003507F583E0F508E5083521 +:100A5000F0F50A750100C3750900E501F5F0E50040 +:100A600035F0F501E509F5F0E50A35F0F509E51A87 +:100A7000F503E509F502E501F582E502F583E503F5 +:100A8000F0750101C3750900E501F5F0E50035F0E9 +:100A9000F501E509F5F0E50A35F0F509E51BF50383 +:100AA000E509F502E501F582E502F583E503F07558 +:100AB0000102C3750900E501F5F0E50035F0F50127 +:100AC000E509F5F0E50A35F0F509E51CF503E5095A +:100AD000F502E501F582E502F583E503F075010312 +:100AE000C3750900E501F5F0E50035F0F501E5090C +:100AF000F5F0E50A35F0F509E51DF503E509F50220 +:100B0000E501F582E502F583E503F0750001750165 +:100B100000750900750A00C3750B00E500F5F0E5E6 +:100B20001035F0F510E501F5F0E51135F0F511E5BA +:100B300009F5F0E51235F0F512E50AF5F0E517359F +:100B4000F0F51702053C00E506F50AE507F5017525 +:100B50000900C3750000E509F5F0E50A35F0F50E6A +:100B6000E500F5F0E50135F0F50F750904750B00AA +:100B7000750C00750D00C3750000E515F5F0E5096D +:100B8000A4F50AE515F5F0E509A4E5F0F501E50A97 +:100B9000F5F0E50035F0F500E516F5F0E509A4F50A +:100BA0000AE516F5F0E509A4E5F0F509E50AF5F022 +:100BB000E50135F0F501C3C3750900E500F5F0E581 +:100BC0000C35F0F50CE501F5F0E50D35F0F50DC34C +:100BD000750100E515F5F0E50BA4F50AE515F5F04E +:100BE000E50BA4E5F0F509E50AF5F0E50135F0F5CA +:100BF00001750000C3C3750900E500F5F0E50C358B +:100C0000F0F50CE501F5F0E50D35F0F50DC37500D7 +:100C100000750100C3C3750900E500F5F0E50C356A +:100C2000F0F50CE501F5F0E50D35F0F50DC37500B7 +:100C300000750100C3C3750900E500F5F0E50C354A +:100C4000F0F50CE501F5F0E50D35F0F50DC3750097 +:100C500000E50CF5F0E50E35F0F500E50DF5F0E5F5 +:100C60000F35F0F50A750900C3750100E509F5F0C7 +:100C7000E50035F0F509E501F5F0E50A35F0F50197 +:100C8000E51AF503E501F502E509F582E502F583CC +:100C9000E503F0750901C3750100E509F5F0E5000C +:100CA00035F0F509E501F5F0E50A35F0F501E51B4C +:100CB000F503E501F502E509F582E502F583E503B3 +:100CC000F0750902C3750100E509F5F0E50035F09E +:100CD000F509E501F5F0E50A35F0F501E51CF50348 +:100CE000E501F502E509F582E502F583E503F07516 +:100CF0000903C3750100E509F5F0E50035F0F509D4 +:100D0000E501F5F0E50A35F0F501E51DF503E5012E +:100D1000F502E509F582E502F583E503F0750101C9 +:100D2000750900750A00750B00C3750000E501F533 +:100D3000F0E51535F0F515E509F5F0E51635F0F5B2 +:100D400016E50AF5F075E0442506F58275E00035F4 +:100D500007F583E0F508E50835F0F50875E044256A +:100D600006F58275E0003507F583E508F0E50BF53B +:100D7000F075E0432506F58275E0003507F583E060 +:100D8000F508E50835F0F50875E0432506F58275A8 +:100D9000E0003507F583E508F0020150007510000A +:100DA000751100751200751700E517F50D75E04017 +:100DB0002506F58275E0003507F583E0F50C750032 +:100DC00080E500F5F0E50D25F0F50DE500F5F0E521 +:100DD0000C25F0F50C750B00750F007518007519D2 +:100DE00000750A00750E01750001C3E50CF5F0E50C +:100DF0000D95F0F509E50AF5F0E50A35F0F509E598 +:100E000009F5F0E50055F0F500E500F5F0E50B45D6 +:100E1000F0F50B750001C3E50CF5F0E50D95F0F567 +:100E200009E50AF5F0E50A35F0F509E50DF5F0E517 +:100E30000C95F0F501E50AF5F0E50A35F0F501E568 +:100E400001F5F0E50945F0F509E50EF5F0E5096570 +:100E5000F0F509E509F5F0E50055F0F500C3E513F7 +:100E6000F5F0E51295F0F509E50AF5F0E50A35F03B +:100E7000F509E509F5F0E50055F0F500E500F5F0B8 +:100E8000E50B45F0F50B750001C3E50CF5F0E50D3C +:100E900095F0F509E50AF5F0E50A35F0F509E50DF7 +:100EA000F5F0E50C95F0F501E50AF5F0E50A35F009 +:100EB000F501E501F5F0E50945F0F509E50EF5F078 +:100EC000E50965F0F509E509F5F0E50055F0F500EF +:100ED000C3E513F5F0E51295F0F509E50AF5F0E53F +:100EE0000A35F0F509E512F5F0E51395F0F501E5A1 +:100EF0000AF5F0E50A35F0F501E501F5F0E50945FB +:100F0000F0F509E50EF5F0E50965F0F509E509F5F7 +:100F1000F0E50055F0F500C3E514F5F0E51195F0A6 +:100F2000F509E50AF5F0E50A35F0F509E509F5F00A +:100F3000E50055F0F500E500F5F0E50B45F0F50BA3 +:100F4000750001C3E50CF5F0E50D95F0F509E50A2E +:100F5000F5F0E50A35F0F509E50DF5F0E50C95F04D +:100F6000F501E50AF5F0E50A35F0F501E501F5F0E2 +:100F7000E50945F0F509E50EF5F0E50965F0F50937 +:100F8000E509F5F0E50055F0F500C3E513F5F0E5EA +:100F90001295F0F509E50AF5F0E50A35F0F509E5F1 +:100FA00012F5F0E51395F0F501E50AF5F0E50A35DF +:100FB000F0F501E501F5F0E50945F0F509E50EF577 +:100FC000F0E50965F0F509E509F5F0E50055F0F5FE +:100FD00000C3E514F5F0E51195F0F509E50AF5F023 +:100FE000E50A35F0F509E511F5F0E51495F0F501A0 +:100FF000E50AF5F0E50A35F0F501E501F5F0E5095A +:1010000045F0F509E50EF5F0E50965F0F509E509A6 +:10101000F5F0E50055F0F500C375E0452506F582CD +:1010200075E0003507F583E0F508E508F5F0E51013 +:1010300095F0F509E50AF5F0E50A35F0F509E50959 +:10104000F5F0E50055F0F500E500F5F0E50B45F0AD +:10105000F50BE50FF500E518F501E519F50C750A36 +:1010600001C3750900E50BF5F0E50995F0F5097583 +:101070000900E509F5F0E50935F0F509E509F5F0B0 +:10108000E50A65F0F50AC3750900E500F5F0E50924 +:1010900095F0F509750900E509F5F0E50935F0F574 +:1010A00009E509F5F0E50A65F0F50AC3750900E5FB +:1010B00001F5F0E50995F0F509750900E509F5F088 +:1010C000E50935F0F509E509F5F0E50A65F0F50AF9 +:1010D000C3750900E50CF5F0E50995F0F50975090A +:1010E00000E509F5F0E50935F0F509E509F5F0E564 +:1010F0000A65F0F50A750100750900750B007500A9 +:1011000000E50AF5F0E50045F0F500E501F5F0E54C +:101110000045F0F500E509F5F0E50045F0F500E5DE +:101120000BF5F0E50045F0F500E5007002800302E4 +:10113000149900750904750B00750C00750D00C33A +:10114000750000E510F5F0E509A4F50AE510F5F0E5 +:10115000E509A4E5F0F501E50AF5F0E50035F0F55F +:1011600000E511F5F0E509A4F50AE511F5F0E5094A +:10117000A4E5F0F509E50AF5F0E50135F0F501C360 +:10118000C3750900E500F5F0E50C35F0F50CE50157 +:10119000F5F0E50D35F0F50DC3750100E510F5F03E +:1011A000E50BA4F50AE510F5F0E50BA4E5F0F5096B +:1011B000E50AF5F0E50135F0F501750000C3C375EA +:1011C0000900E500F5F0E50C35F0F50CE501F5F06A +:1011D000E50D35F0F50DC3750000750100C3C3754D +:1011E0000900E500F5F0E50C35F0F50CE501F5F04A +:1011F000E50D35F0F50DC3750000750100C3C3752D +:101200000900E500F5F0E50C35F0F50CE501F5F029 +:10121000E50D35F0F50DC3750000E50CF5F075E052 +:10122000422506F58275E0003507F583E0F508E50F +:101230000835F0F500E50DF5F075E0412506F5827D +:1012400075E0003507F583E0F508E50835F0F50AA7 +:10125000E500F509750000C3750100E500F5F0E54E +:101260000935F0F500E501F5F0E50A35F0F501E5A1 +:1012700001F502E500F582E502F583E0F50F750062 +:1012800001C3750100E500F5F0E50935F0F500E56D +:1012900001F5F0E50A35F0F501E501F502E500F5A7 +:1012A00082E502F583E0F519750002C3750100E5DA +:1012B00000F5F0E50935F0F500E501F5F0E50A3552 +:1012C000F0F501E501F502E500F582E502F583E0C0 +:1012D000F51A750003C3750100E500F5F0E5093561 +:1012E000F0F500E501F5F0E50A35F0F501E501F569 +:1012F00002E500F582E502F583E0F518C37500000C +:1013000075E0452506F58275E0003507F583E0F5C3 +:1013100008E508F5F0E51535F0F50AE514F5F0E512 +:101320001635F0F50BE513F5F075E0442506F5826A +:1013300075E0003507F583E0F508E50835F0F50CB4 +:1013400075E0402506F58275E0003507F583E0F588 +:1013500008E508F5F075E0432506F58275E00035EF +:1013600007F583E0F508E50835F0F50E7500017521 +:101370000100750900750D00C3E500F5F0E50A955B +:10138000F0F50AE501F5F0E50B95F0F501E509F555 +:10139000F0E50C95F0F509E50DF5F0E50E95F0F5A5 +:1013A00000E50FF50DE519F50EE51AF50FE50AF55F +:1013B0000BE501F50CE509F50A750900C3E50BF528 +:1013C000F0E50D95F0F501E501F5F0E50945F0F5DD +:1013D00009C3E50CF5F0E50E95F0F501E501F5F032 +:1013E000E50945F0F509C3E50AF5F0E50F95F0F5D7 +:1013F00001E501F5F0E50945F0F509C3E500F5F073 +:10140000E51895F0F501E501F5F0E50945F0F50978 +:10141000750100750A00750B00750000E509F5F00F +:10142000E50045F0F500E501F5F0E50045F0F500D3 +:10143000E50AF5F0E50045F0F500E50BF5F0E5000F +:1014400045F0F500E5007002800302148900750084 +:1014500001750100750900750A00C3750B00E500F0 +:10146000F5F0E51035F0F510E501F5F0E51135F092 +:10147000F511E509F5F0E51235F0F512E50AF5F09C +:10148000E51735F0F517020DA900751F01751E004F +:10149000751D00751C0002144E00751000751100BA +:1014A000751200751700E517F50E75E0402506F575 +:1014B0008275E0003507F583E0F50D750080E500E5 +:1014C000F5F0E50E25F0F50EE500F5F0E50D25F05B +:1014D000F50D750C00750F00751500751600750B70 +:1014E00000750A01750001C3E50DF5F0E50E95F0F4 +:1014F000F509E50BF5F0E50B35F0F509E509F5F033 +:10150000E50055F0F500E500F5F0E50C45F0F50CCB +:10151000750001C3E50DF5F0E50E95F0F509E50B55 +:10152000F5F0E50B35F0F509E50EF5F0E50D95F074 +:10153000F501E50BF5F0E50B35F0F501E501F5F00A +:10154000E50945F0F509E50AF5F0E50965F0F50965 +:10155000E509F5F0E50055F0F500C3E513F5F0E514 +:101560001295F0F509E50BF5F0E50B35F0F509E519 +:1015700009F5F0E50055F0F500E500F5F0E50C455E +:10158000F0F50C750001C3E50DF5F0E50E95F0F5ED +:1015900009E50BF5F0E50B35F0F509E50EF5F0E59D +:1015A0000D95F0F501E50BF5F0E50B35F0F501E5EE +:1015B00001F5F0E50945F0F509E50AF5F0E50965FD +:1015C000F0F509E509F5F0E50055F0F500C3E51380 +:1015D000F5F0E51295F0F509E50BF5F0E50B35F0C2 +:1015E000F509E512F5F0E51395F0F501E50BF5F0D9 +:1015F000E50B35F0F501E501F5F0E50945F0F509F4 +:10160000E50AF5F0E50965F0F509E509F5F0E5000D +:1016100055F0F500C3E514F5F0E51195F0F509E591 +:101620000BF5F0E50B35F0F509E509F5F0E50055AA +:10163000F0F500E500F5F0E50C45F0F50C7500015E +:10164000C3E50DF5F0E50E95F0F509E50BF5F0E5D0 +:101650000B35F0F509E50EF5F0E50D95F0F501E532 +:101660000BF5F0E50B35F0F501E501F5F0E5094581 +:10167000F0F509E50AF5F0E50965F0F509E509F584 +:10168000F0E50055F0F500C3E513F5F0E51295F02F +:10169000F509E50BF5F0E50B35F0F509E512F5F088 +:1016A000E51395F0F501E50BF5F0E50B35F0F501E7 +:1016B000E501F5F0E50945F0F509E50AF5F0E5097C +:1016C00065F0F509E509F5F0E50055F0F500C3E52D +:1016D00014F5F0E51195F0F509E50BF5F0E50B359E +:1016E000F0F509E511F5F0E51495F0F501E50BF5D8 +:1016F000F0E50B35F0F501E501F5F0E50945F0F50C +:1017000009E50AF5F0E50965F0F509E509F5F0E503 +:101710000055F0F500C375E0452506F58275E0003B +:101720003507F583E0F508E508F5F0E51095F0F5E7 +:1017300009E50BF5F0E50B35F0F509E509F5F0E500 +:101740000055F0F500E500F5F0E50C45F0F50C75F9 +:101750000101C3750000E50CF5F0E50095F0F5001A +:10176000750000E500F5F0E50035F0F500E500F561 +:10177000F0E50165F0F501C3750000E50FF5F0E552 +:101780000095F0F500750000E500F5F0E50035F096 +:10179000F500E500F5F0E50165F0F501C375000021 +:1017A000E515F5F0E50095F0F500750000E500F5AC +:1017B000F0E50035F0F500E500F5F0E50165F0F540 +:1017C00001C3750000E516F5F0E50095F0F500752C +:1017D0000000E500F5F0E50035F0F500E500F5F076 +:1017E000E50165F0F501750900750A00750B0075D6 +:1017F0000000E501F5F0E50045F0F500E509F5F03C +:10180000E50045F0F500E50AF5F0E50045F0F500E6 +:10181000E50BF5F0E50045F0F500E500700280030A +:10182000021B2400E506F50AE507F501750900C36A +:10183000750000E509F5F0E50A35F0F50EE500F56F +:10184000F0E50135F0F50F750904750B00750C0016 +:10185000750D00C3750000E510F5F0E509A4F50A63 +:10186000E510F5F0E509A4E5F0F501E50AF5F0E588 +:101870000035F0F500E511F5F0E509A4F50AE511EC +:10188000F5F0E509A4E5F0F509E50AF5F0E501351F +:10189000F0F501C3C3750900E500F5F0E50C35F07E +:1018A000F50CE501F5F0E50D35F0F50DC37501001A +:1018B000E510F5F0E50BA4F50AE510F5F0E50BA44D +:1018C000E5F0F509E50AF5F0E50135F0F5017500FB +:1018D00000C3C3750900E500F5F0E50C35F0F50C23 +:1018E000E501F5F0E50D35F0F50DC3750000750166 +:1018F00000C3C3750900E500F5F0E50C35F0F50C03 +:10190000E501F5F0E50D35F0F50DC3750000750145 +:1019100000C3C3750900E500F5F0E50C35F0F50CE2 +:10192000E501F5F0E50D35F0F50DC3750000E50CAA +:10193000F5F0E50E35F0F500E50DF5F0E50F35F0C5 +:10194000F501E500F509E501F50A750100C375002B +:1019500000E501F5F0E50935F0F501E500F5F0E504 +:101960000A35F0F500E500F502E501F582E502F53E +:1019700083E0F50B750101C3750000E501F5F0E5A5 +:101980000935F0F501E500F5F0E50A35F0F500E57B +:1019900000F502E501F582E502F583E0F50D75013C +:1019A00002C3750000E501F5F0E50935F0F501E544 +:1019B00000F5F0E50A35F0F500E500F502E501F582 +:1019C00082E502F583E0F50F750103C3750000E5BC +:1019D00001F5F0E50935F0F501E500F5F0E50A352A +:1019E000F0F500E500F502E501F582E502F583E09A +:1019F000F50CC375000075E0452506F58275E0001D +:101A00003507F583E0F508E508F5F0E51035F0F564 +:101A100000E514F5F0E51135F0F501E513F5F0E515 +:101A20001235F0F50975E0402506F58275E00035C0 +:101A300007F583E0F508E508F5F0E51735F0F50A58 +:101A4000E50DF50E750D00C3E500F5F0E50B95F01D +:101A5000F500E500F5F0E50D45F0F50DC3E501F500 +:101A6000F0E50E95F0F500E500F5F0E50D45F0F533 +:101A70000DC3E509F5F0E50F95F0F500E500F5F08B +:101A8000E50D45F0F50DC3E50AF5F0E50C95F0F52B +:101A900000E500F5F0E50D45F0F50D75010075095F +:101AA00000750A00750000E50DF5F0E50045F0F55C +:101AB00000E501F5F0E50045F0F500E509F5F0E594 +:101AC0000045F0F500E50AF5F0E50045F0F500E524 +:101AD0000070028003021B14007501017509007576 +:101AE0000A00750B00C3750000E501F5F0E510353F +:101AF000F0F510E509F5F0E51135F0F511E50AF519 +:101B0000F0E51235F0F512E50BF5F0E51735F0F5D7 +:101B1000170214A600751F01751E00751D00751CA7 +:101B200000021AD900750000750100750900750AD8 +:101B300000E500F502E501F503E509F504E50AF520 +:101B40000575E04F2506F58275E0003507F583E061 +:101B5000F51775E04E2506F58275E0003507F5832B +:101B6000E0F51675E04D2506F58275E0003507F5C0 +:101B700083E0F51575E04C2506F58275E000350724 +:101B8000F583E0F51475E04B2506F58275E0003528 +:101B900007F583E0F51375E04A2506F58275E00048 +:101BA0003507F583E0F51275E0492506F58275E005 +:101BB000003507F583E0F51175E0482506F58275D7 +:101BC000E0003507F583E0F51075E0462506F5825F +:101BD00075E0003507F583E0F508E508C0E075E03D +:101BE000472506F58275E0003507F583E0F508E541 +:101BF00008C0E075E0562506F50675E0003507F5E6 +:101C000007E502F582E503F583E504F500E505F552 +:101C1000012200E506758242C39582F506E5077547 +:101C200083009583F507D0E0F50875E0412506F5BA +:101C30008275E0003507F583E508F0D0E0F508751A +:101C4000E0402506F58275E0003507F583E508F0EC +:101C5000751F10751E00751D00751C00E506F50A40 +:101C6000E507F501750900C3750000E509F5F0E524 +:101C70000A35F0F51BE500F5F0E50135F0F51A122F +:101C80000010751F00751E00751D00751C00E5060F +:101C9000F50AE507F501750900C3750000E509F5CA +:101CA000F0E50A35F0F51BE500F5F0E50135F0F556 +:101CB0001A120010751F01751E00751D00751C009D +:101CC000E506F50AE507F501750900C3750000E5AD +:101CD00009F5F0E50A35F0F51BE500F5F0E501350D +:101CE000F0F51A120010751F02751E00751D0075A3 +:101CF0001C00E506F50AE507F501750900C3750046 +:101D000000E509F5F0E50A35F0F51BE500F5F0E52D +:101D10000135F0F51A120010750E10750C00750AD9 +:101D200000750100750D01750B0075090075000047 +:101D3000C3E50DF5F0E50E95F0F51FE50BF5F0E5C3 +:101D40000C95F0F51EE509F5F0E50A95F0F51DE5B1 +:101D500000F5F0E50195F0F51CE506F50AE507F557 +:101D600001750900C3750000E509F5F0E50A35F0D5 +:101D7000F51BE500F5F0E50135F0F51A12001075D8 +:101D80000000750100750900750A00E500F502E51F +:101D900001F503E509F504E50AF50575E0402506BA +:101DA000F58275E0003507F583E0F508E508C0E049 +:101DB00075E0412506F58275E0003507F583E0F50D +:101DC00008E508C0E075E0422506F50675E0003537 +:101DD00007F507E502F582E503F583E504F500E57F +:101DE00005F50122000000000000000000000000D6 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29581-3.s.expected b/tests/GCCTestSuite/pr29581-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr29581-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29637.c b/tests/GCCTestSuite/pr29637.c new file mode 100644 index 0000000..5dfee41 --- /dev/null +++ b/tests/GCCTestSuite/pr29637.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/29637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +typedef struct __attribute__ ((aligned (8))) +{ + short a, b, c, d; +} A; + +typedef struct +{ + A a[24]; +} B; + +static const A b = { 0, 0, 1, -1 }; + +void +foo (B *x) +{ + int i; + for (i = 0; i <= 20; i += 4) + x->a[i] = b; +} diff --git a/tests/GCCTestSuite/pr29637.c.expected b/tests/GCCTestSuite/pr29637.c.expected new file mode 100644 index 0000000..5dfee41 --- /dev/null +++ b/tests/GCCTestSuite/pr29637.c.expected @@ -0,0 +1,23 @@ +/* PR tree-optimization/29637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +typedef struct __attribute__ ((aligned (8))) +{ + short a, b, c, d; +} A; + +typedef struct +{ + A a[24]; +} B; + +static const A b = { 0, 0, 1, -1 }; + +void +foo (B *x) +{ + int i; + for (i = 0; i <= 20; i += 4) + x->a[i] = b; +} diff --git a/tests/GCCTestSuite/pr29637.hex.expected b/tests/GCCTestSuite/pr29637.hex.expected new file mode 100644 index 0000000..e7bf5ea --- /dev/null +++ b/tests/GCCTestSuite/pr29637.hex.expected @@ -0,0 +1,247 @@ +:1000000000E506758209C39582F506E5077583004C +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5173C +:10004000F51BE516F51CE515F51D75E0062506F50D +:100050008275E0003507F583E514F075E0052506A7 +:10006000F58275E0003507F583E513F075E00425AA +:1000700006F58275E0003507F583E512F075E003BB +:100080002506F58275E0003507F583E511F075E08A +:10009000022506F58275E0003507F583E510F0E5E9 +:1000A0001FF51AE51EF5197511007512007513007C +:1000B000751400751814751700750F00751000E59C +:1000C00014F50E750080E500F5F0E51025F0F5104B +:1000D000E500F5F0E50E25F0F50E750B00750C004A +:1000E000751600750D00750A00751501750001C3C0 +:1000F000E50EF5F0E51095F0F509E50AF5F0E50AED +:1001000035F0F509E509F5F0E50055F0F500E500F5 +:10011000F5F0E50B45F0F50B750001C3E50EF5F0C4 +:10012000E51095F0F509E50AF5F0E50A35F0F50971 +:10013000E510F5F0E50E95F0F501E50AF5F0E50AB4 +:1001400035F0F501E501F5F0E50945F0F509E515AE +:10015000F5F0E50965F0F509E509F5F0E50055F07C +:10016000F500C3E513F5F0E50F95F0F509E50AF59F +:10017000F0E50A35F0F509E509F5F0E50055F0F58B +:1001800000E500F5F0E50B45F0F50B750001C3E562 +:100190000EF5F0E51095F0F509E50AF5F0E50A35FC +:1001A000F0F509E510F5F0E50E95F0F501E50AF535 +:1001B000F0E50A35F0F501E501F5F0E50945F0F562 +:1001C00009E515F5F0E50965F0F509E509F5F0E54E +:1001D0000055F0F500C3E513F5F0E50F95F0F509CE +:1001E000E50AF5F0E50A35F0F509E50FF5F0E51358 +:1001F00095F0F501E50AF5F0E50A35F0F501E501C0 +:10020000F5F0E50945F0F509E515F5F0E50965F0C6 +:10021000F509E509F5F0E50055F0F500C3E512F53F +:10022000F0E51795F0F509E50AF5F0E50A35F0F582 +:1002300009E509F5F0E50055F0F500E500F5F0E514 +:100240000B45F0F50B750001C3E50EF5F0E51095D3 +:10025000F0F509E50AF5F0E50A35F0F509E510F5E0 +:10026000F0E50E95F0F501E50AF5F0E50A35F0F553 +:1002700001E501F5F0E50945F0F509E515F5F0E5CD +:100280000965F0F509E509F5F0E50055F0F500C35D +:10029000E513F5F0E50F95F0F509E50AF5F0E50A47 +:1002A00035F0F509E50FF5F0E51395F0F501E50AF0 +:1002B000F5F0E50A35F0F501E501F5F0E50945F061 +:1002C000F509E515F5F0E50965F0F509E509F5F03D +:1002D000E50055F0F500C3E512F5F0E51795F0F5EA +:1002E00009E50AF5F0E50A35F0F509E517F5F0E559 +:1002F0001295F0F501E50AF5F0E50A35F0F501E5AE +:1003000001F5F0E50945F0F509E515F5F0E50965B4 +:10031000F0F509E509F5F0E50055F0F500C3E51144 +:10032000F5F0E51895F0F509E50AF5F0E50A35F080 +:10033000F509E509F5F0E50055F0F500E500F5F003 +:10034000E50B45F0F50BE50BF500E516F501750B32 +:1003500001C3750900E500F5F0E50995F0F50975AB +:100360000900E509F5F0E50935F0F509E509F5F0CD +:10037000E50B65F0F50BC3750900E50CF5F0E50933 +:1003800095F0F509750900E509F5F0E50935F0F591 +:1003900009E509F5F0E50B65F0F50BC3750900E516 +:1003A00001F5F0E50995F0F509750900E509F5F0A5 +:1003B000E50935F0F509E509F5F0E50B65F0F50B14 +:1003C000C3750900E50DF5F0E50995F0F509750926 +:1003D00000E509F5F0E50935F0F509E509F5F0E581 +:1003E0000B65F0F50B750C00751600750D00E50C2E +:1003F000F500E516F501E50DF509750C01C3750A63 +:1004000000E50BF5F0E50A95F0F50A750A00E50A36 +:10041000F5F0E50A35F0F50AE50AF5F0E50C65F0CA +:10042000F50CC3750A00E500F5F0E50A95F0F50A4C +:10043000750A00E50AF5F0E50A35F0F50AE50AF572 +:10044000F0E50C65F0F50CC3750A00E501F5F0E583 +:100450000A95F0F50A750A00E50AF5F0E50A35F0A7 +:10046000F50AE50AF5F0E50C65F0F50CC3750A0030 +:10047000E509F5F0E50A95F0F50A750A00E50AF5D3 +:10048000F0E50A35F0F50AE50AF5F0E50C65F0F55A +:100490000C750100750900750A00750000E50CF582 +:1004A000F0E50045F0F500E501F5F0E50045F0F573 +:1004B00000E509F5F0E50045F0F500E50AF5F0E5A1 +:1004C0000045F0F500E50070028003020EA2007501 +:1004D0000100C3750000E501F5F0E51A35F0F509F6 +:1004E000E500F5F0E51935F0F50A750100C3750072 +:1004F00000E501F5F0E50935F0F501E500F5F0E579 +:100500000A35F0F500E500F502E501F582E502F5B2 +:1005100083E0F50E750101C3750000E501F5F0E516 +:100520000935F0F501E500F5F0E50A35F0F500E5EF +:1005300000F502E501F582E502F583E0F50F7509A6 +:1005400008750B00750C00750D00C3750000E511F2 +:10055000F5F0E509A4F50AE511F5F0E509A4E5F0E3 +:10056000F501E50AF5F0E50035F0F500E512F5F0E6 +:10057000E509A4F50AE512F5F0E509A4E5F0F509A9 +:10058000E50AF5F0E50135F0F501C3C3750900E5AD +:1005900000F5F0E50C35F0F50CE501F5F0E50D356D +:1005A000F0F50DC3750100E511F5F0E50BA4F50AB2 +:1005B000E511F5F0E50BA4E5F0F509E50AF5F0E540 +:1005C0000135F0F501750000C3C3750900E500F5BC +:1005D000F0E50C35F0F50CE501F5F0E50D35F0F53D +:1005E0000DC3750000750100C3C3750900E500F572 +:1005F000F0E50C35F0F50CE501F5F0E50D35F0F51D +:100600000DC3750000750100C3C3750900E500F551 +:10061000F0E50C35F0F50CE501F5F0E50D35F0F5FC +:100620000DC3750000E50CF5F0E50E35F0F500E5BD +:100630000DF5F0E50F35F0F509750A00C3750100F9 +:10064000E50AF5F0E50035F0F50CE501F5F0E50912 +:1006500035F0F50D900000E582F509900000E58386 +:10066000F50A750100C3750000E501F5F0E50935EF +:10067000F0F501E500F5F0E50A35F0F500E501F5E6 +:1006800009E500F50A750100C3750000E501F5F004 +:10069000E50935F0F501E500F5F0E50A35F0F5007E +:1006A000E500F502E501F582E502F583E0F50B755D +:1006B0000101C3750000E501F5F0E50935F0F5012C +:1006C000E500F5F0E50A35F0F500E500F502E50195 +:1006D000F582E502F583E0F509750100C3750000B8 +:1006E000E501F5F0E50C35F0F501E500F5F0E50D77 +:1006F00035F0F500E50BF503E500F502E501F582BF +:10070000E502F583E503F0750101C3750000E5011D +:10071000F5F0E50C35F0F501E500F5F0E50D35F007 +:10072000F500E509F503E500F502E501F582E502CE +:10073000F583E503F0750100C3750000E501F5F0F0 +:10074000E51A35F0F509E500F5F0E51935F0F50A9B +:10075000750100C3750000E501F5F0E50935F0F518 +:1007600001E500F5F0E50A35F0F500E500F502E5F4 +:1007700001F582E502F583E0F50E750101C3750010 +:1007800000E501F5F0E50935F0F501E500F5F0E5E6 +:100790000A35F0F500E500F502E501F582E502F520 +:1007A00083E0F50F750908750B00750C00750D00D9 +:1007B000C3750000E511F5F0E509A4F50AE511F5AA +:1007C000F0E509A4E5F0F501E50AF5F0E50035F0FE +:1007D000F500E512F5F0E509A4F50AE512F5F0E5F6 +:1007E00009A4E5F0F509E50AF5F0E50135F0F501B4 +:1007F000C3C3750900E500F5F0E50C35F0F50CE52F +:1008000001F5F0E50D35F0F50DC3750100E511F5C5 +:10081000F0E50BA4F50AE511F5F0E50BA4E5F0F51C +:1008200009E50AF5F0E50135F0F501750000C3C3EF +:10083000750900E500F5F0E50C35F0F50CE501F57E +:10084000F0E50D35F0F50DC3750000750100C3C36B +:10085000750900E500F5F0E50C35F0F50CE501F55E +:10086000F0E50D35F0F50DC3750000750100C3C34B +:10087000750900E500F5F0E50C35F0F50CE501F53E +:10088000F0E50D35F0F50DC3750000E50CF5F0E56C +:100890000E35F0F500E50DF5F0E50F35F0F50975CD +:1008A0000A02C3750100E50AF5F0E50035F0F50C24 +:1008B000E501F5F0E50935F0F50D900000E582F56C +:1008C00009900000E583F50A750102C3750000E593 +:1008D00001F5F0E50935F0F501E500F5F0E50A353B +:1008E000F0F500E501F509E500F50A750100C375AD +:1008F0000000E501F5F0E50935F0F501E500F5F05A +:10090000E50A35F0F500E500F502E501F582E502BE +:10091000F583E0F50B750101C3750000E501F5F005 +:10092000E50935F0F501E500F5F0E50A35F0F500EB +:10093000E500F502E501F582E502F583E0F50975CC +:100940000100C3750000E501F5F0E50C35F0F50197 +:10095000E500F5F0E50D35F0F500E50BF503E500F4 +:10096000F502E501F582E502F583E503F075010185 +:10097000C3750000E501F5F0E50C35F0F501E50083 +:10098000F5F0E50D35F0F500E509F503E500F502B4 +:10099000E501F582E502F583E503F0750100C37515 +:1009A0000000E501F5F0E51A35F0F509E500F5F090 +:1009B000E51935F0F50A750100C3750000E501F58C +:1009C000F0E50935F0F501E500F5F0E50A35F0F55B +:1009D00000E500F502E501F582E502F583E0F50E9C +:1009E000750101C3750000E501F5F0E50935F0F585 +:1009F00001E500F5F0E50A35F0F500E500F502E562 +:100A000001F582E502F583E0F50F750908750B0025 +:100A1000750C00750D00C3750000E511F5F0E509D2 +:100A2000A4F50AE511F5F0E509A4E5F0F501E50AFC +:100A3000F5F0E50035F0F500E512F5F0E509A4F56F +:100A40000AE512F5F0E509A4E5F0F509E50AF5F087 +:100A5000E50135F0F501C3C3750900E500F5F0E5E2 +:100A60000C35F0F50CE501F5F0E50D35F0F50DC3AD +:100A7000750100E511F5F0E50BA4F50AE511F5F0B7 +:100A8000E50BA4E5F0F509E50AF5F0E50135F0F52B +:100A900001750000C3C3750900E500F5F0E50C35EC +:100AA000F0F50CE501F5F0E50D35F0F50DC3750039 +:100AB00000750100C3C3750900E500F5F0E50C35CC +:100AC000F0F50CE501F5F0E50D35F0F50DC3750019 +:100AD00000750100C3C3750900E500F5F0E50C35AC +:100AE000F0F50CE501F5F0E50D35F0F50DC37500F9 +:100AF00000E50CF5F0E50E35F0F500E50DF5F0E557 +:100B00000F35F0F509750A04C3750100E50AF5F023 +:100B1000E50035F0F50CE501F5F0E50935F0F50DEA +:100B2000900000E582F509900000E583F50A750163 +:100B300004C3750000E501F5F0E50935F0F501E5C0 +:100B400000F5F0E50A35F0F500E501F509E500F5F9 +:100B50000A750100C3750000E501F5F0E50935F0FF +:100B6000F501E500F5F0E50A35F0F500E500F502E0 +:100B7000E501F582E502F583E0F50B750101C3752A +:100B80000000E501F5F0E50935F0F501E500F5F0C7 +:100B9000E50A35F0F500E500F502E501F582E5022C +:100BA000F583E0F509750100C3750000E501F5F076 +:100BB000E50C35F0F501E500F5F0E50D35F0F50053 +:100BC000E50BF503E500F502E501F582E502F583A5 +:100BD000E503F0750101C3750000E501F5F0E50CD2 +:100BE00035F0F501E500F5F0E50D35F0F500E50926 +:100BF000F503E500F502E501F582E502F583E5037D +:100C0000F0750100C3750000E501F5F0E51A35F057 +:100C1000F509E500F5F0E51935F0F50A750100C3B1 +:100C2000750000E501F5F0E50935F0F501E500F5A1 +:100C3000F0E50A35F0F500E500F502E501F582E59D +:100C400002F583E0F50E750101C3750000E501F5BD +:100C5000F0E50935F0F501E500F5F0E50A35F0F5C8 +:100C600000E500F502E501F582E502F583E0F50F08 +:100C7000750908750B00750C00750D00C375000033 +:100C8000E511F5F0E509A4F50AE511F5F0E509A48B +:100C9000E5F0F501E50AF5F0E50035F0F500E512BF +:100CA000F5F0E509A4F50AE512F5F0E509A4E5F08B +:100CB000F509E50AF5F0E50135F0F501C3C375095D +:100CC00000E500F5F0E50C35F0F50CE501F5F0E593 +:100CD0000D35F0F50DC3750100E511F5F0E50BA438 +:100CE000F50AE511F5F0E50BA4E5F0F509E50AF5DF +:100CF000F0E50135F0F501750000C3C3750900E5A5 +:100D000000F5F0E50C35F0F50CE501F5F0E50D35F5 +:100D1000F0F50DC3750000750100C3C3750900E54A +:100D200000F5F0E50C35F0F50CE501F5F0E50D35D5 +:100D3000F0F50DC3750000750100C3C3750900E52A +:100D400000F5F0E50C35F0F50CE501F5F0E50D35B5 +:100D5000F0F50DC3750000E50CF5F0E50E35F0F586 +:100D600000E50DF5F0E50F35F0F509750A06C375D8 +:100D70000100E50AF5F0E50035F0F50CE501F5F0C8 +:100D8000E50935F0F50D900000E582F509900000C9 +:100D9000E583F50A750106C3750000E501F5F0E588 +:100DA0000935F0F501E500F5F0E50A35F0F500E567 +:100DB00001F509E500F50A750100C3750000E501BC +:100DC000F5F0E50935F0F501E500F5F0E50A35F057 +:100DD000F500E500F502E501F582E502F583E0F5B1 +:100DE0000B750101C3750000E501F5F0E50935F06B +:100DF000F501E500F5F0E50A35F0F500E500F5024E +:100E0000E501F582E502F583E0F509750100C3759A +:100E10000000E501F5F0E50C35F0F501E500F5F031 +:100E2000E50D35F0F500E50BF503E500F502E5010C +:100E3000F582E502F583E503F0750101C375000055 +:100E4000E501F5F0E50C35F0F501E500F5F0E50D0F +:100E500035F0F500E509F503E500F502E501F58259 +:100E6000E502F583E503F0750104750900750A00D4 +:100E7000750B00C3750000E501F5F0E51135F0F5DF +:100E800011E509F5F0E51235F0F512E50AF5F0E5A2 +:100E90001335F0F513E50BF5F0E51435F0F5140214 +:100EA00000B300750000E500F502E500F503E5007C +:100EB000F504E500F505E51BF517E51CF516E51D40 +:100EC000F51575E0062506F58275E0003507F58312 +:100ED000E0F51475E0052506F58275E0003507F5A7 +:100EE00083E0F51375E0042506F58275E00035070B +:100EF000F583E0F51275E0032506F58275E000350F +:100F000007F583E0F51175E0022506F58275E0002E +:100F10003507F583E0F51075E0002506F58275E0EC +:100F2000003507F583E0F508E508C0E075E0012528 +:100F300006F58275E0003507F583E0F508E508C0A1 +:100F4000E075E0092506F50675E0003507F507E5CB +:100F500002F582E503F583E504F500E505F50122D8 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29637.s.expected b/tests/GCCTestSuite/pr29637.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr29637.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29736.c b/tests/GCCTestSuite/pr29736.c new file mode 100644 index 0000000..54eb9aa --- /dev/null +++ b/tests/GCCTestSuite/pr29736.c @@ -0,0 +1,13 @@ +/* PR c/29736 */ + +int __attribute__ ((vector_size (8), vector_size (8))) v; /* { dg-error "invalid vector type" } */ + +extern int __attribute__ ((vector_size (8))) w; +int __attribute__ ((vector_size (8))) w; + +void +foo () +{ + v = v + v; + w = w + w; +} diff --git a/tests/GCCTestSuite/pr29736.c.expected b/tests/GCCTestSuite/pr29736.c.expected new file mode 100644 index 0000000..54eb9aa --- /dev/null +++ b/tests/GCCTestSuite/pr29736.c.expected @@ -0,0 +1,13 @@ +/* PR c/29736 */ + +int __attribute__ ((vector_size (8), vector_size (8))) v; /* { dg-error "invalid vector type" } */ + +extern int __attribute__ ((vector_size (8))) w; +int __attribute__ ((vector_size (8))) w; + +void +foo () +{ + v = v + v; + w = w + w; +} diff --git a/tests/GCCTestSuite/pr29736.hex.expected b/tests/GCCTestSuite/pr29736.hex.expected new file mode 100644 index 0000000..792f614 --- /dev/null +++ b/tests/GCCTestSuite/pr29736.hex.expected @@ -0,0 +1,83 @@ +:1000000000D0E0F51CD0E0F51DE513F518E512F57C +:1000100019E511F51AE510F51B900000E582F512BF +:10002000900000E583F513900000E582F50990004B +:1000300000E583F50A750100C3750000E501F5F0E0 +:10004000E50935F0F501E500F5F0E50A35F0F500D4 +:10005000E500F502E501F582E502F583E0F50E75B0 +:100060000101C3750000E501F5F0E50935F0F50182 +:10007000E500F5F0E50A35F0F500E500F502E501EB +:10008000F582E502F583E0F50F750102C375000006 +:10009000E501F5F0E50935F0F501E500F5F0E50AD3 +:1000A00035F0F500E500F502E501F582E502F5839E +:1000B000E0F510750103C3750000E501F5F0E509F1 +:1000C00035F0F501E500F5F0E50A35F0F500E5005D +:1000D000F502E501F582E502F583E0F511900000F7 +:1000E000E582F509900000E583F50A750100C37506 +:1000F0000000E501F5F0E50935F0F501E500F5F062 +:10010000E50A35F0F500E500F502E501F582E502C6 +:10011000F583E0F50B750101C3750000E501F5F00D +:10012000E50935F0F501E500F5F0E50A35F0F500F3 +:10013000E500F502E501F582E502F583E0F50C75D1 +:100140000102C3750000E501F5F0E50935F0F501A0 +:10015000E500F5F0E50A35F0F500E500F502E5010A +:10016000F582E502F583E0F50D750103C375000026 +:10017000E501F5F0E50935F0F501E500F5F0E50AF2 +:1001800035F0F500E500F502E501F582E502F583BD +:10019000E0F501C3750000E50BF5F0E50E35F0F56F +:1001A00000E50CF5F0E50F35F0F509E50DF5F0E5A6 +:1001B0001035F0F50AE501F5F0E51135F0F50C75AF +:1001C0000B00C3750100E50BF5F0E51235F0F50BFA +:1001D000E501F5F0E51335F0F501E500F503E5017E +:1001E000F502E50BF582E502F583E503F0750B01F9 +:1001F000C3750000E50BF5F0E51235F0F50BE500F1 +:10020000F5F0E51335F0F501E509F503E501F50233 +:10021000E50BF582E502F583E503F0750B02C37586 +:100220000000E50BF5F0E51235F0F50BE500F5F013 +:10023000E51335F0F501E50AF503E501F502E50BF7 +:10024000F582E502F583E503F0750B03C375000045 +:10025000E50BF5F0E51235F0F50BE500F5F0E513EB +:1002600035F0F501E50CF503E501F502E50BF58246 +:10027000E502F583E503F0900004E582F5129000B5 +:1002800004E583F513900004E582F509900004E588 +:1002900083F50A750100C3750000E501F5F0E50975 +:1002A00035F0F501E500F5F0E50A35F0F500E5007B +:1002B000F502E501F582E502F583E0F50E75010131 +:1002C000C3750000E501F5F0E50935F0F501E5003D +:1002D000F5F0E50A35F0F500E500F502E501F582F7 +:1002E000E502F583E0F50F750102C3750000E50135 +:1002F000F5F0E50935F0F501E500F5F0E50A35F032 +:10030000F500E500F502E501F582E502F583E0F58B +:1003100010750103C3750000E501F5F0E50935F03E +:10032000F501E500F5F0E50A35F0F500E500F50228 +:10033000E501F582E502F583E0F511900004E58220 +:10034000F509900004E583F50A750100C375000006 +:10035000E501F5F0E50935F0F501E500F5F0E50A10 +:1003600035F0F500E500F502E501F582E502F583DB +:10037000E0F50B750101C3750000E501F5F0E50935 +:1003800035F0F501E500F5F0E50A35F0F500E5009A +:10039000F502E501F582E502F583E0F50C75010251 +:1003A000C3750000E501F5F0E50935F0F501E5005C +:1003B000F5F0E50A35F0F500E500F502E501F58216 +:1003C000E502F583E0F50D750103C3750000E50155 +:1003D000F5F0E50935F0F501E500F5F0E50A35F051 +:1003E000F500E500F502E501F582E502F583E0F5AB +:1003F00001C3750000E50BF5F0E50E35F0F500E5FD +:100400000CF5F0E50F35F0F509E50DF5F0E51035E3 +:10041000F0F50AE501F5F0E51135F0F50C750B0086 +:10042000C3750100E50BF5F0E51235F0F50BE501BC +:10043000F5F0E51335F0F501E500F503E501F5020A +:10044000E50BF582E502F583E503F0750B01C37555 +:100450000000E50BF5F0E51235F0F50BE500F5F0E1 +:10046000E51335F0F501E509F503E501F502E50BC6 +:10047000F582E502F583E503F0750B02C375000014 +:10048000E50BF5F0E51235F0F50BE500F5F0E513B9 +:1004900035F0F501E50AF503E501F502E50BF58216 +:1004A000E502F583E503F0750B03C3750000E50B6A +:1004B000F5F0E51235F0F50BE500F5F0E51335F054 +:1004C000F501E50CF503E501F502E50BF582E50222 +:1004D000F583E503F0750000E500F502E500F5039E +:1004E000E500F504E500F505E518F513E519F51245 +:1004F000E51AF511E51BF510E51DC0E0E51CC0E0AF +:10050000E502F582E503F583E504F500E505F5016F +:1005100022000000000000000000000000000000B9 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr29736.s.expected b/tests/GCCTestSuite/pr29736.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr29736.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr3074-1.c b/tests/GCCTestSuite/pr3074-1.c new file mode 100644 index 0000000..c2258d5 --- /dev/null +++ b/tests/GCCTestSuite/pr3074-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/3074 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +void foo() +{ + int a; + 5 * (a == 1) | (a == 2); /* { dg-warning "no effect" "no effect" } */ +} + diff --git a/tests/GCCTestSuite/pr3074-1.c.expected b/tests/GCCTestSuite/pr3074-1.c.expected new file mode 100644 index 0000000..c2258d5 --- /dev/null +++ b/tests/GCCTestSuite/pr3074-1.c.expected @@ -0,0 +1,10 @@ +/* PR middle-end/3074 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +void foo() +{ + int a; + 5 * (a == 1) | (a == 2); /* { dg-warning "no effect" "no effect" } */ +} + diff --git a/tests/GCCTestSuite/pr3074-1.hex.expected b/tests/GCCTestSuite/pr3074-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/pr3074-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr3074-1.s.expected b/tests/GCCTestSuite/pr3074-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr3074-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pr32450.c b/tests/GCCTestSuite/pr32450.c new file mode 100644 index 0000000..7261a3e --- /dev/null +++ b/tests/GCCTestSuite/pr32450.c @@ -0,0 +1,33 @@ +/* Contributed by Joost VandeVondele */ + +/* { dg-do run } */ +/* { dg-require-profiling "-pg" } */ +/* { dg-options "-O2 -pg" } */ +/* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ + +extern void abort (void); + +int stack_pointer=0; + +void +__attribute__((noinline)) +mystop () +{ + abort (); +} + +void +__attribute__((noinline)) +add () +{ + if (stack_pointer + 1 > 10) + mystop (); + + stack_pointer = stack_pointer + 1; +} + +int main () +{ + add (); + return stack_pointer - 1; +} diff --git a/tests/GCCTestSuite/pr32450.c.expected b/tests/GCCTestSuite/pr32450.c.expected new file mode 100644 index 0000000..7261a3e --- /dev/null +++ b/tests/GCCTestSuite/pr32450.c.expected @@ -0,0 +1,33 @@ +/* Contributed by Joost VandeVondele */ + +/* { dg-do run } */ +/* { dg-require-profiling "-pg" } */ +/* { dg-options "-O2 -pg" } */ +/* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ + +extern void abort (void); + +int stack_pointer=0; + +void +__attribute__((noinline)) +mystop () +{ + abort (); +} + +void +__attribute__((noinline)) +add () +{ + if (stack_pointer + 1 > 10) + mystop (); + + stack_pointer = stack_pointer + 1; +} + +int main () +{ + add (); + return stack_pointer - 1; +} diff --git a/tests/GCCTestSuite/pr32450.hex.expected b/tests/GCCTestSuite/pr32450.hex.expected new file mode 100644 index 0000000..0e82a6f --- /dev/null +++ b/tests/GCCTestSuite/pr32450.hex.expected @@ -0,0 +1,165 @@ +:1000000075812F7506FF7507FF1207C102000C00EE +:1000100000E506758202C39582F506E50775830043 +:100020009583F507D0E0F50875E0012506F58275A2 +:10003000E0003507F583E508F0D0E0F50875E0004D +:100040002506F58275E0003507F583E508F07500B3 +:1000500000E500F502E500F503E500F504E500F52F +:100060000575E0002506F58275E0003507F583E0AB +:10007000F508E508C0E075E0012506F58275E000A9 +:100080003507F583E0F508E508C0E075E0022506D0 +:10009000F50675E0003507F507E502F582E503F59D +:1000A00083E504F500E505F5012200E50675820A01 +:1000B000C39582F506E5077583009583F507D0E0C3 +:1000C000F50875E0012506F58275E0003507F58332 +:1000D000E508F0D0E0F50875E0002506F58275E04A +:1000E000003507F583E508F075E0092506F582750A +:1000F000E0003507F583E517F075E0082506F58281 +:1001000075E0003507F583E516F075E0072506F57F +:100110008275E0003507F583E515F075E0062506E4 +:10012000F58275E0003507F583E514F075E00525E7 +:1001300006F58275E0003507F583E513F075E004F8 +:100140002506F58275E0003507F583E512F075E0C8 +:10015000032506F58275E0003507F583E511F07596 +:10016000E0022506F58275E0003507F583E510F01D +:10017000900000E582F509900000E583F50B75011C +:1001800000C3750000E501F5F0E50935F0F501E57E +:1001900000F5F0E50B35F0F500E500F502E501F5B9 +:1001A00082E502F583E0F50F750101C3750000E5F6 +:1001B00001F5F0E50935F0F501E500F5F0E50B3561 +:1001C000F0F500E500F502E501F582E502F583E0D2 +:1001D000F50C750102C3750000E501F5F0E5093580 +:1001E000F0F501E500F5F0E50B35F0F500E500F57B +:1001F00002E501F582E502F583E0F50A750103C326 +:10020000750000E501F5F0E50935F0F501E500F5CB +:10021000F0E50B35F0F500E500F502E501F582E5C6 +:1002200002F583E0F501750E01750B007509007587 +:100230000000C3750D00E50EF5F0E50F35F0F5167D +:10024000E50BF5F0E50C35F0F50EE509F5F0E50AFE +:1002500035F0F50FE500F5F0E50135F0F51075170F +:100260000A751100751200751300750080E500F520 +:10027000F0E51325F0F513E500F5F0E51025F0F5B0 +:1002800010750C00750D00751400751500750B00C8 +:10029000750A01750001C3E510F5F0E51395F0F559 +:1002A00009E50BF5F0E50B35F0F509E509F5F0E5A5 +:1002B0000055F0F500E500F5F0E50C45F0F50C759E +:1002C0000001C3E510F5F0E51395F0F509E50BF530 +:1002D000F0E50B35F0F509E513F5F0E51095F0F5CF +:1002E00001E50BF5F0E50B35F0F501E501F5F0E57D +:1002F0000945F0F509E50AF5F0E50965F0F509E5C8 +:1003000009F5F0E50055F0F500C3E50FF5F0E5124D +:1003100095F0F509E50BF5F0E50B35F0F509E50984 +:10032000F5F0E50055F0F500E500F5F0E50C45F0D9 +:10033000F50C750001C3E510F5F0E51395F0F5092E +:10034000E50BF5F0E50B35F0F509E513F5F0E510F3 +:1003500095F0F501E50BF5F0E50B35F0F501E5015C +:10036000F5F0E50945F0F509E50AF5F0E50965F070 +:10037000F509E509F5F0E50055F0F500C3E50FF5E1 +:10038000F0E51295F0F509E50BF5F0E50B35F0F524 +:1003900009E512F5F0E50F95F0F501E50BF5F0E54F +:1003A0000B35F0F501E501F5F0E50945F0F509E556 +:1003B0000AF5F0E50965F0F509E509F5F0E5005500 +:1003C000F0F500C3E50EF5F0E51195F0F509E50B44 +:1003D000F5F0E50B35F0F509E509F5F0E50055F028 +:1003E000F500E500F5F0E50C45F0F50C750001C3EE +:1003F000E510F5F0E51395F0F509E50BF5F0E50BE3 +:1004000035F0F509E513F5F0E51095F0F501E50B8C +:10041000F5F0E50B35F0F501E501F5F0E50945F0FE +:10042000F509E50AF5F0E50965F0F509E509F5F0E6 +:10043000E50055F0F500C3E50FF5F0E51295F0F590 +:1004400009E50BF5F0E50B35F0F509E512F5F0E5FA +:100450000F95F0F501E50BF5F0E50B35F0F501E54D +:1004600001F5F0E50945F0F509E50AF5F0E509655E +:10047000F0F509E509F5F0E50055F0F500C3E50EE6 +:10048000F5F0E51195F0F509E50BF5F0E50B35F024 +:10049000F509E511F5F0E50E95F0F501E50BF5F040 +:1004A000E50B35F0F501E501F5F0E50945F0F50955 +:1004B000E50AF5F0E50965F0F509E509F5F0E5006F +:1004C00055F0F500C3E516F5F0E51795F0F509E5EB +:1004D0000BF5F0E50B35F0F509E509F5F0E500550C +:1004E000F0F500E500F5F0E50C45F0F50C750000C1 +:1004F000E50CF5F0E50045F0F500E50DF5F0E5005B +:1005000045F0F500E514F5F0E50045F0F500E515DA +:10051000F5F0E50045F0F500E50070028003020704 +:10052000BA00900000E582F510900000E583F51117 +:10053000900000E582F509900000E583F50A750159 +:1005400000C3750000E501F5F0E50935F0F501E5BA +:1005500000F5F0E50A35F0F500E500F502E501F5F6 +:1005600082E502F583E0F50C750101C3750000E535 +:1005700001F5F0E50935F0F501E500F5F0E50A359E +:10058000F0F500E500F502E501F582E502F583E00E +:10059000F50D750102C3750000E501F5F0E50935BB +:1005A000F0F501E500F5F0E50A35F0F500E500F5B8 +:1005B00002E501F582E502F583E0F50E750103C35E +:1005C000750000E501F5F0E50935F0F501E500F508 +:1005D000F0E50A35F0F500E500F502E501F582E504 +:1005E00002F583E0F50F750101750900750A0075C4 +:1005F0000B00C3750000E501F5F0E50C35F0F500E2 +:10060000E509F5F0E50D35F0F501E50AF5F0E50E43 +:1006100035F0F509E50BF5F0E50F35F0F50C750B48 +:1006200000C3750A00E50BF5F0E51035F0F50BE5B4 +:100630000AF5F0E51135F0F50AE500F503E50AF5F0 +:1006400002E50BF582E502F583E503F0750B01C3C6 +:10065000750000E50BF5F0E51035F0F50BE500F55C +:10066000F0E51135F0F50AE501F503E50AF502E5D7 +:100670000BF582E502F583E503F0750B02C3750007 +:1006800000E50BF5F0E51035F0F50BE500F5F0E5CC +:100690001135F0F50AE509F503E50AF502E50BF574 +:1006A00082E502F583E503F0750B03C3750000E5F1 +:1006B0000BF5F0E51035F0F50BE500F5F0E511353B +:1006C000F0F50AE50CF503E50AF502E50BF582E520 +:1006D00002F583E503F0750000E500F502E500F59D +:1006E00003E500F504E500F50575E0092506F5824A +:1006F00075E0003507F583E0F51775E0082506F588 +:100700008275E0003507F583E0F51675E0072506EC +:10071000F58275E0003507F583E0F51575E00625EF +:1007200006F58275E0003507F583E0F51475E00500 +:100730002506F58275E0003507F583E0F51375E0D1 +:10074000042506F58275E0003507F583E0F512759E +:10075000E0032506F58275E0003507F583E0F51125 +:1007600075E0022506F58275E0003507F583E0F5B2 +:100770001075E0002506F58275E0003507F583E089 +:10078000F508E508C0E075E0012506F58275E00092 +:100790003507F583E0F508E508C0E075E00A2506B1 +:1007A000F50675E0003507F507E502F582E503F586 +:1007B00083E504F500E505F50122001200100205AD +:1007C0002200E506758202C39582F506E50775836A +:1007D000009583F507D0E0F50875E0012506F58260 +:1007E00075E0003507F583E508F0D0E0F50875E021 +:1007F000002506F58275E0003507F583E508F090E1 +:100800000000E582F50A900000E583F50175090016 +:10081000C3750000E509F5F0E50A35F0F50DE500D2 +:10082000F5F0E50135F0F50E750900750A00750B58 +:1008300000750C00750100C3750000E501F5F0E5D9 +:100840000D35F0F501E500F5F0E50E35F0F500E5C4 +:1008500009F503E500F502E501F582E502F583E51A +:1008600003F0750101C3750000E501F5F0E50D35F4 +:10087000F0F501E500F5F0E50E35F0F500E50AF5D7 +:1008800003E500F502E501F582E502F583E503F0F5 +:10089000750102C3750000E501F5F0E50D35F0F5D1 +:1008A00001E500F5F0E50E35F0F500E50BF503E5A3 +:1008B00000F502E501F582E502F583E503F0750137 +:1008C00003C3750000E501F5F0E50D35F0F501E530 +:1008D00000F5F0E50E35F0F500E50CF503E500F563 +:1008E00002E501F582E502F583E503F01200AA9026 +:1008F0000000E582F509900000E583F50A75010026 +:10090000C3750000E501F5F0E50935F0F501E500F6 +:10091000F5F0E50A35F0F500E500F502E501F582B0 +:10092000E502F583E0F50B750101C3750000E501F3 +:10093000F5F0E50935F0F501E500F5F0E50A35F0EB +:10094000F500E500F502E501F582E502F583E0F545 +:100950000C750102C3750000E501F5F0E50935F0FD +:10096000F501E500F5F0E50A35F0F500E500F502E2 +:10097000E501F582E502F583E0F50D750103C37528 +:100980000000E501F5F0E50935F0F501E500F5F0C9 +:10099000E50A35F0F500E500F502E501F582E5022E +:1009A000F583E0F50E750001750100750900750A03 +:1009B00000C3E500F5F0E50B95F0F500E501F5F075 +:1009C000E50C95F0F501E509F5F0E50D95F0F50973 +:1009D000E50AF5F0E50E95F0F50AE500F502E5010A +:1009E000F503E509F504E50AF50575E0002506F5CA +:1009F0008275E0003507F583E0F508E508C0E0758D +:100A0000E0012506F58275E0003507F583E0F5087D +:100A1000E508C0E075E0022506F50675E00035073B +:100A2000F507E502F582E503F583E504F500E50544 +:100A3000F50122000000000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pr32450.s.expected b/tests/GCCTestSuite/pr32450.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pr32450.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-ep-2.c b/tests/GCCTestSuite/pragma-ep-2.c new file mode 100644 index 0000000..6e5c467 --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-2.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target *-*-osf5* } } */ + +#pragma extern_prefix /* { dg-warning "malformed" } */ +#pragma extern_prefix foo /* { dg-warning "malformed" } */ +#pragma extern_prefix "foo" 1 /* { dg-warning "junk" } */ + +int bar; /* silence `ISO C forbids an empty source file' warning */ diff --git a/tests/GCCTestSuite/pragma-ep-2.c.expected b/tests/GCCTestSuite/pragma-ep-2.c.expected new file mode 100644 index 0000000..6e5c467 --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-2.c.expected @@ -0,0 +1,7 @@ +/* { dg-do compile { target *-*-osf5* } } */ + +#pragma extern_prefix /* { dg-warning "malformed" } */ +#pragma extern_prefix foo /* { dg-warning "malformed" } */ +#pragma extern_prefix "foo" 1 /* { dg-warning "junk" } */ + +int bar; /* silence `ISO C forbids an empty source file' warning */ diff --git a/tests/GCCTestSuite/pragma-ep-2.hex.expected b/tests/GCCTestSuite/pragma-ep-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-ep-2.s.expected b/tests/GCCTestSuite/pragma-ep-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-ep-3.c b/tests/GCCTestSuite/pragma-ep-3.c new file mode 100644 index 0000000..a3e1e6e --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-3.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target alpha*-*-osf5* } } */ +/* { dg-final { scan-assembler ",Xfoo" } } */ + +#pragma extern_prefix "X" +void foo(void) __attribute__((noreturn)); +void foo(void) __attribute__((noreturn)); +void bar() +{ + foo(); +} diff --git a/tests/GCCTestSuite/pragma-ep-3.c.expected b/tests/GCCTestSuite/pragma-ep-3.c.expected new file mode 100644 index 0000000..a3e1e6e --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-3.c.expected @@ -0,0 +1,10 @@ +/* { dg-do compile { target alpha*-*-osf5* } } */ +/* { dg-final { scan-assembler ",Xfoo" } } */ + +#pragma extern_prefix "X" +void foo(void) __attribute__((noreturn)); +void foo(void) __attribute__((noreturn)); +void bar() +{ + foo(); +} diff --git a/tests/GCCTestSuite/pragma-ep-3.hex.expected b/tests/GCCTestSuite/pragma-ep-3.hex.expected new file mode 100644 index 0000000..0680eba --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-3.hex.expected @@ -0,0 +1,11 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040000000E500F502E500F503E500F504E50034 +:10005000F50575E0002506F58275E0003507F583A6 +:10006000E0F508E508C0E075E0012506F58275E0D9 +:10007000003507F583E0F508E508C0E075E00225E6 +:1000800006F50675E0003507F507E502F582E5039C +:10009000F583E504F500E505F50122000000000008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-ep-3.s.expected b/tests/GCCTestSuite/pragma-ep-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pragma-ep-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-isr-trap_exit.c b/tests/GCCTestSuite/pragma-isr-trap_exit.c new file mode 100644 index 0000000..9b3233a --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr-trap_exit.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target sh-*-* sh[1234ble]*-*-*} } */ +/* { dg-options "-O" } */ +/* This test case will check whether trapa is generated only for isr. */ +#pragma interrupt +void isr() __attribute__ ((trap_exit (4))); +void isr() +{ +} +void delay(int a) +{ +} +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-times "trapa\[ \t\]\[ \t\]*#4" 1} } */ diff --git a/tests/GCCTestSuite/pragma-isr-trap_exit.c.expected b/tests/GCCTestSuite/pragma-isr-trap_exit.c.expected new file mode 100644 index 0000000..9b3233a --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr-trap_exit.c.expected @@ -0,0 +1,17 @@ +/* { dg-do compile { target sh-*-* sh[1234ble]*-*-*} } */ +/* { dg-options "-O" } */ +/* This test case will check whether trapa is generated only for isr. */ +#pragma interrupt +void isr() __attribute__ ((trap_exit (4))); +void isr() +{ +} +void delay(int a) +{ +} +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-times "trapa\[ \t\]\[ \t\]*#4" 1} } */ diff --git a/tests/GCCTestSuite/pragma-isr-trap_exit.hex.expected b/tests/GCCTestSuite/pragma-isr-trap_exit.hex.expected new file mode 100644 index 0000000..bc6b9e7 --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr-trap_exit.hex.expected @@ -0,0 +1,15 @@ +:1000000075812F7506FF7507FF12009A02000C001C +:10001000D0E0F500D0E0F501750900E509F502E54D +:1000200009F503E509F504E509F505E501C0E0E595 +:1000300000C0E0E502F582E503F583E504F500E59F +:1000400005F5012200E506758204C39582F506E5F3 +:10005000077583009583F507D0E0F500D0E0F50142 +:10006000750900E509F502E509F503E509F504E57B +:1000700009F505E501C0E0E500C0E075E0042506EE +:10008000F50675E0003507F507E502F582E503F5AD +:1000900083E504F500E505F5012200D0E0F500D088 +:1000A000E0F501750900750A00750B00750C00E597 +:1000B00009F502E50AF503E50BF504E50CF505E5A0 +:1000C00001C0E0E500C0E0E502F582E503F583E567 +:1000D00004F500E505F50122000000000000000025 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-isr-trap_exit.s.expected b/tests/GCCTestSuite/pragma-isr-trap_exit.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr-trap_exit.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-isr2.c b/tests/GCCTestSuite/pragma-isr2.c new file mode 100644 index 0000000..7dba7f9 --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr2.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target h8300-*-* sh-*-* sh[1234ble]*-*-*} } */ +/* { dg-options "-O" } */ +/* This test case will check whether rte is generated only for isr. */ +#pragma interrupt +void isr() +{ +} +void delay(int a) +{ +} +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-times "rte" 1} } */ diff --git a/tests/GCCTestSuite/pragma-isr2.c.expected b/tests/GCCTestSuite/pragma-isr2.c.expected new file mode 100644 index 0000000..7dba7f9 --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr2.c.expected @@ -0,0 +1,16 @@ +/* { dg-do compile { target h8300-*-* sh-*-* sh[1234ble]*-*-*} } */ +/* { dg-options "-O" } */ +/* This test case will check whether rte is generated only for isr. */ +#pragma interrupt +void isr() +{ +} +void delay(int a) +{ +} +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler-times "rte" 1} } */ diff --git a/tests/GCCTestSuite/pragma-isr2.hex.expected b/tests/GCCTestSuite/pragma-isr2.hex.expected new file mode 100644 index 0000000..bc6b9e7 --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr2.hex.expected @@ -0,0 +1,15 @@ +:1000000075812F7506FF7507FF12009A02000C001C +:10001000D0E0F500D0E0F501750900E509F502E54D +:1000200009F503E509F504E509F505E501C0E0E595 +:1000300000C0E0E502F582E503F583E504F500E59F +:1000400005F5012200E506758204C39582F506E5F3 +:10005000077583009583F507D0E0F500D0E0F50142 +:10006000750900E509F502E509F503E509F504E57B +:1000700009F505E501C0E0E500C0E075E0042506EE +:10008000F50675E0003507F507E502F582E503F5AD +:1000900083E504F500E505F5012200D0E0F500D088 +:1000A000E0F501750900750A00750B00750C00E597 +:1000B00009F502E50AF503E50BF504E50CF505E5A0 +:1000C00001C0E0E500C0E0E502F582E503F583E567 +:1000D00004F500E505F50122000000000000000025 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-isr2.s.expected b/tests/GCCTestSuite/pragma-isr2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pragma-isr2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-pack-4.c b/tests/GCCTestSuite/pragma-pack-4.c new file mode 100644 index 0000000..1d78f47 --- /dev/null +++ b/tests/GCCTestSuite/pragma-pack-4.c @@ -0,0 +1,7 @@ +/* PR c/28286 */ +/* { dg-do compile } */ + +#pragma pack(0.5) /* { dg-warning "invalid constant" } */ +#pragma pack(push,0.5) /* { dg-warning "invalid constant" } */ +#pragma pack(push,x,0.5) /* { dg-warning "invalid constant" } */ +int i; diff --git a/tests/GCCTestSuite/pragma-pack-4.c.expected b/tests/GCCTestSuite/pragma-pack-4.c.expected new file mode 100644 index 0000000..1d78f47 --- /dev/null +++ b/tests/GCCTestSuite/pragma-pack-4.c.expected @@ -0,0 +1,7 @@ +/* PR c/28286 */ +/* { dg-do compile } */ + +#pragma pack(0.5) /* { dg-warning "invalid constant" } */ +#pragma pack(push,0.5) /* { dg-warning "invalid constant" } */ +#pragma pack(push,x,0.5) /* { dg-warning "invalid constant" } */ +int i; diff --git a/tests/GCCTestSuite/pragma-pack-4.hex.expected b/tests/GCCTestSuite/pragma-pack-4.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pragma-pack-4.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-pack-4.s.expected b/tests/GCCTestSuite/pragma-pack-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pragma-pack-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-re-2.c b/tests/GCCTestSuite/pragma-re-2.c new file mode 100644 index 0000000..40b9148 --- /dev/null +++ b/tests/GCCTestSuite/pragma-re-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target *-*-solaris* } } */ + +#pragma redefine_extname /* { dg-warning "malformed" } */ +#pragma redefine_extname foo /* { dg-warning "malformed" } */ +#pragma redefine_extname foo 1 /* { dg-warning "malformed" } */ +#pragma redefine_extname foo bar 2 /* { dg-warning "junk" } */ + +int bar; /* silence `ISO C forbids an empty source file' warning */ diff --git a/tests/GCCTestSuite/pragma-re-2.c.expected b/tests/GCCTestSuite/pragma-re-2.c.expected new file mode 100644 index 0000000..40b9148 --- /dev/null +++ b/tests/GCCTestSuite/pragma-re-2.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile { target *-*-solaris* } } */ + +#pragma redefine_extname /* { dg-warning "malformed" } */ +#pragma redefine_extname foo /* { dg-warning "malformed" } */ +#pragma redefine_extname foo 1 /* { dg-warning "malformed" } */ +#pragma redefine_extname foo bar 2 /* { dg-warning "junk" } */ + +int bar; /* silence `ISO C forbids an empty source file' warning */ diff --git a/tests/GCCTestSuite/pragma-re-2.hex.expected b/tests/GCCTestSuite/pragma-re-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/pragma-re-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pragma-re-2.s.expected b/tests/GCCTestSuite/pragma-re-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pragma-re-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/profile-generate-2.c b/tests/GCCTestSuite/profile-generate-2.c new file mode 100644 index 0000000..eaea065 --- /dev/null +++ b/tests/GCCTestSuite/profile-generate-2.c @@ -0,0 +1,35 @@ +/* PR middle-end/23199 */ +/* Testcase by Ralf Menzel */ + +/* { dg-do compile } */ +/* { dg-options "-O -fprofile-generate" } */ + +union rtunion_def +{ + struct rtx_def *rt_rtx; +}; + +typedef union rtunion_def rtunion; + +struct rtx_def +{ + unsigned int in_struct : 1; + union u { + rtunion fld[1]; + } u; +}; + +typedef struct rtx_def *rtx; + +static void +check_annul_list_true_false (int annul_true_p, rtx delay_list) +{ + rtx temp; + while (1) + { + temp = delay_list; + rtx trial = (((temp)->u.fld[0]).rt_rtx); + if ((annul_true_p && (((trial))->in_struct))) + return; + } +} diff --git a/tests/GCCTestSuite/profile-generate-2.c.expected b/tests/GCCTestSuite/profile-generate-2.c.expected new file mode 100644 index 0000000..eaea065 --- /dev/null +++ b/tests/GCCTestSuite/profile-generate-2.c.expected @@ -0,0 +1,35 @@ +/* PR middle-end/23199 */ +/* Testcase by Ralf Menzel */ + +/* { dg-do compile } */ +/* { dg-options "-O -fprofile-generate" } */ + +union rtunion_def +{ + struct rtx_def *rt_rtx; +}; + +typedef union rtunion_def rtunion; + +struct rtx_def +{ + unsigned int in_struct : 1; + union u { + rtunion fld[1]; + } u; +}; + +typedef struct rtx_def *rtx; + +static void +check_annul_list_true_false (int annul_true_p, rtx delay_list) +{ + rtx temp; + while (1) + { + temp = delay_list; + rtx trial = (((temp)->u.fld[0]).rt_rtx); + if ((annul_true_p && (((trial))->in_struct))) + return; + } +} diff --git a/tests/GCCTestSuite/profile-generate-2.hex.expected b/tests/GCCTestSuite/profile-generate-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/profile-generate-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/profile-generate-2.s.expected b/tests/GCCTestSuite/profile-generate-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/profile-generate-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/pure-1.c b/tests/GCCTestSuite/pure-1.c new file mode 100644 index 0000000..f365c8d --- /dev/null +++ b/tests/GCCTestSuite/pure-1.c @@ -0,0 +1,16 @@ +/* Regression test for PR middle-end/23584 */ +/* Verify that dereferencing a volatile element in a struct causes + the function not be pure. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-ipa-pure-const" } */ + +struct test_a { volatile int a; }; + +int func_a(struct test_a *a) +{ + return a->a; +} + +/* { dg-final { scan-ipa-dump-not "found to be pure: func_a" "pure-const" } } */ +/* { dg-final { cleanup-ipa-dump "pure-const" } } */ diff --git a/tests/GCCTestSuite/pure-1.c.expected b/tests/GCCTestSuite/pure-1.c.expected new file mode 100644 index 0000000..f365c8d --- /dev/null +++ b/tests/GCCTestSuite/pure-1.c.expected @@ -0,0 +1,16 @@ +/* Regression test for PR middle-end/23584 */ +/* Verify that dereferencing a volatile element in a struct causes + the function not be pure. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-ipa-pure-const" } */ + +struct test_a { volatile int a; }; + +int func_a(struct test_a *a) +{ + return a->a; +} + +/* { dg-final { scan-ipa-dump-not "found to be pure: func_a" "pure-const" } } */ +/* { dg-final { cleanup-ipa-dump "pure-const" } } */ diff --git a/tests/GCCTestSuite/pure-1.hex.expected b/tests/GCCTestSuite/pure-1.hex.expected new file mode 100644 index 0000000..98269a1 --- /dev/null +++ b/tests/GCCTestSuite/pure-1.hex.expected @@ -0,0 +1,20 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F518D0E0F519E511F50E58 +:10002000E510F50F750100C3750000E501F5F0E579 +:100030001F35F0F501E500F5F0E51E35F0F500E5BA +:1000400001F509E500F50A750100C3750000E50139 +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E500F502E501F582E502F583E0F52E +:100070000B750101C3750000E501F5F0E50935F0E8 +:10008000F501E500F5F0E50A35F0F500E500F502CB +:10009000E501F582E502F583E0F50C750102C37513 +:1000A0000000E501F5F0E50935F0F501E500F5F0B2 +:1000B000E50A35F0F500E500F502E501F582E50217 +:1000C000F583E0F50D750103C3750000E501F5F05A +:1000D000E50935F0F501E500F5F0E50A35F0F50044 +:1000E000E500F502E501F582E502F583E0F500E5BE +:1000F0000BF502E50CF503E50DF504E500F505E566 +:100100000EF511E50FF510E519C0E0E518C0E07532 +:10011000E0022506F50675E0003507F507E502F56E +:1001200082E503F583E504F500E505F5012200000D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/pure-1.s.expected b/tests/GCCTestSuite/pure-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/pure-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-1.c b/tests/GCCTestSuite/qual-return-1.c new file mode 100644 index 0000000..ac94df6 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-1.c @@ -0,0 +1,22 @@ +/* Test for warnings for qualified function return types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wreturn-type" } */ + +/* Qualifying a function return type makes no sense. */ + +const int int_fn (void); /* { dg-warning "qualifiers" "int decl" } */ +const int (*int_ptr) (void); /* { dg-warning "qualifiers" "int ptr" } */ +const int int_fn2 (void) { return 0; } /* { dg-warning "qualifiers" "int defn" } */ + +const void void_fn (void); /* { dg-warning "qualifiers" "void decl" } */ +const void (*void_ptr) (void); /* { dg-warning "qualifiers" "void ptr" } */ +const void void_fn2 (void) { } /* { dg-warning "qualified" "void defn" } */ + +volatile void vvoid_fn (void); /* { dg-warning "qualifiers" "void decl" } */ +volatile void (*vvoid_ptr) (void); /* { dg-warning "qualifiers" "void ptr" } */ +volatile void vvoid_fn2 (void) { } /* { dg-warning "qualified" "void defn" } */ + +int *restrict ip_fn (void); /* { dg-warning "qualifiers" "restrict decl" } */ +int *restrict (*ip_ptr) (void); /* { dg-warning "qualifiers" "restrict ptr" } */ +int *restrict ip_fn2 (void) { return (int *)0; }; /* { dg-warning "qualifiers" "restrict defn" } */ diff --git a/tests/GCCTestSuite/qual-return-1.c.expected b/tests/GCCTestSuite/qual-return-1.c.expected new file mode 100644 index 0000000..ac94df6 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-1.c.expected @@ -0,0 +1,22 @@ +/* Test for warnings for qualified function return types. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wreturn-type" } */ + +/* Qualifying a function return type makes no sense. */ + +const int int_fn (void); /* { dg-warning "qualifiers" "int decl" } */ +const int (*int_ptr) (void); /* { dg-warning "qualifiers" "int ptr" } */ +const int int_fn2 (void) { return 0; } /* { dg-warning "qualifiers" "int defn" } */ + +const void void_fn (void); /* { dg-warning "qualifiers" "void decl" } */ +const void (*void_ptr) (void); /* { dg-warning "qualifiers" "void ptr" } */ +const void void_fn2 (void) { } /* { dg-warning "qualified" "void defn" } */ + +volatile void vvoid_fn (void); /* { dg-warning "qualifiers" "void decl" } */ +volatile void (*vvoid_ptr) (void); /* { dg-warning "qualifiers" "void ptr" } */ +volatile void vvoid_fn2 (void) { } /* { dg-warning "qualified" "void defn" } */ + +int *restrict ip_fn (void); /* { dg-warning "qualifiers" "restrict decl" } */ +int *restrict (*ip_ptr) (void); /* { dg-warning "qualifiers" "restrict ptr" } */ +int *restrict ip_fn2 (void) { return (int *)0; }; /* { dg-warning "qualifiers" "restrict defn" } */ diff --git a/tests/GCCTestSuite/qual-return-1.hex.expected b/tests/GCCTestSuite/qual-return-1.hex.expected new file mode 100644 index 0000000..b42d50e --- /dev/null +++ b/tests/GCCTestSuite/qual-return-1.hex.expected @@ -0,0 +1,16 @@ +:1000000000D0E0F500D0E0F501750900750A007533 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200D02E +:10004000E0F500D0E0F501750900E509F502E509E4 +:10005000F503E509F504E509F505E501C0E0E5006E +:10006000C0E0E502F582E503F583E504F500E5056A +:10007000F5012200D0E0F500D0E0F501750900E5BA +:1000800009F502E509F503E509F504E509F505E5D6 +:1000900001C0E0E500C0E0E502F582E503F583E597 +:1000A00004F500E505F5012200D0E0F500D0E0F50B +:1000B00001750900750A00750B00E509F502E50AEE +:1000C000F503E50BF504E50BF505E501C0E0E500FA +:1000D000C0E0E502F582E503F583E504F500E505FA +:1000E000F5012200000000000000000000000000F8 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-1.s.expected b/tests/GCCTestSuite/qual-return-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/qual-return-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-2.c b/tests/GCCTestSuite/qual-return-2.c new file mode 100644 index 0000000..22a1946 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-2.c @@ -0,0 +1,13 @@ +/* Test for warnings for qualified function return types. -pedantic test. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +/* Qualifying a function return type makes no sense. */ + +/* The first two of these shouldn't warn (with just -pedantic) as long + as the function is not defined. */ + +volatile void vvoid_fn (void); +volatile void (*vvoid_ptr) (void); +volatile void vvoid_fn2 (void) { } /* { dg-warning "qualified" "volatile defn" } */ diff --git a/tests/GCCTestSuite/qual-return-2.c.expected b/tests/GCCTestSuite/qual-return-2.c.expected new file mode 100644 index 0000000..22a1946 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-2.c.expected @@ -0,0 +1,13 @@ +/* Test for warnings for qualified function return types. -pedantic test. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +/* Qualifying a function return type makes no sense. */ + +/* The first two of these shouldn't warn (with just -pedantic) as long + as the function is not defined. */ + +volatile void vvoid_fn (void); +volatile void (*vvoid_ptr) (void); +volatile void vvoid_fn2 (void) { } /* { dg-warning "qualified" "volatile defn" } */ diff --git a/tests/GCCTestSuite/qual-return-2.hex.expected b/tests/GCCTestSuite/qual-return-2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/qual-return-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-2.s.expected b/tests/GCCTestSuite/qual-return-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/qual-return-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-3.c b/tests/GCCTestSuite/qual-return-3.c new file mode 100644 index 0000000..7a92046 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-3.c @@ -0,0 +1,16 @@ +/* Test for warnings for qualified function return types. Bug 15052 + from Olatunji Ruwase (tjruwase at stanfordalumni.org): qualifiers + should not be lost when merging declarations. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int foo (); /* { dg-error "previous declaration" "different qualifiers" } */ +const int foo () { return 0; } /* { dg-error "conflicting types" "different qualifiers" } */ + +void bar (void); +volatile void bar () { } /* { dg-warning "qualified|volatile" "different qualifiers" } */ + +volatile void baz (void); +void baz () { } /* { dg-warning "not compatible" "different qualifiers" } */ diff --git a/tests/GCCTestSuite/qual-return-3.c.expected b/tests/GCCTestSuite/qual-return-3.c.expected new file mode 100644 index 0000000..7a92046 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-3.c.expected @@ -0,0 +1,16 @@ +/* Test for warnings for qualified function return types. Bug 15052 + from Olatunji Ruwase (tjruwase at stanfordalumni.org): qualifiers + should not be lost when merging declarations. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int foo (); /* { dg-error "previous declaration" "different qualifiers" } */ +const int foo () { return 0; } /* { dg-error "conflicting types" "different qualifiers" } */ + +void bar (void); +volatile void bar () { } /* { dg-warning "qualified|volatile" "different qualifiers" } */ + +volatile void baz (void); +void baz () { } /* { dg-warning "not compatible" "different qualifiers" } */ diff --git a/tests/GCCTestSuite/qual-return-3.hex.expected b/tests/GCCTestSuite/qual-return-3.hex.expected new file mode 100644 index 0000000..ab443da --- /dev/null +++ b/tests/GCCTestSuite/qual-return-3.hex.expected @@ -0,0 +1,12 @@ +:1000000000D0E0F500D0E0F501750900750A007533 +:100010000B00750C00E509F502E50AF503E50BF5A3 +:1000200004E50CF505E501C0E0E500C0E0E502F5FA +:1000300082E503F583E504F500E505F5012200D02E +:10004000E0F500D0E0F501750900E509F502E509E4 +:10005000F503E509F504E509F505E501C0E0E5006E +:10006000C0E0E502F582E503F583E504F500E5056A +:10007000F5012200D0E0F500D0E0F501750900E5BA +:1000800009F502E509F503E509F504E509F505E5D6 +:1000900001C0E0E500C0E0E502F582E503F583E597 +:1000A00004F500E505F50122000000000000000055 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-3.s.expected b/tests/GCCTestSuite/qual-return-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/qual-return-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-4.c b/tests/GCCTestSuite/qual-return-4.c new file mode 100644 index 0000000..9b61cfe --- /dev/null +++ b/tests/GCCTestSuite/qual-return-4.c @@ -0,0 +1,10 @@ +/* Test for warnings for qualified function return types. -pedantic + test. Only the definition gets a warning for qualified void return + types, not other such types within the definition. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +volatile void (*y)(int); + +volatile void (*vvf(int x))(int) { return y; } diff --git a/tests/GCCTestSuite/qual-return-4.c.expected b/tests/GCCTestSuite/qual-return-4.c.expected new file mode 100644 index 0000000..9b61cfe --- /dev/null +++ b/tests/GCCTestSuite/qual-return-4.c.expected @@ -0,0 +1,10 @@ +/* Test for warnings for qualified function return types. -pedantic + test. Only the definition gets a warning for qualified void return + types, not other such types within the definition. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +volatile void (*y)(int); + +volatile void (*vvf(int x))(int) { return y; } diff --git a/tests/GCCTestSuite/qual-return-4.hex.expected b/tests/GCCTestSuite/qual-return-4.hex.expected new file mode 100644 index 0000000..a162382 --- /dev/null +++ b/tests/GCCTestSuite/qual-return-4.hex.expected @@ -0,0 +1,13 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F50CD0E0F50D900000E5F4 +:1000200082F509900000E583F50A750100C37500AB +:1000300000E501F5F0E50935F0F501E500F5F0E53D +:100040000A35F0F500E500F502E501F582E502F577 +:1000500083E0F50B750101C3750000E501F5F0E5DE +:100060000935F0F501E500F5F0E50A35F0F500E5B4 +:1000700000F502E501F582E502F583E0F501750082 +:1000800000E50BF502E501F503E500F504E500F5F3 +:1000900005E50DC0E0E50CC0E075E0042506F506B9 +:1000A00075E0003507F507E502F582E503F583E520 +:1000B00004F500E505F50122000000000000000045 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/qual-return-4.s.expected b/tests/GCCTestSuite/qual-return-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/qual-return-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-13.c b/tests/GCCTestSuite/redecl-13.c new file mode 100644 index 0000000..54be4db --- /dev/null +++ b/tests/GCCTestSuite/redecl-13.c @@ -0,0 +1,9 @@ +/* Some incompatible external linkage declarations were not diagnosed. + Bug 21342. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern int a[]; +void f(void) { extern int a[10]; } /* { dg-error "error: previous declaration of 'a' was here" } */ +extern int a[5]; /* { dg-error "error: conflicting types for 'a'" } */ diff --git a/tests/GCCTestSuite/redecl-13.c.expected b/tests/GCCTestSuite/redecl-13.c.expected new file mode 100644 index 0000000..54be4db --- /dev/null +++ b/tests/GCCTestSuite/redecl-13.c.expected @@ -0,0 +1,9 @@ +/* Some incompatible external linkage declarations were not diagnosed. + Bug 21342. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern int a[]; +void f(void) { extern int a[10]; } /* { dg-error "error: previous declaration of 'a' was here" } */ +extern int a[5]; /* { dg-error "error: conflicting types for 'a'" } */ diff --git a/tests/GCCTestSuite/redecl-13.hex.expected b/tests/GCCTestSuite/redecl-13.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/redecl-13.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-13.s.expected b/tests/GCCTestSuite/redecl-13.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/redecl-13.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-16.c b/tests/GCCTestSuite/redecl-16.c new file mode 100644 index 0000000..52941cb --- /dev/null +++ b/tests/GCCTestSuite/redecl-16.c @@ -0,0 +1,18 @@ +/* PR 21502 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef int IA[]; +typedef int IA5[5]; +typedef int IA10[10]; +typedef IA *IAP; +typedef IA5 *IA5P; +typedef IA10 *IA10P; +extern IAP a[]; +void +f (void) +{ + extern IA5P a[]; +} +IAP a[] = { 0 }; /* { dg-error "previous definition" } */ +extern IA10P a[]; /* { dg-error "conflicting types" } */ diff --git a/tests/GCCTestSuite/redecl-16.c.expected b/tests/GCCTestSuite/redecl-16.c.expected new file mode 100644 index 0000000..52941cb --- /dev/null +++ b/tests/GCCTestSuite/redecl-16.c.expected @@ -0,0 +1,18 @@ +/* PR 21502 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef int IA[]; +typedef int IA5[5]; +typedef int IA10[10]; +typedef IA *IAP; +typedef IA5 *IA5P; +typedef IA10 *IA10P; +extern IAP a[]; +void +f (void) +{ + extern IA5P a[]; +} +IAP a[] = { 0 }; /* { dg-error "previous definition" } */ +extern IA10P a[]; /* { dg-error "conflicting types" } */ diff --git a/tests/GCCTestSuite/redecl-16.hex.expected b/tests/GCCTestSuite/redecl-16.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/redecl-16.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-16.s.expected b/tests/GCCTestSuite/redecl-16.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/redecl-16.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-6.c b/tests/GCCTestSuite/redecl-6.c new file mode 100644 index 0000000..164ec97 --- /dev/null +++ b/tests/GCCTestSuite/redecl-6.c @@ -0,0 +1,24 @@ +/* Test for multiple declarations and composite types. As in bug + 13801. Illustrates how bug causes correct code to be wrongly + diagnosed. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef int IA[]; +typedef int A5[5]; +typedef int A10[10]; + +A10 array10; + +A5 *ap; +void +f (void) +{ + int ap; + { + extern IA *ap; + /* This assignment is valid. */ + ap = &array10; + } +} diff --git a/tests/GCCTestSuite/redecl-6.c.expected b/tests/GCCTestSuite/redecl-6.c.expected new file mode 100644 index 0000000..164ec97 --- /dev/null +++ b/tests/GCCTestSuite/redecl-6.c.expected @@ -0,0 +1,24 @@ +/* Test for multiple declarations and composite types. As in bug + 13801. Illustrates how bug causes correct code to be wrongly + diagnosed. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +typedef int IA[]; +typedef int A5[5]; +typedef int A10[10]; + +A10 array10; + +A5 *ap; +void +f (void) +{ + int ap; + { + extern IA *ap; + /* This assignment is valid. */ + ap = &array10; + } +} diff --git a/tests/GCCTestSuite/redecl-6.hex.expected b/tests/GCCTestSuite/redecl-6.hex.expected new file mode 100644 index 0000000..35ff0d3 --- /dev/null +++ b/tests/GCCTestSuite/redecl-6.hex.expected @@ -0,0 +1,13 @@ +:1000000000D0E0F50ED0E0F50FE510F50D900028DA +:10001000E582F50B900028E583F50C900000E58261 +:10002000F509900000E583F50A750100C37500002D +:10003000E501F5F0E50B35F0F501E500F5F0E50C2F +:1000400035F0F500E509F503E500F502E501F58277 +:10005000E502F583E503F0750101C3750000E501D4 +:10006000F5F0E50B35F0F501E500F5F0E50C35F0C0 +:10007000F500E50AF503E500F502E501F582E50284 +:10008000F583E503F0750000E500F502E500F503F2 +:10009000E500F504E500F505E50DF510E50FC0E018 +:1000A000E50EC0E0E502F582E503F583E504F50021 +:1000B000E505F5012200000000000000000000003E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-6.s.expected b/tests/GCCTestSuite/redecl-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/redecl-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-8.c b/tests/GCCTestSuite/redecl-8.c new file mode 100644 index 0000000..9145b9f --- /dev/null +++ b/tests/GCCTestSuite/redecl-8.c @@ -0,0 +1,23 @@ +/* Test for multiple declarations and composite types. Diagnosis of + completion incompatible with implicit initializer. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +static int x[]; + +void +f (void) +{ + extern int x[2]; /* { dg-error "completed incompatibly" } */ +} + +/* The following is OK. */ + +static int y[]; +void +g (void) +{ + extern int y[1]; +} diff --git a/tests/GCCTestSuite/redecl-8.c.expected b/tests/GCCTestSuite/redecl-8.c.expected new file mode 100644 index 0000000..9145b9f --- /dev/null +++ b/tests/GCCTestSuite/redecl-8.c.expected @@ -0,0 +1,23 @@ +/* Test for multiple declarations and composite types. Diagnosis of + completion incompatible with implicit initializer. */ + +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +static int x[]; + +void +f (void) +{ + extern int x[2]; /* { dg-error "completed incompatibly" } */ +} + +/* The following is OK. */ + +static int y[]; +void +g (void) +{ + extern int y[1]; +} diff --git a/tests/GCCTestSuite/redecl-8.hex.expected b/tests/GCCTestSuite/redecl-8.hex.expected new file mode 100644 index 0000000..64d1011 --- /dev/null +++ b/tests/GCCTestSuite/redecl-8.hex.expected @@ -0,0 +1,8 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F501220000000000002D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-8.s.expected b/tests/GCCTestSuite/redecl-8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/redecl-8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-9.c b/tests/GCCTestSuite/redecl-9.c new file mode 100644 index 0000000..6fe2580 --- /dev/null +++ b/tests/GCCTestSuite/redecl-9.c @@ -0,0 +1,30 @@ +/* Test for multiple declarations and composite types, as in bug + 13801. Test types saved from outer scopes are up to date. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int x[]; + +void +f (void) +{ + extern int x[]; +} + +int x[10]; + +void +g (void) +{ + int x; + { + extern int x[10]; + } +} + +void +h (void) +{ + sizeof (x); +} diff --git a/tests/GCCTestSuite/redecl-9.c.expected b/tests/GCCTestSuite/redecl-9.c.expected new file mode 100644 index 0000000..6fe2580 --- /dev/null +++ b/tests/GCCTestSuite/redecl-9.c.expected @@ -0,0 +1,30 @@ +/* Test for multiple declarations and composite types, as in bug + 13801. Test types saved from outer scopes are up to date. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int x[]; + +void +f (void) +{ + extern int x[]; +} + +int x[10]; + +void +g (void) +{ + int x; + { + extern int x[10]; + } +} + +void +h (void) +{ + sizeof (x); +} diff --git a/tests/GCCTestSuite/redecl-9.hex.expected b/tests/GCCTestSuite/redecl-9.hex.expected new file mode 100644 index 0000000..d22e115 --- /dev/null +++ b/tests/GCCTestSuite/redecl-9.hex.expected @@ -0,0 +1,11 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F5012200D0E0F500D0B8 +:10007000E0F501750900E509F502E509F503E50973 +:10008000F504E509F505E501C0E0E500C0E0E5029D +:10009000F582E503F583E504F500E505F5012200A9 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/redecl-9.s.expected b/tests/GCCTestSuite/redecl-9.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/redecl-9.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/reg-vol-struct-1.c b/tests/GCCTestSuite/reg-vol-struct-1.c new file mode 100644 index 0000000..7751bb4 --- /dev/null +++ b/tests/GCCTestSuite/reg-vol-struct-1.c @@ -0,0 +1,18 @@ +/* Test cases of structures with volatile fields declared register: + should be allowed unless register name given but explicitly taking + the address forbidden. */ +/* Origin: Joseph Myers */ + +/* { dg-do compile } */ + +struct S { volatile int field; }; + +void +f (void) +{ + register struct S a; + register struct S b[2]; + register struct S c __asm__("nosuchreg"); /* { dg-error "object with volatile field" "explicit reg name" } */ + &a; /* { dg-warning "address of register" "explicit address" } */ + b; /* { dg-warning "address of register" "implicit address" } */ +} diff --git a/tests/GCCTestSuite/reg-vol-struct-1.c.expected b/tests/GCCTestSuite/reg-vol-struct-1.c.expected new file mode 100644 index 0000000..7751bb4 --- /dev/null +++ b/tests/GCCTestSuite/reg-vol-struct-1.c.expected @@ -0,0 +1,18 @@ +/* Test cases of structures with volatile fields declared register: + should be allowed unless register name given but explicitly taking + the address forbidden. */ +/* Origin: Joseph Myers */ + +/* { dg-do compile } */ + +struct S { volatile int field; }; + +void +f (void) +{ + register struct S a; + register struct S b[2]; + register struct S c __asm__("nosuchreg"); /* { dg-error "object with volatile field" "explicit reg name" } */ + &a; /* { dg-warning "address of register" "explicit address" } */ + b; /* { dg-warning "address of register" "implicit address" } */ +} diff --git a/tests/GCCTestSuite/reg-vol-struct-1.hex.expected b/tests/GCCTestSuite/reg-vol-struct-1.hex.expected new file mode 100644 index 0000000..03140ee --- /dev/null +++ b/tests/GCCTestSuite/reg-vol-struct-1.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758210C39582F506E50775830045 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0102506F50675E0BA +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F50122000000000000000000009E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/reg-vol-struct-1.s.expected b/tests/GCCTestSuite/reg-vol-struct-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/reg-vol-struct-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/register-var-1.c b/tests/GCCTestSuite/register-var-1.c new file mode 100644 index 0000000..a27d56c --- /dev/null +++ b/tests/GCCTestSuite/register-var-1.c @@ -0,0 +1,14 @@ +/* PR/18160 */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ + +/* This should yield an error even without -pedantic. */ +/* { dg-options "-ansi" } */ + +void g(int *); + +void f(void) +{ + register int x __asm ("eax"); + g(&x); /* { dg-error "error: address of register variable" } */ +} diff --git a/tests/GCCTestSuite/register-var-1.c.expected b/tests/GCCTestSuite/register-var-1.c.expected new file mode 100644 index 0000000..a27d56c --- /dev/null +++ b/tests/GCCTestSuite/register-var-1.c.expected @@ -0,0 +1,14 @@ +/* PR/18160 */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ + +/* This should yield an error even without -pedantic. */ +/* { dg-options "-ansi" } */ + +void g(int *); + +void f(void) +{ + register int x __asm ("eax"); + g(&x); /* { dg-error "error: address of register variable" } */ +} diff --git a/tests/GCCTestSuite/register-var-1.hex.expected b/tests/GCCTestSuite/register-var-1.hex.expected new file mode 100644 index 0000000..106c7d2 --- /dev/null +++ b/tests/GCCTestSuite/register-var-1.hex.expected @@ -0,0 +1,14 @@ +:100000000000E506758206C39582F506E50775834F +:10001000009583F507D0E0F50875E0052506F58223 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000042506F58275E0003507F583E508F0E54F +:1000400006F509E507F50A750100C3750000E5012D +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E501F51FE500F51E750000E500F55A +:1000700002E500F503E500F504E500F50575E0048B +:100080002506F58275E0003507F583E0F508E508FB +:10009000C0E075E0052506F58275E0003507F583BB +:1000A000E0F508E508C0E075E0062506F50675E010 +:1000B000003507F507E502F582E503F583E504F56C +:1000C00000E505F50122000000000000000000002E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/register-var-1.s.expected b/tests/GCCTestSuite/register-var-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/register-var-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/register-var-2.c b/tests/GCCTestSuite/register-var-2.c new file mode 100644 index 0000000..585dfe2 --- /dev/null +++ b/tests/GCCTestSuite/register-var-2.c @@ -0,0 +1,14 @@ +/* PR/18160 */ + +/* { dg-do compile } */ + +/* This should yield an error even without -pedantic. */ +/* { dg-options "-ansi" } */ + +void g(int *); + +void f(void) +{ + register int x; + g(&x); /* { dg-error "error: address of register variable" } */ +} diff --git a/tests/GCCTestSuite/register-var-2.c.expected b/tests/GCCTestSuite/register-var-2.c.expected new file mode 100644 index 0000000..585dfe2 --- /dev/null +++ b/tests/GCCTestSuite/register-var-2.c.expected @@ -0,0 +1,14 @@ +/* PR/18160 */ + +/* { dg-do compile } */ + +/* This should yield an error even without -pedantic. */ +/* { dg-options "-ansi" } */ + +void g(int *); + +void f(void) +{ + register int x; + g(&x); /* { dg-error "error: address of register variable" } */ +} diff --git a/tests/GCCTestSuite/register-var-2.hex.expected b/tests/GCCTestSuite/register-var-2.hex.expected new file mode 100644 index 0000000..106c7d2 --- /dev/null +++ b/tests/GCCTestSuite/register-var-2.hex.expected @@ -0,0 +1,14 @@ +:100000000000E506758206C39582F506E50775834F +:10001000009583F507D0E0F50875E0052506F58223 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000042506F58275E0003507F583E508F0E54F +:1000400006F509E507F50A750100C3750000E5012D +:10005000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10006000F500E501F51FE500F51E750000E500F55A +:1000700002E500F503E500F504E500F50575E0048B +:100080002506F58275E0003507F583E0F508E508FB +:10009000C0E075E0052506F58275E0003507F583BB +:1000A000E0F508E508C0E075E0062506F50675E010 +:1000B000003507F507E502F582E503F583E504F56C +:1000C00000E505F50122000000000000000000002E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/register-var-2.s.expected b/tests/GCCTestSuite/register-var-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/register-var-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/return-type-1.c b/tests/GCCTestSuite/return-type-1.c new file mode 100644 index 0000000..2507caf --- /dev/null +++ b/tests/GCCTestSuite/return-type-1.c @@ -0,0 +1,9 @@ +/* Missing warning for falling off the end of a non-void function. + egcs-1.1.2 passes, egcs-ss-19990428 fails. + http://gcc.gnu.org/ml/gcc-bugs/1999-03n/msg00221.html */ +/* { dg-do compile } */ +/* { dg-options "-O -Wreturn-type" } */ +int +foo(void) +{ +} /* { dg-warning "control reaches end of non-void function" "warning for falling off end of non-void function" } */ diff --git a/tests/GCCTestSuite/return-type-1.c.expected b/tests/GCCTestSuite/return-type-1.c.expected new file mode 100644 index 0000000..2507caf --- /dev/null +++ b/tests/GCCTestSuite/return-type-1.c.expected @@ -0,0 +1,9 @@ +/* Missing warning for falling off the end of a non-void function. + egcs-1.1.2 passes, egcs-ss-19990428 fails. + http://gcc.gnu.org/ml/gcc-bugs/1999-03n/msg00221.html */ +/* { dg-do compile } */ +/* { dg-options "-O -Wreturn-type" } */ +int +foo(void) +{ +} /* { dg-warning "control reaches end of non-void function" "warning for falling off end of non-void function" } */ diff --git a/tests/GCCTestSuite/return-type-1.hex.expected b/tests/GCCTestSuite/return-type-1.hex.expected new file mode 100644 index 0000000..16a396e --- /dev/null +++ b/tests/GCCTestSuite/return-type-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501E509F502E509F5DD +:1000100003E509F504E509F505E501C0E0E500C0E3 +:10002000E0E502F582E503F583E504F500E505F575 +:10003000012200000000000000000000000000009D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/return-type-1.s.expected b/tests/GCCTestSuite/return-type-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/return-type-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/return-type-2.c b/tests/GCCTestSuite/return-type-2.c new file mode 100644 index 0000000..183c6a8 --- /dev/null +++ b/tests/GCCTestSuite/return-type-2.c @@ -0,0 +1,47 @@ +/* Bogus warnings claiming we fall off the end of a non-void function. + By Kaveh R. Ghazi 8/27/2000. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wreturn-type" } */ + +extern void abort (void) __attribute__ ((__noreturn__)); + +int +foo1 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +__inline__ int +foo2 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +static int +foo3 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +static __inline__ int +foo4 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +int bar (int i) +{ + return foo1 (i) + foo2 (i) + foo3 (i) + foo4 (i); +} diff --git a/tests/GCCTestSuite/return-type-2.c.expected b/tests/GCCTestSuite/return-type-2.c.expected new file mode 100644 index 0000000..183c6a8 --- /dev/null +++ b/tests/GCCTestSuite/return-type-2.c.expected @@ -0,0 +1,47 @@ +/* Bogus warnings claiming we fall off the end of a non-void function. + By Kaveh R. Ghazi 8/27/2000. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wreturn-type" } */ + +extern void abort (void) __attribute__ ((__noreturn__)); + +int +foo1 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +__inline__ int +foo2 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +static int +foo3 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +static __inline__ int +foo4 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +int bar (int i) +{ + return foo1 (i) + foo2 (i) + foo3 (i) + foo4 (i); +} diff --git a/tests/GCCTestSuite/return-type-2.hex.expected b/tests/GCCTestSuite/return-type-2.hex.expected new file mode 100644 index 0000000..2e96468 --- /dev/null +++ b/tests/GCCTestSuite/return-type-2.hex.expected @@ -0,0 +1,155 @@ +:100000000000E50675820AC39582F506E50775834B +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0052506F58275E0003507F583E513F038 +:1000500075E0042506F58275E0003507F583E512A5 +:10006000F075E0032506F58275E0003507F583E5B8 +:1000700011F075E0022506F58275E0003507F5837D +:10008000E510F0750000E51FF5F0E50045F0F5001E +:10009000E51EF5F0E50045F0F500E51DF5F0E5009D +:1000A00045F0F500E51CF5F0E50045F0F500E5004C +:1000B0007002800302015500E510F502E511F50319 +:1000C000E512F504E513F50575E0052506F58275DD +:1000D000E0003507F583E0F51375E0042506F582A9 +:1000E00075E0003507F583E0F51275E0032506F5A8 +:1000F0008275E0003507F583E0F51175E00225060D +:10010000F58275E0003507F583E0F51075E0002510 +:1001100006F58275E0003507F583E0F508E508C0CF +:10012000E075E0012506F58275E0003507F583E00E +:10013000F508E508C0E075E00A2506F50675E0005B +:100140003507F507E502F582E503F583E504F500DB +:10015000E505F5012200E51FF510E51EF511E51D89 +:10016000F512E51CF5130200B800E50675820AC316 +:100170009582F506E5077583009583F507D0E0F5D0 +:100180000875E0012506F58275E0003507F583E581 +:1001900008F0D0E0F50875E0002506F58275E0006E +:1001A0003507F583E508F075E0052506F58275E06D +:1001B000003507F583E513F075E0042506F5827533 +:1001C000E0003507F583E512F075E0032506F582BA +:1001D00075E0003507F583E511F075E0022506F5B9 +:1001E0008275E0003507F583E510F0750000E51F26 +:1001F000F5F0E50045F0F500E51EF5F0E50045F009 +:10020000F500E51DF5F0E50045F0F500E51CF5F01D +:10021000E50045F0F500E500700280030202BD0034 +:10022000E510F502E511F503E512F504E513F50512 +:1002300075E0052506F58275E0003507F583E0F5E4 +:100240001375E0042506F58275E0003507F583E0B7 +:10025000F51275E0032506F58275E0003507F58394 +:10026000E0F51175E0022506F58275E0003507F529 +:1002700083E0F51075E0002506F58275E00035078E +:10028000F583E0F508E508C0E075E0012506F58294 +:1002900075E0003507F583E0F508E508C0E075E096 +:1002A0000A2506F50675E0003507F507E502F58233 +:1002B000E503F583E504F500E505F5012200E51FFA +:1002C000F510E51EF511E51DF512E51CF51302020A +:1002D0002000E50675820AC39582F506E507758359 +:1002E000009583F507D0E0F50875E0012506F58255 +:1002F00075E0003507F583E508F0D0E0F50875E016 +:10030000002506F58275E0003507F583E508F075F0 +:10031000E0052506F58275E0003507F583E513F065 +:1003200075E0042506F58275E0003507F583E512D2 +:10033000F075E0032506F58275E0003507F583E5E5 +:1003400011F075E0022506F58275E0003507F583AA +:10035000E510F0750000E51FF5F0E50045F0F5004B +:10036000E51EF5F0E50045F0F500E51DF5F0E500CA +:1003700045F0F500E51CF5F0E50045F0F500E50079 +:100380007002800302042500E510F502E511F50373 +:10039000E512F504E513F50575E0052506F582750A +:1003A000E0003507F583E0F51375E0042506F582D6 +:1003B00075E0003507F583E0F51275E0032506F5D5 +:1003C0008275E0003507F583E0F51175E00225063A +:1003D000F58275E0003507F583E0F51075E000253E +:1003E00006F58275E0003507F583E0F508E508C0FD +:1003F000E075E0012506F58275E0003507F583E03C +:10040000F508E508C0E075E00A2506F50675E00088 +:100410003507F507E502F582E503F583E504F50008 +:10042000E505F5012200E51FF510E51EF511E51DB6 +:10043000F512E51CF51302038800E50675820AC370 +:100440009582F506E5077583009583F507D0E0F5FD +:100450000875E0012506F58275E0003507F583E5AE +:1004600008F0D0E0F50875E0002506F58275E0009B +:100470003507F583E508F075E0052506F58275E09A +:10048000003507F583E513F075E0042506F5827560 +:10049000E0003507F583E512F075E0032506F582E7 +:1004A00075E0003507F583E511F075E0022506F5E6 +:1004B0008275E0003507F583E510F0750000E51F53 +:1004C000F5F0E50045F0F500E51EF5F0E50045F036 +:1004D000F500E51DF5F0E50045F0F500E51CF5F04B +:1004E000E50045F0F500E5007002800302058D008F +:1004F000E510F502E511F503E512F504E513F50540 +:1005000075E0052506F58275E0003507F583E0F511 +:100510001375E0042506F58275E0003507F583E0E4 +:10052000F51275E0032506F58275E0003507F583C1 +:10053000E0F51175E0022506F58275E0003507F556 +:1005400083E0F51075E0002506F58275E0003507BB +:10055000F583E0F508E508C0E075E0012506F582C1 +:1005600075E0003507F583E0F508E508C0E075E0C3 +:100570000A2506F50675E0003507F507E502F58260 +:10058000E503F583E504F500E505F5012200E51F27 +:10059000F510E51EF511E51DF512E51CF513020435 +:1005A000F000E506758216C39582F506E5077583AA +:1005B000009583F507D0E0F50875E0092506F5827A +:1005C00075E0003507F583E508F0D0E0F50875E043 +:1005D000082506F58275E0003507F583E508F07516 +:1005E000E0112506F58275E0003507F583E517F083 +:1005F00075E0102506F58275E0003507F583E516F0 +:10060000F075E00F2506F58275E0003507F583E506 +:1006100015F075E00E2506F58275E0003507F583C7 +:10062000E514F075E00D2506F58275E0003507F557 +:1006300083E513F075E00C2506F58275E0003507BB +:10064000F583E512F075E00B2506F58275E00035BF +:1006500007F583E511F075E00A2506F58275E000DF +:100660003507F583E510F0E51FF510E51EF511E5FA +:100670001DF512E51CF513E510F51FE511F51EE556 +:1006800012F51DE513F51C120001E582F502E58364 +:10069000F503E500F504E501F50575E0032506F52C +:1006A0008275E0003507F583E502F075E002250666 +:1006B000F58275E0003507F583E503F075E0012567 +:1006C00006F58275E0003507F583E504F075E00076 +:1006D0002506F58275E0003507F583E505F0E510A0 +:1006E000F51FE511F51EE512F51DE513F51C1201C8 +:1006F00069E582F502E583F503E500F504E501F51A +:100700000575E0072506F58275E0003507F583E5F8 +:1007100002F075E0062506F58275E0003507F583E1 +:10072000E503F075E0052506F58275E0003507F56F +:1007300083E504F075E0042506F58275E0003507D1 +:10074000F583E505F0E510F51FE511F51EE512F559 +:100750001DE513F51C1202D1E582F502E583F503D0 +:10076000E500F504E501F505E502F514E503F515E9 +:10077000E504F516E505F517E510F51FE511F51E7D +:10078000E512F51DE513F51C120439E582F502E5C5 +:1007900083F503E500F504E501F505E502F500E55F +:1007A00003F501E504F509E505F50AC3750B0075C8 +:1007B000E0072506F58275E0003507F583E0F508CA +:1007C000E508F5F075E0032506F58275E0003507CC +:1007D000F583E0F508E50835F0F50C75E00625062B +:1007E000F58275E0003507F583E0F508E508F5F0DA +:1007F00075E0022506F58275E0003507F583E0F522 +:1008000008E50835F0F50B75E0052506F58275E07D +:10081000003507F583E0F508E508F5F075E00125FA +:1008200006F58275E0003507F583E0F508E5083543 +:10083000F0F50D75E0042506F58275E0003507F545 +:1008400083E0F508E508F5F075E0002506F582750A +:10085000E0003507F583E0F508E50835F0F50FC34E +:10086000750E00E514F5F0E50C35F0F50CE515F521 +:10087000F0E50B35F0F50BE516F5F0E50D35F0F587 +:100880000DE517F5F0E50F35F0F50FC3750E00E532 +:1008900000F5F0E50C35F0F500E501F5F0E50B3578 +:1008A000F0F501E509F5F0E50D35F0F509E50AF596 +:1008B000F0E50F35F0F50AE500F502E501F503E591 +:1008C00009F504E50AF50575E0112506F58275E0E0 +:1008D000003507F583E0F51775E0102506F58275FC +:1008E000E0003507F583E0F51675E00F2506F58283 +:1008F00075E0003507F583E0F51575E00E2506F582 +:100900008275E0003507F583E0F51475E00D2506E6 +:10091000F58275E0003507F583E0F51375E00C25E9 +:1009200006F58275E0003507F583E0F51275E00BFA +:100930002506F58275E0003507F583E0F51175E0D1 +:100940000A2506F58275E0003507F583E0F5107598 +:10095000E0082506F58275E0003507F583E0F50827 +:10096000E508C0E075E0092506F58275E000350769 +:10097000F583E0F508E508C0E075E0162506F50604 +:1009800075E0003507F507E502F582E503F583E537 +:1009900004F500E505F5012200000000000000005C +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/return-type-2.s.expected b/tests/GCCTestSuite/return-type-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/return-type-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/return-type-3.c b/tests/GCCTestSuite/return-type-3.c new file mode 100644 index 0000000..e06ba7c --- /dev/null +++ b/tests/GCCTestSuite/return-type-3.c @@ -0,0 +1,14 @@ +/* PR optimization/7189 + This was a missing warning caused by a cfg cleanup after sibling + call optimization. The return clobber insn was cleaned up and + the warning was never issued. */ +/* { dg-do compile } */ +/* { dg-options "-O -foptimize-sibling-calls -Wreturn-type" } */ + +extern void foo(void); + +int +bar (void) +{ + foo(); +} /* { dg-warning "control reaches end of non-void function" "warning for falling off end of non-void function" } */ diff --git a/tests/GCCTestSuite/return-type-3.c.expected b/tests/GCCTestSuite/return-type-3.c.expected new file mode 100644 index 0000000..e06ba7c --- /dev/null +++ b/tests/GCCTestSuite/return-type-3.c.expected @@ -0,0 +1,14 @@ +/* PR optimization/7189 + This was a missing warning caused by a cfg cleanup after sibling + call optimization. The return clobber insn was cleaned up and + the warning was never issued. */ +/* { dg-do compile } */ +/* { dg-options "-O -foptimize-sibling-calls -Wreturn-type" } */ + +extern void foo(void); + +int +bar (void) +{ + foo(); +} /* { dg-warning "control reaches end of non-void function" "warning for falling off end of non-void function" } */ diff --git a/tests/GCCTestSuite/return-type-3.hex.expected b/tests/GCCTestSuite/return-type-3.hex.expected new file mode 100644 index 0000000..7dbd9e4 --- /dev/null +++ b/tests/GCCTestSuite/return-type-3.hex.expected @@ -0,0 +1,14 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0022506F58226 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000012506F58275E0003507F583E508F075C2 +:10004000E0002506F58275E0003507F583E0F5024E +:1000500075E0002506F58275E0003507F583E0F5CB +:100060000375E0002506F58275E0003507F583E0AD +:10007000F50475E0002506F58275E0003507F58387 +:10008000E0F50575E0012506F58275E0003507F518 +:1000900083E0F508E508C0E075E0022506F5827505 +:1000A000E0003507F583E0F508E508C0E075E003FA +:1000B0002506F50675E0003507F507E502F582E54A +:1000C00003F583E504F500E505F5012200000000D5 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/return-type-3.s.expected b/tests/GCCTestSuite/return-type-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/return-type-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/section1.c b/tests/GCCTestSuite/section1.c new file mode 100644 index 0000000..e907f19 --- /dev/null +++ b/tests/GCCTestSuite/section1.c @@ -0,0 +1,5 @@ +/* PR optimization/6871 */ +/* Constant variables belong in .rodata, not .bss. */ +/* { dg-final { scan-assembler-not "\.bss" } } */ + +const int i = 0; diff --git a/tests/GCCTestSuite/section1.c.expected b/tests/GCCTestSuite/section1.c.expected new file mode 100644 index 0000000..e907f19 --- /dev/null +++ b/tests/GCCTestSuite/section1.c.expected @@ -0,0 +1,5 @@ +/* PR optimization/6871 */ +/* Constant variables belong in .rodata, not .bss. */ +/* { dg-final { scan-assembler-not "\.bss" } } */ + +const int i = 0; diff --git a/tests/GCCTestSuite/section1.hex.expected b/tests/GCCTestSuite/section1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/section1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/section1.s.expected b/tests/GCCTestSuite/section1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/section1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/simd-1b.c b/tests/GCCTestSuite/simd-1b.c new file mode 100644 index 0000000..56d94b9 --- /dev/null +++ b/tests/GCCTestSuite/simd-1b.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +/* Origin: Aldy Hernandez . */ +/* Purpose: Program to test generic SIMD support. */ + +typedef int __attribute__((vector_size (16))) v4si; +typedef int __attribute__((vector_size (8))) v2si; + +v4si a, b; +v2si c, d; + +void +hanneke () +{ + /* Operators on compatible SIMD types. */ + a %= b; /* { dg-error "invalid operands to binary %" } */ + c &= d; + a |= b; + c ^= d; + a >>= b; /* { dg-error "invalid operands to binary >>" } */ + c <<= d; /* { dg-error "invalid operands to binary <<" } */ + a = +b; + c = ~d; + + /* Operators on incompatible SIMD types. */ + a = b % c; /* { dg-error "invalid operands to binary" } */ + a = b % c; /* { dg-error "invalid operands to binary" } */ + d = c & b; /* { dg-error "invalid operands to binary" } */ + a = b | c; /* { dg-error "invalid operands to binary" } */ + d = c ^ b; /* { dg-error "invalid operands to binary" } */ + a = b >> c; /* { dg-error "invalid operands to binary" } */ + a = b >> c; /* { dg-error "invalid operands to binary" } */ + d = c << b; /* { dg-error "invalid operands to binary" } */ + d = c << b; /* { dg-error "invalid operands to binary" } */ +} diff --git a/tests/GCCTestSuite/simd-1b.c.expected b/tests/GCCTestSuite/simd-1b.c.expected new file mode 100644 index 0000000..56d94b9 --- /dev/null +++ b/tests/GCCTestSuite/simd-1b.c.expected @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +/* Origin: Aldy Hernandez . */ +/* Purpose: Program to test generic SIMD support. */ + +typedef int __attribute__((vector_size (16))) v4si; +typedef int __attribute__((vector_size (8))) v2si; + +v4si a, b; +v2si c, d; + +void +hanneke () +{ + /* Operators on compatible SIMD types. */ + a %= b; /* { dg-error "invalid operands to binary %" } */ + c &= d; + a |= b; + c ^= d; + a >>= b; /* { dg-error "invalid operands to binary >>" } */ + c <<= d; /* { dg-error "invalid operands to binary <<" } */ + a = +b; + c = ~d; + + /* Operators on incompatible SIMD types. */ + a = b % c; /* { dg-error "invalid operands to binary" } */ + a = b % c; /* { dg-error "invalid operands to binary" } */ + d = c & b; /* { dg-error "invalid operands to binary" } */ + a = b | c; /* { dg-error "invalid operands to binary" } */ + d = c ^ b; /* { dg-error "invalid operands to binary" } */ + a = b >> c; /* { dg-error "invalid operands to binary" } */ + a = b >> c; /* { dg-error "invalid operands to binary" } */ + d = c << b; /* { dg-error "invalid operands to binary" } */ + d = c << b; /* { dg-error "invalid operands to binary" } */ +} diff --git a/tests/GCCTestSuite/simd-1b.hex.expected b/tests/GCCTestSuite/simd-1b.hex.expected new file mode 100644 index 0000000..0d404dd --- /dev/null +++ b/tests/GCCTestSuite/simd-1b.hex.expected @@ -0,0 +1,1402 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758217C31E +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0062506F58275E0003507F583E5A7 +:1006600008F0D0E0F50875E0052506F58275E00094 +:100670003507F583E508F075E00E2506F58275E08F +:10068000003507F583E517F075E00D2506F5827551 +:10069000E0003507F583E516F075E00C2506F582D8 +:1006A00075E0003507F583E515F075E00B2506F5D7 +:1006B0008275E0003507F583E514F075E00A25063C +:1006C000F58275E0003507F583E513F075E009253F +:1006D00006F58275E0003507F583E512F075E00850 +:1006E0002506F58275E0003507F583E511F075E024 +:1006F000072506F58275E0003507F583E510F0E57E +:100700001FF511E51BF512E51AF513E519F514753A +:10071000E0042506F58275E0003507F583E511F064 +:1007200075E0032506F58275E0003507F583E51EC3 +:10073000F075E0022506F58275E0003507F583E5E2 +:100740001DF075E0012506F58275E0003507F5839B +:10075000E51CF07515017516007517007508007514 +:10076000E0002506F58275E0003507F583E508F021 +:10077000751900750D00750E00750F00E51CF5105C +:10078000750080E500F5F0E51025F0F510E500F5C1 +:10079000F0E50F25F0F50F750C00751A00751B00BC +:1007A000751F00750B00750A01750001C3E50FF593 +:1007B000F0E51095F0F509E50BF5F0E50B35F0F5F2 +:1007C00009E509F5F0E50055F0F500E500F5F0E57F +:1007D0000C45F0F50C750001C3E50FF5F0E510953B +:1007E000F0F509E50BF5F0E50B35F0F509E510F549 +:1007F000F0E50F95F0F501E50BF5F0E50B35F0F5BB +:1008000001E501F5F0E50945F0F509E50AF5F0E542 +:100810000965F0F509E509F5F0E50055F0F500C3C7 +:10082000E50EF5F0E51D95F0F509E50BF5F0E50BA6 +:1008300035F0F509E509F5F0E50055F0F500E500BE +:10084000F5F0E50C45F0F50C750001C3E50FF5F08A +:10085000E51095F0F509E50BF5F0E50B35F0F50938 +:10086000E510F5F0E50F95F0F501E50BF5F0E50B7A +:1008700035F0F501E501F5F0E50945F0F509E50A82 +:10088000F5F0E50965F0F509E509F5F0E50055F045 +:10089000F500C3E50EF5F0E51D95F0F509E50BF55E +:1008A000F0E50B35F0F509E51DF5F0E50E95F0F5F1 +:1008B00001E50BF5F0E50B35F0F501E501F5F0E5A7 +:1008C0000945F0F509E50AF5F0E50965F0F509E5F2 +:1008D00009F5F0E50055F0F500C3E50DF5F0E51E6E +:1008E00095F0F509E50BF5F0E50B35F0F509E509AF +:1008F000F5F0E50055F0F500E500F5F0E50C45F004 +:10090000F50C750001C3E50FF5F0E51095F0F5095C +:10091000E50BF5F0E50B35F0F509E510F5F0E50F21 +:1009200095F0F501E50BF5F0E50B35F0F501E50186 +:10093000F5F0E50945F0F509E50AF5F0E50965F09A +:10094000F509E509F5F0E50055F0F500C3E50EF50C +:10095000F0E51D95F0F509E50BF5F0E50B35F0F543 +:1009600009E51DF5F0E50E95F0F501E50BF5F0E56F +:100970000B35F0F501E501F5F0E50945F0F509E580 +:100980000AF5F0E50965F0F509E509F5F0E500552A +:10099000F0F500C3E50DF5F0E51E95F0F509E50B62 +:1009A000F5F0E50B35F0F509E51EF5F0E50D95F0F0 +:1009B000F501E50BF5F0E50B35F0F501E501F5F096 +:1009C000E50945F0F509E50AF5F0E50965F0F509F1 +:1009D000E509F5F0E50055F0F500C3E519F5F0E59A +:1009E0001195F0F509E50BF5F0E50B35F0F509E5A6 +:1009F00009F5F0E50055F0F500E500F5F0E50C45EA +:100A0000F0F50CE51AF501E51BF509E51FF50A758A +:100A10000000E50CF5F0E50045F0F500E501F5F026 +:100A2000E50045F0F500E509F5F0E50045F0F500D5 +:100A3000E50AF5F0E50045F0F500E50070028003F9 +:100A400002116B00751900750D00750E00750F0011 +:100A5000E512F51BE513F51AE514F510E518F51187 +:100A6000750080E500F5F0E51125F0F511E500F5DC +:100A7000F0E50F25F0F50F750C00751C00751D00D5 +:100A8000751E00750B00750A01750001C3E50FF5B1 +:100A9000F0E51195F0F509E50BF5F0E50B35F0F50E +:100AA00009E509F5F0E50055F0F500E500F5F0E59C +:100AB0000C45F0F50C750001C3E50FF5F0E5119557 +:100AC000F0F509E50BF5F0E50B35F0F509E511F565 +:100AD000F0E50F95F0F501E50BF5F0E50B35F0F5D8 +:100AE00001E501F5F0E50945F0F509E50AF5F0E560 +:100AF0000965F0F509E509F5F0E50055F0F500C3E5 +:100B0000E50EF5F0E51095F0F509E50BF5F0E50BD0 +:100B100035F0F509E509F5F0E50055F0F500E500DB +:100B2000F5F0E50C45F0F50C750001C3E50FF5F0A7 +:100B3000E51195F0F509E50BF5F0E50B35F0F50954 +:100B4000E511F5F0E50F95F0F501E50BF5F0E50B96 +:100B500035F0F501E501F5F0E50945F0F509E50A9F +:100B6000F5F0E50965F0F509E509F5F0E50055F062 +:100B7000F500C3E50EF5F0E51095F0F509E50BF588 +:100B8000F0E50B35F0F509E510F5F0E50E95F0F51B +:100B900001E50BF5F0E50B35F0F501E501F5F0E5C4 +:100BA0000945F0F509E50AF5F0E50965F0F509E50F +:100BB00009F5F0E50055F0F500C3E50DF5F0E51A8F +:100BC00095F0F509E50BF5F0E50B35F0F509E509CC +:100BD000F5F0E50055F0F500E500F5F0E50C45F021 +:100BE000F50C750001C3E50FF5F0E51195F0F50979 +:100BF000E50BF5F0E50B35F0F509E511F5F0E50F3E +:100C000095F0F501E50BF5F0E50B35F0F501E501A3 +:100C1000F5F0E50945F0F509E50AF5F0E50965F0B7 +:100C2000F509E509F5F0E50055F0F500C3E50EF529 +:100C3000F0E51095F0F509E50BF5F0E50B35F0F56D +:100C400009E510F5F0E50E95F0F501E50BF5F0E599 +:100C50000B35F0F501E501F5F0E50945F0F509E59D +:100C60000AF5F0E50965F0F509E509F5F0E5005547 +:100C7000F0F500C3E50DF5F0E51A95F0F509E50B83 +:100C8000F5F0E50B35F0F509E51AF5F0E50D95F011 +:100C9000F501E50BF5F0E50B35F0F501E501F5F0B3 +:100CA000E50945F0F509E50AF5F0E50965F0F5090E +:100CB000E509F5F0E50055F0F500C3E519F5F0E5B7 +:100CC0001B95F0F509E50BF5F0E50B35F0F509E5B9 +:100CD00009F5F0E50055F0F500E500F5F0E50C4507 +:100CE000F0F50CE51CF501E51DF509E51EF50A75A5 +:100CF0000000E50CF5F0E50045F0F500E501F5F044 +:100D0000E50045F0F500E509F5F0E50045F0F500F2 +:100D1000E50AF5F0E50045F0F500E5007002800316 +:100D20000210A30075E0042506F58275E000350782 +:100D3000F583E0F51F75E0032506F58275E00035C3 +:100D400007F583E0F51E75E0022506F58275E000E3 +:100D50003507F583E0F51D75E0012506F58275E0A0 +:100D6000003507F583E0F51CE512F51BE513F51AD0 +:100D7000E514F519120000E582F502E583F503E5B7 +:100D800000F504E501F505E502F511E503F512E5C9 +:100D900004F513E505F514E515F500E516F515E57B +:100DA00017F51675E0002506F58275E0003507F5A4 +:100DB00083E0F517750D00750E00750F00751000B6 +:100DC000C3750100E500F5F0E511A4F50CE500F5AB +:100DD000F0E511A4E5F0F509E50CF5F0E50135F0D5 +:100DE000F501E515F5F0E511A4F50CE515F5F0E5CF +:100DF00011A4E5F0F50AE50CF5F0E50935F0F50983 +:100E0000E516F5F0E511A4F50CE516F5F0E511A4ED +:100E1000E5F0F50BE50CF5F0E50A35F0F50AE51718 +:100E2000F5F0E511A4F50CE517F5F0E511A4E5F0F2 +:100E3000F511E50CF5F0E50B35F0F50BC3C3750CBA +:100E400000E501F5F0E50D35F0F50DE509F5F0E506 +:100E50000E35F0F50EE50AF5F0E50F35F0F50FE586 +:100E60000BF5F0E51035F0F510C3750900E500F558 +:100E7000F0E512A4F50CE500F5F0E512A4E5F0F5B7 +:100E80000AE50CF5F0E50935F0F509E515F5F0E5AD +:100E900012A4F50CE515F5F0E512A4E5F0F50BE567 +:100EA0000CF5F0E50A35F0F50AE516F5F0E512A4C3 +:100EB000F50CE516F5F0E512A4E5F0F511E50CF5F5 +:100EC000F0E50B35F0F50B750100C3C3750C00E5BB +:100ED00001F5F0E50D35F0F50DE509F5F0E50E3518 +:100EE000F0F50EE50AF5F0E50F35F0F50FE50BF539 +:100EF000F0E51035F0F510C3750A00E500F5F0E5F2 +:100F000013A4F50CE500F5F0E513A4E5F0F50BE509 +:100F10000CF5F0E50A35F0F50AE515F5F0E513A452 +:100F2000F50CE515F5F0E513A4E5F0F511E50CF584 +:100F3000F0E50B35F0F50B750100750900C3C375BD +:100F40000C00E501F5F0E50D35F0F50DE509F5F0DE +:100F5000E50E35F0F50EE50AF5F0E50F35F0F50F85 +:100F6000E50BF5F0E51035F0F510C3750B00E50065 +:100F7000F5F0E514A4F50CE500F5F0E514A4E5F0B2 +:100F8000F511E50CF5F0E50B35F0F50B7501007585 +:100F90000900750A00C3C3750000E501F5F0E50D11 +:100FA00035F0F50DE509F5F0E50E35F0F50EE50A3D +:100FB000F5F0E50F35F0F50FE50BF5F0E51035F040 +:100FC000F510E50DF502E50EF503E50FF504E51066 +:100FD000F50575E00E2506F58275E0003507F58309 +:100FE000E0F51775E00D2506F58275E0003507F58B +:100FF00083E0F51675E00C2506F58275E0003507EF +:10100000F583E0F51575E00B2506F58275E00035F2 +:1010100007F583E0F51475E00A2506F58275E00012 +:101020003507F583E0F51375E0092506F58275E0CF +:10103000003507F583E0F51275E0082506F58275A1 +:10104000E0003507F583E0F51175E0072506F58228 +:1010500075E0003507F583E0F51075E0052506F528 +:101060008275E0003507F583E0F508E508C0E07516 +:10107000E0062506F58275E0003507F583E0F50802 +:10108000E508C0E075E0172506F50675E0003507B0 +:10109000F507E502F582E503F583E504F500E505CE +:1010A000F5012200E512F4F512E513F4F513E51449 +:1010B000F4F514E518F4F518D3750000E500F5F023 +:1010C000E51235F0F512E500F5F0E51335F0F5130E +:1010D000E500F5F0E51435F0F514E500F5F0E51858 +:1010E00035F0F518E515F4F515E516F4F516E517E0 +:1010F000F4F51775E0002506F58275E0003507F573 +:1011000083E0F508E508F4F50875E0002506F582AA +:1011100075E0003507F583E508F0D3750000E500BC +:10112000F5F0E51535F0F515E500F5F0E51635F0C7 +:10113000F516E500F5F0E51735F0F517E500F5F0E3 +:1011400075E0002506F58275E0003507F583E0F5CA +:1011500008E50835F0F50875E0002506F58275E02C +:10116000003507F583E508F0020D2400E511F4F5DC +:1011700000E51EF4F501E51DF4F509E51CF4F50B99 +:10118000D3750A00E50AF5F0E50035F0F500E50A4B +:10119000F5F0E50135F0F501E50AF5F0E50935F082 +:1011A000F509E50AF5F0E50B35F0F50B75E00425DA +:1011B00006F58275E0003507F583E500F075E0037C +:1011C0002506F58275E0003507F583E501F075E049 +:1011D000022506F58275E0003507F583E509F0750F +:1011E000E0012506F58275E0003507F583E50BF093 +:1011F000E515F4F515E516F4F516E517F4F517758C +:10120000E0002506F58275E0003507F583E0F50876 +:10121000E508F4F50875E0002506F58275E000356F +:1012200007F583E508F0D3750000E500F5F0E51556 +:1012300035F0F515E500F5F0E51635F0F516E500A5 +:10124000F5F0E51735F0F517E500F5F075E0002548 +:1012500006F58275E0003507F583E0F508E5083509 +:10126000F0F50875E0002506F58275E0003507F514 +:1012700083E508F0020A4400E506758216C39582EC +:10128000F506E5077583009583F507D0E0F5087549 +:10129000E0052506F58275E0003507F583E508F0E1 +:1012A000D0E0F50875E0042506F58275E000350705 +:1012B000F583E508F075E00D2506F58275E000354B +:1012C00007F583E517F075E00C2506F58275E0005B +:1012D0003507F583E516F075E00B2506F58275E018 +:1012E000003507F583E515F075E00A2506F58275EA +:1012F000E0003507F583E514F075E0092506F58271 +:1013000075E0003507F583E513F075E0082506F56F +:101310008275E0003507F583E512F075E0072506D4 +:10132000F58275E0003507F583E511F075E00625D7 +:1013300006F58275E0003507F583E510F075E003EA +:101340002506F58275E0003507F583E51FF075E0A9 +:10135000022506F58275E0003507F583E51EF07578 +:10136000E0012506F58275E0003507F583E51DF0FF +:1013700075E0002506F58275E0003507F583E51C6C +:10138000F0E51BF514E51AF515E519F516E518F560 +:101390001775E0032506F58275E0003507F583E053 +:1013A000F51F75E0022506F58275E0003507F58327 +:1013B000E0F51E75E0012506F58275E0003507F5BC +:1013C00083E0F51D75E0002506F58275E000350720 +:1013D000F583E0F51CE514F51BE515F51AE516F5A2 +:1013E00019E517F518120639E582F502E583F503CC +:1013F000E500F504E501F505E502F500E503F50175 +:10140000E504F509E505F50A75100075110075127A +:1014100000751300C3750B00E500F5F0E514A4F5A5 +:101420000FE500F5F0E514A4E5F0F50CE50FF5F097 +:10143000E50B35F0F50BE501F5F0E514A4F50FE546 +:1014400001F5F0E514A4E5F0F50DE50FF5F0E50C78 +:1014500035F0F50CE509F5F0E514A4F50FE509F50F +:10146000F0E514A4E5F0F50EE50FF5F0E50D35F027 +:10147000F50DE50AF5F0E514A4F50FE50AF5F0E53C +:1014800014A4E5F0F50AE50FF5F0E50E35F0F50EDC +:10149000C3C3750A00E50BF5F0E51035F0F510E56E +:1014A0000CF5F0E51135F0F511E50DF5F0E5123527 +:1014B000F0F512E50EF5F0E51335F0F513C3750CF4 +:1014C00000E500F5F0E515A4F50FE500F5F0E515EC +:1014D000A4E5F0F50DE50FF5F0E50C35F0F50CE5BC +:1014E00001F5F0E515A4F50FE501F5F0E515A4E526 +:1014F000F0F50EE50FF5F0E50D35F0F50DE509F524 +:10150000F0E515A4F50FE509F5F0E515A4E5F0F50E +:101510000AE50FF5F0E50E35F0F50E750B00C3C3C7 +:10152000750900E50BF5F0E51035F0F510E50CF563 +:10153000F0E51135F0F511E50DF5F0E51235F0F5B2 +:1015400012E50EF5F0E51335F0F513C3750D00E562 +:1015500000F5F0E516A4F50FE500F5F0E516A4E5B5 +:10156000F0F50EE50FF5F0E50D35F0F50DE501F5BB +:10157000F0E516A4F50FE501F5F0E516A4E5F0F5A4 +:101580000AE50FF5F0E50E35F0F50E750B00750C5C +:1015900000C3C3750100E50BF5F0E51035F0F5105B +:1015A000E50CF5F0E51135F0F511E50DF5F0E51276 +:1015B00035F0F512E50EF5F0E51335F0F513C375CA +:1015C0000E00E500F5F0E517A4F50FE500F5F0E5F0 +:1015D00017A4E5F0F50AE50FF5F0E50E35F0F50E88 +:1015E000750B00750C00750D00C3C3750000E50B8D +:1015F000F5F0E51035F0F510E50CF5F0E51135F0F6 +:10160000F511E50DF5F0E51235F0F512E50EF5F002 +:10161000E51335F0F513C3E510F5F075E003250685 +:10162000F58275E0003507F583E0F508E50895F0EB +:10163000F500E511F5F075E0022506F58275E0008C +:101640003507F583E0F508E50895F0F501E512F5B5 +:10165000F075E0012506F58275E0003507F583E0B9 +:10166000F508E50895F0F509E513F5F075E00025B6 +:1016700006F58275E0003507F583E0F508E5089585 +:10168000F0F50AE500F502E501F503E509F504E5E5 +:101690000AF50575E00D2506F58275E0003507F5BC +:1016A00083E0F51775E00C2506F58275E000350737 +:1016B000F583E0F51675E00B2506F58275E000353B +:1016C00007F583E0F51575E00A2506F58275E0005B +:1016D0003507F583E0F51475E0092506F58275E018 +:1016E000003507F583E0F51375E0082506F58275EA +:1016F000E0003507F583E0F51275E0072506F58271 +:1017000075E0003507F583E0F51175E0062506F56F +:101710008275E0003507F583E0F51075E0042506D5 +:10172000F58275E0003507F583E0F508E508C0E0CF +:1017300075E0052506F58275E0003507F583E0F5CF +:1017400008E508C0E075E0162506F50675E00035E9 +:1017500007F507E502F582E503F583E504F500E505 +:1017600005F5012200E506758212C39582F506E5AE +:10177000077583009583F507D0E0F50875E001252E +:1017800006F58275E0003507F583E508F0D0E0F551 +:101790000875E0002506F58275E0003507F583E55C +:1017A00008F075E0092506F58275E0003507F58338 +:1017B000E517F075E0082506F58275E0003507F5B8 +:1017C00083E516F075E0072506F58275E00035071C +:1017D000F583E515F075E0062506F58275E0003520 +:1017E00007F583E514F075E0052506F58275E00040 +:1017F0003507F583E513F075E0042506F58275E0FD +:10180000003507F583E512F075E0032506F58275CE +:10181000E0003507F583E511F075E0022506F58255 +:1018200075E0003507F583E510F0E51FF500E51ECE +:10183000F501E51DF509E51CF50AE51BF51EE519A1 +:10184000F516E518F51FE500F50FE501F510E509BA +:10185000F511E50AF5127519007515007513007577 +:101860001D00E51DF50EE51FF50D750080E500F581 +:10187000F0E50E25F0F50EE500F5F0E50D25F0F5A7 +:101880000D750C00751400751700751800750B00A8 +:10189000750A01750001C3E50DF5F0E50E95F0F54B +:1018A00009E50BF5F0E50B35F0F509E509F5F0E58F +:1018B0000055F0F500E500F5F0E50C45F0F50C7588 +:1018C0000001C3E50DF5F0E50E95F0F509E50BF522 +:1018D000F0E50B35F0F509E50EF5F0E50D95F0F5C1 +:1018E00001E50BF5F0E50B35F0F501E501F5F0E567 +:1018F0000945F0F509E50AF5F0E50965F0F509E5B2 +:1019000009F5F0E50055F0F500C3E516F5F0E5132F +:1019100095F0F509E50BF5F0E50B35F0F509E5096E +:10192000F5F0E50055F0F500E500F5F0E50C45F0C3 +:10193000F50C750001C3E50DF5F0E50E95F0F50920 +:10194000E50BF5F0E50B35F0F509E50EF5F0E50DE5 +:1019500095F0F501E50BF5F0E50B35F0F501E50146 +:10196000F5F0E50945F0F509E50AF5F0E50965F05A +:10197000F509E509F5F0E50055F0F500C3E516F5C4 +:10198000F0E51395F0F509E50BF5F0E50B35F0F50D +:1019900009E513F5F0E51695F0F501E50BF5F0E531 +:1019A0000B35F0F501E501F5F0E50945F0F509E540 +:1019B0000AF5F0E50965F0F509E509F5F0E50055EA +:1019C000F0F500C3E51AF5F0E51595F0F509E50B1E +:1019D000F5F0E50B35F0F509E509F5F0E50055F012 +:1019E000F500E500F5F0E50C45F0F50C750001C3D8 +:1019F000E50DF5F0E50E95F0F509E50BF5F0E50BD5 +:101A000035F0F509E50EF5F0E50D95F0F501E50B7E +:101A1000F5F0E50B35F0F501E501F5F0E50945F0E8 +:101A2000F509E50AF5F0E50965F0F509E509F5F0D0 +:101A3000E50055F0F500C3E516F5F0E51395F0F572 +:101A400009E50BF5F0E50B35F0F509E513F5F0E5E3 +:101A50001695F0F501E50BF5F0E50B35F0F501E530 +:101A600001F5F0E50945F0F509E50AF5F0E5096548 +:101A7000F0F509E509F5F0E50055F0F500C3E51AC4 +:101A8000F5F0E51595F0F509E50BF5F0E50B35F00A +:101A9000F509E515F5F0E51A95F0F501E50BF5F01A +:101AA000E50B35F0F501E501F5F0E50945F0F5093F +:101AB000E50AF5F0E50965F0F509E509F5F0E50059 +:101AC00055F0F500C3E51EF5F0E51995F0F509E5CB +:101AD0000BF5F0E50B35F0F509E509F5F0E50055F6 +:101AE000F0F500E500F5F0E50C45F0F50CE50CF53A +:101AF0000AE514F500E517F501E518F509E50AF51D +:101B00000C750B01C3750A00E50CF5F0E50A95F0BC +:101B1000F50A750A00E50AF5F0E50A35F0F50AE57B +:101B20000AF5F0E50B65F0F50BC3750A00E500F565 +:101B3000F0E50A95F0F50A750A00E50AF5F0E50A00 +:101B400035F0F50AE50AF5F0E50B65F0F50BC37520 +:101B50000A00E501F5F0E50A95F0F50A750A00E5D9 +:101B60000AF5F0E50A35F0F50AE50AF5F0E50B654A +:101B7000F0F50BC3750A00E509F5F0E50A95F0F5F7 +:101B80000A750A00E50AF5F0E50A35F0F50AE50AF6 +:101B9000F5F0E50B65F0F50B750100750900750AA8 +:101BA00000750000E50BF5F0E50045F0F500E501F6 +:101BB000F5F0E50045F0F500E509F5F0E50045F044 +:101BC000F500E50AF5F0E50045F0F500E5007002E6 +:101BD0008003021E3B00750D02750E00751700751F +:101BE0001B00E50FF500E510F514E511F518E512F9 +:101BF000F51C750F00751000751100751200C37586 +:101C00000100E500F5F0E50DA4F50CE500F5F0E5C3 +:101C10000DA4E5F0F509E50CF5F0E50135F0F50169 +:101C2000E514F5F0E50DA4F50CE514F5F0E50DA4CB +:101C3000E5F0F50AE50CF5F0E50935F0F509E518EC +:101C4000F5F0E50DA4F50CE518F5F0E50DA4E5F0CB +:101C5000F50BE50CF5F0E50A35F0F50AE51CF5F0B5 +:101C6000E50DA4F50CE51CF5F0E50DA4E5F0F50D8A +:101C7000E50CF5F0E50B35F0F50BC3C3750C00E58D +:101C800001F5F0E50F35F0F50FE509F5F0E5103554 +:101C9000F0F510E50AF5F0E51135F0F511E50BF575 +:101CA000F0E51235F0F512C3750900E500F5F0E531 +:101CB0000EA4F50CE500F5F0E50EA4E5F0F50AE557 +:101CC0000CF5F0E50935F0F509E514F5F0E50EA49D +:101CD000F50CE514F5F0E50EA4E5F0F50BE50CF5D3 +:101CE000F0E50A35F0F50AE518F5F0E50EA4F50C77 +:101CF000E518F5F0E50EA4E5F0F50DE50CF5F0E5D9 +:101D00000B35F0F50B750100C3C3750C00E501F54B +:101D1000F0E50F35F0F50FE509F5F0E51035F0F5D4 +:101D200010E50AF5F0E51135F0F511E50BF5F0E5F4 +:101D30001235F0F512C3750A00E500F5F0E517A4B9 +:101D4000F50CE500F5F0E517A4E5F0F50BE50CF56D +:101D5000F0E50A35F0F50AE514F5F0E517A4F50C01 +:101D6000E514F5F0E517A4E5F0F50DE50CF5F0E563 +:101D70000B35F0F50B750100750900C3C3750C0038 +:101D8000E501F5F0E50F35F0F50FE509F5F0E510A3 +:101D900035F0F510E50AF5F0E51135F0F511E50B34 +:101DA000F5F0E51235F0F512C3750B00E500F5F01E +:101DB000E51BA4F50CE500F5F0E51BA4E5F0F50D39 +:101DC000E50CF5F0E50B35F0F50B75010075090034 +:101DD000750A00C3C3750000E501F5F0E50F35F0A5 +:101DE000F50FE509F5F0E51035F0F510E50AF5F029 +:101DF000E51135F0F511E50BF5F0E51235F0F512CA +:101E0000750001750100750900750A00C3750B00A6 +:101E1000E500F5F0E51935F0F519E501F5F0E51502 +:101E200035F0F515E509F5F0E51335F0F513E50A9C +:101E3000F5F0E51D35F0F51D02186200E50FF5021D +:101E4000E510F503E511F504E512F50575E0092542 +:101E500006F58275E0003507F583E0F51775E008B3 +:101E60002506F58275E0003507F583E0F51675E087 +:101E7000072506F58275E0003507F583E0F5157551 +:101E8000E0062506F58275E0003507F583E0F514D8 +:101E900075E0052506F58275E0003507F583E0F568 +:101EA0001375E0042506F58275E0003507F583E03B +:101EB000F51275E0032506F58275E0003507F58318 +:101EC000E0F51175E0022506F58275E0003507F5AD +:101ED00083E0F51075E0002506F58275E000350712 +:101EE000F583E0F508E508C0E075E0012506F58218 +:101EF00075E0003507F583E0F508E508C0E075E01A +:101F0000122506F50675E0003507F507E502F582AE +:101F1000E503F583E504F500E505F5012200E50696 +:101F2000758219C39582F506E5077583009583F5DB +:101F300007D0E0F50875E0082506F58275E0003564 +:101F400007F583E508F0D0E0F50875E0072506F50C +:101F50008275E0003507F583E508F075E010250689 +:101F6000F58275E0003507F583E517F075E00F257C +:101F700006F58275E0003507F583E516F075E00E8D +:101F80002506F58275E0003507F583E515F075E067 +:101F90000D2506F58275E0003507F583E514F0752B +:101FA000E00C2506F58275E0003507F583E513F0B2 +:101FB00075E00B2506F58275E0003507F583E5121F +:101FC000F075E00A2506F58275E0003507F583E532 +:101FD00011F075E0092506F58275E0003507F583F7 +:101FE000E510F0E51DF517E51CF516E518F5157576 +:101FF0001400750D00750E00750F00E515F51075D0 +:102000000080E500F5F0E51025F0F510E500F5F0AD +:10201000E50F25F0F50F750C0075110075120075B0 +:102020001300750B00750A01750001C3E50FF5F08B +:10203000E51095F0F509E50BF5F0E50B35F0F50940 +:10204000E509F5F0E50055F0F500E500F5F0E50CE3 +:1020500045F0F50C750001C3E50FF5F0E51095F0BE +:10206000F509E50BF5F0E50B35F0F509E510F5F0B0 +:10207000E50F95F0F501E50BF5F0E50B35F0F50111 +:10208000E501F5F0E50945F0F509E50AF5F0E509A2 +:1020900065F0F509E509F5F0E50055F0F500C3E553 +:1020A0000EF5F0E51995F0F509E50BF5F0E50B35C2 +:1020B000F0F509E509F5F0E50055F0F500E500F566 +:1020C000F0E50C45F0F50C750001C3E50FF5F0E502 +:1020D0001095F0F509E50BF5F0E50B35F0F509E5A0 +:1020E00010F5F0E50F95F0F501E50BF5F0E50B3592 +:1020F000F0F501E501F5F0E50945F0F509E50AF52A +:10210000F0E50965F0F509E509F5F0E50055F0F5AC +:1021100000C3E50EF5F0E51995F0F509E50BF5F0CE +:10212000E50B35F0F509E519F5F0E50E95F0F5014B +:10213000E50BF5F0E50B35F0F501E501F5F0E50906 +:1021400045F0F509E50AF5F0E50965F0F509E50959 +:10215000F5F0E50055F0F500C3E50DF5F0E51A954D +:10216000F0F509E50BF5F0E50B35F0F509E509F5B6 +:10217000F0E50055F0F500E500F5F0E50C45F0F56B +:102180000C750001C3E50FF5F0E51095F0F509E5D4 +:102190000BF5F0E50B35F0F509E510F5F0E50F95D9 +:1021A000F0F501E50BF5F0E50B35F0F501E501F58E +:1021B000F0E50945F0F509E50AF5F0E50965F0F502 +:1021C00009E509F5F0E50055F0F500C3E50EF5F079 +:1021D000E51995F0F509E50BF5F0E50B35F0F50996 +:1021E000E519F5F0E50E95F0F501E50BF5F0E50BD9 +:1021F00035F0F501E501F5F0E50945F0F509E50AE9 +:10220000F5F0E50965F0F509E509F5F0E50055F0AB +:10221000F500C3E50DF5F0E51A95F0F509E50BF5C8 +:10222000F0E50B35F0F509E51AF5F0E50D95F0F55B +:1022300001E50BF5F0E50B35F0F501E501F5F0E50D +:102240000945F0F509E50AF5F0E50965F0F509E558 +:1022500009F5F0E50055F0F500C3E514F5F0E51BD0 +:1022600095F0F509E50BF5F0E50B35F0F509E50915 +:10227000F5F0E50055F0F500E500F5F0E50C45F06A +:10228000F50C750000E50CF5F0E50045F0F500E50E +:1022900011F5F0E50045F0F500E512F5F0E5004533 +:1022A000F0F500E513F5F0E50045F0F500E5007008 +:1022B00002800302300400E51FF51CE51EF51DE554 +:1022C00017F51FE516F51E75E0032506F58275E086 +:1022D000003507F583E51BF075E0022506F58275EC +:1022E000E0003507F583E51AF075E0012506F58273 +:1022F00075E0003507F583E519F075E0002506F572 +:102300008275E0003507F583E515F0751301751446 +:102310000075150075120075E0062506F58275E05A +:10232000003507F583E51FF075E0052506F5827594 +:10233000E0003507F583E51EF075080075E004251B +:1023400006F58275E0003507F583E508F07516009F +:1023500075110075100075171F750F00750C00754D +:102360000D00750B00751800751900751A00750AB7 +:1023700000750E01750001C3E50DF5F0E51095F04F +:10238000F509E50AF5F0E50A35F0F509E509F5F096 +:10239000E50055F0F500E500F5F0E50B45F0F50B2F +:1023A000750001C3E50DF5F0E51095F0F509E50AB6 +:1023B000F5F0E50A35F0F509E510F5F0E50D95F0D5 +:1023C000F501E50AF5F0E50A35F0F501E501F5F06E +:1023D000E50945F0F509E50EF5F0E50965F0F509C3 +:1023E000E509F5F0E50055F0F500C3E50CF5F0E57D +:1023F0001195F0F509E50AF5F0E50A35F0F509E57E +:1024000009F5F0E50055F0F500E500F5F0E50B45C0 +:10241000F0F50B750001C3E50DF5F0E51095F0F54D +:1024200009E50AF5F0E50A35F0F509E510F5F0E5FE +:102430000D95F0F501E50AF5F0E50A35F0F501E551 +:1024400001F5F0E50945F0F509E50EF5F0E509655A +:10245000F0F509E509F5F0E50055F0F500C3E50CE8 +:10246000F5F0E51195F0F509E50AF5F0E50A35F026 +:10247000F509E511F5F0E50C95F0F501E50AF5F043 +:10248000E50A35F0F501E501F5F0E50945F0F50956 +:10249000E50EF5F0E50965F0F509E509F5F0E5006B +:1024A00055F0F500C3E50FF5F0E51695F0F509E5F3 +:1024B0000AF5F0E50A35F0F509E509F5F0E500550E +:1024C000F0F500E500F5F0E50B45F0F50B750001C2 +:1024D000C3E50DF5F0E51095F0F509E50AF5F0E531 +:1024E0000A35F0F509E510F5F0E50D95F0F501E593 +:1024F0000AF5F0E50A35F0F501E501F5F0E50945E5 +:10250000F0F509E50EF5F0E50965F0F509E509F5E1 +:10251000F0E50055F0F500C3E50CF5F0E51195F098 +:10252000F509E50AF5F0E50A35F0F509E511F5F0EC +:10253000E50C95F0F501E50AF5F0E50A35F0F50151 +:10254000E501F5F0E50945F0F509E50EF5F0E509D9 +:1025500065F0F509E509F5F0E50055F0F500C3E58E +:102560000FF5F0E51695F0F509E50AF5F0E50A3501 +:10257000F0F509E516F5F0E50F95F0F501E50AF53A +:10258000F0E50A35F0F501E501F5F0E50945F0F56E +:1025900009E50EF5F0E50965F0F509E509F5F0E561 +:1025A0000055F0F500C3E517F5F075E0042506F5D4 +:1025B0008275E0003507F583E0F508E50895F0F54C +:1025C00009E50AF5F0E50A35F0F509E509F5F0E564 +:1025D0000055F0F500E500F5F0E50B45F0F50BE5ED +:1025E00018F500E519F501E51AF50C750A01C37532 +:1025F0000900E50BF5F0E50995F0F509750900E529 +:1026000009F5F0E50935F0F509E509F5F0E50A65A4 +:10261000F0F50AC3750900E500F5F0E50995F0F558 +:1026200009750900E509F5F0E50935F0F509E50951 +:10263000F5F0E50A65F0F50AC3750900E501F5F066 +:10264000E50995F0F509750900E509F5F0E50935A5 +:10265000F0F509E509F5F0E50A65F0F50AC3750935 +:1026600000E50CF5F0E50995F0F509750900E509B7 +:10267000F5F0E50935F0F509E509F5F0E50A65F04D +:10268000F50A750100750900750B00750000E50A73 +:10269000F5F0E50045F0F500E501F5F0E50045F061 +:1026A000F500E509F5F0E50045F0F500E50BF5F07E +:1026B000E50045F0F500E5007002800302294700BF +:1026C000750C02750D00750F00751800E513F50EF9 +:1026D000E514F517E515F519E512F51A75130075EA +:1026E0001400751500751200C3750000E50EF5F0B5 +:1026F000E50CA4F50BE50EF5F0E50CA4E5F0F5010D +:10270000E50BF5F0E50035F0F500E517F5F0E50C23 +:10271000A4F50BE517F5F0E50CA4E5F0F509E50BDC +:10272000F5F0E50135F0F501E519F5F0E50CA4F556 +:102730000BE519F5F0E50CA4E5F0F50AE50BF5F06D +:10274000E50935F0F509E51AF5F0E50CA4F50BE51A +:102750001AF5F0E50CA4E5F0F50CE50BF5F0E50A4B +:1027600035F0F50AC3C3750B00E500F5F0E5133548 +:10277000F0F513E501F5F0E51435F0F514E509F58C +:10278000F0E51535F0F515E50AF5F0E51235F0F54B +:1027900012C3750100E50EF5F0E50DA4F50BE50E8D +:1027A000F5F0E50DA4E5F0F509E50BF5F0E50135EB +:1027B000F0F501E517F5F0E50DA4F50BE517F5F0DB +:1027C000E50DA4E5F0F50AE50BF5F0E50935F0F5C2 +:1027D00009E519F5F0E50DA4F50BE519F5F0E50DA2 +:1027E000A4E5F0F50CE50BF5F0E50A35F0F50A7512 +:1027F0000000C3C3750B00E500F5F0E51335F0F5F7 +:1028000013E501F5F0E51435F0F514E509F5F0E50B +:102810001535F0F515E50AF5F0E51235F0F512C3BA +:10282000750900E50EF5F0E50FA4F50BE50EF5F0E2 +:10283000E50FA4E5F0F50AE50BF5F0E50935F0F54F +:1028400009E517F5F0E50FA4F50BE517F5F0E50F31 +:10285000A4E5F0F50CE50BF5F0E50A35F0F50A75A1 +:102860000000750100C3C3750B00E500F5F0E5132A +:1028700035F0F513E501F5F0E51435F0F514E5094B +:10288000F5F0E51535F0F515E50AF5F0E51235F04A +:10289000F512C3750A00E50EF5F0E518A4F50BE591 +:1028A0000EF5F0E518A4E5F0F50CE50BF5F0E50AFA +:1028B00035F0F50A750000750100750900C3C37590 +:1028C0000B00E500F5F0E51335F0F513E501F5F043 +:1028D000E51435F0F514E509F5F0E51535F0F515D5 +:1028E000E50AF5F0E51235F0F51275000175010005 +:1028F000750900750A00C3750B00E500F5F075E079 +:10290000042506F58275E0003507F583E0F508E556 +:102910000835F0F50875E0042506F58275E0003508 +:1029200007F583E508F0E501F5F0E51635F0F51655 +:10293000E509F5F0E51135F0F511E50AF5F0E510DA +:1029400035F0F51002235600C3E51CF5F0E51355EC +:10295000F0F513E51DF5F0E51455F0F514E51FF558 +:10296000F0E51555F0F515E51EF5F0E51255F0F515 +:102970001275080075E0042506F58275E00035073C +:10298000F583E508F0751600751100751000750CDB +:1029900000750D00750E00750F00750B00750A01AE +:1029A000750001C375E0002506F58275E000350766 +:1029B000F583E0F508E508F5F0E51095F0F509E593 +:1029C0000BF5F0E50B35F0F509E509F5F0E50055F7 +:1029D000F0F500E500F5F0E50C45F0F50C750001AB +:1029E000C375E0002506F58275E0003507F583E044 +:1029F000F508E508F5F0E51095F0F509E50BF5F0BB +:102A0000E50B35F0F509E510F5F075E0002506F564 +:102A10008275E0003507F583E0F508E50895F0F5E7 +:102A200001E50BF5F0E50B35F0F501E501F5F0E515 +:102A30000945F0F509E50AF5F0E50965F0F509E560 +:102A400009F5F0E50055F0F500C375E0012506F540 +:102A50008275E0003507F583E0F508E508F5F0E557 +:102A60001195F0F509E50BF5F0E50B35F0F509E505 +:102A700009F5F0E50055F0F500E500F5F0E50C4549 +:102A8000F0F50C750001C375E0002506F58275E0D0 +:102A9000003507F583E0F508E508F5F0E51095F059 +:102AA000F509E50BF5F0E50B35F0F509E510F5F066 +:102AB00075E0002506F58275E0003507F583E0F541 +:102AC00008E50895F0F501E50BF5F0E50B35F0F5B7 +:102AD00001E501F5F0E50945F0F509E50AF5F0E550 +:102AE0000965F0F509E509F5F0E50055F0F500C3D5 +:102AF00075E0012506F58275E0003507F583E0F500 +:102B000008E508F5F0E51195F0F509E50BF5F0E5B8 +:102B10000B35F0F509E511F5F075E0012506F582B4 +:102B200075E0003507F583E0F508E50895F0F50157 +:102B3000E50BF5F0E50B35F0F501E501F5F0E509FC +:102B400045F0F509E50AF5F0E50965F0F509E5094F +:102B5000F5F0E50055F0F500C375E0022506F582B5 +:102B600075E0003507F583E0F508E508F5F0E516B2 +:102B700095F0F509E50BF5F0E50B35F0F509E509FC +:102B8000F5F0E50055F0F500E500F5F0E50C45F051 +:102B9000F50C750001C375E0002506F58275E000AF +:102BA0003507F583E0F508E508F5F0E51095F0F553 +:102BB00009E50BF5F0E50B35F0F509E510F5F075D5 +:102BC000E0002506F58275E0003507F583E0F5089D +:102BD000E50895F0F501E50BF5F0E50B35F0F501AD +:102BE000E501F5F0E50945F0F509E50AF5F0E50937 +:102BF00065F0F509E509F5F0E50055F0F500C37558 +:102C0000E0012506F58275E0003507F583E0F5085B +:102C1000E508F5F0E51195F0F509E50BF5F0E50BA4 +:102C200035F0F509E511F5F075E0012506F5827539 +:102C3000E0003507F583E0F508E50895F0F501E5D6 +:102C40000BF5F0E50B35F0F501E501F5F0E509458B +:102C5000F0F509E50AF5F0E50965F0F509E509F58E +:102C6000F0E50055F0F500C375E0022506F5827524 +:102C7000E0003507F583E0F508E508F5F0E5169581 +:102C8000F0F509E50BF5F0E50B35F0F509E516F57E +:102C9000F075E0022506F58275E0003507F583E062 +:102CA000F508E50895F0F501E50BF5F0E50B35F0D5 +:102CB000F501E501F5F0E50945F0F509E50AF5F05E +:102CC000E50965F0F509E509F5F0E50055F0F500D1 +:102CD000C375E0032506F58275E0003507F583E04E +:102CE000F508E508F5F075E0042506F58275E000C5 +:102CF0003507F583E0F508E50895F0F509E50BF5EE +:102D0000F0E50B35F0F509E509F5F0E50055F0F5CE +:102D100000E500F5F0E50C45F0F50CE50DF500E5F6 +:102D20000EF501E50FF509E500F50BE501F50A756E +:102D30000101C3750000E50CF5F0E50095F0F50024 +:102D4000750000E500F5F0E50035F0F500E500F56B +:102D5000F0E50165F0F501C3750000E50BF5F0E560 +:102D60000095F0F500750000E500F5F0E50035F0A0 +:102D7000F500E500F5F0E50165F0F501C37500002B +:102D8000E50AF5F0E50095F0F500750000E500F5C1 +:102D9000F0E50035F0F500E500F5F0E50165F0F54A +:102DA00001C3750000E509F5F0E50095F0F5007543 +:102DB0000000E500F5F0E50035F0F500E500F5F080 +:102DC000E50165F0F501750900750A00750B0075E0 +:102DD0000000E501F5F0E50045F0F500E509F5F046 +:102DE000E50045F0F500E50AF5F0E50045F0F500F1 +:102DF000E50BF5F0E50045F0F500E5007002800315 +:102E0000022F0800751B02751A007519007518004D +:102E1000E51CF51FE51DF51E75E0062506F5827516 +:102E2000E0003507F583E0F51D75E0052506F58220 +:102E300075E0003507F583E0F51C120000E582F52A +:102E400002E583F503E500F504E501F505E502F586 +:102E50000AE503F509E504F501E505F500C3750B81 +:102E600000E513F5F0E50A35F0F51CE514F5F0E59D +:102E70000935F0F51DE515F5F0E50135F0F50875B6 +:102E8000E0062506F58275E0003507F583E508F0D4 +:102E9000E512F5F0E50035F0F50875E0052506F5D5 +:102EA0008275E0003507F583E508F07500017501CE +:102EB00000750900750A00C3750B00E500F5F07593 +:102EC000E0042506F58275E0003507F583E0F50896 +:102ED000E50835F0F50875E0042506F58275E00093 +:102EE0003507F583E508F0E501F5F0E51635F0F571 +:102EF00016E509F5F0E51135F0F511E50AF5F0E50F +:102F00001035F0F51002298E00E51CF502E51DF5DF +:102F10000375E0062506F58275E0003507F583E0C8 +:102F2000F50475E0052506F58275E0003507F583A3 +:102F3000E0F50575E0102506F58275E0003507F52A +:102F400083E0F51775E00F2506F58275E00035077B +:102F5000F583E0F51675E00E2506F58275E000357F +:102F600007F583E0F51575E00D2506F58275E0009F +:102F70003507F583E0F51475E00C2506F58275E05C +:102F8000003507F583E0F51375E00B2506F582752E +:102F9000E0003507F583E0F51275E00A2506F582B5 +:102FA00075E0003507F583E0F51175E0092506F5B4 +:102FB0008275E0003507F583E0F51075E00725061A +:102FC000F58275E0003507F583E0F508E508C0E017 +:102FD00075E0082506F58275E0003507F583E0F514 +:102FE00008E508C0E075E0192506F50675E000352E +:102FF00007F507E502F582E503F583E504F500E54D +:1030000005F5012200751C00751D0075080075E0AE +:10301000062506F58275E0003507F583E508F075AD +:10302000080075E0052506F58275E0003507F58393 +:10303000E508F0022F0900E506758206C39582F5C2 +:1030400006E5077583009583F507D0E0F50875E080 +:10305000012506F58275E0003507F583E508F0D017 +:10306000E0F50875E0002506F58275E0003507F506 +:1030700083E508F075E0052506F58275E000350763 +:10308000F583E513F075E0042506F58275E000355B +:1030900007F583E512F075E0032506F58275E0007B +:1030A0003507F583E511F075E0022506F58275E038 +:1030B000003507F583E510F0900000E582F50990F2 +:1030C0000000E583F50A750100C3750000E501F510 +:1030D000F0E50935F0F501E500F5F0E50A35F0F524 +:1030E00000E500F502E501F582E502F583E0F51F54 +:1030F000750101C3750000E501F5F0E50935F0F54E +:1031000001E500F5F0E50A35F0F500E500F502E52A +:1031100001F582E502F583E0F51E750102C3750035 +:1031200000E501F5F0E50935F0F501E500F5F0E51C +:103130000A35F0F500E500F502E501F582E502F556 +:1031400083E0F51D750103C3750000E501F5F0E5A9 +:103150000935F0F501E500F5F0E50A35F0F500E593 +:1031600000F502E501F582E502F583E0F51C90002B +:1031700004E582F509900004E583F50A750100C3B2 +:10318000750000E501F5F0E50935F0F501E500F51C +:10319000F0E50A35F0F500E500F502E501F582E518 +:1031A00002F583E0F51B750101C3750000E501F52B +:1031B000F0E50935F0F501E500F5F0E50A35F0F543 +:1031C00000E500F502E501F582E502F583E0F51A78 +:1031D000750102C3750000E501F5F0E50935F0F56C +:1031E00001E500F5F0E50A35F0F500E500F502E54A +:1031F00001F582E502F583E0F519750103C3750059 +:1032000000E501F5F0E50935F0F501E500F5F0E53B +:103210000A35F0F500E500F502E501F582E502F575 +:1032200083E0F518121277E582F502E583F503E5F0 +:1032300000F504E501F505E502F50BE503F50CE500 +:1032400004F50DE505F50E900000E582F509900006 +:1032500000E583F50A750100C3750000E501F5F08E +:10326000E50935F0F501E500F5F0E50A35F0F50082 +:10327000E50BF503E500F502E501F582E502F583CE +:10328000E503F0750101C3750000E501F5F0E509FE +:1032900035F0F501E500F5F0E50A35F0F500E50C4F +:1032A000F503E500F502E501F582E502F583E503A6 +:1032B000F0750102C3750000E501F5F0E50935F090 +:1032C000F501E500F5F0E50A35F0F500E50DF5034B +:1032D000E500F502E501F582E502F583E503F07509 +:1032E0000103C3750000E501F5F0E50935F0F501CE +:1032F000E500F5F0E50A35F0F500E50EF503E5002B +:10330000F502E501F582E502F583E503F09000089A +:10331000E582F512900008E583F513900008E58238 +:10332000F509900008E583F50A750100C3750000F2 +:10333000E501F5F0E50935F0F501E500F5F0E50A00 +:1033400035F0F500E500F502E501F582E502F583CB +:10335000E0F50E750101C3750000E501F5F0E50922 +:1033600035F0F501E500F5F0E50A35F0F500E5008A +:10337000F502E501F582E502F583E0F50F7501023E +:10338000C3750000E501F5F0E50935F0F501E5004C +:10339000F5F0E50A35F0F500E500F502E501F58206 +:1033A000E502F583E0F510750103C3750000E50142 +:1033B000F5F0E50935F0F501E500F5F0E50A35F041 +:1033C000F500E500F502E501F582E502F583E0F59B +:1033D0001190000CE582F50990000CE583F50A7563 +:1033E0000100C3750000E501F5F0E50935F0F501D0 +:1033F000E500F5F0E50A35F0F500E500F502E50138 +:10340000F582E502F583E0F50B750101C375000057 +:10341000E501F5F0E50935F0F501E500F5F0E50A1F +:1034200035F0F500E500F502E501F582E502F583EA +:10343000E0F50C750102C3750000E501F5F0E50942 +:1034400035F0F501E500F5F0E50A35F0F500E500A9 +:10345000F502E501F582E502F583E0F50D7501035E +:10346000C3750000E501F5F0E50935F0F501E5006B +:10347000F5F0E50A35F0F500E500F502E501F58225 +:10348000E502F583E0F500C3E50BF5F0E50E55F038 +:10349000F501E50CF5F0E50F55F0F509E50DF5F052 +:1034A000E51055F0F50AE500F5F0E51155F0F50CDD +:1034B000750B00C3750000E50BF5F0E51235F0F56E +:1034C0000BE500F5F0E51335F0F500E501F503E552 +:1034D00000F502E50BF582E502F583E503F0750BD7 +:1034E00001C3750000E50BF5F0E51235F0F50BE5CD +:1034F00000F5F0E51335F0F500E509F503E500F515 +:1035000002E50BF582E502F583E503F0750B02C3D6 +:10351000750000E50BF5F0E51235F0F50BE500F56B +:10352000F0E51335F0F500E50AF503E500F502E5F1 +:103530000BF582E502F583E503F0750B03C3750017 +:1035400000E50BF5F0E51235F0F50BE500F5F0E5DB +:103550001335F0F500E50CF503E500F502E50BF594 +:1035600082E502F583E503F0900000E582F5129014 +:103570000000E583F513900000E582F50990000056 +:10358000E583F50A750100C3750000E501F5F0E576 +:103590000935F0F501E500F5F0E50A35F0F500E54F +:1035A00000F502E501F582E502F583E0F50E75010F +:1035B00001C3750000E501F5F0E50935F0F501E519 +:1035C00000F5F0E50A35F0F500E500F502E501F556 +:1035D00082E502F583E0F50F750102C3750000E591 +:1035E00001F5F0E50935F0F501E500F5F0E50A35FE +:1035F000F0F500E500F502E501F582E502F583E06E +:10360000F510750103C3750000E501F5F0E5093516 +:10361000F0F501E500F5F0E50A35F0F500E500F517 +:1036200002E501F582E502F583E0F511900004E57D +:1036300082F509900004E583F50A750100C3750061 +:1036400000E501F5F0E50935F0F501E500F5F0E5F7 +:103650000A35F0F500E500F502E501F582E502F531 +:1036600083E0F50B750101C3750000E501F5F0E598 +:103670000935F0F501E500F5F0E50A35F0F500E56E +:1036800000F502E501F582E502F583E0F50C750130 +:1036900002C3750000E501F5F0E50935F0F501E537 +:1036A00000F5F0E50A35F0F500E500F502E501F575 +:1036B00082E502F583E0F50D750103C3750000E5B1 +:1036C00001F5F0E50935F0F501E500F5F0E50A351D +:1036D000F0F500E500F502E501F582E502F583E08D +:1036E000F500C3E50BF5F0E50E45F0F501E50CF549 +:1036F000F0E50F45F0F509E50DF5F0E51045F0F5BD +:103700000AE500F5F0E51145F0F50C750B00C37501 +:103710000000E50BF5F0E51235F0F50BE500F5F0EE +:10372000E51335F0F500E501F503E500F502E50BDD +:10373000F582E502F583E503F0750B01C375000022 +:10374000E50BF5F0E51235F0F50BE500F5F0E513C6 +:1037500035F0F500E509F503E500F502E50BF58226 +:10376000E502F583E503F0750B02C3750000E50B78 +:10377000F5F0E51235F0F50BE500F5F0E51335F061 +:10378000F500E50AF503E500F502E50BF582E50233 +:10379000F583E503F0750B03C3750000E50BF5F049 +:1037A000E51235F0F50BE500F5F0E51335F0F50021 +:1037B000E50CF503E500F502E50BF582E502F5837E +:1037C000E503F0900008E582F512900008E583F526 +:1037D00013900008E582F509900008E583F50A7565 +:1037E0000100C3750000E501F5F0E50935F0F501CC +:1037F000E500F5F0E50A35F0F500E500F502E50134 +:10380000F582E502F583E0F50E750101C375000050 +:10381000E501F5F0E50935F0F501E500F5F0E50A1B +:1038200035F0F500E500F502E501F582E502F583E6 +:10383000E0F50F750102C3750000E501F5F0E5093B +:1038400035F0F501E500F5F0E50A35F0F500E500A5 +:10385000F502E501F582E502F583E0F51075010357 +:10386000C3750000E501F5F0E50935F0F501E50067 +:10387000F5F0E50A35F0F500E500F502E501F58221 +:10388000E502F583E0F51190000CE582F509900062 +:103890000CE583F50A750100C3750000E501F5F03C +:1038A000E50935F0F501E500F5F0E50A35F0F5003C +:1038B000E500F502E501F582E502F583E0F50B751B +:1038C0000101C3750000E501F5F0E50935F0F501EA +:1038D000E500F5F0E50A35F0F500E500F502E50153 +:1038E000F582E502F583E0F50C750102C375000071 +:1038F000E501F5F0E50935F0F501E500F5F0E50A3B +:1039000035F0F500E500F502E501F582E502F58305 +:10391000E0F50D750103C3750000E501F5F0E5095B +:1039200035F0F501E500F5F0E50A35F0F500E500C4 +:10393000F502E501F582E502F583E0F500C3E50B4C +:10394000F5F0E50E65F0F501E50CF5F0E50F65F035 +:10395000F509E50DF5F0E51065F0F50AE500F5F07F +:10396000E51165F0F50C750B00C3750000E50BF56E +:10397000F0E51235F0F50BE500F5F0E51335F0F55F +:1039800000E501F503E500F502E50BF582E502F53A +:1039900083E503F0750B01C3750000E50BF5F0E559 +:1039A0001235F0F50BE500F5F0E51335F0F500E51F +:1039B00009F503E500F502E50BF582E502F583E57F +:1039C00003F0750B02C3750000E50BF5F0E5123549 +:1039D000F0F50BE500F5F0E51335F0F500E50AF537 +:1039E00003E500F502E50BF582E502F583E503F05A +:1039F000750B03C3750000E50BF5F0E51235F0F526 +:103A00000BE500F5F0E51335F0F500E50CF503E501 +:103A100000F502E50BF582E502F583E503F0900081 +:103A200000E582F509900000E583F50A750100C301 +:103A3000750000E501F5F0E50935F0F501E500F563 +:103A4000F0E50A35F0F500E500F502E501F582E55F +:103A500002F583E0F51F750101C3750000E501F56E +:103A6000F0E50935F0F501E500F5F0E50A35F0F58A +:103A700000E500F502E501F582E502F583E0F51EBB +:103A8000750102C3750000E501F5F0E50935F0F5B3 +:103A900001E500F5F0E50A35F0F500E500F502E591 +:103AA00001F582E502F583E0F51D750103C375009C +:103AB00000E501F5F0E50935F0F501E500F5F0E583 +:103AC0000A35F0F500E500F502E501F582E502F5BD +:103AD00083E0F51C900004E582F509900004E5837D +:103AE000F50A750100C3750000E501F5F0E509353B +:103AF000F0F501E500F5F0E50A35F0F500E500F533 +:103B000002E501F582E502F583E0F51B750101C3CD +:103B1000750000E501F5F0E50935F0F501E500F582 +:103B2000F0E50A35F0F500E500F502E501F582E57E +:103B300002F583E0F51A750102C3750000E501F591 +:103B4000F0E50935F0F501E500F5F0E50A35F0F5A9 +:103B500000E500F502E501F582E502F583E0F519DF +:103B6000750103C3750000E501F5F0E50935F0F5D1 +:103B700001E500F5F0E50A35F0F500E500F502E5B0 +:103B800001F582E502F583E0F518121F1DE582F5C7 +:103B900002E583F503E500F504E501F505E502F529 +:103BA0000BE503F50CE504F50DE505F50E900000B9 +:103BB000E582F509900000E583F50A750100C375FB +:103BC0000000E501F5F0E50935F0F501E500F5F057 +:103BD000E50A35F0F500E50BF503E500F502E50132 +:103BE000F582E502F583E503F0750101C375000078 +:103BF000E501F5F0E50935F0F501E500F5F0E50A38 +:103C000035F0F500E50CF503E500F502E501F58278 +:103C1000E502F583E503F0750102C3750000E501D7 +:103C2000F5F0E50935F0F501E500F5F0E50A35F0C8 +:103C3000F500E50DF503E500F502E501F582E50285 +:103C4000F583E503F0750103C3750000E501F5F0A8 +:103C5000E50935F0F501E500F5F0E50A35F0F50088 +:103C6000E50EF503E500F502E501F582E502F583D1 +:103C7000E503F0900008E582F509900008E583F57A +:103C80000A750100C3750000E501F5F0E50935F09E +:103C9000F501E500F5F0E50A35F0F500E500F5027F +:103CA000E501F582E502F583E0F51F750101C375B5 +:103CB0000000E501F5F0E50935F0F501E500F5F066 +:103CC000E50A35F0F500E500F502E501F582E502CB +:103CD000F583E0F51E750102C3750000E501F5F0FE +:103CE000E50935F0F501E500F5F0E50A35F0F500F8 +:103CF000E500F502E501F582E502F583E0F51D75C5 +:103D00000103C3750000E501F5F0E50935F0F501A3 +:103D1000E500F5F0E50A35F0F500E500F502E5010E +:103D2000F582E502F583E0F51C90000CE582F509CB +:103D300090000CE583F50A750100C3750000E501EC +:103D4000F5F0E50935F0F501E500F5F0E50A35F0A7 +:103D5000F500E500F502E501F582E502F583E0F501 +:103D60001B750101C3750000E501F5F0E50935F0AB +:103D7000F501E500F5F0E50A35F0F500E500F5029E +:103D8000E501F582E502F583E0F51A750102C375D8 +:103D90000000E501F5F0E50935F0F501E500F5F085 +:103DA000E50A35F0F500E500F502E501F582E502EA +:103DB000F583E0F519750103C3750000E501F5F021 +:103DC000E50935F0F501E500F5F0E50A35F0F50017 +:103DD000E500F502E501F582E502F583E0F518124C +:103DE0001764E582F502E583F503E500F504E501D6 +:103DF000F505E502F50BE503F50CE504F50DE50524 +:103E0000F50E900008E582F509900008E583F50AB3 +:103E1000750100C3750000E501F5F0E50935F0F521 +:103E200001E500F5F0E50A35F0F500E50BF503E5F1 +:103E300000F502E501F582E502F583E503F0750181 +:103E400001C3750000E501F5F0E50935F0F501E580 +:103E500000F5F0E50A35F0F500E50CF503E500F5B1 +:103E600002E501F582E502F583E503F0750102C381 +:103E7000750000E501F5F0E50935F0F501E500F51F +:103E8000F0E50A35F0F500E50DF503E500F502E58E +:103E900001F582E502F583E503F0750103C37500C2 +:103EA00000E501F5F0E50935F0F501E500F5F0E58F +:103EB0000A35F0F500E50EF503E500F502E501F53C +:103EC00082E502F583E503F0900000E582F50E90AF +:103ED0000000E583F50F900004E582F509900004E9 +:103EE000E583F50A750100C3750000E501F5F0E50D +:103EF0000935F0F501E500F5F0E50A35F0F500E5E6 +:103F000000F502E501F582E502F583E0F50B7501A8 +:103F100001C3750000E501F5F0E50935F0F501E5AF +:103F200000F5F0E50A35F0F500E500F502E501F5EC +:103F300082E502F583E0F50C750102C3750000E52A +:103F400001F5F0E50935F0F501E500F5F0E50A3594 +:103F5000F0F500E500F502E501F582E502F583E004 +:103F6000F50D750103C3750000E501F5F0E50935B0 +:103F7000F0F501E500F5F0E50A35F0F500E500F5AE +:103F800002E501F582E502F583E0F509750100C35C +:103F9000750000E501F5F0E50E35F0F501E500F5F9 +:103FA000F0E50F35F0F500E50BF503E500F502E56A +:103FB00001F582E502F583E503F0750101C37500A3 +:103FC00000E501F5F0E50E35F0F501E500F5F0E569 +:103FD0000F35F0F500E50CF503E500F502E501F518 +:103FE00082E502F583E503F0750102C3750000E583 +:103FF00001F5F0E50E35F0F501E500F5F0E50F35DA +:10400000F0F500E50DF503E500F502E501F582E5C3 +:1040100002F583E503F0750103C3750000E501F5C2 +:10402000F0E50E35F0F501E500F5F0E50F35F0F5BA +:1040300000E509F503E500F502E501F582E502F585 +:1040400083E503F0900008E582F50E900008E58313 +:10405000F50F90000CE582F50990000CE583F50A58 +:10406000750100C3750000E501F5F0E50935F0F5CF +:1040700001E500F5F0E50A35F0F500E500F502E5AB +:1040800001F582E502F583E0F50B750101C37500CA +:1040900000E501F5F0E50935F0F501E500F5F0E59D +:1040A0000A35F0F500E500F502E501F582E502F5D7 +:1040B00083E0F50C750102C3750000E501F5F0E53C +:1040C0000935F0F501E500F5F0E50A35F0F500E514 +:1040D00000F502E501F582E502F583E0F50D7501D5 +:1040E00003C3750000E501F5F0E50935F0F501E5DC +:1040F00000F5F0E50A35F0F500E500F502E501F51B +:1041000082E502F583E0F509E50BF4F500E50CF432 +:10411000F501E50DF4F50BE509F4F50C750A00C39E +:10412000750900E50AF5F0E50E35F0F50AE509F543 +:10413000F0E50F35F0F509E500F503E509F502E5D1 +:104140000AF582E502F583E503F0750A01C37500FF +:1041500000E50AF5F0E50E35F0F50AE500F5F0E5C5 +:104160000F35F0F509E501F503E509F502E50AF576 +:1041700082E502F583E503F0750A02C3750000E5E8 +:104180000AF5F0E50E35F0F50AE500F5F0E50F3536 +:10419000F0F509E50BF503E509F502E50AF582E519 +:1041A00002F583E503F0750A03C3750000E50AF51F +:1041B000F0E50E35F0F50AE500F5F0E50F35F0F520 +:1041C00009E50CF503E509F502E50AF582E502F5D6 +:1041D00083E503F0900004E582F509900004E5838F +:1041E000F50A750100C3750000E501F5F0E5093534 +:1041F000F0F501E500F5F0E50A35F0F500E500F52C +:1042000002E501F582E502F583E0F51F750101C3C2 +:10421000750000E501F5F0E50935F0F501E500F57B +:10422000F0E50A35F0F500E500F502E501F582E577 +:1042300002F583E0F51E750102C3750000E501F586 +:10424000F0E50935F0F501E500F5F0E50A35F0F5A2 +:1042500000E500F502E501F582E502F583E0F51DD4 +:10426000750103C3750000E501F5F0E50935F0F5CA +:1042700001E500F5F0E50A35F0F500E500F502E5A9 +:1042800001F582E502F583E0F51C900008E582F572 +:1042900009900008E583F50A750100C3750000E583 +:1042A00001F5F0E50935F0F501E500F5F0E50A3531 +:1042B000F0F500E500F502E501F582E502F583E0A1 +:1042C000F51B750101C3750000E501F5F0E5093541 +:1042D000F0F501E500F5F0E50A35F0F500E500F54B +:1042E00002E501F582E502F583E0F51A750102C3E6 +:1042F000750000E501F5F0E50935F0F501E500F59B +:10430000F0E50A35F0F500E500F502E501F582E596 +:1043100002F583E0F519750103C3750000E501F5A9 +:10432000F0E50935F0F501E500F5F0E50A35F0F5C1 +:1043300000E500F502E501F582E502F583E0F518F8 +:10434000121277E582F502E583F503E500F504E551 +:1043500001F505E502F50BE503F50CE504F50DE5C2 +:1043600005F50E900000E582F509900000E583F563 +:104370000A750100C3750000E501F5F0E50935F0A7 +:10438000F501E500F5F0E50A35F0F500E50BF5037C +:10439000E500F502E501F582E502F583E503F07538 +:1043A0000101C3750000E501F5F0E50935F0F501FF +:1043B000E500F5F0E50A35F0F500E50CF503E5005C +:1043C000F502E501F582E502F583E503F0750102EA +:1043D000C3750000E501F5F0E50935F0F501E500EC +:1043E000F5F0E50A35F0F500E50DF503E500F50219 +:1043F000E501F582E502F583E503F0750103C37578 +:104400000000E501F5F0E50935F0F501E500F5F00E +:10441000E50A35F0F500E50EF503E500F502E501E6 +:10442000F582E502F583E503F0900004E582F509E5 +:10443000900004E583F50A750100C3750000E501ED +:10444000F5F0E50935F0F501E500F5F0E50A35F0A0 +:10445000F500E500F502E501F582E502F583E0F5FA +:104460001F750101C3750000E501F5F0E50935F0A0 +:10447000F501E500F5F0E50A35F0F500E500F50297 +:10448000E501F582E502F583E0F51E750102C375CD +:104490000000E501F5F0E50935F0F501E500F5F07E +:1044A000E50A35F0F500E500F502E501F582E502E3 +:1044B000F583E0F51D750103C3750000E501F5F016 +:1044C000E50935F0F501E500F5F0E50A35F0F50010 +:1044D000E500F502E501F582E502F583E0F51C90C3 +:1044E0000008E582F509900008E583F50A750100EA +:1044F000C3750000E501F5F0E50935F0F501E500CB +:10450000F5F0E50A35F0F500E500F502E501F58284 +:10451000E502F583E0F51B750101C3750000E501B7 +:10452000F5F0E50935F0F501E500F5F0E50A35F0BF +:10453000F500E500F502E501F582E502F583E0F519 +:104540001A750102C3750000E501F5F0E50935F0C3 +:10455000F501E500F5F0E50A35F0F500E500F502B6 +:10456000E501F582E502F583E0F519750103C375F0 +:104570000000E501F5F0E50935F0F501E500F5F09D +:10458000E50A35F0F500E500F502E501F582E50202 +:10459000F583E0F518121277E582F502E583F5035D +:1045A000E500F504E501F505E502F50BE503F50C7D +:1045B000E504F50DE505F50E900000E582F509909E +:1045C0000000E583F50A750100C3750000E501F5FB +:1045D000F0E50935F0F501E500F5F0E50A35F0F50F +:1045E00000E50BF503E500F502E501F582E502F5CE +:1045F00083E503F0750101C3750000E501F5F0E501 +:104600000935F0F501E500F5F0E50A35F0F500E5CE +:104610000CF503E500F502E501F582E502F583E519 +:1046200003F0750102C3750000E501F5F0E50935F9 +:10463000F0F501E500F5F0E50A35F0F500E50DF5DA +:1046400003E500F502E501F582E502F583E503F0F7 +:10465000750103C3750000E501F5F0E50935F0F5D6 +:1046600001E500F5F0E50A35F0F500E50EF503E5A6 +:1046700000F502E501F582E502F583E503F090001F +:104680000CE582F51290000CE583F513900008E527 +:1046900082F509900008E583F50A750100C37500ED +:1046A00000E501F5F0E50935F0F501E500F5F0E587 +:1046B0000A35F0F500E500F502E501F582E502F5C1 +:1046C00083E0F50E750101C3750000E501F5F0E525 +:1046D0000935F0F501E500F5F0E50A35F0F500E5FE +:1046E00000F502E501F582E502F583E0F50F7501BD +:1046F00002C3750000E501F5F0E50935F0F501E5C7 +:1047000000F5F0E50A35F0F500E500F502E501F504 +:1047100082E502F583E0F510750103C3750000E53D +:1047200001F5F0E50935F0F501E500F5F0E50A35AC +:10473000F0F500E500F502E501F582E502F583E01C +:10474000F511900004E582F509900004E583F50A6F +:10475000750100C3750000E501F5F0E50935F0F5D8 +:1047600001E500F5F0E50A35F0F500E500F502E5B4 +:1047700001F582E502F583E0F50B750101C37500D3 +:1047800000E501F5F0E50935F0F501E500F5F0E5A6 +:104790000A35F0F500E500F502E501F582E502F5E0 +:1047A00083E0F50C750102C3750000E501F5F0E545 +:1047B0000935F0F501E500F5F0E50A35F0F500E51D +:1047C00000F502E501F582E502F583E0F50D7501DE +:1047D00003C3750000E501F5F0E50935F0F501E5E5 +:1047E00000F5F0E50A35F0F500E500F502E501F524 +:1047F00082E502F583E0F500C3E50BF5F0E50E5523 +:10480000F0F501E50CF5F0E50F55F0F509E50DF5CE +:10481000F0E51055F0F50AE500F5F0E51155F0F575 +:104820000C750B00C3750000E50BF5F0E51235F0D3 +:10483000F50BE500F5F0E51335F0F500E501F503BE +:10484000E500F502E50BF582E502F583E503F07579 +:104850000B01C3750000E50BF5F0E51235F0F50B23 +:10486000E500F5F0E51335F0F500E509F503E500A1 +:10487000F502E50BF582E502F583E503F0750B0221 +:10488000C3750000E50BF5F0E51235F0F50BE5001A +:10489000F5F0E51335F0F500E50AF503E500F5025E +:1048A000E50BF582E502F583E503F0750B03C375AF +:1048B0000000E50BF5F0E51235F0F50BE500F5F03D +:1048C000E51335F0F500E50CF503E500F502E50B21 +:1048D000F582E502F583E503F0900000E582F5122C +:1048E000900000E583F513900004E582F50990003F +:1048F00004E583F50A750100C3750000E501F5F0D4 +:10490000E50935F0F501E500F5F0E50A35F0F500CB +:10491000E500F502E501F582E502F583E0F50E75A7 +:104920000101C3750000E501F5F0E50935F0F50179 +:10493000E500F5F0E50A35F0F500E500F502E501E2 +:10494000F582E502F583E0F50F750102C3750000FD +:10495000E501F5F0E50935F0F501E500F5F0E50ACA +:1049600035F0F500E500F502E501F582E502F58395 +:10497000E0F510750103C3750000E501F5F0E509E8 +:1049800035F0F501E500F5F0E50A35F0F500E50054 +:10499000F502E501F582E502F583E0F511900008E6 +:1049A000E582F509900008E583F50A750100C375F5 +:1049B0000000E501F5F0E50935F0F501E500F5F059 +:1049C000E50A35F0F500E500F502E501F582E502BE +:1049D000F583E0F50B750101C3750000E501F5F005 +:1049E000E50935F0F501E500F5F0E50A35F0F500EB +:1049F000E500F502E501F582E502F583E0F50C75C9 +:104A00000102C3750000E501F5F0E50935F0F50197 +:104A1000E500F5F0E50A35F0F500E500F502E50101 +:104A2000F582E502F583E0F50D750103C37500001D +:104A3000E501F5F0E50935F0F501E500F5F0E50AE9 +:104A400035F0F500E500F502E501F582E502F583B4 +:104A5000E0F500C3E50BF5F0E50E45F0F501E50CDA +:104A6000F5F0E50F45F0F509E50DF5F0E51045F039 +:104A7000F50AE500F5F0E51145F0F50C750B00C3FE +:104A8000750000E50BF5F0E51235F0F50BE500F5E6 +:104A9000F0E51335F0F500E501F503E500F502E575 +:104AA0000BF582E502F583E503F0750B01C3750094 +:104AB00000E50BF5F0E51235F0F50BE500F5F0E556 +:104AC0001335F0F500E509F503E500F502E50BF512 +:104AD00082E502F583E503F0750B02C3750000E57E +:104AE0000BF5F0E51235F0F50BE500F5F0E51335C3 +:104AF000F0F500E50AF503E500F502E50BF582E5C2 +:104B000002F583E503F0750B03C3750000E50BF5B3 +:104B1000F0E51235F0F50BE500F5F0E51335F0F5AD +:104B200000E50CF503E500F502E50BF582E502F57D +:104B300083E503F090000CE582F51290000CE5830C +:104B4000F513900008E582F509900008E583F50A61 +:104B5000750100C3750000E501F5F0E50935F0F5D4 +:104B600001E500F5F0E50A35F0F500E500F502E5B0 +:104B700001F582E502F583E0F50E750101C37500CC +:104B800000E501F5F0E50935F0F501E500F5F0E5A2 +:104B90000A35F0F500E500F502E501F582E502F5DC +:104BA00083E0F50F750102C3750000E501F5F0E53E +:104BB0000935F0F501E500F5F0E50A35F0F500E519 +:104BC00000F502E501F582E502F583E0F5107501D7 +:104BD00003C3750000E501F5F0E50935F0F501E5E1 +:104BE00000F5F0E50A35F0F500E500F502E501F520 +:104BF00082E502F583E0F511900004E582F5099065 +:104C00000004E583F50A750100C3750000E501F5B0 +:104C1000F0E50935F0F501E500F5F0E50A35F0F5C8 +:104C200000E500F502E501F582E502F583E0F50B0C +:104C3000750101C3750000E501F5F0E50935F0F5F2 +:104C400001E500F5F0E50A35F0F500E500F502E5CF +:104C500001F582E502F583E0F50C750102C37500EC +:104C600000E501F5F0E50935F0F501E500F5F0E5C1 +:104C70000A35F0F500E500F502E501F582E502F5FB +:104C800083E0F50D750103C3750000E501F5F0E55E +:104C90000935F0F501E500F5F0E50A35F0F500E538 +:104CA00000F502E501F582E502F583E0F500C3E5D4 +:104CB0000BF5F0E50E65F0F501E50CF5F0E50F6597 +:104CC000F0F509E50DF5F0E51065F0F50AE500F5FC +:104CD000F0E51165F0F50C750B00C3750000E50BF0 +:104CE000F5F0E51235F0F50BE500F5F0E51335F0DC +:104CF000F500E501F503E500F502E50BF582E502B7 +:104D0000F583E503F0750B01C3750000E50BF5F0C5 +:104D1000E51235F0F50BE500F5F0E51335F0F5009B +:104D2000E509F503E500F502E50BF582E502F583FB +:104D3000E503F0750B02C3750000E50BF5F0E51215 +:104D400035F0F50BE500F5F0E51335F0F500E50A73 +:104D5000F503E500F502E50BF582E502F583E503D1 +:104D6000F0750B03C3750000E50BF5F0E51235F0A7 +:104D7000F50BE500F5F0E51335F0F500E50CF5036E +:104D8000E500F502E50BF582E502F583E503F09019 +:104D90000004E582F509900004E583F50A75010039 +:104DA000C3750000E501F5F0E50935F0F501E50012 +:104DB000F5F0E50A35F0F500E500F502E501F582CC +:104DC000E502F583E0F51F750101C3750000E501FB +:104DD000F5F0E50935F0F501E500F5F0E50A35F007 +:104DE000F500E500F502E501F582E502F583E0F561 +:104DF0001E750102C3750000E501F5F0E50935F007 +:104E0000F501E500F5F0E50A35F0F500E500F502FD +:104E1000E501F582E502F583E0F51D750103C37533 +:104E20000000E501F5F0E50935F0F501E500F5F0E4 +:104E3000E50A35F0F500E500F502E501F582E50249 +:104E4000F583E0F51C900008E582F509900008E57F +:104E500083F50A750100C3750000E501F5F0E50969 +:104E600035F0F501E500F5F0E50A35F0F500E5006F +:104E7000F502E501F582E502F583E0F51B75010118 +:104E8000C3750000E501F5F0E50935F0F501E50031 +:104E9000F5F0E50A35F0F500E500F502E501F582EB +:104EA000E502F583E0F51A750102C3750000E5011E +:104EB000F5F0E50935F0F501E500F5F0E50A35F026 +:104EC000F500E500F502E501F582E502F583E0F580 +:104ED00019750103C3750000E501F5F0E50935F02A +:104EE000F501E500F5F0E50A35F0F500E500F5021D +:104EF000E501F582E502F583E0F518121F1DE58254 +:104F0000F502E583F503E500F504E501F505E502A5 +:104F1000F50BE503F50CE504F50DE505F50E900040 +:104F200000E582F509900000E583F50A750100C3EC +:104F3000750000E501F5F0E50935F0F501E500F54E +:104F4000F0E50A35F0F500E50BF503E500F502E5BF +:104F500001F582E502F583E503F0750101C37500F3 +:104F600000E501F5F0E50935F0F501E500F5F0E5BE +:104F70000A35F0F500E50CF503E500F502E501F56D +:104F800082E502F583E503F0750102C3750000E5D3 +:104F900001F5F0E50935F0F501E500F5F0E50A3534 +:104FA000F0F500E50DF503E500F502E501F582E514 +:104FB00002F583E503F0750103C3750000E501F513 +:104FC000F0E50935F0F501E500F5F0E50A35F0F515 +:104FD00000E50EF503E500F502E501F582E502F5D1 +:104FE00083E503F0900004E582F509900004E58371 +:104FF000F50A750100C3750000E501F5F0E5093516 +:10500000F0F501E500F5F0E50A35F0F500E500F50D +:1050100002E501F582E502F583E0F51F750101C3A4 +:10502000750000E501F5F0E50935F0F501E500F55D +:10503000F0E50A35F0F500E500F502E501F582E559 +:1050400002F583E0F51E750102C3750000E501F568 +:10505000F0E50935F0F501E500F5F0E50A35F0F584 +:1050600000E500F502E501F582E502F583E0F51DB6 +:10507000750103C3750000E501F5F0E50935F0F5AC +:1050800001E500F5F0E50A35F0F500E500F502E58B +:1050900001F582E502F583E0F51C900008E582F554 +:1050A00009900008E583F50A750100C3750000E565 +:1050B00001F5F0E50935F0F501E500F5F0E50A3513 +:1050C000F0F500E500F502E501F582E502F583E083 +:1050D000F51B750101C3750000E501F5F0E5093523 +:1050E000F0F501E500F5F0E50A35F0F500E500F52D +:1050F00002E501F582E502F583E0F51A750102C3C8 +:10510000750000E501F5F0E50935F0F501E500F57C +:10511000F0E50A35F0F500E500F502E501F582E578 +:1051200002F583E0F519750103C3750000E501F58B +:10513000F0E50935F0F501E500F5F0E50A35F0F5A3 +:1051400000E500F502E501F582E502F583E0F518DA +:10515000121F1DE582F502E583F503E500F504E580 +:1051600001F505E502F50BE503F50CE504F50DE5A4 +:1051700005F50E900000E582F509900000E583F545 +:105180000A750100C3750000E501F5F0E50935F089 +:10519000F501E500F5F0E50A35F0F500E50BF5035E +:1051A000E500F502E501F582E502F583E503F0751A +:1051B0000101C3750000E501F5F0E50935F0F501E1 +:1051C000E500F5F0E50A35F0F500E50CF503E5003E +:1051D000F502E501F582E502F583E503F0750102CC +:1051E000C3750000E501F5F0E50935F0F501E500CE +:1051F000F5F0E50A35F0F500E50DF503E500F502FB +:10520000E501F582E502F583E503F0750103C37559 +:105210000000E501F5F0E50935F0F501E500F5F0F0 +:10522000E50A35F0F500E50EF503E500F502E501C8 +:10523000F582E502F583E503F0900008E582F509C3 +:10524000900008E583F50A750100C3750000E501CB +:10525000F5F0E50935F0F501E500F5F0E50A35F082 +:10526000F500E500F502E501F582E502F583E0F5DC +:105270001F750101C3750000E501F5F0E50935F082 +:10528000F501E500F5F0E50A35F0F500E500F50279 +:10529000E501F582E502F583E0F51E750102C375AF +:1052A0000000E501F5F0E50935F0F501E500F5F060 +:1052B000E50A35F0F500E500F502E501F582E502C5 +:1052C000F583E0F51D750103C3750000E501F5F0F8 +:1052D000E50935F0F501E500F5F0E50A35F0F500F2 +:1052E000E500F502E501F582E502F583E0F51C90A5 +:1052F0000004E582F509900004E583F50A750100D4 +:10530000C3750000E501F5F0E50935F0F501E500AC +:10531000F5F0E50A35F0F500E500F502E501F58266 +:10532000E502F583E0F51B750101C3750000E50199 +:10533000F5F0E50935F0F501E500F5F0E50A35F0A1 +:10534000F500E500F502E501F582E502F583E0F5FB +:105350001A750102C3750000E501F5F0E50935F0A5 +:10536000F501E500F5F0E50A35F0F500E500F50298 +:10537000E501F582E502F583E0F519750103C375D2 +:105380000000E501F5F0E50935F0F501E500F5F07F +:10539000E50A35F0F500E500F502E501F582E502E4 +:1053A000F583E0F518121764E582F502E583F5034D +:1053B000E500F504E501F505E502F50BE503F50C5F +:1053C000E504F50DE505F50E90000CE582F5099074 +:1053D000000CE583F50A750100C3750000E501F5D1 +:1053E000F0E50935F0F501E500F5F0E50A35F0F5F1 +:1053F00000E50BF503E500F502E501F582E502F5B0 +:1054000083E503F0750101C3750000E501F5F0E5E2 +:105410000935F0F501E500F5F0E50A35F0F500E5B0 +:105420000CF503E500F502E501F582E502F583E5FB +:1054300003F0750102C3750000E501F5F0E50935DB +:10544000F0F501E500F5F0E50A35F0F500E50DF5BC +:1054500003E500F502E501F582E502F583E503F0D9 +:10546000750103C3750000E501F5F0E50935F0F5B8 +:1054700001E500F5F0E50A35F0F500E50EF503E588 +:1054800000F502E501F582E502F583E503F0900001 +:1054900008E582F509900008E583F50A750100C367 +:1054A000750000E501F5F0E50935F0F501E500F5D9 +:1054B000F0E50A35F0F500E500F502E501F582E5D5 +:1054C00002F583E0F51F750101C3750000E501F5E4 +:1054D000F0E50935F0F501E500F5F0E50A35F0F500 +:1054E00000E500F502E501F582E502F583E0F51E31 +:1054F000750102C3750000E501F5F0E50935F0F529 +:1055000001E500F5F0E50A35F0F500E500F502E506 +:1055100001F582E502F583E0F51D750103C3750011 +:1055200000E501F5F0E50935F0F501E500F5F0E5F8 +:105530000A35F0F500E500F502E501F582E502F532 +:1055400083E0F51C900004E582F509900004E583F2 +:10555000F50A750100C3750000E501F5F0E50935B0 +:10556000F0F501E500F5F0E50A35F0F500E500F5A8 +:1055700002E501F582E502F583E0F51B750101C343 +:10558000750000E501F5F0E50935F0F501E500F5F8 +:10559000F0E50A35F0F500E500F502E501F582E5F4 +:1055A00002F583E0F51A750102C3750000E501F507 +:1055B000F0E50935F0F501E500F5F0E50A35F0F51F +:1055C00000E500F502E501F582E502F583E0F51955 +:1055D000750103C3750000E501F5F0E50935F0F547 +:1055E00001E500F5F0E50A35F0F500E500F502E526 +:1055F00001F582E502F583E0F518121764E582F5FE +:1056000002E583F503E500F504E501F505E502F59E +:105610000BE503F50CE504F50DE505F50E90000C22 +:10562000E582F50990000CE583F50A750100C37564 +:105630000000E501F5F0E50935F0F501E500F5F0CC +:10564000E50A35F0F500E50BF503E500F502E501A7 +:10565000F582E502F583E503F0750101C3750000ED +:10566000E501F5F0E50935F0F501E500F5F0E50AAD +:1056700035F0F500E50CF503E500F502E501F582EE +:10568000E502F583E503F0750102C3750000E5014D +:10569000F5F0E50935F0F501E500F5F0E50A35F03E +:1056A000F500E50DF503E500F502E501F582E502FB +:1056B000F583E503F0750103C3750000E501F5F01E +:1056C000E50935F0F501E500F5F0E50A35F0F500FE +:1056D000E50EF503E500F502E501F582E502F58347 +:1056E000E503F0750000E500F502E500F503E500CF +:1056F000F504E500F50575E0052506F58275E00081 +:105700003507F583E0F51375E0042506F58275E0AD +:10571000003507F583E0F51275E0032506F582757F +:10572000E0003507F583E0F51175E0022506F58206 +:1057300075E0003507F583E0F51075E0002506F506 +:105740008275E0003507F583E0F508E508C0E075EF +:10575000E0012506F58275E0003507F583E0F508E0 +:10576000E508C0E075E0062506F50675E00035079A +:10577000F507E502F582E503F583E504F500E505A7 +:10578000F501220000000000000000000000000001 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/simd-1b.s.expected b/tests/GCCTestSuite/simd-1b.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/simd-1b.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/simd-3.c b/tests/GCCTestSuite/simd-3.c new file mode 100644 index 0000000..34ad75d --- /dev/null +++ b/tests/GCCTestSuite/simd-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-maltivec" { target powerpc-*-* } } */ + +__attribute__ ((vector_size (2))) signed char v1, v2, v3; +void +one (void) +{ + v1 = v2 + v3; +} + +__attribute__ ((vector_size (8))) signed char v4, v5, v6; +void +two (void) +{ + v4 = v5 + v6; +} diff --git a/tests/GCCTestSuite/simd-3.c.expected b/tests/GCCTestSuite/simd-3.c.expected new file mode 100644 index 0000000..34ad75d --- /dev/null +++ b/tests/GCCTestSuite/simd-3.c.expected @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-maltivec" { target powerpc-*-* } } */ + +__attribute__ ((vector_size (2))) signed char v1, v2, v3; +void +one (void) +{ + v1 = v2 + v3; +} + +__attribute__ ((vector_size (8))) signed char v4, v5, v6; +void +two (void) +{ + v4 = v5 + v6; +} diff --git a/tests/GCCTestSuite/simd-3.hex.expected b/tests/GCCTestSuite/simd-3.hex.expected new file mode 100644 index 0000000..27fcf56 --- /dev/null +++ b/tests/GCCTestSuite/simd-3.hex.expected @@ -0,0 +1,33 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F900000E582F50C900000E583F50D904F +:100020000001E582F509900001E583F50A750100FC +:10003000C3750000E501F5F0E50935F0F501E500CF +:10004000F5F0E50A35F0F500E500F502E501F58289 +:10005000E502F583E0F50B900002E582F5099000DA +:1000600002E583F50A750100C3750000E501F5F0AE +:10007000E50935F0F501E500F5F0E50A35F0F500A4 +:10008000E500F502E501F582E502F583E0F500C340 +:10009000750100E500F5F0E50B35F0F50975010097 +:1000A000C3750000E501F5F0E50C35F0F501E5005C +:1000B000F5F0E50D35F0F500E509F503E500F5028D +:1000C000E501F582E502F583E503F0750000E50042 +:1000D000F502E500F503E500F504E500F505E50E9C +:1000E000F511E50FF510E519C0E0E518C0E0E502EF +:1000F000F582E503F583E504F500E505F501220049 +:10010000D0E0F518D0E0F519E511F50EE510F50F82 +:10011000900003E582F50C900003E583F50D900057 +:1001200004E582F509900004E583F50A750100C332 +:10013000750000E501F5F0E50935F0F501E500F59C +:10014000F0E50A35F0F500E500F502E501F582E598 +:1001500002F583E0F50B900005E582F509900005B6 +:10016000E583F50A750100C3750000E501F5F0E5CA +:100170000935F0F501E500F5F0E50A35F0F500E5A3 +:1001800000F502E501F582E502F583E0F500C375AF +:100190000100E500F5F0E50B35F0F509750100C348 +:1001A000750000E501F5F0E50C35F0F501E500F529 +:1001B000F0E50D35F0F500E509F503E500F502E59C +:1001C00001F582E502F583E503F0750000E500F531 +:1001D00002E500F503E500F504E500F505E50EF59B +:1001E00011E50FF510E519C0E0E518C0E0E502F5EE +:1001F00082E503F583E504F500E505F5012200003D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/simd-3.s.expected b/tests/GCCTestSuite/simd-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/simd-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/sparc-constant-1.c b/tests/GCCTestSuite/sparc-constant-1.c new file mode 100644 index 0000000..bb4b1bc --- /dev/null +++ b/tests/GCCTestSuite/sparc-constant-1.c @@ -0,0 +1,12 @@ +/* PR optimization/10876 */ +/* { dg-do compile { target sparc*-*-* } } */ + +/* Verify that adding the constant 4096 is turned + into substracting the constant -4096. */ + +int foo(int a) +{ + return a+4096; +} + +/* { dg-final { scan-assembler "sub" } } */ diff --git a/tests/GCCTestSuite/sparc-constant-1.c.expected b/tests/GCCTestSuite/sparc-constant-1.c.expected new file mode 100644 index 0000000..bb4b1bc --- /dev/null +++ b/tests/GCCTestSuite/sparc-constant-1.c.expected @@ -0,0 +1,12 @@ +/* PR optimization/10876 */ +/* { dg-do compile { target sparc*-*-* } } */ + +/* Verify that adding the constant 4096 is turned + into substracting the constant -4096. */ + +int foo(int a) +{ + return a+4096; +} + +/* { dg-final { scan-assembler "sub" } } */ diff --git a/tests/GCCTestSuite/sparc-constant-1.hex.expected b/tests/GCCTestSuite/sparc-constant-1.hex.expected new file mode 100644 index 0000000..463f762 --- /dev/null +++ b/tests/GCCTestSuite/sparc-constant-1.hex.expected @@ -0,0 +1,12 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F50ED0E0F50FE512F50B6E +:10002000E511F50CE510F50D750000750110750969 +:1000300000750A00C3751000E500F5F0E51F35F006 +:10004000F500E501F5F0E51E35F0F501E509F5F0FF +:10005000E51D35F0F509E50AF5F0E51C35F0F50A82 +:10006000E500F502E501F503E509F504E50AF50506 +:10007000E50BF512E50CF511E50DF510E50FC0E007 +:10008000E50EC0E075E0042506F50675E0003507CD +:10009000F507E502F582E503F583E504F500E505DE +:1000A000F501220000000000000000000000000038 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/sparc-constant-1.s.expected b/tests/GCCTestSuite/sparc-constant-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/sparc-constant-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-empty-1.c b/tests/GCCTestSuite/struct-empty-1.c new file mode 100644 index 0000000..7797465 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-1.c @@ -0,0 +1,10 @@ +/* Test diagnostics for empty structures and unions. Test with no + special options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s0 {}; +union u0 {}; +struct s1 { int : 1; }; +union u1 { int : 1; }; diff --git a/tests/GCCTestSuite/struct-empty-1.c.expected b/tests/GCCTestSuite/struct-empty-1.c.expected new file mode 100644 index 0000000..7797465 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-1.c.expected @@ -0,0 +1,10 @@ +/* Test diagnostics for empty structures and unions. Test with no + special options. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s0 {}; +union u0 {}; +struct s1 { int : 1; }; +union u1 { int : 1; }; diff --git a/tests/GCCTestSuite/struct-empty-1.hex.expected b/tests/GCCTestSuite/struct-empty-1.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-1.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-empty-1.s.expected b/tests/GCCTestSuite/struct-empty-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-empty-2.c b/tests/GCCTestSuite/struct-empty-2.c new file mode 100644 index 0000000..132ef45 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-2.c @@ -0,0 +1,10 @@ +/* Test diagnostics for empty structures and unions. Test with + -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +struct s0 {}; /* { dg-warning "warning: struct has no members" } */ +union u0 {}; /* { dg-warning "warning: union has no members" } */ +struct s1 { int : 1; }; /* { dg-warning "warning: struct has no named members" } */ +union u1 { int : 1; }; /* { dg-warning "warning: union has no named members" } */ diff --git a/tests/GCCTestSuite/struct-empty-2.c.expected b/tests/GCCTestSuite/struct-empty-2.c.expected new file mode 100644 index 0000000..132ef45 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-2.c.expected @@ -0,0 +1,10 @@ +/* Test diagnostics for empty structures and unions. Test with + -pedantic. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +struct s0 {}; /* { dg-warning "warning: struct has no members" } */ +union u0 {}; /* { dg-warning "warning: union has no members" } */ +struct s1 { int : 1; }; /* { dg-warning "warning: struct has no named members" } */ +union u1 { int : 1; }; /* { dg-warning "warning: union has no named members" } */ diff --git a/tests/GCCTestSuite/struct-empty-2.hex.expected b/tests/GCCTestSuite/struct-empty-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-empty-2.s.expected b/tests/GCCTestSuite/struct-empty-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-empty-3.c b/tests/GCCTestSuite/struct-empty-3.c new file mode 100644 index 0000000..b9285c0 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-3.c @@ -0,0 +1,10 @@ +/* Test diagnostics for empty structures and unions. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +struct s0 {}; /* { dg-error "error: struct has no members" } */ +union u0 {}; /* { dg-error "error: union has no members" } */ +struct s1 { int : 1; }; /* { dg-error "error: struct has no named members" } */ +union u1 { int : 1; }; /* { dg-error "error: union has no named members" } */ diff --git a/tests/GCCTestSuite/struct-empty-3.c.expected b/tests/GCCTestSuite/struct-empty-3.c.expected new file mode 100644 index 0000000..b9285c0 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-3.c.expected @@ -0,0 +1,10 @@ +/* Test diagnostics for empty structures and unions. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +struct s0 {}; /* { dg-error "error: struct has no members" } */ +union u0 {}; /* { dg-error "error: union has no members" } */ +struct s1 { int : 1; }; /* { dg-error "error: struct has no named members" } */ +union u1 { int : 1; }; /* { dg-error "error: union has no named members" } */ diff --git a/tests/GCCTestSuite/struct-empty-3.hex.expected b/tests/GCCTestSuite/struct-empty-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-empty-3.s.expected b/tests/GCCTestSuite/struct-empty-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/struct-empty-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-ret-2.c b/tests/GCCTestSuite/struct-ret-2.c new file mode 100644 index 0000000..0d9b86f --- /dev/null +++ b/tests/GCCTestSuite/struct-ret-2.c @@ -0,0 +1,15 @@ +/* Simplified by Alexandre Oliva + from bug report by Helmut Jarausch + + Copyright (C) 1999 Free Software Foundation */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -w" } */ + +struct { + unsigned i[4]; +} foo() {} + +void bar() { + foo(); +} diff --git a/tests/GCCTestSuite/struct-ret-2.c.expected b/tests/GCCTestSuite/struct-ret-2.c.expected new file mode 100644 index 0000000..0d9b86f --- /dev/null +++ b/tests/GCCTestSuite/struct-ret-2.c.expected @@ -0,0 +1,15 @@ +/* Simplified by Alexandre Oliva + from bug report by Helmut Jarausch + + Copyright (C) 1999 Free Software Foundation */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -w" } */ + +struct { + unsigned i[4]; +} foo() {} + +void bar() { + foo(); +} diff --git a/tests/GCCTestSuite/struct-ret-2.hex.expected b/tests/GCCTestSuite/struct-ret-2.hex.expected new file mode 100644 index 0000000..2d47535 --- /dev/null +++ b/tests/GCCTestSuite/struct-ret-2.hex.expected @@ -0,0 +1,19 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0022506F50675E0C8 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F5012200E506758212C39582F5DB +:1000600006E5077583009583F507D0E0F50875E090 +:10007000112506F58275E0003507F583E508F0D017 +:10008000E0F50875E0102506F58275E0003507F506 +:1000900083E508F0E506F509E507F50A750100C3F3 +:1000A000750000E501F5F0E50935F0F501E500F52D +:1000B000F0E50A35F0F500E501F51FE500F51E1243 +:1000C0000000750000E500F502E500F503E500F528 +:1000D00004E500F50575E0102506F58275E00035AC +:1000E00007F583E0F508E508C0E075E0112506F5A1 +:1000F0008275E0003507F583E0F508E508C0E07596 +:10010000E0122506F50675E0003507F507E502F56E +:1001100082E503F583E504F500E505F5012200001D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/struct-ret-2.s.expected b/tests/GCCTestSuite/struct-ret-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/struct-ret-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/switch-1.c b/tests/GCCTestSuite/switch-1.c new file mode 100644 index 0000000..457c520 --- /dev/null +++ b/tests/GCCTestSuite/switch-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target rs6000-*-linux* powerpc-*-linux*} } */ +/* { dg-options "-fpic -O2" } */ + +void f (char *s) +{ + for (;;) + { + int t = 6; + switch (t) + { + case 2: + *s = '2'; + case 6: case 4: case 3: case 1: + break; + } + } +} diff --git a/tests/GCCTestSuite/switch-1.c.expected b/tests/GCCTestSuite/switch-1.c.expected new file mode 100644 index 0000000..457c520 --- /dev/null +++ b/tests/GCCTestSuite/switch-1.c.expected @@ -0,0 +1,17 @@ +/* { dg-do compile { target rs6000-*-linux* powerpc-*-linux*} } */ +/* { dg-options "-fpic -O2" } */ + +void f (char *s) +{ + for (;;) + { + int t = 6; + switch (t) + { + case 2: + *s = '2'; + case 6: case 4: case 3: case 1: + break; + } + } +} diff --git a/tests/GCCTestSuite/switch-1.hex.expected b/tests/GCCTestSuite/switch-1.hex.expected new file mode 100644 index 0000000..a59d492 --- /dev/null +++ b/tests/GCCTestSuite/switch-1.hex.expected @@ -0,0 +1,129 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F519D0E0F51AE510F5184D +:10002000750001750100750900750A00750C01C3A2 +:10003000750B00E500F5F0E50B95F0F50B750B0081 +:10004000E50BF5F0E50B35F0F50BE50BF5F0E50C00 +:1000500065F0F50CC3750B00E501F5F0E50B95F0C7 +:10006000F50B750B00E50BF5F0E50B35F0F50BE541 +:100070000BF5F0E50C65F0F50CC3750B00E509F523 +:10008000F0E50B95F0F50B750B00E50BF5F0E50BC6 +:1000900035F0F50BE50BF5F0E50C65F0F50CC375E7 +:1000A0000B00E50AF5F0E50B95F0F50B750B00E597 +:1000B0000BF5F0E50B35F0F50BE50BF5F0E50C6510 +:1000C000F0F50C750100750900750A00750000E572 +:1000D0000CF5F0E50045F0F500E501F5F0E500452B +:1000E000F0F500E509F5F0E50045F0F500E50AF565 +:1000F000F0E50045F0F500E500700280030207B569 +:1001000000750D06750E00750F0075100075000264 +:10011000750100750900750A00750C00C3E500F54E +:10012000F0E50D95F0F500E500F5F0E50C45F0F58E +:100130000CC3E501F5F0E50E95F0F500E500F5F0EE +:10014000E50C45F0F50CC3E509F5F0E50F95F0F584 +:1001500000E500F5F0E50C45F0F50CC3E50AF5F017 +:10016000E51095F0F500E500F5F0E50C45F0F50C2F +:10017000750100750900750A00E50CF500750C01A4 +:10018000C3750B00E500F5F0E50B95F0F50B750B6D +:1001900000E50BF5F0E50B35F0F50BE50BF5F0E5BB +:1001A0000C65F0F50CC3750B00E501F5F0E50B955A +:1001B000F0F50B750B00E50BF5F0E50B35F0F50BE5 +:1001C000E50BF5F0E50C65F0F50CC3750B00E509E2 +:1001D000F5F0E50B95F0F50B750B00E50BF5F0E58B +:1001E0000B35F0F50BE50BF5F0E50C65F0F50CC300 +:1001F000750B00E50AF5F0E50B95F0F50B750B00B6 +:10020000E50BF5F0E50B35F0F50BE50BF5F0E50C3E +:1002100065F0F50C750100750900750A00750000A0 +:10022000E50CF5F0E50045F0F500E501F5F0E50039 +:1002300045F0F500E509F5F0E50045F0F500E50AC3 +:10024000F5F0E50045F0F500E500700280030207D7 +:100250007F00750006750100750900750A00750CB0 +:1002600000C3E500F5F0E50D95F0F500E500F5F0CB +:10027000E50C45F0F50CC3E501F5F0E50E95F0F55C +:1002800000E500F5F0E50C45F0F50CC3E509F5F0E7 +:10029000E50F95F0F500E500F5F0E50C45F0F50CFF +:1002A000C3E50AF5F0E51095F0F500E500F5F0E599 +:1002B0000C45F0F50C750100750900750A00E50C98 +:1002C000F500750C01C3750B00E500F5F0E50B9525 +:1002D000F0F50B750B00E50BF5F0E50B35F0F50BC4 +:1002E000E50BF5F0E50C65F0F50CC3750B00E501C9 +:1002F000F5F0E50B95F0F50B750B00E50BF5F0E56A +:100300000B35F0F50BE50BF5F0E50C65F0F50CC3DE +:10031000750B00E509F5F0E50B95F0F50B750B0095 +:10032000E50BF5F0E50B35F0F50BE50BF5F0E50C1D +:1003300065F0F50CC3750B00E50AF5F0E50B95F0DB +:10034000F50B750B00E50BF5F0E50B35F0F50BE55E +:100350000BF5F0E50C65F0F50C75010075090075FD +:100360000A00750000E50CF5F0E50045F0F500E544 +:1003700001F5F0E50045F0F500E509F5F0E500458B +:10038000F0F500E50AF5F0E50045F0F500E5007050 +:1003900002800302077A00750004750100750900E8 +:1003A000750A00750C00C3E500F5F0E50D95F0F554 +:1003B00000E500F5F0E50C45F0F50CC3E501F5F0BE +:1003C000E50E95F0F500E500F5F0E50C45F0F50CCF +:1003D000C3E509F5F0E50F95F0F500E500F5F0E56A +:1003E0000C45F0F50CC3E50AF5F0E51095F0F500C5 +:1003F000E500F5F0E50C45F0F50C75010075090018 +:10040000750A00E50CF500750C01C3750B00E500DD +:10041000F5F0E50B95F0F50B750B00E50BF5F0E548 +:100420000B35F0F50BE50BF5F0E50C65F0F50CC3BD +:10043000750B00E501F5F0E50B95F0F50B750B007C +:10044000E50BF5F0E50B35F0F50BE50BF5F0E50CFC +:1004500065F0F50CC3750B00E509F5F0E50B95F0BB +:10046000F50B750B00E50BF5F0E50B35F0F50BE53D +:100470000BF5F0E50C65F0F50CC3750B00E50AF51E +:10048000F0E50B95F0F50B750B00E50BF5F0E50BC2 +:1004900035F0F50BE50BF5F0E50C65F0F50C7501A5 +:1004A00000750900750A00750000E50CF5F0E5001F +:1004B00045F0F500E501F5F0E50045F0F500E5094A +:1004C000F5F0E50045F0F500E50AF5F0E50045F04A +:1004D000F500E500700280030207750075000375E2 +:1004E0000100750900750A00750C00C3E500F5F000 +:1004F000E50D95F0F500E500F5F0E50C45F0F50C9F +:10050000C3E501F5F0E50E95F0F500E500F5F0E541 +:100510000C45F0F50CC3E509F5F0E50F95F0F50095 +:10052000E500F5F0E50C45F0F50CC3E50AF5F0E55E +:100530001095F0F500E500F5F0E50C45F0F50C75CB +:100540000100750900750A00E50CF500750C01C382 +:10055000750B00E500F5F0E50B95F0F50B750B005C +:10056000E50BF5F0E50B35F0F50BE50BF5F0E50CDB +:1005700065F0F50CC3750B00E501F5F0E50B95F0A2 +:10058000F50B750B00E50BF5F0E50B35F0F50BE51C +:100590000BF5F0E50C65F0F50CC3750B00E509F5FE +:1005A000F0E50B95F0F50B750B00E50BF5F0E50BA1 +:1005B00035F0F50BE50BF5F0E50C65F0F50CC375C2 +:1005C0000B00E50AF5F0E50B95F0F50B750B00E572 +:1005D0000BF5F0E50B35F0F50BE50BF5F0E50C65EB +:1005E000F0F50C750100750900750A00750000E54D +:1005F0000CF5F0E50045F0F500E501F5F0E5004506 +:10060000F0F500E509F5F0E50045F0F500E50AF53F +:10061000F0E50045F0F500E5007002800302077088 +:1006200000750001750100750900750A00750B0061 +:10063000C3E500F5F0E50D95F0F500E500F5F0E512 +:100640000B45F0F50BC3E501F5F0E50E95F0F5006F +:10065000E500F5F0E50B45F0F50BC3E509F5F0E530 +:100660000F95F0F500E500F5F0E50B45F0F50BC34F +:10067000E50AF5F0E51095F0F500E500F5F0E50B7D +:1006800045F0F50B750100750900750A00E50BF5DD +:1006900000750B01C3750C00E500F5F0E50C95F055 +:1006A000F50C750C00E50CF5F0E50C35F0F50CE5F6 +:1006B0000CF5F0E50B65F0F50BC3750C00E501F5E5 +:1006C000F0E50C95F0F50C750C00E50CF5F0E50C7B +:1006D00035F0F50CE50CF5F0E50B65F0F50BC375A1 +:1006E0000C00E509F5F0E50C95F0F50C750C00E54E +:1006F0000CF5F0E50C35F0F50CE50CF5F0E50B65C7 +:10070000F0F50BC3750C00E50AF5F0E50C95F0F576 +:100710000C750C00E50CF5F0E50C35F0F50CE50C6E +:10072000F5F0E50B65F0F50B750100750900750A2C +:1007300000750000E50BF5F0E50045F0F500E5017A +:10074000F5F0E50045F0F500E509F5F0E50045F0C8 +:10075000F500E50AF5F0E50045F0F500E50070026A +:10076000800302076B000000020020000002076700 +:10077000000002076C00000207710000020776000B +:1007800000750932750100C3750000E501F5F0E55B +:100790001F35F0F501E500F5F0E51E35F0F500E553 +:1007A00009F503E500F502E501F582E502F583E5CB +:1007B00003F002077B00750000E500F502E500F597 +:1007C00003E500F504E500F505E518F510E51AC0A8 +:1007D000E0E519C0E075E0022506F50675E0003594 +:1007E00007F507E502F582E503F583E504F500E585 +:1007F00005F50122000000000000000000000000DC +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/switch-1.s.expected b/tests/GCCTestSuite/switch-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/switch-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/switch-4.c b/tests/GCCTestSuite/switch-4.c new file mode 100644 index 0000000..f2d8530 --- /dev/null +++ b/tests/GCCTestSuite/switch-4.c @@ -0,0 +1,24 @@ +/* PR middle-end/17657 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern signed char foo(int); + +void bar (void) +{ + signed char tmp = foo (0); + int t1 = tmp; + switch (t1) + { + case 1: foo (1); break; + case 2: foo (2); break; + case 3: foo (3); break; + case 4: foo (4); break; + case 5: foo (5); break; + case 6: foo (6); break; + case 7: foo (7); break; + case 255: foo (8); break; + default: break; + } +} + diff --git a/tests/GCCTestSuite/switch-4.c.expected b/tests/GCCTestSuite/switch-4.c.expected new file mode 100644 index 0000000..f2d8530 --- /dev/null +++ b/tests/GCCTestSuite/switch-4.c.expected @@ -0,0 +1,24 @@ +/* PR middle-end/17657 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern signed char foo(int); + +void bar (void) +{ + signed char tmp = foo (0); + int t1 = tmp; + switch (t1) + { + case 1: foo (1); break; + case 2: foo (2); break; + case 3: foo (3); break; + case 4: foo (4); break; + case 5: foo (5); break; + case 6: foo (6); break; + case 7: foo (7); break; + case 255: foo (8); break; + default: break; + } +} + diff --git a/tests/GCCTestSuite/switch-4.hex.expected b/tests/GCCTestSuite/switch-4.hex.expected new file mode 100644 index 0000000..8c635f2 --- /dev/null +++ b/tests/GCCTestSuite/switch-4.hex.expected @@ -0,0 +1,188 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0022506F58275E0003507F583E510F03E +:10005000751F00751E00751D00751C00E582F502F8 +:10006000E502F50D750080E50DF5F0E50055F0F5BC +:1000700010E500F5F0E51084F5107500FFE500F5DA +:10008000F0E510A4F510E510F50EE510F50F75007C +:1000900001750100750900750A00750C00C3E500C3 +:1000A000F5F0E50D95F0F500E500F5F0E50C45F00F +:1000B000F50CC3E501F5F0E50E95F0F500E500F56A +:1000C000F0E50C45F0F50CC3E509F5F0E50F95F00A +:1000D000F500E500F5F0E50C45F0F50CC3E50AF593 +:1000E000F0E51095F0F500E500F5F0E50C45F0F5CC +:1000F0000C750100750900750A00E50CF500750C1A +:1001000001C3750B00E500F5F0E50B95F0F50B75F7 +:100110000B00E50BF5F0E50B35F0F50BE50BF5F015 +:10012000E50C65F0F50CC3750B00E501F5F0E50B8A +:1001300095F0F50B750B00E50BF5F0E50B35F0F5DB +:100140000BE50BF5F0E50C65F0F50CC3750B00E560 +:1001500009F5F0E50B95F0F50B750B00E50BF5F0E7 +:10016000E50B35F0F50BE50BF5F0E50C65F0F50C5E +:10017000C3750B00E50AF5F0E50B95F0F50B750B73 +:1001800000E50BF5F0E50B35F0F50BE50BF5F0E5CB +:100190000C65F0F50C750100750900750A00750015 +:1001A00000E50CF5F0E50045F0F500E501F5F0E5BA +:1001B0000045F0F500E509F5F0E50045F0F500E54E +:1001C0000AF5F0E50045F0F500E500700280030255 +:1001D0000B9C00750002750100750900750A007519 +:1001E0000C00C3E500F5F0E50D95F0F500E500F530 +:1001F000F0E50C45F0F50CC3E501F5F0E50E95F0E2 +:10020000F500E500F5F0E50C45F0F50CC3E509F562 +:10021000F0E50F95F0F500E500F5F0E50C45F0F59B +:100220000CC3E50AF5F0E51095F0F500E500F5F0F2 +:10023000E50C45F0F50C750100750900750A00E53F +:100240000CF500750C01C3750B00E500F5F0E50B2E +:1002500095F0F50B750B00E50BF5F0E50B35F0F5BA +:100260000BE50BF5F0E50C65F0F50CC3750B00E53F +:1002700001F5F0E50B95F0F50B750B00E50BF5F0CE +:10028000E50B35F0F50BE50BF5F0E50C65F0F50C3D +:10029000C3750B00E509F5F0E50B95F0F50B750B53 +:1002A00000E50BF5F0E50B35F0F50BE50BF5F0E5AA +:1002B0000C65F0F50CC3750B00E50AF5F0E50B9540 +:1002C000F0F50B750B00E50BF5F0E50B35F0F50BD4 +:1002D000E50BF5F0E50C65F0F50C7501007509000E +:1002E000750A00750000E50CF5F0E50045F0F50035 +:1002F000E501F5F0E50045F0F500E509F5F0E5006C +:1003000045F0F500E50AF5F0E50045F0F500E500FB +:1003100070028003020B8B007500037501007509E4 +:1003200000750A00750C00C3E500F5F0E50D95F0C9 +:10033000F500E500F5F0E50C45F0F50CC3E501F539 +:10034000F0E50E95F0F500E500F5F0E50C45F0F56B +:100350000CC3E509F5F0E50F95F0F500E500F5F0C3 +:10036000E50C45F0F50CC3E50AF5F0E51095F0F560 +:1003700000E500F5F0E50C45F0F50C750100750998 +:1003800000750A00E50CF500750C01C3750B00E55E +:1003900000F5F0E50B95F0F50B750B00E50BF5F0AE +:1003A000E50B35F0F50BE50BF5F0E50C65F0F50C1C +:1003B000C3750B00E501F5F0E50B95F0F50B750B3A +:1003C00000E50BF5F0E50B35F0F50BE50BF5F0E589 +:1003D0000C65F0F50CC3750B00E509F5F0E50B9520 +:1003E000F0F50B750B00E50BF5F0E50B35F0F50BB3 +:1003F000E50BF5F0E50C65F0F50CC3750B00E50AAF +:10040000F5F0E50B95F0F50B750B00E50BF5F0E558 +:100410000B35F0F50BE50BF5F0E50C65F0F50C751B +:100420000100750900750A00750000E50CF5F0E59E +:100430000045F0F500E501F5F0E50045F0F500E5D3 +:1004400009F5F0E50045F0F500E50AF5F0E50045B1 +:10045000F0F500E50070028003020B7A00750004DD +:10046000750100750900750A00750C00C3E500F5FB +:10047000F0E50D95F0F500E500F5F0E50C45F0F53B +:100480000CC3E501F5F0E50E95F0F500E500F5F09B +:10049000E50C45F0F50CC3E509F5F0E50F95F0F531 +:1004A00000E500F5F0E50C45F0F50CC3E50AF5F0C4 +:1004B000E51095F0F500E500F5F0E50C45F0F50CDC +:1004C000750100750900750A00E50CF500750C0151 +:1004D000C3750B00E500F5F0E50B95F0F50B750B1A +:1004E00000E50BF5F0E50B35F0F50BE50BF5F0E568 +:1004F0000C65F0F50CC3750B00E501F5F0E50B9507 +:10050000F0F50B750B00E50BF5F0E50B35F0F50B91 +:10051000E50BF5F0E50C65F0F50CC3750B00E5098E +:10052000F5F0E50B95F0F50B750B00E50BF5F0E537 +:100530000B35F0F50BE50BF5F0E50C65F0F50CC3AC +:10054000750B00E50AF5F0E50B95F0F50B750B0062 +:10055000E50BF5F0E50B35F0F50BE50BF5F0E50CEB +:1005600065F0F50C750100750900750A007500004D +:10057000E50CF5F0E50045F0F500E501F5F0E500E6 +:1005800045F0F500E509F5F0E50045F0F500E50A70 +:10059000F5F0E50045F0F500E50070028003020B80 +:1005A0006900750005750100750900750A00750C74 +:1005B00000C3E500F5F0E50D95F0F500E500F5F078 +:1005C000E50C45F0F50CC3E501F5F0E50E95F0F509 +:1005D00000E500F5F0E50C45F0F50CC3E509F5F094 +:1005E000E50F95F0F500E500F5F0E50C45F0F50CAC +:1005F000C3E50AF5F0E51095F0F500E500F5F0E546 +:100600000C45F0F50C750100750900750A00E50C44 +:10061000F500750C01C3750B00E500F5F0E50B95D1 +:10062000F0F50B750B00E50BF5F0E50B35F0F50B70 +:10063000E50BF5F0E50C65F0F50CC3750B00E50175 +:10064000F5F0E50B95F0F50B750B00E50BF5F0E516 +:100650000B35F0F50BE50BF5F0E50C65F0F50CC38B +:10066000750B00E509F5F0E50B95F0F50B750B0042 +:10067000E50BF5F0E50B35F0F50BE50BF5F0E50CCA +:1006800065F0F50CC3750B00E50AF5F0E50B95F088 +:10069000F50B750B00E50BF5F0E50B35F0F50BE50B +:1006A0000BF5F0E50C65F0F50C75010075090075AA +:1006B0000A00750000E50CF5F0E50045F0F500E5F1 +:1006C00001F5F0E50045F0F500E509F5F0E5004538 +:1006D000F0F500E50AF5F0E50045F0F500E50070FD +:1006E000028003020B5800750006750100750900B1 +:1006F000750A00750C00C3E500F5F0E50D95F0F501 +:1007000000E500F5F0E50C45F0F50CC3E501F5F06A +:10071000E50E95F0F500E500F5F0E50C45F0F50C7B +:10072000C3E509F5F0E50F95F0F500E500F5F0E516 +:100730000C45F0F50CC3E50AF5F0E51095F0F50071 +:10074000E500F5F0E50C45F0F50C750100750900C4 +:10075000750A00E50CF500750C01C3750B00E5008A +:10076000F5F0E50B95F0F50B750B00E50BF5F0E5F5 +:100770000B35F0F50BE50BF5F0E50C65F0F50CC36A +:10078000750B00E501F5F0E50B95F0F50B750B0029 +:10079000E50BF5F0E50B35F0F50BE50BF5F0E50CA9 +:1007A00065F0F50CC3750B00E509F5F0E50B95F068 +:1007B000F50B750B00E50BF5F0E50B35F0F50BE5EA +:1007C0000BF5F0E50C65F0F50CC3750B00E50AF5CB +:1007D000F0E50B95F0F50B750B00E50BF5F0E50B6F +:1007E00035F0F50BE50BF5F0E50C65F0F50C750152 +:1007F00000750900750A00750000E50CF5F0E500CC +:1008000045F0F500E501F5F0E50045F0F500E509F6 +:10081000F5F0E50045F0F500E50AF5F0E50045F0F6 +:10082000F500E50070028003020B470075000775B4 +:100830000100750900750A00750C00C3E500F5F0AC +:10084000E50D95F0F500E500F5F0E50C45F0F50C4B +:10085000C3E501F5F0E50E95F0F500E500F5F0E5EE +:100860000C45F0F50CC3E509F5F0E50F95F0F50042 +:10087000E500F5F0E50C45F0F50CC3E50AF5F0E50B +:100880001095F0F500E500F5F0E50C45F0F50C7578 +:100890000100750900750A00E50CF500750C01C32F +:1008A000750B00E500F5F0E50B95F0F50B750B0009 +:1008B000E50BF5F0E50B35F0F50BE50BF5F0E50C88 +:1008C00065F0F50CC3750B00E501F5F0E50B95F04F +:1008D000F50B750B00E50BF5F0E50B35F0F50BE5C9 +:1008E0000BF5F0E50C65F0F50CC3750B00E509F5AB +:1008F000F0E50B95F0F50B750B00E50BF5F0E50B4E +:1009000035F0F50BE50BF5F0E50C65F0F50CC3756E +:100910000B00E50AF5F0E50B95F0F50B750B00E51E +:100920000BF5F0E50B35F0F50BE50BF5F0E50C6597 +:10093000F0F50C750100750900750A00750000E5F9 +:100940000CF5F0E50045F0F500E501F5F0E50045B2 +:10095000F0F500E509F5F0E50045F0F500E50AF5EC +:10096000F0E50045F0F500E50070028003020B366B +:10097000007500FF750100750900750A00750B0010 +:10098000C3E500F5F0E50D95F0F500E500F5F0E5BF +:100990000B45F0F50BC3E501F5F0E50E95F0F5001C +:1009A000E500F5F0E50B45F0F50BC3E509F5F0E5DD +:1009B0000F95F0F500E500F5F0E50B45F0F50BC3FC +:1009C000E50AF5F0E51095F0F500E500F5F0E50B2A +:1009D00045F0F50B750100750900750A00E50BF58A +:1009E00000750B01C3750C00E500F5F0E50C95F002 +:1009F000F50C750C00E50CF5F0E50C35F0F50CE5A3 +:100A00000CF5F0E50B65F0F50BC3750C00E501F591 +:100A1000F0E50C95F0F50C750C00E50CF5F0E50C27 +:100A200035F0F50CE50CF5F0E50B65F0F50BC3754D +:100A30000C00E509F5F0E50C95F0F50C750C00E5FA +:100A40000CF5F0E50C35F0F50CE50CF5F0E50B6573 +:100A5000F0F50BC3750C00E50AF5F0E50C95F0F523 +:100A60000C750C00E50CF5F0E50C35F0F50CE50C1B +:100A7000F5F0E50B65F0F50B750100750900750AD9 +:100A800000750000E50BF5F0E50045F0F500E50127 +:100A9000F5F0E50045F0F500E509F5F0E50045F075 +:100AA000F500E50AF5F0E50045F0F500E500700217 +:100AB0008003020B25000000750000E500F502E54B +:100AC00000F503E500F504E500F50575E0022506EF +:100AD000F58275E0003507F583E0F51075E0002537 +:100AE00006F58275E0003507F583E0F508E508C0F6 +:100AF000E075E0012506F58275E0003507F583E035 +:100B0000F508E508C0E075E0032506F50675E00088 +:100B10003507F507E502F582E503F583E504F50001 +:100B2000E505F501220000751F08751E00751D0002 +:100B3000751C00020AB70000751F07751E00751DA1 +:100B400000751C00020AB70000751F06751E0075AF +:100B50001D00751C00020AB70000751F05751E00F8 +:100B6000751D00751C00020AB70000751F04751E74 +:100B700000751D00751C00020AB70000751F037583 +:100B80001E00751D00751C00020AB70000751F02CB +:100B9000751E00751D00751C00020AB70000751F48 +:100BA00001751E00751D00751C00020AB7000000CB +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/switch-4.s.expected b/tests/GCCTestSuite/switch-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/switch-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian1.c b/tests/GCCTestSuite/symbian1.c new file mode 100644 index 0000000..25e8128 --- /dev/null +++ b/tests/GCCTestSuite/symbian1.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Symbian OS requires that all defined symbols with external linkage + have the ELF STV_HIDDEN attribute set by default. */ +/* { dg-final { scan-assembler ".hidden.*i" } } */ +/* { dg-final { scan-assembler ".hidden.*j" } } */ +/* { dg-final { scan-assembler ".hidden.*f" } } */ + +int i; +int j = 3; +void f() {} + diff --git a/tests/GCCTestSuite/symbian1.c.expected b/tests/GCCTestSuite/symbian1.c.expected new file mode 100644 index 0000000..25e8128 --- /dev/null +++ b/tests/GCCTestSuite/symbian1.c.expected @@ -0,0 +1,11 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Symbian OS requires that all defined symbols with external linkage + have the ELF STV_HIDDEN attribute set by default. */ +/* { dg-final { scan-assembler ".hidden.*i" } } */ +/* { dg-final { scan-assembler ".hidden.*j" } } */ +/* { dg-final { scan-assembler ".hidden.*f" } } */ + +int i; +int j = 3; +void f() {} + diff --git a/tests/GCCTestSuite/symbian1.hex.expected b/tests/GCCTestSuite/symbian1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/symbian1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian1.s.expected b/tests/GCCTestSuite/symbian1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/symbian1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian3.c b/tests/GCCTestSuite/symbian3.c new file mode 100644 index 0000000..2f11d35 --- /dev/null +++ b/tests/GCCTestSuite/symbian3.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Check that enumeration types are 4-byte types. */ + +enum e { e_1 }; + +extern int i[sizeof (enum e)]; +int i[4]; diff --git a/tests/GCCTestSuite/symbian3.c.expected b/tests/GCCTestSuite/symbian3.c.expected new file mode 100644 index 0000000..2f11d35 --- /dev/null +++ b/tests/GCCTestSuite/symbian3.c.expected @@ -0,0 +1,7 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Check that enumeration types are 4-byte types. */ + +enum e { e_1 }; + +extern int i[sizeof (enum e)]; +int i[4]; diff --git a/tests/GCCTestSuite/symbian3.hex.expected b/tests/GCCTestSuite/symbian3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/symbian3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian3.s.expected b/tests/GCCTestSuite/symbian3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/symbian3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian4.c b/tests/GCCTestSuite/symbian4.c new file mode 100644 index 0000000..aede7f5 --- /dev/null +++ b/tests/GCCTestSuite/symbian4.c @@ -0,0 +1,5 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Check that wchar_t is a 2-byte type. */ + +extern int i[sizeof (L'a')]; +int i[2]; diff --git a/tests/GCCTestSuite/symbian4.c.expected b/tests/GCCTestSuite/symbian4.c.expected new file mode 100644 index 0000000..aede7f5 --- /dev/null +++ b/tests/GCCTestSuite/symbian4.c.expected @@ -0,0 +1,5 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Check that wchar_t is a 2-byte type. */ + +extern int i[sizeof (L'a')]; +int i[2]; diff --git a/tests/GCCTestSuite/symbian4.hex.expected b/tests/GCCTestSuite/symbian4.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/symbian4.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian4.s.expected b/tests/GCCTestSuite/symbian4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/symbian4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian5.c b/tests/GCCTestSuite/symbian5.c new file mode 100644 index 0000000..0bde6b0 --- /dev/null +++ b/tests/GCCTestSuite/symbian5.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* { dg-options "-fno-short-wchar" } */ +/* Check that wchar_t is a 4-byte type when -fno-short-wchar is + used. */ + +extern int i[sizeof (L'a')]; +int i[4]; + diff --git a/tests/GCCTestSuite/symbian5.c.expected b/tests/GCCTestSuite/symbian5.c.expected new file mode 100644 index 0000000..0bde6b0 --- /dev/null +++ b/tests/GCCTestSuite/symbian5.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* { dg-options "-fno-short-wchar" } */ +/* Check that wchar_t is a 4-byte type when -fno-short-wchar is + used. */ + +extern int i[sizeof (L'a')]; +int i[4]; + diff --git a/tests/GCCTestSuite/symbian5.hex.expected b/tests/GCCTestSuite/symbian5.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/symbian5.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/symbian5.s.expected b/tests/GCCTestSuite/symbian5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/symbian5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/transparent-union-2.c b/tests/GCCTestSuite/transparent-union-2.c new file mode 100644 index 0000000..f466c4a --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-2.c @@ -0,0 +1,18 @@ +/* PR c/20043 */ +/* { dg-compile } */ +/* { dg-options "-std=gnu99" } */ + +typedef union { int *i; long *l; } U + __attribute__((transparent_union)); + +extern void f0 (U); /* { dg-error "previous declaration" } */ +extern void f0 (void *); /* { dg-error "conflicting types" } */ + +extern void f1 (U); /* { dg-error "previous declaration" } */ +extern void f1 (unsigned long); /* { dg-error "conflicting types" } */ + +extern void f2 (void *); /* { dg-error "previous declaration" } */ +extern void f2 (U); /* { dg-error "conflicting types" } */ + +extern void f3 (unsigned long); /* { dg-error "previous declaration" } */ +extern void f3 (U); /* { dg-error "conflicting types" } */ diff --git a/tests/GCCTestSuite/transparent-union-2.c.expected b/tests/GCCTestSuite/transparent-union-2.c.expected new file mode 100644 index 0000000..f466c4a --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-2.c.expected @@ -0,0 +1,18 @@ +/* PR c/20043 */ +/* { dg-compile } */ +/* { dg-options "-std=gnu99" } */ + +typedef union { int *i; long *l; } U + __attribute__((transparent_union)); + +extern void f0 (U); /* { dg-error "previous declaration" } */ +extern void f0 (void *); /* { dg-error "conflicting types" } */ + +extern void f1 (U); /* { dg-error "previous declaration" } */ +extern void f1 (unsigned long); /* { dg-error "conflicting types" } */ + +extern void f2 (void *); /* { dg-error "previous declaration" } */ +extern void f2 (U); /* { dg-error "conflicting types" } */ + +extern void f3 (unsigned long); /* { dg-error "previous declaration" } */ +extern void f3 (U); /* { dg-error "conflicting types" } */ diff --git a/tests/GCCTestSuite/transparent-union-2.hex.expected b/tests/GCCTestSuite/transparent-union-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/transparent-union-2.s.expected b/tests/GCCTestSuite/transparent-union-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/transparent-union-3.c b/tests/GCCTestSuite/transparent-union-3.c new file mode 100644 index 0000000..cebd5f8 --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-3.c @@ -0,0 +1,22 @@ +/* Test for ICEs on invalid transparent unions (empty or no named + members). Bug 21213. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { A }; + +union __attribute__((__transparent_union__)) ue1 { enum e; }; /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 9 } */ +union ue2 { enum e; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 11 } */ + +union __attribute__((__transparent_union__)) ui1 { int; }; /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 14 } */ +union ui2 { int; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 16 } */ + +union __attribute__((__transparent_union__)) u1 { }; +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 19 } */ +union u2 { } __attribute__((__transparent_union__)); +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 21 } */ diff --git a/tests/GCCTestSuite/transparent-union-3.c.expected b/tests/GCCTestSuite/transparent-union-3.c.expected new file mode 100644 index 0000000..cebd5f8 --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-3.c.expected @@ -0,0 +1,22 @@ +/* Test for ICEs on invalid transparent unions (empty or no named + members). Bug 21213. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { A }; + +union __attribute__((__transparent_union__)) ue1 { enum e; }; /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 9 } */ +union ue2 { enum e; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 11 } */ + +union __attribute__((__transparent_union__)) ui1 { int; }; /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 14 } */ +union ui2 { int; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 16 } */ + +union __attribute__((__transparent_union__)) u1 { }; +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 19 } */ +union u2 { } __attribute__((__transparent_union__)); +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 21 } */ diff --git a/tests/GCCTestSuite/transparent-union-3.hex.expected b/tests/GCCTestSuite/transparent-union-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/transparent-union-3.s.expected b/tests/GCCTestSuite/transparent-union-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/transparent-union-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/trunc-1.c b/tests/GCCTestSuite/trunc-1.c new file mode 100644 index 0000000..0d6a48b --- /dev/null +++ b/tests/GCCTestSuite/trunc-1.c @@ -0,0 +1,15 @@ +/* Origin: PR c/675 from aj@suse.de. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +#include + +int +main (void) +{ + size_t len; + + len = ~(sizeof (size_t) - 1); /* { dg-bogus "truncated" "bogus truncation warning" } */ + + return 0; +} diff --git a/tests/GCCTestSuite/trunc-1.c.expected b/tests/GCCTestSuite/trunc-1.c.expected new file mode 100644 index 0000000..0d6a48b --- /dev/null +++ b/tests/GCCTestSuite/trunc-1.c.expected @@ -0,0 +1,15 @@ +/* Origin: PR c/675 from aj@suse.de. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +#include + +int +main (void) +{ + size_t len; + + len = ~(sizeof (size_t) - 1); /* { dg-bogus "truncated" "bogus truncation warning" } */ + + return 0; +} diff --git a/tests/GCCTestSuite/trunc-1.hex.expected b/tests/GCCTestSuite/trunc-1.hex.expected new file mode 100644 index 0000000..1209c8d --- /dev/null +++ b/tests/GCCTestSuite/trunc-1.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501C3750900750A007560 +:100020000B00750C00E509F502E50AF503E50BF593 +:1000300004E50CF505E501C0E0E500C0E0E502F5EA +:1000400082E503F583E504F500E505F501220000EE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/trunc-1.s.expected b/tests/GCCTestSuite/trunc-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/trunc-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/typedef-init.c b/tests/GCCTestSuite/typedef-init.c new file mode 100644 index 0000000..52928da --- /dev/null +++ b/tests/GCCTestSuite/typedef-init.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } // suppress default -pedantic-errors */ + +/* This code used to be a legitimate, if dubious, extension. However, + it's been broken since GCC 3.0 (caused ICE) and we have now removed + the extension. See PR c/7353. */ + +/* Case A: just the bare name = initializer. */ + +typedef A = 0; /* { dg-error "initialized" "A" } */ +A a; /* { dg-bogus "" "A error cascade" } */ + +/* Case B: with a type also. */ + +typedef int B = 0; /* { dg-error "initialized" "B" } */ +B b; /* { dg-bogus "" "B error cascade" } */ diff --git a/tests/GCCTestSuite/typedef-init.c.expected b/tests/GCCTestSuite/typedef-init.c.expected new file mode 100644 index 0000000..52928da --- /dev/null +++ b/tests/GCCTestSuite/typedef-init.c.expected @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } // suppress default -pedantic-errors */ + +/* This code used to be a legitimate, if dubious, extension. However, + it's been broken since GCC 3.0 (caused ICE) and we have now removed + the extension. See PR c/7353. */ + +/* Case A: just the bare name = initializer. */ + +typedef A = 0; /* { dg-error "initialized" "A" } */ +A a; /* { dg-bogus "" "A error cascade" } */ + +/* Case B: with a type also. */ + +typedef int B = 0; /* { dg-error "initialized" "B" } */ +B b; /* { dg-bogus "" "B error cascade" } */ diff --git a/tests/GCCTestSuite/typedef-init.hex.expected b/tests/GCCTestSuite/typedef-init.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/typedef-init.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/typedef-init.s.expected b/tests/GCCTestSuite/typedef-init.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/typedef-init.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/ultrasp1.c b/tests/GCCTestSuite/ultrasp1.c new file mode 100644 index 0000000..82f586c --- /dev/null +++ b/tests/GCCTestSuite/ultrasp1.c @@ -0,0 +1,9 @@ +/* Simplified from testcase by David Staepelaere */ + +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-options -mcpu=ultrasparc { target sparc-*-* } } */ + +int foo(long long y) { + return -1 * y; +} diff --git a/tests/GCCTestSuite/ultrasp1.c.expected b/tests/GCCTestSuite/ultrasp1.c.expected new file mode 100644 index 0000000..82f586c --- /dev/null +++ b/tests/GCCTestSuite/ultrasp1.c.expected @@ -0,0 +1,9 @@ +/* Simplified from testcase by David Staepelaere */ + +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-options -mcpu=ultrasparc { target sparc-*-* } } */ + +int foo(long long y) { + return -1 * y; +} diff --git a/tests/GCCTestSuite/ultrasp1.hex.expected b/tests/GCCTestSuite/ultrasp1.hex.expected new file mode 100644 index 0000000..8dfde0c --- /dev/null +++ b/tests/GCCTestSuite/ultrasp1.hex.expected @@ -0,0 +1,60 @@ +:1000000000E50675820AC39582F506E5077583004B +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5173C +:10004000F518E516F519E515F51AE514F51B75E033 +:10005000052506F58275E0003507F583E513F07593 +:10006000E0042506F58275E0003507F583E512F01A +:1000700075E0032506F58275E0003507F583E51187 +:10008000F075E0022506F58275E0003507F583E599 +:1000900010F0E51FF514E51EF515E51DF516E51C38 +:1000A000F517750001750100750900750A00E50076 +:1000B000F4F500E501F4F501E509F4F509E50AF4C4 +:1000C000F50AD3750B00E50BF5F0E50035F0F5000A +:1000D000E50BF5F0E50135F0F501E50BF5F0E50987 +:1000E00035F0F509E50BF5F0E50A35F0F50A751080 +:1000F00000751100751200751300C3750B00E50043 +:10010000F5F0E514A4F50FE500F5F0E514A4E5F02D +:10011000F50CE50FF5F0E50B35F0F50BE501F5F025 +:10012000E514A4F50FE501F5F0E514A4E5F0F50DEF +:10013000E50FF5F0E50C35F0F50CE509F5F0E51403 +:10014000A4F50FE509F5F0E514A4E5F0F50EE50FCB +:10015000F5F0E50D35F0F50DE50AF5F0E514A4F53B +:100160000FE50AF5F0E514A4E5F0F50AE50FF5F062 +:10017000E50E35F0F50EC3C3750A00E50BF5F0E5A5 +:100180001035F0F510E50CF5F0E51135F0F511E559 +:100190000DF5F0E51235F0F512E50EF5F0E5133545 +:1001A000F0F513C3750C00E500F5F0E515A4F50FA7 +:1001B000E500F5F0E515A4E5F0F50DE50FF5F0E542 +:1001C0000C35F0F50CE501F5F0E515A4F50FE501AA +:1001D000F5F0E515A4E5F0F50EE50FF5F0E50D35C4 +:1001E000F0F50DE509F5F0E515A4F50FE509F5F0D5 +:1001F000E515A4E5F0F50AE50FF5F0E50E35F0F5A7 +:100200000E750B00C3C3750900E50BF5F0E510355D +:10021000F0F510E50CF5F0E51135F0F511E50DF50B +:10022000F0E51235F0F512E50EF5F0E51335F0F5D1 +:1002300013C3750D00E500F5F0E516A4F50FE50014 +:10024000F5F0E516A4E5F0F50EE50FF5F0E50D3552 +:10025000F0F50DE501F5F0E516A4F50FE501F5F073 +:10026000E516A4E5F0F50AE50FF5F0E50E35F0F535 +:100270000E750B00750C00C3C3750100E50BF5F09E +:10028000E51035F0F510E50CF5F0E51135F0F51158 +:10029000E50DF5F0E51235F0F512E50EF5F0E51394 +:1002A00035F0F513C3750E00E500F5F0E517A4F57C +:1002B0000FE500F5F0E517A4E5F0F50AE50FF5F018 +:1002C000E50E35F0F50E750B00750C00750D00C3CD +:1002D000C3750000E50BF5F0E51035F0F510E50C01 +:1002E000F5F0E51135F0F511E50DF5F0E51235F015 +:1002F000F512E50EF5F0E51335F0F513E510F5020E +:10030000E511F503E512F504E513F505E518F51714 +:10031000E519F516E51AF515E51BF51475E0052543 +:1003200006F58275E0003507F583E0F51375E00406 +:100330002506F58275E0003507F583E0F51275E0D6 +:10034000032506F58275E0003507F583E0F51175A4 +:10035000E0022506F58275E0003507F583E0F5102B +:1003600075E0002506F58275E0003507F583E0F5B8 +:1003700008E508C0E075E0012506F58275E0003566 +:1003800007F583E0F508E508C0E075E00A2506F505 +:100390000675E0003507F507E502F582E503F5830C +:1003A000E504F500E505F50122000000000000006D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/ultrasp1.s.expected b/tests/GCCTestSuite/ultrasp1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/ultrasp1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/ultrasp10.c b/tests/GCCTestSuite/ultrasp10.c new file mode 100644 index 0000000..ffa3229 --- /dev/null +++ b/tests/GCCTestSuite/ultrasp10.c @@ -0,0 +1,25 @@ +/* PR target/11965 */ +/* Originator: */ +/* { dg-do run { target sparc*-*-* } } */ +/* { dg-options "-O -mcpu=ultrasparc" } */ + +/* This used to fail on 32-bit Ultrasparc because GCC emitted + an invalid shift instruction. */ + + +static inline unsigned int shift(int n, unsigned int value) +{ + return value << n; +} + +unsigned int val = 1; + +int main(void) +{ + int i; + + for (i = 0; i < 4; i++) + val = shift(32, val); + + return 0; +} diff --git a/tests/GCCTestSuite/ultrasp10.c.expected b/tests/GCCTestSuite/ultrasp10.c.expected new file mode 100644 index 0000000..ffa3229 --- /dev/null +++ b/tests/GCCTestSuite/ultrasp10.c.expected @@ -0,0 +1,25 @@ +/* PR target/11965 */ +/* Originator: */ +/* { dg-do run { target sparc*-*-* } } */ +/* { dg-options "-O -mcpu=ultrasparc" } */ + +/* This used to fail on 32-bit Ultrasparc because GCC emitted + an invalid shift instruction. */ + + +static inline unsigned int shift(int n, unsigned int value) +{ + return value << n; +} + +unsigned int val = 1; + +int main(void) +{ + int i; + + for (i = 0; i < 4; i++) + val = shift(32, val); + + return 0; +} diff --git a/tests/GCCTestSuite/ultrasp2.c b/tests/GCCTestSuite/ultrasp2.c new file mode 100644 index 0000000..1fd821c --- /dev/null +++ b/tests/GCCTestSuite/ultrasp2.c @@ -0,0 +1,12 @@ +/* Copyright (C) 1999 Free Software Foundation + by Alexandre Oliva + Simplified from libg++/src/Fix16.cc */ + +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-options "-O0" { target sparc64-*-* sparcv9-*-* } } */ + +short foo() { + short i = (short)(1<<15); + return i; +} diff --git a/tests/GCCTestSuite/ultrasp2.c.expected b/tests/GCCTestSuite/ultrasp2.c.expected new file mode 100644 index 0000000..1fd821c --- /dev/null +++ b/tests/GCCTestSuite/ultrasp2.c.expected @@ -0,0 +1,12 @@ +/* Copyright (C) 1999 Free Software Foundation + by Alexandre Oliva + Simplified from libg++/src/Fix16.cc */ + +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-options "-O0" { target sparc64-*-* sparcv9-*-* } } */ + +short foo() { + short i = (short)(1<<15); + return i; +} diff --git a/tests/GCCTestSuite/ultrasp2.hex.expected b/tests/GCCTestSuite/ultrasp2.hex.expected new file mode 100644 index 0000000..8336a20 --- /dev/null +++ b/tests/GCCTestSuite/ultrasp2.hex.expected @@ -0,0 +1,137 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51BF51EE519F516E51809 +:1000E000F51FE500F50FE501F510E509F511E50A45 +:1000F000F512751900751500751300751D00E51DC5 +:10010000F50EE51FF50D750080E500F5F0E50E250F +:10011000F0F50EE500F5F0E50D25F0F50D750C0098 +:10012000751400751700751800750B00750A0175B8 +:100130000001C3E50DF5F0E50E95F0F509E50BF5C9 +:10014000F0E50B35F0F509E509F5F0E50055F0F5BA +:1001500000E500F5F0E50C45F0F50C750001C3E590 +:100160000DF5F0E50E95F0F509E50BF5F0E50B352D +:10017000F0F509E50EF5F0E50D95F0F501E50BF567 +:10018000F0E50B35F0F501E501F5F0E50945F0F591 +:1001900009E50AF5F0E50965F0F509E509F5F0E589 +:1001A0000055F0F500C3E516F5F0E51395F0F509F7 +:1001B000E50BF5F0E50B35F0F509E509F5F0E5009F +:1001C00055F0F500E500F5F0E50C45F0F50C75008F +:1001D00001C3E50DF5F0E50E95F0F509E50BF5F039 +:1001E000E50B35F0F509E50EF5F0E50D95F0F501B7 +:1001F000E50BF5F0E50B35F0F501E501F5F0E50966 +:1002000045F0F509E50AF5F0E50965F0F509E509B8 +:10021000F5F0E50055F0F500C3E516F5F0E51395AA +:10022000F0F509E50BF5F0E50B35F0F509E513F50B +:10023000F0E51695F0F501E50BF5F0E50B35F0F579 +:1002400001E501F5F0E50945F0F509E50AF5F0E508 +:100250000965F0F509E509F5F0E50055F0F500C38D +:10026000E51AF5F0E51595F0F509E50BF5F0E50B68 +:1002700035F0F509E509F5F0E50055F0F500E50084 +:10028000F5F0E50C45F0F50C750001C3E50DF5F052 +:10029000E50E95F0F509E50BF5F0E50B35F0F50900 +:1002A000E50EF5F0E50D95F0F501E50BF5F0E50B44 +:1002B00035F0F501E501F5F0E50945F0F509E50A48 +:1002C000F5F0E50965F0F509E509F5F0E50055F00B +:1002D000F500C3E516F5F0E51395F0F509E50BF526 +:1002E000F0E50B35F0F509E513F5F0E51695F0F5B9 +:1002F00001E50BF5F0E50B35F0F501E501F5F0E56D +:100300000945F0F509E50AF5F0E50965F0F509E5B7 +:1003100009F5F0E50055F0F500C3E51AF5F0E5152F +:1003200095F0F509E50BF5F0E50B35F0F509E51568 +:10033000F5F0E51A95F0F501E50BF5F0E50B35F074 +:10034000F501E501F5F0E50945F0F509E50AF5F0F7 +:10035000E50965F0F509E509F5F0E50055F0F5006A +:10036000C3E51EF5F0E51995F0F509E50BF5F0E5A7 +:100370000B35F0F509E509F5F0E50055F0F500E578 +:1003800000F5F0E50C45F0F50CE50CF50AE514F583 +:1003900000E517F501E518F509E50AF50C750B01FF +:1003A000C3750A00E50CF5F0E50A95F0F50A750A43 +:1003B00000E50AF5F0E50A35F0F50AE50AF5F0E59D +:1003C0000B65F0F50BC3750A00E500F5F0E50A953D +:1003D000F0F50A750A00E50AF5F0E50A35F0F50AC8 +:1003E000E50AF5F0E50B65F0F50BC3750A00E501CC +:1003F000F5F0E50A95F0F50A750A00E50AF5F0E56D +:100400000A35F0F50AE50AF5F0E50B65F0F50BC3E2 +:10041000750A00E509F5F0E50A95F0F50A750A0098 +:10042000E50AF5F0E50A35F0F50AE50AF5F0E50B21 +:1004300065F0F50B750100750900750A007500007F +:10044000E50BF5F0E50045F0F500E501F5F0E50018 +:1004500045F0F500E509F5F0E50045F0F500E50AA1 +:10046000F5F0E50045F0F500E500700280030206B6 +:10047000D700750D02750E00751700751B00E50F8E +:10048000F500E510F514E511F518E512F51C750FEA +:1004900000751000751100751200C3750100E500AC +:1004A000F5F0E50DA4F50CE500F5F0E50DA4E5F09B +:1004B000F509E50CF5F0E50135F0F501E514F5F089 +:1004C000E50DA4F50CE514F5F0E50DA4E5F0F50A4D +:1004D000E50CF5F0E50935F0F509E518F5F0E50D61 +:1004E000A4F50CE518F5F0E50DA4E5F0F50BE50C29 +:1004F000F5F0E50A35F0F50AE51CF5F0E50DA4F593 +:100500000CE51CF5F0E50DA4E5F0F50DE50CF5F0B6 +:10051000E50B35F0F50BC3C3750C00E501F5F0E50F +:100520000F35F0F50FE509F5F0E51035F0F510E5BC +:100530000AF5F0E51135F0F511E50BF5F0E51235AA +:10054000F0F512C3750900E500F5F0E50EA4F50C11 +:10055000E500F5F0E50EA4E5F0F50AE50CF5F0E5AB +:100560000935F0F509E514F5F0E50EA4F50CE514F0 +:10057000F5F0E50EA4E5F0F50BE50CF5F0E50A3530 +:10058000F0F50AE518F5F0E50EA4F50CE518F5F020 +:10059000E50EA4E5F0F50DE50CF5F0E50B35F0F50D +:1005A0000B750100C3C3750C00E501F5F0E50F35CF +:1005B000F0F50FE509F5F0E51035F0F510E50AF571 +:1005C000F0E51135F0F511E50BF5F0E51235F0F534 +:1005D00012C3750A00E500F5F0E517A4F50CE50077 +:1005E000F5F0E517A4E5F0F50BE50CF5F0E50A35B7 +:1005F000F0F50AE514F5F0E517A4F50CE514F5F0AF +:10060000E517A4E5F0F50DE50CF5F0E50B35F0F593 +:100610000B750100750900C3C3750C00E501F5F009 +:10062000E50F35F0F50FE509F5F0E51035F0F510BB +:10063000E50AF5F0E51135F0F511E50BF5F0E512F9 +:1006400035F0F512C3750B00E500F5F0E51BA4F5D8 +:100650000CE500F5F0E51BA4E5F0F50DE50CF5F073 +:10066000E50B35F0F50B750100750900750A00C33F +:10067000C3750000E501F5F0E50F35F0F50FE5096C +:10068000F5F0E51035F0F510E50AF5F0E51135F077 +:10069000F511E50BF5F0E51235F0F5127500017571 +:1006A0000100750900750A00C3750B00E500F5F03F +:1006B000E51935F0F519E501F5F0E51535F0F51515 +:1006C000E509F5F0E51335F0F513E50AF5F0E51D5C +:1006D00035F0F51D0200FE00E50FF502E510F5030B +:1006E000E511F504E512F50575E0092506F58275B5 +:1006F000E0003507F583E0F51775E0082506F5827B +:1007000075E0003507F583E0F51675E0072506F579 +:100710008275E0003507F583E0F51575E0062506DE +:10072000F58275E0003507F583E0F51475E00525E1 +:1007300006F58275E0003507F583E0F51375E004F2 +:100740002506F58275E0003507F583E0F51275E0C2 +:10075000032506F58275E0003507F583E0F5117590 +:10076000E0022506F58275E0003507F583E0F51017 +:1007700075E0002506F58275E0003507F583E0F5A4 +:1007800008E508C0E075E0012506F58275E0003552 +:1007900007F583E0F508E508C0E075E0122506F5E9 +:1007A0000675E0003507F507E502F582E503F583F8 +:1007B000E504F500E505F5012200E506758202C3B2 +:1007C0009582F506E5077583009583F507D0E0F57A +:1007D0000875E0012506F58275E0003507F583E52B +:1007E00008F0D0E0F50875E0002506F58275E00018 +:1007F0003507F583E508F0751F01751E00751D00AE +:10080000751C00751B0F751A0075190075180012FC +:100810000000E582F502E583F503E502F500E50356 +:10082000F501750900E500F502E501F503E509F5B7 +:1008300004E509F50575E0002506F58275E000354B +:1008400007F583E0F508E508C0E075E0012506F549 +:100850008275E0003507F583E0F508E508C0E0752E +:10086000E0022506F50675E0003507F507E502F517 +:1008700082E503F583E504F500E505F501220000B6 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/ultrasp2.s.expected b/tests/GCCTestSuite/ultrasp2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/ultrasp2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/ultrasp4.c b/tests/GCCTestSuite/ultrasp4.c new file mode 100644 index 0000000..1c72d06 --- /dev/null +++ b/tests/GCCTestSuite/ultrasp4.c @@ -0,0 +1,21 @@ +/* Simplified from PR target/5309. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mcpu=ultrasparc" { target sparc64-*-* sparcv9-*-* } } */ + +#if __INT_MAX__ > 32767 +#define PTR_TYPE long +#else +/* For 16-bit ports a long is a 32-bit quantity. So you cannot + cast a 32-bit long integer into a pointer which will only be + 16-bits long. */ +#define PTR_TYPE int +#endif + +extern PTR_TYPE bar (unsigned int); + +PTR_TYPE +foo (PTR_TYPE x, unsigned int y) +{ + return *(((PTR_TYPE *) (bar (y) - 1)) + 1 + (x >> 2) % 359); +} diff --git a/tests/GCCTestSuite/ultrasp4.c.expected b/tests/GCCTestSuite/ultrasp4.c.expected new file mode 100644 index 0000000..1c72d06 --- /dev/null +++ b/tests/GCCTestSuite/ultrasp4.c.expected @@ -0,0 +1,21 @@ +/* Simplified from PR target/5309. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mcpu=ultrasparc" { target sparc64-*-* sparcv9-*-* } } */ + +#if __INT_MAX__ > 32767 +#define PTR_TYPE long +#else +/* For 16-bit ports a long is a 32-bit quantity. So you cannot + cast a 32-bit long integer into a pointer which will only be + 16-bits long. */ +#define PTR_TYPE int +#endif + +extern PTR_TYPE bar (unsigned int); + +PTR_TYPE +foo (PTR_TYPE x, unsigned int y) +{ + return *(((PTR_TYPE *) (bar (y) - 1)) + 1 + (x >> 2) % 359); +} diff --git a/tests/GCCTestSuite/ultrasp4.hex.expected b/tests/GCCTestSuite/ultrasp4.hex.expected new file mode 100644 index 0000000..22a8607 --- /dev/null +++ b/tests/GCCTestSuite/ultrasp4.hex.expected @@ -0,0 +1,725 @@ +:1000000000E506758212C39582F506E50775830043 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0E51FF500E51EF501E51DD8 +:1000D000F509E51CF50AE51AF515E519F513750F8F +:1000E00000751000751100751200E500F516E501A8 +:1000F000F514E509F50DE50AF50E750C0075170008 +:10010000751900751A00750B00750A01750001C399 +:10011000E518F5F0E50E95F0F509E50BF5F0E50BC2 +:1001200035F0F509E509F5F0E50055F0F500E500D5 +:10013000F5F0E50C45F0F50C750001C3E518F5F098 +:10014000E50E95F0F509E50BF5F0E50B35F0F50951 +:10015000E50EF5F0E51895F0F501E50BF5F0E50B8A +:1001600035F0F501E501F5F0E50945F0F509E50A99 +:10017000F5F0E50965F0F509E509F5F0E50055F05C +:10018000F500C3E513F5F0E50D95F0F509E50BF580 +:10019000F0E50B35F0F509E509F5F0E50055F0F56A +:1001A00000E500F5F0E50C45F0F50C750001C3E540 +:1001B00018F5F0E50E95F0F509E50BF5F0E50B35D2 +:1001C000F0F509E50EF5F0E51895F0F501E50BF50C +:1001D000F0E50B35F0F501E501F5F0E50945F0F541 +:1001E00009E50AF5F0E50965F0F509E509F5F0E539 +:1001F0000055F0F500C3E513F5F0E50D95F0F509B0 +:10020000E50BF5F0E50B35F0F509E50DF5F0E51337 +:1002100095F0F501E50BF5F0E50B35F0F501E5019D +:10022000F5F0E50945F0F509E50AF5F0E50965F0B1 +:10023000F509E509F5F0E50055F0F500C3E515F51C +:10024000F0E51495F0F509E50BF5F0E50B35F0F563 +:1002500009E509F5F0E50055F0F500E500F5F0E5F4 +:100260000C45F0F50C750001C3E518F5F0E50E95A9 +:10027000F0F509E50BF5F0E50B35F0F509E50EF5C0 +:10028000F0E51895F0F501E50BF5F0E50B35F0F527 +:1002900001E501F5F0E50945F0F509E50AF5F0E5B8 +:1002A0000965F0F509E509F5F0E50055F0F500C33D +:1002B000E513F5F0E50D95F0F509E50BF5F0E50B27 +:1002C00035F0F509E50DF5F0E51395F0F501E50BD1 +:1002D000F5F0E50B35F0F501E501F5F0E50945F040 +:1002E000F509E50AF5F0E50965F0F509E509F5F028 +:1002F000E50055F0F500C3E515F5F0E51495F0F5CA +:1003000009E50BF5F0E50B35F0F509E514F5F0E539 +:100310001595F0F501E50BF5F0E50B35F0F501E588 +:1003200001F5F0E50945F0F509E50AF5F0E509659F +:10033000F0F509E509F5F0E50055F0F500C3E51B1A +:10034000F5F0E51695F0F509E50BF5F0E50B35F060 +:10035000F509E509F5F0E50055F0F500E500F5F0E3 +:10036000E50C45F0F50CE517F500E519F501E51A82 +:10037000F509E50CF50B750C01C3750A00E50BF5E5 +:10038000F0E50A95F0F50A750A00E50AF5F0E50AC8 +:1003900035F0F50AE50AF5F0E50C65F0F50CC375E6 +:1003A0000A00E500F5F0E50A95F0F50A750A00E5A2 +:1003B0000AF5F0E50A35F0F50AE50AF5F0E50C6511 +:1003C000F0F50CC3750A00E501F5F0E50A95F0F5C6 +:1003D0000A750A00E50AF5F0E50A35F0F50AE50ABE +:1003E000F5F0E50C65F0F50CC3750A00E509F5F0CC +:1003F000E50A95F0F50A750A00E50AF5F0E50A3513 +:10040000F0F50AE50AF5F0E50C65F0F50C7500006D +:10041000750100750900E500F50BE501F50A7501A8 +:1004200001C3750000E50CF5F0E50095F0F50075E9 +:100430000000E500F5F0E50035F0F500E500F5F029 +:10044000E50165F0F501C3750000E50BF5F0E50089 +:1004500095F0F500750000E500F5F0E50035F0F5E4 +:1004600000E500F5F0E50165F0F501C3750000E574 +:100470000AF5F0E50095F0F500750000E500F5F0EF +:10048000E50035F0F500E500F5F0E50165F0F50172 +:10049000C3750000E509F5F0E50095F0F50075007D +:1004A00000E500F5F0E50035F0F500E500F5F0E5D4 +:1004B0000165F0F501750900750A00750B007500FE +:1004C00000E501F5F0E50045F0F500E509F5F0E59A +:1004D0000045F0F500E50AF5F0E50045F0F500E52A +:1004E0000BF5F0E50045F0F500E500700280030231 +:1004F000055700750001750100750900750A00C3F4 +:10050000750B00E500F5F0E50F35F0F50FE501F5A9 +:10051000F0E51035F0F510E509F5F0E51135F0F5E9 +:1005200011E50AF5F0E51235F0F512C3E51BF5F01B +:10053000E51695F0F516E515F5F0E51495F0F514CA +:10054000E513F5F0E50D95F0F50DE518F5F0E50E80 +:1005500095F0F50E0200FA00E50FF502E510F5033F +:10056000E511F504E512F50575E0092506F5827536 +:10057000E0003507F583E0F51775E0082506F582FC +:1005800075E0003507F583E0F51675E0072506F5FB +:100590008275E0003507F583E0F51575E006250660 +:1005A000F58275E0003507F583E0F51475E0052563 +:1005B00006F58275E0003507F583E0F51375E00474 +:1005C0002506F58275E0003507F583E0F51275E044 +:1005D000032506F58275E0003507F583E0F5117512 +:1005E000E0022506F58275E0003507F583E0F51099 +:1005F00075E0002506F58275E0003507F583E0F526 +:1006000008E508C0E075E0012506F58275E00035D3 +:1006100007F583E0F508E508C0E075E0122506F56A +:100620000675E0003507F507E502F582E503F58379 +:10063000E504F500E505F5012200E506758217C31E +:100640009582F506E5077583009583F507D0E0F5FB +:100650000875E0062506F58275E0003507F583E5A7 +:1006600008F0D0E0F50875E0052506F58275E00094 +:100670003507F583E508F075E00E2506F58275E08F +:10068000003507F583E517F075E00D2506F5827551 +:10069000E0003507F583E516F075E00C2506F582D8 +:1006A00075E0003507F583E515F075E00B2506F5D7 +:1006B0008275E0003507F583E514F075E00A25063C +:1006C000F58275E0003507F583E513F075E009253F +:1006D00006F58275E0003507F583E512F075E00850 +:1006E0002506F58275E0003507F583E511F075E024 +:1006F000072506F58275E0003507F583E510F0E57E +:100700001FF511E51BF512E51AF513E519F514753A +:10071000E0042506F58275E0003507F583E511F064 +:1007200075E0032506F58275E0003507F583E51EC3 +:10073000F075E0022506F58275E0003507F583E5E2 +:100740001DF075E0012506F58275E0003507F5839B +:10075000E51CF07515017516007517007508007514 +:10076000E0002506F58275E0003507F583E508F021 +:10077000751900750D00750E00750F00E51CF5105C +:10078000750080E500F5F0E51025F0F510E500F5C1 +:10079000F0E50F25F0F50F750C00751A00751B00BC +:1007A000751F00750B00750A01750001C3E50FF593 +:1007B000F0E51095F0F509E50BF5F0E50B35F0F5F2 +:1007C00009E509F5F0E50055F0F500E500F5F0E57F +:1007D0000C45F0F50C750001C3E50FF5F0E510953B +:1007E000F0F509E50BF5F0E50B35F0F509E510F549 +:1007F000F0E50F95F0F501E50BF5F0E50B35F0F5BB +:1008000001E501F5F0E50945F0F509E50AF5F0E542 +:100810000965F0F509E509F5F0E50055F0F500C3C7 +:10082000E50EF5F0E51D95F0F509E50BF5F0E50BA6 +:1008300035F0F509E509F5F0E50055F0F500E500BE +:10084000F5F0E50C45F0F50C750001C3E50FF5F08A +:10085000E51095F0F509E50BF5F0E50B35F0F50938 +:10086000E510F5F0E50F95F0F501E50BF5F0E50B7A +:1008700035F0F501E501F5F0E50945F0F509E50A82 +:10088000F5F0E50965F0F509E509F5F0E50055F045 +:10089000F500C3E50EF5F0E51D95F0F509E50BF55E +:1008A000F0E50B35F0F509E51DF5F0E50E95F0F5F1 +:1008B00001E50BF5F0E50B35F0F501E501F5F0E5A7 +:1008C0000945F0F509E50AF5F0E50965F0F509E5F2 +:1008D00009F5F0E50055F0F500C3E50DF5F0E51E6E +:1008E00095F0F509E50BF5F0E50B35F0F509E509AF +:1008F000F5F0E50055F0F500E500F5F0E50C45F004 +:10090000F50C750001C3E50FF5F0E51095F0F5095C +:10091000E50BF5F0E50B35F0F509E510F5F0E50F21 +:1009200095F0F501E50BF5F0E50B35F0F501E50186 +:10093000F5F0E50945F0F509E50AF5F0E50965F09A +:10094000F509E509F5F0E50055F0F500C3E50EF50C +:10095000F0E51D95F0F509E50BF5F0E50B35F0F543 +:1009600009E51DF5F0E50E95F0F501E50BF5F0E56F +:100970000B35F0F501E501F5F0E50945F0F509E580 +:100980000AF5F0E50965F0F509E509F5F0E500552A +:10099000F0F500C3E50DF5F0E51E95F0F509E50B62 +:1009A000F5F0E50B35F0F509E51EF5F0E50D95F0F0 +:1009B000F501E50BF5F0E50B35F0F501E501F5F096 +:1009C000E50945F0F509E50AF5F0E50965F0F509F1 +:1009D000E509F5F0E50055F0F500C3E519F5F0E59A +:1009E0001195F0F509E50BF5F0E50B35F0F509E5A6 +:1009F00009F5F0E50055F0F500E500F5F0E50C45EA +:100A0000F0F50CE51AF501E51BF509E51FF50A758A +:100A10000000E50CF5F0E50045F0F500E501F5F026 +:100A2000E50045F0F500E509F5F0E50045F0F500D5 +:100A3000E50AF5F0E50045F0F500E50070028003F9 +:100A400002116B00751900750D00750E00750F0011 +:100A5000E512F51BE513F51AE514F510E518F51187 +:100A6000750080E500F5F0E51125F0F511E500F5DC +:100A7000F0E50F25F0F50F750C00751C00751D00D5 +:100A8000751E00750B00750A01750001C3E50FF5B1 +:100A9000F0E51195F0F509E50BF5F0E50B35F0F50E +:100AA00009E509F5F0E50055F0F500E500F5F0E59C +:100AB0000C45F0F50C750001C3E50FF5F0E5119557 +:100AC000F0F509E50BF5F0E50B35F0F509E511F565 +:100AD000F0E50F95F0F501E50BF5F0E50B35F0F5D8 +:100AE00001E501F5F0E50945F0F509E50AF5F0E560 +:100AF0000965F0F509E509F5F0E50055F0F500C3E5 +:100B0000E50EF5F0E51095F0F509E50BF5F0E50BD0 +:100B100035F0F509E509F5F0E50055F0F500E500DB +:100B2000F5F0E50C45F0F50C750001C3E50FF5F0A7 +:100B3000E51195F0F509E50BF5F0E50B35F0F50954 +:100B4000E511F5F0E50F95F0F501E50BF5F0E50B96 +:100B500035F0F501E501F5F0E50945F0F509E50A9F +:100B6000F5F0E50965F0F509E509F5F0E50055F062 +:100B7000F500C3E50EF5F0E51095F0F509E50BF588 +:100B8000F0E50B35F0F509E510F5F0E50E95F0F51B +:100B900001E50BF5F0E50B35F0F501E501F5F0E5C4 +:100BA0000945F0F509E50AF5F0E50965F0F509E50F +:100BB00009F5F0E50055F0F500C3E50DF5F0E51A8F +:100BC00095F0F509E50BF5F0E50B35F0F509E509CC +:100BD000F5F0E50055F0F500E500F5F0E50C45F021 +:100BE000F50C750001C3E50FF5F0E51195F0F50979 +:100BF000E50BF5F0E50B35F0F509E511F5F0E50F3E +:100C000095F0F501E50BF5F0E50B35F0F501E501A3 +:100C1000F5F0E50945F0F509E50AF5F0E50965F0B7 +:100C2000F509E509F5F0E50055F0F500C3E50EF529 +:100C3000F0E51095F0F509E50BF5F0E50B35F0F56D +:100C400009E510F5F0E50E95F0F501E50BF5F0E599 +:100C50000B35F0F501E501F5F0E50945F0F509E59D +:100C60000AF5F0E50965F0F509E509F5F0E5005547 +:100C7000F0F500C3E50DF5F0E51A95F0F509E50B83 +:100C8000F5F0E50B35F0F509E51AF5F0E50D95F011 +:100C9000F501E50BF5F0E50B35F0F501E501F5F0B3 +:100CA000E50945F0F509E50AF5F0E50965F0F5090E +:100CB000E509F5F0E50055F0F500C3E519F5F0E5B7 +:100CC0001B95F0F509E50BF5F0E50B35F0F509E5B9 +:100CD00009F5F0E50055F0F500E500F5F0E50C4507 +:100CE000F0F50CE51CF501E51DF509E51EF50A75A5 +:100CF0000000E50CF5F0E50045F0F500E501F5F044 +:100D0000E50045F0F500E509F5F0E50045F0F500F2 +:100D1000E50AF5F0E50045F0F500E5007002800316 +:100D20000210A30075E0042506F58275E000350782 +:100D3000F583E0F51F75E0032506F58275E00035C3 +:100D400007F583E0F51E75E0022506F58275E000E3 +:100D50003507F583E0F51D75E0012506F58275E0A0 +:100D6000003507F583E0F51CE512F51BE513F51AD0 +:100D7000E514F519120000E582F502E583F503E5B7 +:100D800000F504E501F505E502F511E503F512E5C9 +:100D900004F513E505F514E515F500E516F515E57B +:100DA00017F51675E0002506F58275E0003507F5A4 +:100DB00083E0F517750D00750E00750F00751000B6 +:100DC000C3750100E500F5F0E511A4F50CE500F5AB +:100DD000F0E511A4E5F0F509E50CF5F0E50135F0D5 +:100DE000F501E515F5F0E511A4F50CE515F5F0E5CF +:100DF00011A4E5F0F50AE50CF5F0E50935F0F50983 +:100E0000E516F5F0E511A4F50CE516F5F0E511A4ED +:100E1000E5F0F50BE50CF5F0E50A35F0F50AE51718 +:100E2000F5F0E511A4F50CE517F5F0E511A4E5F0F2 +:100E3000F511E50CF5F0E50B35F0F50BC3C3750CBA +:100E400000E501F5F0E50D35F0F50DE509F5F0E506 +:100E50000E35F0F50EE50AF5F0E50F35F0F50FE586 +:100E60000BF5F0E51035F0F510C3750900E500F558 +:100E7000F0E512A4F50CE500F5F0E512A4E5F0F5B7 +:100E80000AE50CF5F0E50935F0F509E515F5F0E5AD +:100E900012A4F50CE515F5F0E512A4E5F0F50BE567 +:100EA0000CF5F0E50A35F0F50AE516F5F0E512A4C3 +:100EB000F50CE516F5F0E512A4E5F0F511E50CF5F5 +:100EC000F0E50B35F0F50B750100C3C3750C00E5BB +:100ED00001F5F0E50D35F0F50DE509F5F0E50E3518 +:100EE000F0F50EE50AF5F0E50F35F0F50FE50BF539 +:100EF000F0E51035F0F510C3750A00E500F5F0E5F2 +:100F000013A4F50CE500F5F0E513A4E5F0F50BE509 +:100F10000CF5F0E50A35F0F50AE515F5F0E513A452 +:100F2000F50CE515F5F0E513A4E5F0F511E50CF584 +:100F3000F0E50B35F0F50B750100750900C3C375BD +:100F40000C00E501F5F0E50D35F0F50DE509F5F0DE +:100F5000E50E35F0F50EE50AF5F0E50F35F0F50F85 +:100F6000E50BF5F0E51035F0F510C3750B00E50065 +:100F7000F5F0E514A4F50CE500F5F0E514A4E5F0B2 +:100F8000F511E50CF5F0E50B35F0F50B7501007585 +:100F90000900750A00C3C3750000E501F5F0E50D11 +:100FA00035F0F50DE509F5F0E50E35F0F50EE50A3D +:100FB000F5F0E50F35F0F50FE50BF5F0E51035F040 +:100FC000F510E50DF502E50EF503E50FF504E51066 +:100FD000F50575E00E2506F58275E0003507F58309 +:100FE000E0F51775E00D2506F58275E0003507F58B +:100FF00083E0F51675E00C2506F58275E0003507EF +:10100000F583E0F51575E00B2506F58275E00035F2 +:1010100007F583E0F51475E00A2506F58275E00012 +:101020003507F583E0F51375E0092506F58275E0CF +:10103000003507F583E0F51275E0082506F58275A1 +:10104000E0003507F583E0F51175E0072506F58228 +:1010500075E0003507F583E0F51075E0052506F528 +:101060008275E0003507F583E0F508E508C0E07516 +:10107000E0062506F58275E0003507F583E0F50802 +:10108000E508C0E075E0172506F50675E0003507B0 +:10109000F507E502F582E503F583E504F500E505CE +:1010A000F5012200E512F4F512E513F4F513E51449 +:1010B000F4F514E518F4F518D3750000E500F5F023 +:1010C000E51235F0F512E500F5F0E51335F0F5130E +:1010D000E500F5F0E51435F0F514E500F5F0E51858 +:1010E00035F0F518E515F4F515E516F4F516E517E0 +:1010F000F4F51775E0002506F58275E0003507F573 +:1011000083E0F508E508F4F50875E0002506F582AA +:1011100075E0003507F583E508F0D3750000E500BC +:10112000F5F0E51535F0F515E500F5F0E51635F0C7 +:10113000F516E500F5F0E51735F0F517E500F5F0E3 +:1011400075E0002506F58275E0003507F583E0F5CA +:1011500008E50835F0F50875E0002506F58275E02C +:10116000003507F583E508F0020D2400E511F4F5DC +:1011700000E51EF4F501E51DF4F509E51CF4F50B99 +:10118000D3750A00E50AF5F0E50035F0F500E50A4B +:10119000F5F0E50135F0F501E50AF5F0E50935F082 +:1011A000F509E50AF5F0E50B35F0F50B75E00425DA +:1011B00006F58275E0003507F583E500F075E0037C +:1011C0002506F58275E0003507F583E501F075E049 +:1011D000022506F58275E0003507F583E509F0750F +:1011E000E0012506F58275E0003507F583E50BF093 +:1011F000E515F4F515E516F4F516E517F4F517758C +:10120000E0002506F58275E0003507F583E0F50876 +:10121000E508F4F50875E0002506F58275E000356F +:1012200007F583E508F0D3750000E500F5F0E51556 +:1012300035F0F515E500F5F0E51635F0F516E500A5 +:10124000F5F0E51735F0F517E500F5F075E0002548 +:1012500006F58275E0003507F583E0F508E5083509 +:10126000F0F50875E0002506F58275E0003507F514 +:1012700083E508F0020A4400E506758216C39582EC +:10128000F506E5077583009583F507D0E0F5087549 +:10129000E0052506F58275E0003507F583E508F0E1 +:1012A000D0E0F50875E0042506F58275E000350705 +:1012B000F583E508F075E00D2506F58275E000354B +:1012C00007F583E517F075E00C2506F58275E0005B +:1012D0003507F583E516F075E00B2506F58275E018 +:1012E000003507F583E515F075E00A2506F58275EA +:1012F000E0003507F583E514F075E0092506F58271 +:1013000075E0003507F583E513F075E0082506F56F +:101310008275E0003507F583E512F075E0072506D4 +:10132000F58275E0003507F583E511F075E00625D7 +:1013300006F58275E0003507F583E510F075E003EA +:101340002506F58275E0003507F583E51FF075E0A9 +:10135000022506F58275E0003507F583E51EF07578 +:10136000E0012506F58275E0003507F583E51DF0FF +:1013700075E0002506F58275E0003507F583E51C6C +:10138000F0E51BF514E51AF515E519F516E518F560 +:101390001775E0032506F58275E0003507F583E053 +:1013A000F51F75E0022506F58275E0003507F58327 +:1013B000E0F51E75E0012506F58275E0003507F5BC +:1013C00083E0F51D75E0002506F58275E000350720 +:1013D000F583E0F51CE514F51BE515F51AE516F5A2 +:1013E00019E517F518120639E582F502E583F503CC +:1013F000E500F504E501F505E502F500E503F50175 +:10140000E504F509E505F50A75100075110075127A +:1014100000751300C3750B00E500F5F0E514A4F5A5 +:101420000FE500F5F0E514A4E5F0F50CE50FF5F097 +:10143000E50B35F0F50BE501F5F0E514A4F50FE546 +:1014400001F5F0E514A4E5F0F50DE50FF5F0E50C78 +:1014500035F0F50CE509F5F0E514A4F50FE509F50F +:10146000F0E514A4E5F0F50EE50FF5F0E50D35F027 +:10147000F50DE50AF5F0E514A4F50FE50AF5F0E53C +:1014800014A4E5F0F50AE50FF5F0E50E35F0F50EDC +:10149000C3C3750A00E50BF5F0E51035F0F510E56E +:1014A0000CF5F0E51135F0F511E50DF5F0E5123527 +:1014B000F0F512E50EF5F0E51335F0F513C3750CF4 +:1014C00000E500F5F0E515A4F50FE500F5F0E515EC +:1014D000A4E5F0F50DE50FF5F0E50C35F0F50CE5BC +:1014E00001F5F0E515A4F50FE501F5F0E515A4E526 +:1014F000F0F50EE50FF5F0E50D35F0F50DE509F524 +:10150000F0E515A4F50FE509F5F0E515A4E5F0F50E +:101510000AE50FF5F0E50E35F0F50E750B00C3C3C7 +:10152000750900E50BF5F0E51035F0F510E50CF563 +:10153000F0E51135F0F511E50DF5F0E51235F0F5B2 +:1015400012E50EF5F0E51335F0F513C3750D00E562 +:1015500000F5F0E516A4F50FE500F5F0E516A4E5B5 +:10156000F0F50EE50FF5F0E50D35F0F50DE501F5BB +:10157000F0E516A4F50FE501F5F0E516A4E5F0F5A4 +:101580000AE50FF5F0E50E35F0F50E750B00750C5C +:1015900000C3C3750100E50BF5F0E51035F0F5105B +:1015A000E50CF5F0E51135F0F511E50DF5F0E51276 +:1015B00035F0F512E50EF5F0E51335F0F513C375CA +:1015C0000E00E500F5F0E517A4F50FE500F5F0E5F0 +:1015D00017A4E5F0F50AE50FF5F0E50E35F0F50E88 +:1015E000750B00750C00750D00C3C3750000E50B8D +:1015F000F5F0E51035F0F510E50CF5F0E51135F0F6 +:10160000F511E50DF5F0E51235F0F512E50EF5F002 +:10161000E51335F0F513C3E510F5F075E003250685 +:10162000F58275E0003507F583E0F508E50895F0EB +:10163000F500E511F5F075E0022506F58275E0008C +:101640003507F583E0F508E50895F0F501E512F5B5 +:10165000F075E0012506F58275E0003507F583E0B9 +:10166000F508E50895F0F509E513F5F075E00025B6 +:1016700006F58275E0003507F583E0F508E5089585 +:10168000F0F50AE500F502E501F503E509F504E5E5 +:101690000AF50575E00D2506F58275E0003507F5BC +:1016A00083E0F51775E00C2506F58275E000350737 +:1016B000F583E0F51675E00B2506F58275E000353B +:1016C00007F583E0F51575E00A2506F58275E0005B +:1016D0003507F583E0F51475E0092506F58275E018 +:1016E000003507F583E0F51375E0082506F58275EA +:1016F000E0003507F583E0F51275E0072506F58271 +:1017000075E0003507F583E0F51175E0062506F56F +:101710008275E0003507F583E0F51075E0042506D5 +:10172000F58275E0003507F583E0F508E508C0E0CF +:1017300075E0052506F58275E0003507F583E0F5CF +:1017400008E508C0E075E0162506F50675E00035E9 +:1017500007F507E502F582E503F583E504F500E505 +:1017600005F5012200E506758219C39582F506E5A7 +:10177000077583009583F507D0E0F50875E0082527 +:1017800006F58275E0003507F583E508F0D0E0F551 +:101790000875E0072506F58275E0003507F583E555 +:1017A00008F075E0102506F58275E0003507F58331 +:1017B000E517F075E00F2506F58275E0003507F5B1 +:1017C00083E516F075E00E2506F58275E000350715 +:1017D000F583E515F075E00D2506F58275E0003519 +:1017E00007F583E514F075E00C2506F58275E00039 +:1017F0003507F583E513F075E00B2506F58275E0F6 +:10180000003507F583E512F075E00A2506F58275C7 +:10181000E0003507F583E511F075E0092506F5824E +:1018200075E0003507F583E510F0E51DF517E51CBB +:10183000F516E518F515751400750D00750E007593 +:101840000F00E515F510750080E500F5F0E51025B1 +:10185000F0F510E500F5F0E50F25F0F50F750C003B +:10186000751100751200751300750B00750A01756E +:101870000001C3E50FF5F0E51095F0F509E50BF56E +:10188000F0E50B35F0F509E509F5F0E50055F0F563 +:1018900000E500F5F0E50C45F0F50C750001C3E539 +:1018A0000FF5F0E51095F0F509E50BF5F0E50B35D2 +:1018B000F0F509E510F5F0E50F95F0F501E50BF50C +:1018C000F0E50B35F0F501E501F5F0E50945F0F53A +:1018D00009E50AF5F0E50965F0F509E509F5F0E532 +:1018E0000055F0F500C3E50EF5F0E51995F0F509A2 +:1018F000E50BF5F0E50B35F0F509E509F5F0E50048 +:1019000055F0F500E500F5F0E50C45F0F50C750037 +:1019100001C3E50FF5F0E51095F0F509E50BF5F0DD +:10192000E50B35F0F509E510F5F0E50F95F0F5015B +:10193000E50BF5F0E50B35F0F501E501F5F0E5090E +:1019400045F0F509E50AF5F0E50965F0F509E50961 +:10195000F5F0E50055F0F500C3E50EF5F0E5199555 +:10196000F0F509E50BF5F0E50B35F0F509E519F5AE +:10197000F0E50E95F0F501E50BF5F0E50B35F0F52A +:1019800001E501F5F0E50945F0F509E50AF5F0E5B1 +:101990000965F0F509E509F5F0E50055F0F500C336 +:1019A000E50DF5F0E51A95F0F509E50BF5F0E50B19 +:1019B00035F0F509E509F5F0E50055F0F500E5002D +:1019C000F5F0E50C45F0F50C750001C3E50FF5F0F9 +:1019D000E51095F0F509E50BF5F0E50B35F0F509A7 +:1019E000E510F5F0E50F95F0F501E50BF5F0E50BE9 +:1019F00035F0F501E501F5F0E50945F0F509E50AF1 +:101A0000F5F0E50965F0F509E509F5F0E50055F0B3 +:101A1000F500C3E50EF5F0E51995F0F509E50BF5D0 +:101A2000F0E50B35F0F509E519F5F0E50E95F0F563 +:101A300001E50BF5F0E50B35F0F501E501F5F0E515 +:101A40000945F0F509E50AF5F0E50965F0F509E560 +:101A500009F5F0E50055F0F500C3E50DF5F0E51AE0 +:101A600095F0F509E50BF5F0E50B35F0F509E51A0C +:101A7000F5F0E50D95F0F501E50BF5F0E50B35F02A +:101A8000F501E501F5F0E50945F0F509E50AF5F0A0 +:101A9000E50965F0F509E509F5F0E50055F0F50013 +:101AA000C3E514F5F0E51B95F0F509E50BF5F0E558 +:101AB0000B35F0F509E509F5F0E50055F0F500E521 +:101AC00000F5F0E50C45F0F50C750000E50CF5F0BF +:101AD000E50045F0F500E511F5F0E50045F0F5000D +:101AE000E512F5F0E50045F0F500E513F5F0E50049 +:101AF00045F0F500E5007002800302284B00E51F69 +:101B0000F51CE51EF51DE517F51FE516F51E75E03C +:101B1000032506F58275E0003507F583E51BF075B2 +:101B2000E0022506F58275E0003507F583E51AF039 +:101B300075E0012506F58275E0003507F583E519A6 +:101B4000F075E0002506F58275E0003507F583E5C0 +:101B500015F075130175140075150075120075E008 +:101B6000062506F58275E0003507F583E51FF0755B +:101B7000E0052506F58275E0003507F583E51EF0E2 +:101B800075080075E0042506F58275E0003507F557 +:101B900083E508F075160075110075100075171FA4 +:101BA000750F00750C00750D00750B00751800752C +:101BB0001900751A00750A00750E01750001C3E55C +:101BC0000DF5F0E51095F0F509E50AF5F0E50A35B3 +:101BD000F0F509E509F5F0E50055F0F500E500F54B +:101BE000F0E50B45F0F50B750001C3E50DF5F0E5EB +:101BF0001095F0F509E50AF5F0E50A35F0F509E587 +:101C000010F5F0E50D95F0F501E50AF5F0E50A357A +:101C1000F0F501E501F5F0E50945F0F509E50EF50A +:101C2000F0E50965F0F509E509F5F0E50055F0F591 +:101C300000C3E50CF5F0E51195F0F509E50AF5F0BE +:101C4000E50A35F0F509E509F5F0E50055F0F50090 +:101C5000E500F5F0E50B45F0F50B750001C3E50D6A +:101C6000F5F0E51095F0F509E50AF5F0E50A35F02F +:101C7000F509E510F5F0E50D95F0F501E50AF5F04B +:101C8000E50A35F0F501E501F5F0E50945F0F5095E +:101C9000E50EF5F0E50965F0F509E509F5F0E50073 +:101CA00055F0F500C3E50CF5F0E51195F0F509E503 +:101CB0000AF5F0E50A35F0F509E511F5F0E50C95C2 +:101CC000F0F501E50AF5F0E50A35F0F501E501F575 +:101CD000F0E50945F0F509E50EF5F0E50965F0F5E3 +:101CE00009E509F5F0E50055F0F500C3E50FF5F05D +:101CF000E51695F0F509E50AF5F0E50A35F0F50980 +:101D0000E509F5F0E50055F0F500E500F5F0E50B27 +:101D100045F0F50B750001C3E50DF5F0E51095F004 +:101D2000F509E50AF5F0E50A35F0F509E510F5F0F5 +:101D3000E50D95F0F501E50AF5F0E50A35F0F50158 +:101D4000E501F5F0E50945F0F509E50EF5F0E509E1 +:101D500065F0F509E509F5F0E50055F0F500C3E596 +:101D60000CF5F0E51195F0F509E50AF5F0E50A3511 +:101D7000F0F509E511F5F0E50C95F0F501E50AF54A +:101D8000F0E50A35F0F501E501F5F0E50945F0F576 +:101D900009E50EF5F0E50965F0F509E509F5F0E569 +:101DA0000055F0F500C3E50FF5F0E51695F0F509DF +:101DB000E50AF5F0E50A35F0F509E516F5F0E50F69 +:101DC00095F0F501E50AF5F0E50A35F0F501E501D4 +:101DD000F5F0E50945F0F509E50EF5F0E50965F0E2 +:101DE000F509E509F5F0E50055F0F500C3E517F54F +:101DF000F075E0042506F58275E0003507F583E00F +:101E0000F508E50895F0F509E50AF5F0E50A35F07D +:101E1000F509E509F5F0E50055F0F500E500F5F008 +:101E2000E50B45F0F50BE518F500E519F501E51AA8 +:101E3000F50C750A01C3750900E50BF5F0E5099588 +:101E4000F0F509750900E509F5F0E50935F0F50942 +:101E5000E509F5F0E50A65F0F50AC3750900E50046 +:101E6000F5F0E50995F0F509750900E509F5F0E5E6 +:101E70000935F0F509E509F5F0E50A65F0F50AC35D +:101E8000750900E501F5F0E50995F0F5097509001A +:101E9000E509F5F0E50935F0F509E509F5F0E50A9C +:101EA00065F0F50AC3750900E50CF5F0E50995F054 +:101EB000F509750900E509F5F0E50935F0F509E5DD +:101EC00009F5F0E50A65F0F50A7501007509007578 +:101ED0000B00750000E50AF5F0E50045F0F500E5BA +:101EE00001F5F0E50045F0F500E509F5F0E5004500 +:101EF000F0F500E50BF5F0E50045F0F500E50070C4 +:101F000002800302218E00750C02750D00750F0012 +:101F1000751800E513F50EE514F517E515F519E547 +:101F200012F51A751300751400751500751200C3AB +:101F3000750000E50EF5F0E50CA4F50BE50EF5F0E7 +:101F4000E50CA4E5F0F501E50BF5F0E50035F0F55D +:101F500000E517F5F0E50CA4F50BE517F5F0E50C39 +:101F6000A4E5F0F509E50BF5F0E50135F0F501E53F +:101F700019F5F0E50CA4F50BE519F5F0E50CA4E571 +:101F8000F0F50AE50BF5F0E50935F0F509E51AF588 +:101F9000F0E50CA4F50BE51AF5F0E50CA4E5F0F579 +:101FA0000CE50BF5F0E50A35F0F50AC3C3750B0037 +:101FB000E500F5F0E51335F0F513E501F5F0E5146E +:101FC00035F0F514E509F5F0E51535F0F515E50AF8 +:101FD000F5F0E51235F0F512C3750100E50EF5F0E8 +:101FE000E50DA4F50BE50EF5F0E50DA4E5F0F5091A +:101FF000E50BF5F0E50135F0F501E517F5F0E50D38 +:10200000A4F50BE517F5F0E50DA4E5F0F50AE50BF1 +:10201000F5F0E50935F0F509E519F5F0E50DA4F55C +:102020000BE519F5F0E50DA4E5F0F50CE50BF5F081 +:10203000E50A35F0F50A750000C3C3750B00E5002D +:10204000F5F0E51335F0F513E501F5F0E51435F09D +:10205000F514E509F5F0E51535F0F515E50AF5F0A7 +:10206000E51235F0F512C3750900E50EF5F0E50F40 +:10207000A4F50BE50EF5F0E50FA4E5F0F50AE50B88 +:10208000F5F0E50935F0F509E517F5F0E50FA4F5EC +:102090000BE517F5F0E50FA4E5F0F50CE50BF5F011 +:1020A000E50A35F0F50A750000750100C3C3750B2C +:1020B00000E500F5F0E51335F0F513E501F5F0E581 +:1020C0001435F0F514E509F5F0E51535F0F515E5ED +:1020D0000AF5F0E51235F0F512C3750A00E50EF5C4 +:1020E000F0E518A4F50BE50EF5F0E518A4E5F0F51C +:1020F0000CE50BF5F0E50A35F0F50A750000750101 +:1021000000750900C3C3750B00E500F5F0E5133554 +:10211000F0F513E501F5F0E51435F0F514E509F5F2 +:10212000F0E51535F0F515E50AF5F0E51235F0F5B1 +:1021300012750001750100750900750A00C3750B61 +:1021400000E500F5F075E0042506F58275E0003540 +:1021500007F583E0F508E50835F0F50875E0042596 +:1021600006F58275E0003507F583E508F0E501F531 +:10217000F0E51635F0F516E509F5F0E51135F0F561 +:1021800011E50AF5F0E51035F0F510021B9D00C3CE +:10219000E51CF5F0E51355F0F513E51DF5F0E51434 +:1021A00055F0F514E51FF5F0E51555F0F515E51EAC +:1021B000F5F0E51255F0F51275080075E0042506F6 +:1021C000F58275E0003507F583E508F075160075B2 +:1021D0001100751000750C00750D00750E00750F5F +:1021E00000750B00750A01750001C375E000250636 +:1021F000F58275E0003507F583E0F508E508F5F0B0 +:10220000E51095F0F509E50BF5F0E50B35F0F5096E +:10221000E509F5F0E50055F0F500E500F5F0E50C11 +:1022200045F0F50C750001C375E0002506F58275D3 +:10223000E0003507F583E0F508E508F5F0E51095D1 +:10224000F0F509E50BF5F0E50B35F0F509E510F5CE +:10225000F075E0002506F58275E0003507F583E0AE +:10226000F508E50895F0F501E50BF5F0E50B35F01F +:10227000F501E501F5F0E50945F0F509E50AF5F0A8 +:10228000E50965F0F509E509F5F0E50055F0F5001B +:10229000C375E0012506F58275E0003507F583E09A +:1022A000F508E508F5F0E51195F0F509E50BF5F011 +:1022B000E50B35F0F509E509F5F0E50055F0F50019 +:1022C000E500F5F0E50C45F0F50C750001C375E08F +:1022D000002506F58275E0003507F583E0F508E591 +:1022E00008F5F0E51095F0F509E50BF5F0E50B358F +:1022F000F0F509E510F5F075E0002506F58275E0CA +:10230000003507F583E0F508E50895F0F501E50BE4 +:10231000F5F0E50B35F0F501E501F5F0E50945F0DF +:10232000F509E50AF5F0E50965F0F509E509F5F0C7 +:10233000E50055F0F500C375E0012506F58275E06E +:10234000003507F583E0F508E508F5F0E51195F0AF +:10235000F509E50BF5F0E50B35F0F509E511F5F0BC +:1023600075E0012506F58275E0003507F583E0F597 +:1023700008E50895F0F501E50BF5F0E50B35F0F50E +:1023800001E501F5F0E50945F0F509E50AF5F0E5A7 +:102390000965F0F509E509F5F0E50055F0F500C32C +:1023A00075E0022506F58275E0003507F583E0F556 +:1023B00008E508F5F0E51695F0F509E50BF5F0E50B +:1023C0000B35F0F509E509F5F0E50055F0F500E508 +:1023D00000F5F0E50C45F0F50C750001C375E00063 +:1023E0002506F58275E0003507F583E0F508E50878 +:1023F000F5F0E51095F0F509E50BF5F0E50B35F096 +:10240000F509E510F5F075E0002506F58275E000A8 +:102410003507F583E0F508E50895F0F501E50BF5DE +:10242000F0E50B35F0F501E501F5F0E50945F0F5CE +:1024300009E50AF5F0E50965F0F509E509F5F0E5C6 +:102440000055F0F500C375E0012506F58275E00042 +:102450003507F583E0F508E508F5F0E51195F0F5A9 +:1024600009E50BF5F0E50B35F0F509E511F5F0752B +:10247000E0012506F58275E0003507F583E0F508F3 +:10248000E50895F0F501E50BF5F0E50B35F0F50104 +:10249000E501F5F0E50945F0F509E50AF5F0E5098E +:1024A00065F0F509E509F5F0E50055F0F500C375AF +:1024B000E0022506F58275E0003507F583E0F508B2 +:1024C000E508F5F0E51695F0F509E50BF5F0E50BF7 +:1024D00035F0F509E516F5F075E0022506F582758B +:1024E000E0003507F583E0F508E50895F0F501E52E +:1024F0000BF5F0E50B35F0F501E501F5F0E50945E3 +:10250000F0F509E50AF5F0E50965F0F509E509F5E5 +:10251000F0E50055F0F500C375E0032506F582757A +:10252000E0003507F583E0F508E508F5F075E0040F +:102530002506F58275E0003507F583E0F508E50826 +:1025400095F0F509E50BF5F0E50B35F0F509E50932 +:10255000F5F0E50055F0F500E500F5F0E50C45F087 +:10256000F50CE50DF500E50EF501E50FF509E500C3 +:10257000F50BE501F50A750101C3750000E50CF5E1 +:10258000F0E50095F0F500750000E500F5F0E500D8 +:1025900035F0F500E500F5F0E50165F0F501C375EE +:1025A0000000E50BF5F0E50095F0F500750000E59D +:1025B00000F5F0E50035F0F500E500F5F0E5016522 +:1025C000F0F501C3750000E50AF5F0E50095F0F5BA +:1025D00000750000E500F5F0E50035F0F500E500D8 +:1025E000F5F0E50165F0F501C3750000E509F5F0CA +:1025F000E50095F0F500750000E500F5F0E5003523 +:10260000F0F500E500F5F0E50165F0F5017509006C +:10261000750A00750B00750000E501F5F0E5004551 +:10262000F0F500E509F5F0E50045F0F500E50AF5FF +:10263000F0E50045F0F500E50BF5F0E50045F0F5B7 +:1026400000E5007002800302274F00751B02751A17 +:1026500000751900751800E51CF51FE51DF51E75C0 +:10266000E0062506F58275E0003507F583E0F51DE7 +:1026700075E0052506F58275E0003507F583E0F580 +:102680001C120000E582F502E583F503E500F50480 +:10269000E501F505E502F50AE503F509E504F501AF +:1026A000E505F500C3750B00E513F5F0E50A35F017 +:1026B000F51CE514F5F0E50935F0F51DE515F5F027 +:1026C000E50135F0F50875E0062506F58275E000B0 +:1026D0003507F583E508F0E512F5F0E50035F0F58E +:1026E0000875E0052506F58275E0003507F583E5F8 +:1026F00008F0750001750100750900750A00C375C1 +:102700000B00E500F5F075E0042506F58275E000A4 +:102710003507F583E0F508E50835F0F50875E004C0 +:102720002506F58275E0003507F583E508F0E5013B +:10273000F5F0E51635F0F516E509F5F0E51135F09B +:10274000F511E50AF5F0E51035F0F5100221D50098 +:10275000E51CF502E51DF50375E0062506F5827515 +:10276000E0003507F583E0F50475E0052506F58200 +:1027700075E0003507F583E0F50575E0102506F5F1 +:102780008275E0003507F583E0F51775E00F250643 +:10279000F58275E0003507F583E0F51675E00E2546 +:1027A00006F58275E0003507F583E0F51575E00D57 +:1027B0002506F58275E0003507F583E0F51475E030 +:1027C0000C2506F58275E0003507F583E0F51375F5 +:1027D000E00B2506F58275E0003507F583E0F5127C +:1027E00075E00A2506F58275E0003507F583E0F50A +:1027F0001175E0092506F58275E0003507F583E0DF +:10280000F51075E0072506F58275E0003507F583BC +:10281000E0F508E508C0E075E0082506F58275E0FA +:10282000003507F583E0F508E508C0E075E01925F7 +:1028300006F50675E0003507F507E502F582E503C4 +:10284000F583E504F500E505F5012200751C00752A +:102850001D0075080075E0062506F58275E0003557 +:1028600007F583E508F075080075E0052506F58293 +:1028700075E0003507F583E508F00227500000E514 +:1028800006758210C39582F506E50775830095836A +:10289000F507D0E0F50875E0012506F58275E00042 +:1028A0003507F583E508F0D0E0F50875E00025066A +:1028B000F58275E0003507F583E508F075E007253A +:1028C00006F58275E0003507F583E515F075E0063D +:1028D0002506F58275E0003507F583E514F075E00F +:1028E000052506F58275E0003507F583E513F075DB +:1028F000E0042506F58275E0003507F583E512F062 +:1029000075E0032506F58275E0003507F583E511CE +:10291000F075E0022506F58275E0003507F583E5E0 +:1029200010F0E51FF512E51EF513E51DF514E51C85 +:10293000F515E51BF51FE51AF51EE519F51DE5185A +:10294000F51CE582F502E583F503E502F510E503E4 +:10295000F511751B02751A00751900751800E5123E +:10296000F51FE513F51EE514F51DE515F51C121709 +:1029700064E582F502E583F503E500F504E501F57C +:1029800005E502F51FE503F51EE504F51DE505F572 +:102990001C751B67751A01751900751800121277DE +:1029A000E582F502E583F503E502F500E503F501AF +:1029B000750901750A00C3E509F5F0E51095F0F514 +:1029C00009E50AF5F0E51195F0F50AE509F512E5D6 +:1029D0000AF513750901750A00750E04750F007567 +:1029E0001000751100C3750B00E509F5F0E50EA4A4 +:1029F000F50DE509F5F0E50EA4E5F0F50CE50DF5AE +:102A0000F0E50B35F0F50BE50AF5F0E50EA4F50D54 +:102A1000E50AF5F0E50EA4E5F0F50AE50DF5F0E5BB +:102A20000C35F0F50CC3C3750A00E50BF5F0E510A5 +:102A300035F0F510E50CF5F0E51135F0F511C3753D +:102A40000C00E509F5F0E50FA4F50DE509F5F0E555 +:102A50000FA4E5F0F50AE50DF5F0E50C35F0F50C01 +:102A6000750B00C3C3750900E50BF5F0E51035F0F3 +:102A7000F510E50CF5F0E51135F0F511C3750B0017 +:102A8000750C00C3C3750900E50BF5F0E51035F0D2 +:102A9000F510E50CF5F0E51135F0F511C3750B00F7 +:102AA000750C00C3C3750900E50BF5F0E51035F0B2 +:102AB000F510E50CF5F0E51135F0F511C3750900D9 +:102AC000E510F5F0E51235F0F509E511F5F0E5133F +:102AD00035F0F50C750A04750B00751000751100C2 +:102AE000C3750D00E500F5F0E50AA4F50FE500F566 +:102AF000F0E50AA4E5F0F50EE50FF5F0E50D35F08B +:102B0000F50DE501F5F0E50AA4F50FE501F5F0E5B1 +:102B10000AA4E5F0F501E50FF5F0E50E35F0F50E48 +:102B2000C3C3750100E50DF5F0E51035F0F510E5CE +:102B30000EF5F0E51135F0F511C3750E00E500F561 +:102B4000F0E50BA4F50FE500F5F0E50BA4E5F0F5D5 +:102B500001E50FF5F0E50E35F0F50E750D00C3C378 +:102B6000750000E50DF5F0E51035F0F510E50EF512 +:102B7000F0E51135F0F511C3750D00750E00C3C3F6 +:102B8000750000E50DF5F0E51035F0F510E50EF5F2 +:102B9000F0E51135F0F511C3750D00750E00C3C3D6 +:102BA000750000E50DF5F0E51035F0F510E50EF5D2 +:102BB000F0E51135F0F511C3750000E510F5F0E50D +:102BC0000935F0F500E511F5F0E50C35F0F501E516 +:102BD00000F509E501F50A750100C3750000E5017E +:102BE000F5F0E50935F0F501E500F5F0E50A35F019 +:102BF000F500E500F502E501F582E502F583E0F573 +:102C00000B750101C3750000E501F5F0E50935F02C +:102C1000F501E500F5F0E50A35F0F500E500F5020F +:102C2000E501F582E502F583E0F50C750102C37557 +:102C30000000E501F5F0E50935F0F501E500F5F0F6 +:102C4000E50A35F0F500E500F502E501F582E5025B +:102C5000F583E0F50D750103C3750000E501F5F09E +:102C6000E50935F0F501E500F5F0E50A35F0F50088 +:102C7000E500F502E501F582E502F583E0F500E502 +:102C80000BF502E50CF503E50DF504E500F505751A +:102C9000E0072506F58275E0003507F583E0F515B8 +:102CA00075E0062506F58275E0003507F583E0F549 +:102CB0001475E0052506F58275E0003507F583E01B +:102CC000F51375E0042506F58275E0003507F583F8 +:102CD000E0F51275E0032506F58275E0003507F58D +:102CE00083E0F51175E0022506F58275E0003507F1 +:102CF000F583E0F51075E0002506F58275E00035F6 +:102D000007F583E0F508E508C0E075E0012506F564 +:102D10008275E0003507F583E0F508E508C0E07549 +:102D2000E0102506F50675E0003507F507E502F524 +:102D300082E503F583E504F500E505F501220000D1 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/ultrasp4.s.expected b/tests/GCCTestSuite/ultrasp4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/ultrasp4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-1.c b/tests/GCCTestSuite/uninit-1.c new file mode 100644 index 0000000..060ec25 --- /dev/null +++ b/tests/GCCTestSuite/uninit-1.c @@ -0,0 +1,30 @@ +/* Spurious uninitialized variable warnings, case 1. + Taken from cppfiles.c (merge_include_chains) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct list +{ + struct list *next; + int id; +}; + +extern void free (void *); + +void remove_dupes (struct list *el) +{ + struct list *p, *q, *r; /* { dg-bogus "r" "uninitialized variable warning" } */ + + for (p = el; p; p = p->next) + { + for (q = el; q != p; q = q->next) + if (q->id == p->id) + { + r->next = p->next; + free (p); + p = r; + break; + } + r = p; + } +} diff --git a/tests/GCCTestSuite/uninit-1.c.expected b/tests/GCCTestSuite/uninit-1.c.expected new file mode 100644 index 0000000..060ec25 --- /dev/null +++ b/tests/GCCTestSuite/uninit-1.c.expected @@ -0,0 +1,30 @@ +/* Spurious uninitialized variable warnings, case 1. + Taken from cppfiles.c (merge_include_chains) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct list +{ + struct list *next; + int id; +}; + +extern void free (void *); + +void remove_dupes (struct list *el) +{ + struct list *p, *q, *r; /* { dg-bogus "r" "uninitialized variable warning" } */ + + for (p = el; p; p = p->next) + { + for (q = el; q != p; q = q->next) + if (q->id == p->id) + { + r->next = p->next; + free (p); + p = r; + break; + } + r = p; + } +} diff --git a/tests/GCCTestSuite/uninit-1.hex.expected b/tests/GCCTestSuite/uninit-1.hex.expected new file mode 100644 index 0000000..bffac8e --- /dev/null +++ b/tests/GCCTestSuite/uninit-1.hex.expected @@ -0,0 +1,128 @@ +:100000000000E50675820CC39582F506E507758349 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0092506F58275E0003507F583E517F030 +:1000500075E0082506F58275E0003507F583E5169D +:10006000F075E0072506F58275E0003507F583E5B4 +:1000700015F075E0062506F58275E0003507F58375 +:10008000E514F075E0052506F58275E0003507F505 +:1000900083E513F075E0042506F58275E000350769 +:1000A000F583E512F075E0032506F58275E000356D +:1000B00007F583E511F075E0022506F58275E0008D +:1000C0003507F583E510F0E51FF516E51EF517E594 +:1000D00016F51FE517F51E750101C3750000E51F34 +:1000E000F5F0E50095F0F500750000E500F5F0E5A8 +:1000F0000035F0F500E500F5F0E50165F0F501C328 +:10010000750000E51EF5F0E50095F0F500750000BE +:10011000E500F5F0E50035F0F500E500F5F0E50166 +:1001200065F0F501750900750000E501F5F0E500E1 +:1001300045F0F500E509F5F0E50045F0F500E500CE +:100140007002800302070600E516F510E517F511A9 +:10015000750000C3E51FF5F0E51095F0F501E50128 +:10016000F5F0E50045F0F500C3E51EF5F0E5119565 +:10017000F0F501E501F5F0E50045F0F50075010049 +:10018000750900750A00750C01C3750B00E500F5D3 +:10019000F0E50B95F0F50B750B00E50BF5F0E50BB5 +:1001A00035F0F50BE50BF5F0E50C65F0F50CC375D6 +:1001B0000B00E501F5F0E50B95F0F50B750B00E58F +:1001C0000BF5F0E50B35F0F50BE50BF5F0E50C65FF +:1001D000F0F50CC3750B00E509F5F0E50B95F0F5AE +:1001E0000B750B00E50BF5F0E50B35F0F50BE50BAA +:1001F000F5F0E50C65F0F50CC3750B00E50AF5F0BC +:10020000E50B95F0F50B750B00E50BF5F0E50B35FF +:10021000F0F50BE50BF5F0E50C65F0F50C7501005C +:10022000750900750A00750000E50CF5F0E500455C +:10023000F0F500E501F5F0E50045F0F500E509F51C +:10024000F0E50045F0F500E50AF5F0E50045F0F5CC +:1002500000E5007002800302068300750102C37589 +:100260000000E501F5F0E51035F0F509E500F5F0E1 +:10027000E51135F0F50A750100C3750000E501F5DB +:10028000F0E50935F0F501E500F5F0E50A35F0F5A2 +:1002900000E500F502E501F582E502F583E0F50EE3 +:1002A000750101C3750000E501F5F0E50935F0F5CC +:1002B00001E500F5F0E50A35F0F500E500F502E5A9 +:1002C00001F582E502F583E0F50F750102C37500C3 +:1002D00000E501F5F0E50935F0F501E500F5F0E59B +:1002E0000A35F0F500E500F502E501F582E502F5D5 +:1002F00083E0F512750103C3750000E501F5F0E533 +:100300000935F0F501E500F5F0E50A35F0F500E511 +:1003100000F502E501F582E502F583E0F5137501CC +:1003200002C3750000E501F5F0E51F35F0F509E5BC +:1003300000F5F0E51E35F0F50A750000C375010003 +:10034000E500F5F0E50935F0F500E501F5F0E50A21 +:1003500035F0F501E501F502E500F582E502F583EA +:10036000E0F50B750001C3750100E500F5F0E50946 +:1003700035F0F500E501F5F0E50A35F0F501E501A8 +:10038000F502E500F582E502F583E0F50C75000263 +:10039000C3750100E500F5F0E50935F0F500E5016C +:1003A000F5F0E50A35F0F501E501F502E500F58225 +:1003B000E502F583E0F50D750003C3750100E50066 +:1003C000F5F0E50935F0F500E501F5F0E50A35F061 +:1003D000F501E501F502E500F582E502F583E0F5BA +:1003E00000750100C3E50BF5F0E50E95F0F509E5A4 +:1003F00009F5F0E50145F0F501C3E50CF5F0E50F71 +:1004000095F0F509E509F5F0E50145F0F501C3E5DD +:100410000DF5F0E51295F0F509E509F5F0E5014572 +:10042000F0F501C3E500F5F0E51395F0F509E509F0 +:10043000F5F0E50145F0F501750900750A00750B49 +:1004400000E501F500750101C3750C00E500F5F04C +:10045000E50C95F0F50C750C00E50CF5F0E50C35A8 +:10046000F0F50CE50CF5F0E50165F0F501C3750C50 +:1004700000E509F5F0E50C95F0F50C750C00E50CC0 +:10048000F5F0E50C35F0F50CE50CF5F0E50165F05F +:10049000F501C3750C00E50AF5F0E50C95F0F50CD7 +:1004A000750C00E50CF5F0E50C35F0F50CE50CF5F8 +:1004B000F0E50165F0F501C3750C00E50BF5F0E51D +:1004C0000C95F0F50C750C00E50CF5F0E50C35F02D +:1004D000F50CE50CF5F0E50165F0F5017509007521 +:1004E0000A00750B00750000E501F5F0E50045F028 +:1004F000F500E509F5F0E50045F0F500E50AF5F051 +:10050000E50045F0F500E50BF5F0E50045F0F500F8 +:10051000E5007002800302059400750100C37500B8 +:1005200000E501F5F0E51035F0F501E500F5F0E541 +:100530001135F0F500E501F509E500F50A75010052 +:10054000C3750000E501F5F0E50935F0F501E500BA +:10055000F5F0E50A35F0F500E500F502E501F58274 +:10056000E502F583E0F510750101C3750000E501B2 +:10057000F5F0E50935F0F501E500F5F0E50A35F0AF +:10058000F500E500F502E501F582E502F583E0F509 +:100590001102015000750100C3750000E501F5F07E +:1005A000E51435F0F50CE500F5F0E51535F0F50D41 +:1005B000750100C3750000E501F5F0E51F35F0F5A4 +:1005C00009E500F5F0E51E35F0F50A750100C37583 +:1005D0000000E501F5F0E50935F0F501E500F5F07D +:1005E000E50A35F0F500E500F502E501F582E502E2 +:1005F000F583E0F50B750101C3750000E501F5F029 +:10060000E50935F0F501E500F5F0E50A35F0F5000E +:10061000E500F502E501F582E502F583E0F50975EF +:100620000100C3750000E501F5F0E50C35F0F501BA +:10063000E500F5F0E50D35F0F500E50BF503E50017 +:10064000F502E501F582E502F583E503F0750101A8 +:10065000C3750000E501F5F0E50C35F0F501E500A6 +:10066000F5F0E50D35F0F500E509F503E500F502D7 +:10067000E501F582E502F583E503F0E514F51FE5F4 +:1006800015F51E00E51FF514E51EF515750100C3EF +:10069000750000E501F5F0E51F35F0F501E500F521 +:1006A000F0E51E35F0F500E501F509E500F50A7500 +:1006B0000100C3750000E501F5F0E50935F0F5012D +:1006C000E500F5F0E50A35F0F500E500F502E50195 +:1006D000F582E502F583E0F51F750101C3750000A1 +:1006E000E501F5F0E50935F0F501E500F5F0E50A7D +:1006F00035F0F500E500F502E501F582E502F58348 +:10070000E0F51E0200D700750000E500F502E500E7 +:10071000F503E500F504E500F50575E0092506F5A6 +:100720008275E0003507F583E0F51775E0082506CA +:10073000F58275E0003507F583E0F51675E00725CD +:1007400006F58275E0003507F583E0F51575E006DE +:100750002506F58275E0003507F583E0F51475E0B0 +:10076000052506F58275E0003507F583E0F513757C +:10077000E0042506F58275E0003507F583E0F51203 +:1007800075E0032506F58275E0003507F583E0F591 +:100790001175E0022506F58275E0003507F583E066 +:1007A000F51075E0002506F58275E0003507F58344 +:1007B000E0F508E508C0E075E0012506F58275E082 +:1007C000003507F583E0F508E508C0E075E00C2585 +:1007D00006F50675E0003507F507E502F582E50345 +:1007E000F583E504F500E505F501220000000000B1 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-1.s.expected b/tests/GCCTestSuite/uninit-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-11.c b/tests/GCCTestSuite/uninit-11.c new file mode 100644 index 0000000..5251f0a --- /dev/null +++ b/tests/GCCTestSuite/uninit-11.c @@ -0,0 +1,42 @@ +/* Positive test for uninitialized variables. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +int sink; + +void f1(int parm) /* { dg-bogus "uninitialized" "parameter" } */ +{ + sink = parm; /* { dg-bogus "uninitialized" "parameter" } */ +} + +void f2(void) +{ + int x; + sink = x; /* { dg-warning "is used" "unconditional" } */ +} + +void f3(int p) +{ + int x; /* { dg-warning "may be used" "conditional" } */ + if (p) + x = p; + sink = x; +} + +void f4(int p) +{ + int x; /* { dg-bogus "uninitialized" "easy if" } */ + if (p) + x = 1; + else + x = 2; + sink = x; +} + +void f5(void) +{ + int x, i; /* { dg-bogus "uninitialized" "easy loop" } */ + for (i = 0; i < 10; ++i) + x = 1; + sink = x; +} diff --git a/tests/GCCTestSuite/uninit-11.c.expected b/tests/GCCTestSuite/uninit-11.c.expected new file mode 100644 index 0000000..5251f0a --- /dev/null +++ b/tests/GCCTestSuite/uninit-11.c.expected @@ -0,0 +1,42 @@ +/* Positive test for uninitialized variables. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +int sink; + +void f1(int parm) /* { dg-bogus "uninitialized" "parameter" } */ +{ + sink = parm; /* { dg-bogus "uninitialized" "parameter" } */ +} + +void f2(void) +{ + int x; + sink = x; /* { dg-warning "is used" "unconditional" } */ +} + +void f3(int p) +{ + int x; /* { dg-warning "may be used" "conditional" } */ + if (p) + x = p; + sink = x; +} + +void f4(int p) +{ + int x; /* { dg-bogus "uninitialized" "easy if" } */ + if (p) + x = 1; + else + x = 2; + sink = x; +} + +void f5(void) +{ + int x, i; /* { dg-bogus "uninitialized" "easy loop" } */ + for (i = 0; i < 10; ++i) + x = 1; + sink = x; +} diff --git a/tests/GCCTestSuite/uninit-11.hex.expected b/tests/GCCTestSuite/uninit-11.hex.expected new file mode 100644 index 0000000..b8ee611 --- /dev/null +++ b/tests/GCCTestSuite/uninit-11.hex.expected @@ -0,0 +1,176 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F50ED0E0F50FE512F50B6E +:10002000E511F50CE510F50D900000E582F509905D +:100030000000E583F50A750100C3750000E501F5D0 +:10004000F0E50935F0F501E500F5F0E50A35F0F5E4 +:1000500000E51FF503E500F502E501F582E502F58F +:1000600083E503F0750101C3750000E501F5F0E5D6 +:100070000935F0F501E500F5F0E50A35F0F500E5A4 +:100080001EF503E500F502E501F582E502F583E5DD +:1000900003F0750102C3750000E501F5F0E50935CF +:1000A000F0F501E500F5F0E50A35F0F500E51DF5A0 +:1000B00003E500F502E501F582E502F583E503F0CD +:1000C000750103C3750000E501F5F0E50935F0F5AC +:1000D00001E500F5F0E50A35F0F500E51CF503E56E +:1000E00000F502E501F582E502F583E503F0750010 +:1000F00000E500F502E500F503E500F504E500F58F +:1001000005E50BF512E50CF511E50DF510E50FC051 +:10011000E0E50EC0E075E0042506F50675E0003563 +:1001200007F507E502F582E503F583E504F500E54B +:1001300005F5012200D0E0F50BD0E0F50C900000B1 +:10014000E582F509900000E583F50A750100C375A5 +:100150000000E501F5F0E50935F0F501E500F5F001 +:10016000E50A35F0F500E50DF503E500F502E501DA +:10017000F582E502F583E503F0750101C375000022 +:10018000E501F5F0E50935F0F501E500F5F0E50AE2 +:1001900035F0F500E50DF503E500F502E501F58222 +:1001A000E502F583E503F0750102C3750000E50182 +:1001B000F5F0E50935F0F501E500F5F0E50A35F073 +:1001C000F500E50DF503E500F502E501F582E50230 +:1001D000F583E503F0750103C3750000E501F5F053 +:1001E000E50935F0F501E500F5F0E50A35F0F50033 +:1001F000E50DF503E500F502E501F582E502F5837D +:10020000E503F0750000E500F502E500F503E50003 +:10021000F504E500F505E50CC0E0E50BC0E0E502FE +:10022000F582E503F583E504F500E505F501220017 +:10023000E506758204C39582F506E507758300958A +:1002400083F507D0E0F518D0E0F519E512F50F7544 +:100250000B00E51FF5F0E50B45F0F50BE51EF5F09D +:10026000E50B45F0F50BE51DF5F0E50B45F0F50B5D +:10027000E51CF5F0E50B45F0F50BE50B700280038E +:1002800002038800900000E582F50D900000E583F0 +:10029000F50E750C00C3750B00E50CF5F0E50D359A +:1002A000F0F50CE50BF5F0E50E35F0F50BE500F596 +:1002B00003E50BF502E50CF582E502F583E503F0B5 +:1002C000750C01C3750000E50CF5F0E50D35F0F592 +:1002D0000CE500F5F0E50E35F0F50BE501F503E56D +:1002E0000BF502E50CF582E502F583E503F0750CEC +:1002F00002C3750000E50CF5F0E50D35F0F50CE5F1 +:1003000000F5F0E50E35F0F50BE509F503E50BF525 +:1003100002E50CF582E502F583E503F0750C03C3F5 +:10032000750000E50CF5F0E50D35F0F50CE500F590 +:10033000F0E50E35F0F50BE50AF503E50BF502E502 +:100340000CF582E502F583E503F0750000E500F5A4 +:1003500002E500F503E500F504E500F505E50FF518 +:1003600012E519C0E0E518C0E075E0042506F506C1 +:1003700075E0003507F507E502F582E503F583E54D +:1003800004F500E505F5012200E51FF500E51EF581 +:1003900001E51DF509E51CF50A02028400E5067574 +:1003A0008204C39582F506E5077583009583F507FA +:1003B000D0E0F518D0E0F519E512F50F750000E56D +:1003C0001FF5F0E50045F0F500E51EF5F0E5004508 +:1003D000F0F500E51DF5F0E50045F0F500E51CF54C +:1003E000F0E50045F0F500E500700280030205012C +:1003F00000750B02750C00750D00750E0090000065 +:10040000E582F509900000E583F50A750100C375E2 +:100410000000E501F5F0E50935F0F501E500F5F03E +:10042000E50A35F0F500E50BF503E500F502E50119 +:10043000F582E502F583E503F0750101C37500005F +:10044000E501F5F0E50935F0F501E500F5F0E50A1F +:1004500035F0F500E50CF503E500F502E501F58260 +:10046000E502F583E503F0750102C3750000E501BF +:10047000F5F0E50935F0F501E500F5F0E50A35F0B0 +:10048000F500E50DF503E500F502E501F582E5026D +:10049000F583E503F0750103C3750000E501F5F090 +:1004A000E50935F0F501E500F5F0E50A35F0F50070 +:1004B000E50EF503E500F502E501F582E502F583B9 +:1004C000E503F0750000E500F502E500F503E50041 +:1004D000F504E500F505E50FF512E519C0E0E518AE +:1004E000C0E075E0042506F50675E0003507F50760 +:1004F000E502F582E503F583E504F500E505F50180 +:100500002200750B01750C00750D00750E000203BD +:10051000FD00E506758207C39582F506E50775833C +:10052000009583F507D0E0F50875E0012506F58212 +:1005300075E0003507F583E508F0D0E0F50875E0D3 +:10054000002506F58275E0003507F583E508F0E53E +:1005500017F51DE516F51EE515F51F75E0062506D0 +:10056000F58275E0003507F583E514F075E00525A3 +:1005700006F58275E0003507F583E513F075E004B4 +:100580002506F58275E0003507F583E512F075E084 +:10059000032506F58275E0003507F583E511F07552 +:1005A000E0022506F58275E0003507F583E510F0D9 +:1005B00075160075120075130075180075170A7509 +:1005C0001500750F00751000E518F511750080E530 +:1005D00000F5F0E51125F0F511E500F5F0E5102541 +:1005E000F0F510750C00750D00750E007514007592 +:1005F0000B00750A01750001C3E510F5F0E51195D2 +:10060000F0F509E50BF5F0E50B35F0F509E509F531 +:10061000F0E50055F0F500E500F5F0E50C45F0F5E6 +:100620000C750001C3E510F5F0E51195F0F509E54D +:100630000BF5F0E50B35F0F509E511F5F0E5109552 +:10064000F0F501E50BF5F0E50B35F0F501E501F509 +:10065000F0E50945F0F509E50AF5F0E50965F0F57D +:1006600009E509F5F0E50055F0F500C3E50FF5F0F3 +:10067000E51395F0F509E50BF5F0E50B35F0F50917 +:10068000E509F5F0E50055F0F500E500F5F0E50CBD +:1006900045F0F50C750001C3E510F5F0E51195F096 +:1006A000F509E50BF5F0E50B35F0F509E511F5F089 +:1006B000E51095F0F501E50BF5F0E50B35F0F501EA +:1006C000E501F5F0E50945F0F509E50AF5F0E5097C +:1006D00065F0F509E509F5F0E50055F0F500C3E52D +:1006E0000FF5F0E51395F0F509E50BF5F0E50B35A1 +:1006F000F0F509E513F5F0E50F95F0F501E50BF5DB +:10070000F0E50B35F0F501E501F5F0E50945F0F50B +:1007100009E50AF5F0E50965F0F509E509F5F0E503 +:100720000055F0F500C3E515F5F0E51295F0F50973 +:10073000E50BF5F0E50B35F0F509E509F5F0E50019 +:1007400055F0F500E500F5F0E50C45F0F50C750009 +:1007500001C3E510F5F0E51195F0F509E50BF5F0AD +:10076000E50B35F0F509E511F5F0E51095F0F5012B +:10077000E50BF5F0E50B35F0F501E501F5F0E509E0 +:1007800045F0F509E50AF5F0E50965F0F509E50933 +:10079000F5F0E50055F0F500C3E50FF5F0E513952C +:1007A000F0F509E50BF5F0E50B35F0F509E513F586 +:1007B000F0E50F95F0F501E50BF5F0E50B35F0F5FB +:1007C00001E501F5F0E50945F0F509E50AF5F0E583 +:1007D0000965F0F509E509F5F0E50055F0F500C308 +:1007E000E515F5F0E51295F0F509E50BF5F0E50BEB +:1007F00035F0F509E512F5F0E51595F0F501E50B95 +:10080000F5F0E50B35F0F501E501F5F0E50945F00A +:10081000F509E50AF5F0E50965F0F509E509F5F0F2 +:10082000E50055F0F500C3E517F5F0E51695F0F590 +:1008300009E50BF5F0E50B35F0F509E509F5F0E50F +:100840000055F0F500E500F5F0E50C45F0F50C7508 +:100850000101C3750000E50CF5F0E50095F0F50029 +:10086000750000E500F5F0E50035F0F500E500F570 +:10087000F0E50165F0F501C3750000E50DF5F0E563 +:100880000095F0F500750000E500F5F0E50035F0A5 +:10089000F500E500F5F0E50165F0F501C375000030 +:1008A000E50EF5F0E50095F0F500750000E500F5C2 +:1008B000F0E50035F0F500E500F5F0E50165F0F54F +:1008C00001C3750000E514F5F0E50095F0F500753D +:1008D0000000E500F5F0E50035F0F500E500F5F085 +:1008E000E50165F0F501750900750A00750B0075E5 +:1008F0000000E501F5F0E50045F0F500E509F5F04B +:10090000E50045F0F500E50AF5F0E50045F0F500F5 +:10091000E50BF5F0E50045F0F500E5007002800319 +:1009200002096B00751901751A00751B00751C0012 +:10093000750101750900750A00750B00C37500008B +:10094000E501F5F0E51635F0F516E509F5F0E512E7 +:1009500035F0F512E50AF5F0E51335F0F513E50B82 +:10096000F5F0E51835F0F5180205BC00900000E53B +:1009700082F509900000E583F50A750100C3750052 +:1009800000E501F5F0E50935F0F501E500F5F0E5E4 +:100990000A35F0F500E519F503E500F502E501F586 +:1009A00082E502F583E503F0750101C3750000E5FA +:1009B00001F5F0E50935F0F501E500F5F0E50A355A +:1009C000F0F500E51AF503E500F502E501F582E52D +:1009D00002F583E503F0750102C3750000E501F53A +:1009E000F0E50935F0F501E500F5F0E50A35F0F53B +:1009F00000E51BF503E500F502E501F582E502F5EA +:100A000083E503F0750103C3750000E501F5F0E52A +:100A10000935F0F501E500F5F0E50A35F0F500E5FA +:100A20001CF503E500F502E501F582E502F583E535 +:100A300003F0750000E500F502E500F503E500F5BB +:100A400004E500F505E51DF517E51EF516E51FF5AE +:100A50001575E0062506F58275E0003507F583E09B +:100A6000F51475E0052506F58275E0003507F58378 +:100A7000E0F51375E0042506F58275E0003507F50D +:100A800083E0F51275E0032506F58275E000350771 +:100A9000F583E0F51175E0022506F58275E0003575 +:100AA00007F583E0F51075E0002506F58275E00096 +:100AB0003507F583E0F508E508C0E075E001250697 +:100AC000F58275E0003507F583E0F508E508C0E03C +:100AD00075E0072506F50675E0003507F507E50220 +:100AE000F582E503F583E504F500E505F50122004F +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-11.s.expected b/tests/GCCTestSuite/uninit-11.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-11.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-2.c b/tests/GCCTestSuite/uninit-2.c new file mode 100644 index 0000000..352bbac --- /dev/null +++ b/tests/GCCTestSuite/uninit-2.c @@ -0,0 +1,52 @@ +/* Spurious uninitialized variable warnings, case 2. + Taken from cpphash.c (macroexpand) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct definition +{ + int nargs; + int rest_args; +}; + +struct cpp_reader; + +enum cpp_token +{ + CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN +}; + +extern enum cpp_token macarg (struct cpp_reader *, int); + +void +macroexpand (struct cpp_reader *pfile, struct definition *defn) +{ + int nargs = defn->nargs; + + if (nargs >= 0) + { + enum cpp_token token; /* { dg-bogus "token" "uninitialized variable warning" } */ + int i, rest_args; + i = 0; + rest_args = 0; + do + { + if (rest_args) + continue; + if (i < nargs || (nargs == 0 && i == 0)) + { + /* if we are working on last arg which absorbs rest of args... */ + if (i == nargs - 1 && defn->rest_args) + rest_args = 1; + token = macarg (pfile, rest_args); + } + else + token = macarg (pfile, 0); + if (token == CPP_EOF || token == CPP_POP) + return; + + i++; + } + while (token == CPP_COMMA); + } +} diff --git a/tests/GCCTestSuite/uninit-2.c.expected b/tests/GCCTestSuite/uninit-2.c.expected new file mode 100644 index 0000000..352bbac --- /dev/null +++ b/tests/GCCTestSuite/uninit-2.c.expected @@ -0,0 +1,52 @@ +/* Spurious uninitialized variable warnings, case 2. + Taken from cpphash.c (macroexpand) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct definition +{ + int nargs; + int rest_args; +}; + +struct cpp_reader; + +enum cpp_token +{ + CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN +}; + +extern enum cpp_token macarg (struct cpp_reader *, int); + +void +macroexpand (struct cpp_reader *pfile, struct definition *defn) +{ + int nargs = defn->nargs; + + if (nargs >= 0) + { + enum cpp_token token; /* { dg-bogus "token" "uninitialized variable warning" } */ + int i, rest_args; + i = 0; + rest_args = 0; + do + { + if (rest_args) + continue; + if (i < nargs || (nargs == 0 && i == 0)) + { + /* if we are working on last arg which absorbs rest of args... */ + if (i == nargs - 1 && defn->rest_args) + rest_args = 1; + token = macarg (pfile, rest_args); + } + else + token = macarg (pfile, 0); + if (token == CPP_EOF || token == CPP_POP) + return; + + i++; + } + while (token == CPP_COMMA); + } +} diff --git a/tests/GCCTestSuite/uninit-2.hex.expected b/tests/GCCTestSuite/uninit-2.hex.expected new file mode 100644 index 0000000..dd721cd --- /dev/null +++ b/tests/GCCTestSuite/uninit-2.hex.expected @@ -0,0 +1,373 @@ +:100000000000E506758218C39582F506E50775833D +:10001000009583F507D0E0F50875E00B2506F5821D +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:100030000A2506F58275E0003507F583E508F075B9 +:10004000E0132506F58275E0003507F583E517F026 +:1000500075E0122506F58275E0003507F583E51693 +:10006000F075E0112506F58275E0003507F583E5AA +:1000700015F075E0102506F58275E0003507F5836B +:10008000E514F075E00F2506F58275E0003507F5FB +:1000900083E513F075E00E2506F58275E00035075F +:1000A000F583E512F075E00D2506F58275E0003563 +:1000B00007F583E511F075E00C2506F58275E00083 +:1000C0003507F583E510F075E0012506F58275E04A +:1000D000003507F583E51FF075E0002506F582750C +:1000E000E0003507F583E51EF075E0032506F5828F +:1000F00075E0003507F583E51DF075E0022506F58E +:100100008275E0003507F583E51CF0750C00C375BA +:100110000B00E50CF5F075E0032506F58275E000AF +:100120003507F583E0F508E50835F0F50DE50BF545 +:10013000F075E0022506F58275E0003507F583E0ED +:10014000F508E50835F0F50E750C00C3750B00E5F4 +:100150000CF5F0E50D35F0F50CE50BF5F0E50E3599 +:10016000F0F50BE50BF502E50CF582E502F583E011 +:10017000F50875E0092506F58275E0003507F58379 +:10018000E508F0750C01C3750B00E50CF5F0E50D05 +:1001900035F0F50CE50BF5F0E50E35F0F50BE50B5C +:1001A000F502E50CF582E502F583E0F512750C0227 +:1001B000C3750B00E50CF5F0E50D35F0F50CE50B1E +:1001C000F5F0E50E35F0F50BE50BF502E50CF582E3 +:1001D000E502F583E0F510750C03C3750B00E50C23 +:1001E000F5F0E50D35F0F50CE50BF5F0E50E35F025 +:1001F000F50BE50BF502E50CF582E502F583E0F57C +:100200000875E0082506F58275E0003507F583E5F9 +:1002100008F0751A0075190075160075110075E063 +:10022000082506F58275E0003507F583E0F51375BE +:100230000B80E50BF5F0E51325F0F513E50BF5F074 +:10024000E51125F0F511750F00751400751800758E +:100250001500750E00751701750B01C3E511F5F05A +:10026000E51395F0F50DE50EF5F0E50E35F0F50D1D +:10027000E50DF5F0E50B55F0F50BE50BF5F0E50FA9 +:1002800045F0F50F750B01C3E511F5F0E51395F099 +:10029000F50DE50EF5F0E50E35F0F50DE513F5F08D +:1002A000E51195F0F50CE50EF5F0E50E35F0F50CE1 +:1002B000E50CF5F0E50D45F0F50DE517F5F0E50D6C +:1002C00065F0F50DE50DF5F0E50B55F0F50BC3E523 +:1002D00016F5F0E51095F0F50DE50EF5F0E50E35A7 +:1002E000F0F50DE50DF5F0E50B55F0F50BE50BF52B +:1002F000F0E50F45F0F50F750B01C3E511F5F0E5DD +:100300001395F0F50DE50EF5F0E50E35F0F50DE57C +:1003100013F5F0E51195F0F50CE50EF5F0E50E3569 +:10032000F0F50CE50CF5F0E50D45F0F50DE517F5EC +:10033000F0E50D65F0F50DE50DF5F0E50B55F0F583 +:100340000BC3E516F5F0E51095F0F50DE50EF5F0AB +:10035000E50E35F0F50DE510F5F0E51695F0F50C28 +:10036000E50EF5F0E50E35F0F50CE50CF5F0E50DD4 +:1003700045F0F50DE517F5F0E50D65F0F50DE50D2A +:10038000F5F0E50B55F0F50BC3E519F5F0E5129521 +:10039000F0F50DE50EF5F0E50E35F0F50DE50DF592 +:1003A000F0E50B55F0F50BE50BF5F0E50F45F0F535 +:1003B0000F750B01C3E511F5F0E51395F0F50DE5AB +:1003C0000EF5F0E50E35F0F50DE513F5F0E51195B8 +:1003D000F0F50CE50EF5F0E50E35F0F50CE50CF555 +:1003E000F0E50D45F0F50DE517F5F0E50D65F0F5D7 +:1003F0000DE50DF5F0E50B55F0F50BC3E516F5F041 +:10040000E51095F0F50DE50EF5F0E50E35F0F50D7E +:10041000E510F5F0E51695F0F50CE50EF5F0E50EB6 +:1004200035F0F50CE50CF5F0E50D45F0F50DE517AB +:10043000F5F0E50D65F0F50DE50DF5F0E50B55F082 +:10044000F50BC3E519F5F0E51295F0F50DE50EF5A0 +:10045000F0E50E35F0F50DE512F5F0E51995F0F53E +:100460000CE50EF5F0E50E35F0F50CE50CF5F0E5D4 +:100470000D45F0F50DE517F5F0E50D65F0F50DE529 +:100480000DF5F0E50B55F0F50BC3E51AF5F075E049 +:10049000092506F58275E0003507F583E0F508E5E6 +:1004A0000895F0F50DE50EF5F0E50E35F0F50DE5E6 +:1004B0000DF5F0E50B55F0F50BE50BF5F0E50F4507 +:1004C000F0F50FE50FF50BE518F50C750F01C37589 +:1004D0000D00E50BF5F0E50D95F0F50D750D00E55A +:1004E0000DF5F0E50D35F0F50DE50DF5F0E50F65D1 +:1004F000F0F50FC3750D00E514F5F0E50D95F0F579 +:100500000D750D00E50DF5F0E50D35F0F50DE50D7A +:10051000F5F0E50F65F0F50FC3750D00E50CF5F08E +:10052000E50D95F0F50D750D00E50DF5F0E50D35D2 +:10053000F0F50DE50DF5F0E50F65F0F50FC3750D60 +:1005400000E515F5F0E50D95F0F50D750D00E50DDF +:10055000F5F0E50D35F0F50DE50DF5F0E50F65F07D +:10056000F50F751400751800751500750B00E50F73 +:10057000F5F0E50B45F0F50BE514F5F0E50B45F06E +:10058000F50BE518F5F0E50B45F0F50BE515F5F085 +:10059000E50B45F0F50BE50B7002800302068400C5 +:1005A000750000E500F502E500F503E500F504E55A +:1005B00000F50575E0132506F58275E0003507F5B1 +:1005C00083E0F51775E0122506F58275E000350722 +:1005D000F583E0F51675E0112506F58275E0003526 +:1005E00007F583E0F51575E0102506F58275E00046 +:1005F0003507F583E0F51475E00F2506F58275E003 +:10060000003507F583E0F51375E00E2506F58275D4 +:10061000E0003507F583E0F51275E00D2506F5825B +:1006200075E0003507F583E0F51175E00C2506F55A +:100630008275E0003507F583E0F51075E00A2506C0 +:10064000F58275E0003507F583E0F508E508C0E0C0 +:1006500075E00B2506F58275E0003507F583E0F5BA +:1006600008E508C0E075E0182506F50675E00035D8 +:1006700007F507E502F582E503F583E504F500E5F6 +:1006800005F501220075140075130075110075172A +:100690000075080075E0072506F58275E00035074E +:1006A000F583E508F075080075E0062506F5827506 +:1006B000E0003507F583E508F075080075E00525CD +:1006C00006F58275E0003507F583E508F07508004A +:1006D00075E0042506F58275E0003507F583E50829 +:1006E000F000750B0075E0072506F58275E0003512 +:1006F00007F583E0F508E508F5F0E50B45F0F50BA7 +:1007000075E0062506F58275E0003507F583E0F50E +:1007100008E508F5F0E50B45F0F50B75E005250655 +:10072000F58275E0003507F583E0F508E508F5F09A +:10073000E50B45F0F50B75E0042506F58275E00044 +:100740003507F583E0F508E508F5F0E50B45F0F52C +:100750000BE50B7002800302172F00E517F50E75ED +:10076000E0082506F58275E0003507F583E0F50D14 +:10077000750080E500F5F0E50E25F0F50EE500F5D5 +:10078000F0E50D25F0F50D750C00750F00751500E1 +:10079000751600750B00750A01750001C3E50DF5AE +:1007A000F0E50E95F0F509E50BF5F0E50B35F0F504 +:1007B00009E509F5F0E50055F0F500E500F5F0E58F +:1007C0000C45F0F50C750001C3E50DF5F0E50E954F +:1007D000F0F509E50BF5F0E50B35F0F509E50EF55B +:1007E000F0E50D95F0F501E50BF5F0E50B35F0F5CD +:1007F00001E501F5F0E50945F0F509E50AF5F0E553 +:100800000965F0F509E509F5F0E50055F0F500C3D7 +:10081000E510F5F0E51195F0F509E50BF5F0E50BC0 +:1008200035F0F509E509F5F0E50055F0F500E500CE +:10083000F5F0E50C45F0F50C750001C3E50DF5F09C +:10084000E50E95F0F509E50BF5F0E50B35F0F5094A +:10085000E50EF5F0E50D95F0F501E50BF5F0E50B8E +:1008600035F0F501E501F5F0E50945F0F509E50A92 +:10087000F5F0E50965F0F509E509F5F0E50055F055 +:10088000F500C3E510F5F0E51195F0F509E50BF578 +:10089000F0E50B35F0F509E511F5F0E51095F0F50B +:1008A00001E50BF5F0E50B35F0F501E501F5F0E5B7 +:1008B0000945F0F509E50AF5F0E50965F0F509E502 +:1008C00009F5F0E50055F0F500C3E512F5F0E51384 +:1008D00095F0F509E50BF5F0E50B35F0F509E509BF +:1008E000F5F0E50055F0F500E500F5F0E50C45F014 +:1008F000F50C750001C3E50DF5F0E50E95F0F50971 +:10090000E50BF5F0E50B35F0F509E50EF5F0E50D35 +:1009100095F0F501E50BF5F0E50B35F0F501E50196 +:10092000F5F0E50945F0F509E50AF5F0E50965F0AA +:10093000F509E509F5F0E50055F0F500C3E510F51A +:10094000F0E51195F0F509E50BF5F0E50B35F0F55F +:1009500009E511F5F0E51095F0F501E50BF5F0E589 +:100960000B35F0F501E501F5F0E50945F0F509E590 +:100970000AF5F0E50965F0F509E509F5F0E500553A +:10098000F0F500C3E512F5F0E51395F0F509E50B78 +:10099000F5F0E50B35F0F509E513F5F0E51295F006 +:1009A000F501E50BF5F0E50B35F0F501E501F5F0A6 +:1009B000E50945F0F509E50AF5F0E50965F0F50901 +:1009C000E509F5F0E50055F0F500C375E0092506E9 +:1009D000F58275E0003507F583E0F508E508F5F0E8 +:1009E000E51495F0F509E50BF5F0E50B35F0F509A3 +:1009F000E509F5F0E50055F0F500E500F5F0E50C4A +:100A000045F0F50C750000E50CF5F0E50045F0F556 +:100A100000E50FF5F0E50045F0F500E515F5F0E52A +:100A20000045F0F500E516F5F0E50045F0F500E5C8 +:100A3000007002800302171F007500007501007529 +:100A40000900750A00750C00C3E500F5F075E009B2 +:100A50002506F58275E0003507F583E0F508E50821 +:100A600095F0F500E500F5F0E50C45F0F50CC3E573 +:100A700001F5F0E51295F0F500E500F5F0E50C451F +:100A8000F0F50CC3E509F5F0E51095F0F500E5008B +:100A9000F5F0E50C45F0F50CC3E50AF5F075E00856 +:100AA0002506F58275E0003507F583E0F508E508D1 +:100AB00095F0F500E500F5F0E50C45F0F50C750155 +:100AC00000750900750A00E50CF500750C01C37589 +:100AD0000B00E500F5F0E50B95F0F50B750B00E567 +:100AE0000BF5F0E50B35F0F50BE50BF5F0E50C65D6 +:100AF000F0F50CC3750B00E501F5F0E50B95F0F58D +:100B00000B750B00E50BF5F0E50B35F0F50BE50B80 +:100B1000F5F0E50C65F0F50CC3750B00E509F5F093 +:100B2000E50B95F0F50B750B00E50BF5F0E50B35D6 +:100B3000F0F50BE50BF5F0E50C65F0F50CC3750B66 +:100B400000E50AF5F0E50B95F0F50B750B00E50BEC +:100B5000F5F0E50B35F0F50BE50BF5F0E50C65F080 +:100B6000F50C750100750900750A00750000E50CAB +:100B7000F5F0E50045F0F500E501F5F0E50045F09C +:100B8000F500E509F5F0E50045F0F500E50AF5F0BA +:100B9000E50045F0F500E500700280030215BA009B +:100BA000750100750900750A00750B00750000E5F8 +:100BB00001F5F0E50045F0F500E509F5F0E5004543 +:100BC000F0F500E50AF5F0E50045F0F500E50BF578 +:100BD000F0E50045F0F500E500700280030215AA7B +:100BE00000750100750900750A00750B007500009D +:100BF000E501F5F0E50045F0F500E509F5F0E50063 +:100C000045F0F500E50AF5F0E50045F0F500E50BE7 +:100C1000F5F0E50045F0F500E500700280030211F3 +:100C2000A200751D00751C00751B00751A0075E08B +:100C3000012506F58275E0003507F583E0F51F759F +:100C4000E0002506F58275E0003507F583E0F51E26 +:100C5000E582F502E583F503E500F504E501F50518 +:100C6000E502F500E503F501E504F509E505F50AFA +:100C7000750B00750C00750D00750F00750E00C327 +:100C8000E50BF5F0E50095F0F50BE50BF5F0E50E5D +:100C900045F0F50EC3E50CF5F0E50195F0F50BE533 +:100CA0000BF5F0E50E45F0F50EC3E50DF5F0E509A1 +:100CB00095F0F50BE50BF5F0E50E45F0F50EC3E507 +:100CC0000FF5F0E50A95F0F50BE50BF5F0E50E45AF +:100CD000F0F50E750C00750D00750F00E50EF5169C +:100CE000E50CF515E50FF50C750E01C3750B00E568 +:100CF00016F5F0E50B95F0F50B750B00E50BF5F02F +:100D0000E50B35F0F50BE50BF5F0E50E65F0F50EAE +:100D1000C3750B00E515F5F0E50B95F0F50B750BBC +:100D200000E50BF5F0E50B35F0F50BE50BF5F0E51F +:100D30000E65F0F50EC3750B00E50DF5F0E50B95AE +:100D4000F0F50B750B00E50BF5F0E50B35F0F50B49 +:100D5000E50BF5F0E50E65F0F50EC3750B00E50C3F +:100D6000F5F0E50B95F0F50B750B00E50BF5F0E5EF +:100D70000B35F0F50BE50BF5F0E50E65F0F50E75AE +:100D80000C00750D00750F00750B00E50EF5F0E514 +:100D90000B45F0F50BE50CF5F0E50B45F0F50BE533 +:100DA0000DF5F0E50B45F0F50BE50FF5F0E50B451E +:100DB000F0F50BE50B7002800302119200750B0138 +:100DC000750C00750D00750F00750E00C3E50BF571 +:100DD000F0E50095F0F50BE50BF5F0E50E45F0F5C7 +:100DE0000EC3E50CF5F0E50195F0F50BE50BF5F01C +:100DF000E50E45F0F50EC3E50DF5F0E50995F0F5C6 +:100E00000BE50BF5F0E50E45F0F50EC3E50FF5F03B +:100E1000E50A95F0F50BE50BF5F0E50E45F0F50E5E +:100E2000750C00750D00750F00E50EF516E50CF557 +:100E300015E50FF50C750E01C3750B00E516F5F001 +:100E4000E50B95F0F50B750B00E50BF5F0E50B35B3 +:100E5000F0F50BE50BF5F0E50E65F0F50EC3750B3F +:100E600000E515F5F0E50B95F0F50B750B00E50BBE +:100E7000F5F0E50B35F0F50BE50BF5F0E50E65F05B +:100E8000F50EC3750B00E50DF5F0E50B95F0F50BD0 +:100E9000750B00E50BF5F0E50B35F0F50BE50BF503 +:100EA000F0E50E65F0F50EC3750B00E50CF5F0E509 +:100EB0000B95F0F50B750B00E50BF5F0E50B35F038 +:100EC000F50BE50BF5F0E50E65F0F50E750C00750C +:100ED0000D00750F00750B00E50EF5F0E50B45F004 +:100EE000F50BE50CF5F0E50B45F0F50BE50DF5F030 +:100EF000E50B45F0F50BE50FF5F0E50B45F0F50BCF +:100F0000E50B7002800302118200750C00750D0064 +:100F1000750E00750F00750B00E50CF5F0E50B453F +:100F2000F0F50BE50DF5F0E50B45F0F50BE50EF5ED +:100F3000F0E50B45F0F50BE50FF5F0E50B45F0F5A9 +:100F40000BE50B7002800302117E00750B01750C1E +:100F500000750D00750E00C3750F00E50BF5F0E58B +:100F60001435F0F514E50CF5F0E51335F0F513E55F +:100F70000DF5F0E51135F0F511E50EF5F0E5173555 +:100F8000F0F517750B02750C00750D00750F0075E7 +:100F90000E00C3E50BF5F0E50095F0F50BE50BF55C +:100FA000F0E50E45F0F50EC3E50CF5F0E50195F022 +:100FB000F50BE50BF5F0E50E45F0F50EC3E50DF587 +:100FC000F0E50995F0F50BE50BF5F0E50E45F0F5CC +:100FD0000EC3E50FF5F0E50A95F0F50BE50BF5F01E +:100FE000E50E45F0F50E750B00750C00750F00E56C +:100FF0000EF515750E01C3750D00E515F5F0E50D3F +:1010000095F0F50D750D00E50DF5F0E50D35F0F5F4 +:101010000DE50DF5F0E50E65F0F50EC3750D00E577 +:101020000BF5F0E50D95F0F50D750D00E50DF5F0FE +:10103000E50D35F0F50DE50DF5F0E50E65F0F50E75 +:10104000C3750D00E50CF5F0E50D95F0F50D750D8A +:1010500000E50DF5F0E50D35F0F50DE50DF5F0E5E4 +:101060000E65F0F50EC3750D00E50FF5F0E50D9575 +:10107000F0F50D750D00E50DF5F0E50D35F0F50D0C +:10108000E50DF5F0E50E65F0F50E750B00750C003D +:10109000750F00E50EF516E50BF515E50CF50EE5FB +:1010A0000FF50D750C01C3750B00E516F5F0E50B9A +:1010B00095F0F50B750B00E50BF5F0E50B35F0F54C +:1010C0000BE50BF5F0E50C65F0F50CC3750B00E5D1 +:1010D00015F5F0E50B95F0F50B750B00E50BF5F04C +:1010E000E50B35F0F50BE50BF5F0E50C65F0F50CCF +:1010F000C3750B00E50EF5F0E50B95F0F50B750BE0 +:1011000000E50BF5F0E50B35F0F50BE50BF5F0E53B +:101110000C65F0F50CC3750B00E50DF5F0E50B95CE +:10112000F0F50B750B00E50BF5F0E50B35F0F50B65 +:10113000E50BF5F0E50C65F0F50C750D00750E008E +:10114000750F00750B00E50CF5F0E50B45F0F50BA0 +:10115000E50DF5F0E50B45F0F50BE50EF5F0E50BCB +:1011600045F0F50BE50FF5F0E50B45F0F50BE50B5C +:101170007002800302117A0206E1000205A000025B +:1011800005A000750C01750D00750E00750F0002AD +:101190000F1600750C01750D00750E00750F00021D +:1011A0000F1600750001750100750900750A00C36E +:1011B000E500F5F075E0092506F58275E0003507D4 +:1011C000F583E0F508E50895F0F500E501F5F0E5B3 +:1011D0001295F0F501E509F5F0E51095F0F509E552 +:1011E0000AF5F075E0082506F58275E0003507F58B +:1011F00083E0F508E50895F0F50A750C00C3E500F5 +:10120000F5F0E51495F0F500E500F5F0E50C45F096 +:10121000F50CC3E501F5F0E51395F0F500E500F5F3 +:10122000F0E50C45F0F50CC3E509F5F0E51195F096 +:10123000F500E500F5F0E50C45F0F50CC3E50AF521 +:10124000F0E51795F0F500E500F5F0E50C45F0F553 +:101250000C750100750900750A00E50CF500750CA8 +:1012600001C3750B00E500F5F0E50B95F0F50B7586 +:101270000B00E50BF5F0E50B35F0F50BE50BF5F0A4 +:10128000E50C65F0F50CC3750B00E501F5F0E50B19 +:1012900095F0F50B750B00E50BF5F0E50B35F0F56A +:1012A0000BE50BF5F0E50C65F0F50CC3750B00E5EF +:1012B00009F5F0E50B95F0F50B750B00E50BF5F076 +:1012C000E50B35F0F50BE50BF5F0E50C65F0F50CED +:1012D000C3750B00E50AF5F0E50B95F0F50B750B02 +:1012E00000E50BF5F0E50B35F0F50BE50BF5F0E55A +:1012F0000C65F0F50C750100750900750A007500A4 +:1013000000E50CF5F0E50045F0F500E501F5F0E548 +:101310000045F0F500E509F5F0E50045F0F500E5DC +:101320000AF5F0E50045F0F500E5007002800302E3 +:10133000145100750D00750100750900750A0075DE +:101340000000E50DF5F0E50045F0F500E501F5F0EC +:10135000E50045F0F500E509F5F0E50045F0F5009C +:10136000E50AF5F0E50045F0F500E50070028003C0 +:101370000213FD0075E0012506F58275E0003507D2 +:10138000F583E0F51F75E0002506F58275E0003570 +:1013900007F583E0F51E75E0072506F58275E00088 +:1013A0003507F583E0F51D75E0062506F58275E045 +:1013B000003507F583E0F51C75E0052506F5827517 +:1013C000E0003507F583E0F51B75E0042506F5829E +:1013D00075E0003507F583E0F51AE582F502E5834F +:1013E000F503E500F504E501F505E502F500E50383 +:1013F000F501E504F509E505F50A020C700075082C +:101400000175E0072506F58275E0003507F583E5EF +:1014100008F075080075E0062506F58275E00035D0 +:1014200007F583E508F075080075E0052506F582E7 +:1014300075E0003507F583E508F075080075E004F0 +:101440002506F58275E0003507F583E508F00213FF +:101450007400750104C3750000E501F5F075E00343 +:101460002506F58275E0003507F583E0F508E50807 +:1014700035F0F509E500F5F075E0022506F5827511 +:10148000E0003507F583E0F508E50835F0F50A7565 +:101490000100C3750000E501F5F0E50935F0F5013F +:1014A000E500F5F0E50A35F0F500E500F502E501A7 +:1014B000F582E502F583E0F50B750101C3750000C7 +:1014C000E501F5F0E50935F0F501E500F5F0E50A8F +:1014D00035F0F500E500F502E501F582E502F5835A +:1014E000E0F50D750102C3750000E501F5F0E509B1 +:1014F00035F0F501E500F5F0E50A35F0F500E50019 +:10150000F502E501F582E502F583E0F50F750103CB +:10151000C3750000E501F5F0E50935F0F501E500DA +:10152000F5F0E50A35F0F500E500F502E501F58294 +:10153000E502F583E0F50C75000075010075090002 +:10154000750A00E50DF50E750D00C3E500F5F0E533 +:101550000B95F0F500E500F5F0E50D45F0F50DC350 +:10156000E501F5F0E50E95F0F500E500F5F0E50D87 +:1015700045F0F50DC3E509F5F0E50F95F0F500E54B +:1015800000F5F0E50D45F0F50DC3E50AF5F0E50CC5 +:1015900095F0F500E500F5F0E50D45F0F50D750168 +:1015A00000750900750A0002133F007501017509F5 +:1015B00000750A00750B00020BED00750000750147 +:1015C00000750900750A00750C00C3E500F5F0E52B +:1015D0001495F0F500E500F5F0E50C45F0F50CC3C9 +:1015E000E501F5F0E51395F0F500E500F5F0E50C03 +:1015F00045F0F50CC3E509F5F0E51195F0F500E5CA +:1016000000F5F0E50C45F0F50CC3E50AF5F0E5173B +:1016100095F0F500E500F5F0E50C45F0F50C7501E9 +:1016200000750900750A00E50CF500750C01C3751D +:101630000B00E500F5F0E50B95F0F50B750B00E5FB +:101640000BF5F0E50B35F0F50BE50BF5F0E50C656A +:10165000F0F50CC3750B00E501F5F0E50B95F0F521 +:101660000B750B00E50BF5F0E50B35F0F50BE50B15 +:10167000F5F0E50C65F0F50CC3750B00E509F5F028 +:10168000E50B95F0F50B750B00E50BF5F0E50B356B +:10169000F0F50BE50BF5F0E50C65F0F50CC3750BFB +:1016A00000E50AF5F0E50B95F0F50B750B00E50B81 +:1016B000F5F0E50B35F0F50BE50BF5F0E50C65F015 +:1016C000F50C750100750900750A00750000E50C40 +:1016D000F5F0E50045F0F500E501F5F0E50045F031 +:1016E000F500E509F5F0E50045F0F500E50AF5F04F +:1016F000E50045F0F500E5007002800302170F00D9 +:10170000750100750900750A00750B00020BAC002D +:10171000750101750900750A00750B00020BAC001C +:10172000750101750900750A00750B00020BED00CB +:10173000020F830000000000000000000000000015 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-2.s.expected b/tests/GCCTestSuite/uninit-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-3.c b/tests/GCCTestSuite/uninit-3.c new file mode 100644 index 0000000..ac5bfec --- /dev/null +++ b/tests/GCCTestSuite/uninit-3.c @@ -0,0 +1,33 @@ +/* Spurious uninit variable warnings, case 3. + Inspired by cppexp.c (parse_charconst) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void error (char *); + +int +parse_charconst (const char *start, const char *end) +{ + int c; /* { dg-bogus "c" "uninitialized variable warning" } */ + int nchars, retval; + + nchars = 0; + retval = 0; + while (start < end) + { + c = *start++; + if (c == '\'') + break; + nchars++; + retval += c; + retval <<= 8; + } + + if (nchars == 0) + return 0; + + if (c != '\'') + error ("malformed character constant"); + + return retval; +} diff --git a/tests/GCCTestSuite/uninit-3.c.expected b/tests/GCCTestSuite/uninit-3.c.expected new file mode 100644 index 0000000..ac5bfec --- /dev/null +++ b/tests/GCCTestSuite/uninit-3.c.expected @@ -0,0 +1,33 @@ +/* Spurious uninit variable warnings, case 3. + Inspired by cppexp.c (parse_charconst) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void error (char *); + +int +parse_charconst (const char *start, const char *end) +{ + int c; /* { dg-bogus "c" "uninitialized variable warning" } */ + int nchars, retval; + + nchars = 0; + retval = 0; + while (start < end) + { + c = *start++; + if (c == '\'') + break; + nchars++; + retval += c; + retval <<= 8; + } + + if (nchars == 0) + return 0; + + if (c != '\'') + error ("malformed character constant"); + + return retval; +} diff --git a/tests/GCCTestSuite/uninit-4.c b/tests/GCCTestSuite/uninit-4.c new file mode 100644 index 0000000..d39ecac --- /dev/null +++ b/tests/GCCTestSuite/uninit-4.c @@ -0,0 +1,52 @@ +/* Spurious uninit variable warnings, case 4. + Simplified version of cppexp.c (cpp_parse_expr). + + This one is really fragile, it gets it right if you take out case + 1, or if the structure is replaced by an int, or if the structure + has fewer members (!) */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void abort (void); + +struct operation { + short op; + char rprio; + char flags; + char unsignedp; + long value; +}; + +extern struct operation cpp_lex (void); + +void +cpp_parse_expr (void) +{ + int rprio; /* { dg-bogus "rprio" "uninitialized variable warning PR19833" } */ + struct operation op; + + for (;;) + { + op = cpp_lex (); + + switch (op.op) + { + case 0: + break; + case 1: + return; + case 2: + rprio = 1; + break; + default: + return; + } + + if (op.op == 0) + return; + + if (rprio != 1) + abort(); + } +} diff --git a/tests/GCCTestSuite/uninit-4.c.expected b/tests/GCCTestSuite/uninit-4.c.expected new file mode 100644 index 0000000..d39ecac --- /dev/null +++ b/tests/GCCTestSuite/uninit-4.c.expected @@ -0,0 +1,52 @@ +/* Spurious uninit variable warnings, case 4. + Simplified version of cppexp.c (cpp_parse_expr). + + This one is really fragile, it gets it right if you take out case + 1, or if the structure is replaced by an int, or if the structure + has fewer members (!) */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void abort (void); + +struct operation { + short op; + char rprio; + char flags; + char unsignedp; + long value; +}; + +extern struct operation cpp_lex (void); + +void +cpp_parse_expr (void) +{ + int rprio; /* { dg-bogus "rprio" "uninitialized variable warning PR19833" } */ + struct operation op; + + for (;;) + { + op = cpp_lex (); + + switch (op.op) + { + case 0: + break; + case 1: + return; + case 2: + rprio = 1; + break; + default: + return; + } + + if (op.op == 0) + return; + + if (rprio != 1) + abort(); + } +} diff --git a/tests/GCCTestSuite/uninit-4.hex.expected b/tests/GCCTestSuite/uninit-4.hex.expected new file mode 100644 index 0000000..a682541 --- /dev/null +++ b/tests/GCCTestSuite/uninit-4.hex.expected @@ -0,0 +1,179 @@ +:10000000000000E50675820FC39582F506E50775C9 +:1000100083009583F507D0E0F50875E00A2506F51D +:100020008275E0003507F583E508F0D0E0F5087546 +:10003000E0092506F58275E0003507F583E508F04F +:1000400075E00E2506F58275E0003507F583E513AA +:10005000F075E00D2506F58275E0003507F583E5BE +:1000600012F075E00C2506F58275E0003507F58382 +:10007000E511F075E00B2506F58275E0003507F512 +:1000800083E510F0750001750100750900750A001F +:10009000750C01C3750B00E500F5F0E50B95F0F567 +:1000A0000B750B00E50BF5F0E50B35F0F50BE50BEB +:1000B000F5F0E50C65F0F50CC3750B00E501F5F006 +:1000C000E50B95F0F50B750B00E50BF5F0E50B3541 +:1000D000F0F50BE50BF5F0E50C65F0F50CC3750BD1 +:1000E00000E509F5F0E50B95F0F50B750B00E50B58 +:1000F000F5F0E50B35F0F50BE50BF5F0E50C65F0EB +:10010000F50CC3750B00E50AF5F0E50B95F0F50B62 +:10011000750B00E50BF5F0E50B35F0F50BE50BF590 +:10012000F0E50C65F0F50C750100750900750A0025 +:10013000750000E50CF5F0E50045F0F500E501F58A +:10014000F0E50045F0F500E509F5F0E50045F0F5CE +:1001500000E50AF5F0E50045F0F500E500700280E5 +:1001600003020B1A00E506F509E507F50A7501001B +:10017000C3750000E501F5F0E50935F0F501E5008E +:10018000F5F0E50A35F0F500E501F51FE500F51E8F +:10019000E506F509E507F50A750100C3750000E5F8 +:1001A00001F5F0E50935F0F501E500F5F0E50A3572 +:1001B000F0F50A750900C3750000E509F5F0E501E1 +:1001C00035F0F501E500F5F0E50A35F0F500E5015B +:1001D000F509E500F50A750100C3750000E501F5B4 +:1001E000F0E50935F0F501E500F5F0E50A35F0F543 +:1001F00000E500F502E501F582E502F583E0F50B87 +:10020000750101C3750000E501F5F0E50935F0F56C +:1002100001E500F5F0E50A35F0F500E500F502E549 +:1002200001F582E502F583E0F501E501F50C7500C5 +:1002300080E501F5F0E50055F0F50EE500F5F0E597 +:100240000E84F50E7500FFE500F5F0E50EA4F50E41 +:10025000E50EF50D750000750100750900750A00C1 +:10026000750F00C3E500F5F0E50B95F0F500E5002E +:10027000F5F0E50F45F0F50FC3E501F5F0E50C9558 +:10028000F0F500E500F5F0E50F45F0F50FC3E509E1 +:10029000F5F0E50D95F0F500E500F5F0E50F45F01A +:1002A000F50FC3E50AF5F0E50E95F0F500E500F56C +:1002B000F0E50F45F0F50F750100750900750A00AE +:1002C000E50FF500750F01C3750B00E500F5F0E5CE +:1002D0000B95F0F50B750B00E50BF5F0E50B35F024 +:1002E000F50BE50BF5F0E50F65F0F50FC3750B00A9 +:1002F000E501F5F0E50B95F0F50B750B00E50BF559 +:10030000F0E50B35F0F50BE50BF5F0E50F65F0F5D5 +:100310000FC3750B00E509F5F0E50B95F0F50B75CE +:100320000B00E50BF5F0E50B35F0F50BE50BF5F003 +:10033000E50F65F0F50FC3750B00E50AF5F0E50B69 +:1003400095F0F50B750B00E50BF5F0E50B35F0F5C9 +:100350000BE50BF5F0E50F65F0F50F75010075097C +:1003600000750A00750000E50FF5F0E50045F0F5B1 +:1003700000E501F5F0E50045F0F500E509F5F0E5EB +:100380000045F0F500E50AF5F0E50045F0F500E57B +:100390000070028003020B1500E506F509E507F57C +:1003A0000A750100C3750000E501F5F0E50935F0B7 +:1003B000F501E500F5F0E50A35F0F50A750900C329 +:1003C000750000E509F5F0E50135F0F501E500F50A +:1003D000F0E50A35F0F500E501F509E500F50A75E7 +:1003E0000100C3750000E501F5F0E50935F0F50100 +:1003F000E500F5F0E50A35F0F500E500F502E50168 +:10040000F582E502F583E0F50B750101C375000087 +:10041000E501F5F0E50935F0F501E500F5F0E50A4F +:1004200035F0F500E500F502E501F582E502F5831A +:10043000E0F501E501F50C750080E501F5F0E5005A +:1004400055F0F50EE500F5F0E50E84F50E7500FFAC +:10045000E500F5F0E50EA4F50EE50EF50D750001CD +:10046000750100750900750A00750F00C3E500F5F8 +:10047000F0E50B95F0F500E500F5F0E50F45F0F53A +:100480000FC3E501F5F0E50C95F0F500E500F5F09A +:10049000E50F45F0F50FC3E509F5F0E50D95F0F52D +:1004A00000E500F5F0E50F45F0F50FC3E50AF5F0BE +:1004B000E50E95F0F500E500F5F0E50F45F0F50FD8 +:1004C000750100750900750A00E50FF500750F014B +:1004D000C3750B00E500F5F0E50B95F0F50B750B1A +:1004E00000E50BF5F0E50B35F0F50BE50BF5F0E568 +:1004F0000F65F0F50FC3750B00E501F5F0E50B9501 +:10050000F0F50B750B00E50BF5F0E50B35F0F50B91 +:10051000E50BF5F0E50F65F0F50FC3750B00E50988 +:10052000F5F0E50B95F0F50B750B00E50BF5F0E537 +:100530000B35F0F50BE50BF5F0E50F65F0F50FC3A6 +:10054000750B00E50AF5F0E50B95F0F50B750B0062 +:10055000E50BF5F0E50B35F0F50BE50BF5F0E50FE8 +:1005600065F0F50F750100750900750A007500004A +:10057000E50FF5F0E50045F0F500E501F5F0E500E3 +:1005800045F0F500E509F5F0E50045F0F500E50A70 +:10059000F5F0E50045F0F500E50070028003020B80 +:1005A0001000E506F509E507F50A750100C37500B9 +:1005B00000E501F5F0E50935F0F501E500F5F0E5B8 +:1005C0000A35F0F50A750900C3750000E509F5F074 +:1005D000E50135F0F501E500F5F0E50A35F0F50047 +:1005E000E501F509E500F50A750100C3750000E5B0 +:1005F00001F5F0E50935F0F501E500F5F0E50A351E +:10060000F0F500E500F502E501F582E502F583E08D +:10061000F50B750101C3750000E501F5F0E509353D +:10062000F0F501E500F5F0E50A35F0F500E500F537 +:1006300002E501F582E502F583E0F501E501F50C3F +:10064000750080E501F5F0E50055F0F50EE500F5E3 +:10065000F0E50E84F50E7500FFE500F5F0E50EA45B +:10066000F50EE50EF50D75000275010075090075B2 +:100670000A00750F00C3E500F5F0E50B95F0F500F5 +:10068000E500F5F0E50F45F0F50FC3E501F5F0E500 +:100690000C95F0F500E500F5F0E50F45F0F50FC31A +:1006A000E509F5F0E50D95F0F500E500F5F0E50F4D +:1006B00045F0F50FC3E50AF5F0E50E95F0F500E518 +:1006C00000F5F0E50F45F0F50F75010075090075AF +:1006D0000A00E50FF500750F01C3750B00E500F585 +:1006E000F0E50B95F0F50B750B00E50BF5F0E50B60 +:1006F00035F0F50BE50BF5F0E50F65F0F50FC3757B +:100700000B00E501F5F0E50B95F0F50B750B00E539 +:100710000BF5F0E50B35F0F50BE50BF5F0E50F65A6 +:10072000F0F50FC3750B00E509F5F0E50B95F0F555 +:100730000B750B00E50BF5F0E50B35F0F50BE50B54 +:10074000F5F0E50F65F0F50FC3750B00E50AF5F060 +:10075000E50B95F0F50B750B00E50BF5F0E50B35AA +:10076000F0F50BE50BF5F0E50F65F0F50F75010001 +:10077000750900750A00750000E50FF5F0E5004504 +:10078000F0F500E501F5F0E50045F0F500E509F5C7 +:10079000F0E50045F0F500E50AF5F0E50045F0F577 +:1007A00000E5007002800302084C0000750000E5BF +:1007B00000F502E500F503E500F504E500F5057533 +:1007C000E00E2506F58275E0003507F583E0F513A8 +:1007D00075E00D2506F58275E0003507F583E0F537 +:1007E0001275E00C2506F58275E0003507F583E00B +:1007F000F51175E00B2506F58275E0003507F583E8 +:10080000E0F51075E0092506F58275E0003507F57D +:1008100083E0F508E508C0E075E00A2506F5827575 +:10082000E0003507F583E0F508E508C0E075E00F66 +:100830002506F50675E0003507F507E502F582E5C2 +:1008400003F583E504F500E505F5012200007510C8 +:100850000175110075120075130000E506F509E534 +:1008600007F50A750100C3750000E501F5F0E5091B +:1008700035F0F501E500F5F0E50A35F0F50A750902 +:1008800000C3750000E509F5F0E50135F0F501E577 +:1008900000F5F0E50A35F0F500E501F509E500F5AC +:1008A0000A750100C3750000E501F5F0E50935F0B2 +:1008B000F501E500F5F0E50A35F0F500E500F50293 +:1008C000E501F582E502F583E0F50B750101C375DD +:1008D0000000E501F5F0E50935F0F501E500F5F07A +:1008E000E50A35F0F500E500F502E501F582E502DF +:1008F000F583E0F501E501F50C750080E501F5F003 +:10090000E50055F0F50EE500F5F0E50E84F50E7501 +:1009100000FFE500F5F0E50EA4F50EE50EF50D750A +:100920000000750100750900750A00750F00C3E528 +:1009300000F5F0E50B95F0F500E500F5F0E50F4565 +:10094000F0F50FC3E501F5F0E50C95F0F500E500D5 +:10095000F5F0E50F45F0F50FC3E509F5F0E50D9568 +:10096000F0F500E500F5F0E50F45F0F50FC3E50AF9 +:10097000F5F0E50E95F0F500E500F5F0E50F45F032 +:10098000F50F750100750900750A00E50FF5007592 +:100990000F01C3750B00E500F5F0E50B95F0F50BC5 +:1009A000750B00E50BF5F0E50B35F0F50BE50BF5F8 +:1009B000F0E50F65F0F50FC3750B00E501F5F0E507 +:1009C0000B95F0F50B750B00E50BF5F0E50B35F02D +:1009D000F50BE50BF5F0E50F65F0F50FC3750B00B2 +:1009E000E509F5F0E50B95F0F50B750B00E50BF55A +:1009F000F0E50B35F0F50BE50BF5F0E50F65F0F5DF +:100A00000FC3750B00E50AF5F0E50B95F0F50B75D6 +:100A10000B00E50BF5F0E50B35F0F50BE50BF5F00C +:100A2000E50F65F0F50F750100750900750A007591 +:100A30000000E50FF5F0E50045F0F500E501F5F003 +:100A4000E50045F0F500E509F5F0E50045F0F500B5 +:100A5000E50AF5F0E50045F0F500E50070028003D9 +:100A6000020B0C00750001750100750900750A0084 +:100A7000750B00C3E500F5F0E51095F0F500E50015 +:100A8000F5F0E50B45F0F50BC3E501F5F0E5119543 +:100A9000F0F500E500F5F0E50B45F0F50BC3E509D1 +:100AA000F5F0E51295F0F500E500F5F0E50B45F001 +:100AB000F50BC3E50AF5F0E51395F0F500E500F553 +:100AC000F0E50B45F0F50B750100750900750A009E +:100AD000750000E50BF5F0E50045F0F500E501F5E2 +:100AE000F0E50045F0F500E509F5F0E50045F0F525 +:100AF00000E50AF5F0E50045F0F500E5007002803C +:100B000003020B080002008400020084000207AC0C +:100B100000000207AC000002085A000207AC000007 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-4.s.expected b/tests/GCCTestSuite/uninit-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-5.c b/tests/GCCTestSuite/uninit-5.c new file mode 100644 index 0000000..ae7a8de --- /dev/null +++ b/tests/GCCTestSuite/uninit-5.c @@ -0,0 +1,39 @@ +/* Spurious uninitialized-variable warnings. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void use(int); +extern void foo(void); + +void +func1(int cond) +{ + int x; /* { dg-bogus "x" "uninitialized variable warning" } */ + + if(cond) + x = 1; + + foo(); + + if(cond) + use(x); +} + +void +func2 (int cond) +{ + int x; /* { dg-bogus "x" "uninitialized variable warning" } */ + int flag = 0; + + if(cond) + { + x = 1; + flag = 1; + } + + foo(); + + if(flag) + use(x); +} diff --git a/tests/GCCTestSuite/uninit-5.c.expected b/tests/GCCTestSuite/uninit-5.c.expected new file mode 100644 index 0000000..ae7a8de --- /dev/null +++ b/tests/GCCTestSuite/uninit-5.c.expected @@ -0,0 +1,39 @@ +/* Spurious uninitialized-variable warnings. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void use(int); +extern void foo(void); + +void +func1(int cond) +{ + int x; /* { dg-bogus "x" "uninitialized variable warning" } */ + + if(cond) + x = 1; + + foo(); + + if(cond) + use(x); +} + +void +func2 (int cond) +{ + int x; /* { dg-bogus "x" "uninitialized variable warning" } */ + int flag = 0; + + if(cond) + { + x = 1; + flag = 1; + } + + foo(); + + if(flag) + use(x); +} diff --git a/tests/GCCTestSuite/uninit-5.hex.expected b/tests/GCCTestSuite/uninit-5.hex.expected new file mode 100644 index 0000000..c67c70d --- /dev/null +++ b/tests/GCCTestSuite/uninit-5.hex.expected @@ -0,0 +1,75 @@ +:10000000000000E50675820EC39582F506E50775CA +:1000100083009583F507D0E0F50875E0012506F526 +:100020008275E0003507F583E508F0D0E0F5087546 +:10003000E0002506F58275E0003507F583E508F058 +:1000400075E0092506F58275E0003507F583E517AB +:10005000F075E0082506F58275E0003507F583E5C3 +:1000600016F075E0072506F58275E0003507F58383 +:10007000E515F075E0062506F58275E0003507F513 +:1000800083E514F075E0052506F58275E000350777 +:10009000F583E513F075E0042506F58275E000357B +:1000A00007F583E512F075E0032506F58275E0009B +:1000B0003507F583E511F075E0022506F58275E058 +:1000C000003507F583E510F0E51FF510E51EF51185 +:1000D000E51DF512E51CF513750000E510F5F0E5DA +:1000E0000045F0F500E511F5F0E50045F0F500E517 +:1000F00012F5F0E50045F0F500E513F5F0E50045F3 +:10010000F0F500E5007002800302023A007500007D +:10011000E510F5F0E50045F0F500E511F5F0E50036 +:1001200045F0F500E512F5F0E50045F0F500E513C2 +:10013000F5F0E50045F0F500E500700280030202ED +:100140002600750000E500F502E500F503E500F581 +:1001500004E500F50575E0092506F58275E0003532 +:1001600007F583E0F51775E0082506F58275E000D0 +:100170003507F583E0F51675E0072506F58275E08D +:10018000003507F583E0F51575E0062506F582755F +:10019000E0003507F583E0F51475E0052506F582E6 +:1001A00075E0003507F583E0F51375E0042506F5E5 +:1001B0008275E0003507F583E0F51275E00325064A +:1001C000F58275E0003507F583E0F51175E002254D +:1001D00006F58275E0003507F583E0F51075E0005F +:1001E0002506F58275E0003507F583E0F508E5089A +:1001F000C0E075E0012506F58275E0003507F5835E +:10020000E0F508E508C0E075E00E2506F50675E0A6 +:10021000003507F507E502F582E503F583E504F50A +:1002200000E505F5012200E514F51FE515F51EE5CD +:1002300016F51DE517F51C02014200751401751530 +:100240000075160075170002010D00E50675820E97 +:10025000C39582F506E5077583009583F507D0E021 +:10026000F50875E0012506F58275E0003507F58390 +:10027000E508F0D0E0F50875E0002506F58275E0A8 +:10028000003507F583E508F075E0092506F5827568 +:10029000E0003507F583E517F075E0082506F582DF +:1002A00075E0003507F583E516F075E0072506F5DE +:1002B0008275E0003507F583E515F075E006250643 +:1002C000F58275E0003507F583E514F075E0052546 +:1002D00006F58275E0003507F583E513F075E00457 +:1002E0002506F58275E0003507F583E512F075E027 +:1002F000032506F58275E0003507F583E511F075F5 +:10030000E0022506F58275E0003507F583E510F07B +:10031000751000751100751200751300750000E569 +:100320001FF5F0E50045F0F500E51EF5F0E50045A8 +:10033000F0F500E51DF5F0E50045F0F500E51CF5EC +:10034000F0E50045F0F500E5007002800302047E50 +:1003500000750000E510F5F0E50045F0F500E51149 +:10036000F5F0E50045F0F500E512F5F0E50045F0A3 +:10037000F500E513F5F0E50045F0F500E500700245 +:10038000800302046A00750000E500F502E500F54F +:1003900003E500F504E500F50575E0092506F5829D +:1003A00075E0003507F583E0F51775E0082506F5DB +:1003B0008275E0003507F583E0F51675E007250640 +:1003C000F58275E0003507F583E0F51575E0062543 +:1003D00006F58275E0003507F583E0F51475E00554 +:1003E0002506F58275E0003507F583E0F51375E025 +:1003F000042506F58275E0003507F583E0F51275F2 +:10040000E0032506F58275E0003507F583E0F51178 +:1004100075E0022506F58275E0003507F583E0F505 +:100420001075E0002506F58275E0003507F583E0DC +:10043000F508E508C0E075E0012506F58275E000E5 +:100440003507F583E0F508E508C0E075E00E250600 +:10045000F50675E0003507F507E502F582E503F5D9 +:1004600083E504F500E505F5012200E514F51FE537 +:1004700015F51EE516F51DE517F51C02038600753A +:1004800014017515007516007517007510017511AA +:1004900000751200751300020351000000000000F7 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-5.s.expected b/tests/GCCTestSuite/uninit-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-6.c b/tests/GCCTestSuite/uninit-6.c new file mode 100644 index 0000000..b0f2083 --- /dev/null +++ b/tests/GCCTestSuite/uninit-6.c @@ -0,0 +1,47 @@ +/* Spurious uninitialized variable warnings. + This one inspired by java/class.c:build_utf8_ref. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include + +struct tree +{ + struct tree *car; + struct tree *cdr; + int type, data; +}; + +extern void *malloc(size_t); + +#define INTEGER_T 1 +#define PTR_T 2 + +#define APPEND(TREE, LAST, TYPE, VALUE) \ +do { \ + struct tree *tmp = malloc (sizeof (struct tree)); \ + tmp->car = 0; tmp->cdr = 0; tmp->type = TYPE; \ + tmp->data = VALUE; \ + if (TREE->car) \ + LAST->cdr = tmp; \ + else \ + TREE->car = tmp; \ + LAST = tmp; \ +} while(0) + +struct tree * +make_something(int a, int b, int c) +{ + struct tree *rv; + struct tree *field; + + rv = malloc (sizeof (struct tree)); + rv->car = 0; + + APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */ + APPEND(rv, field, PTR_T, b); + APPEND(rv, field, INTEGER_T, c); + + return rv; +} diff --git a/tests/GCCTestSuite/uninit-6.c.expected b/tests/GCCTestSuite/uninit-6.c.expected new file mode 100644 index 0000000..b0f2083 --- /dev/null +++ b/tests/GCCTestSuite/uninit-6.c.expected @@ -0,0 +1,47 @@ +/* Spurious uninitialized variable warnings. + This one inspired by java/class.c:build_utf8_ref. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include + +struct tree +{ + struct tree *car; + struct tree *cdr; + int type, data; +}; + +extern void *malloc(size_t); + +#define INTEGER_T 1 +#define PTR_T 2 + +#define APPEND(TREE, LAST, TYPE, VALUE) \ +do { \ + struct tree *tmp = malloc (sizeof (struct tree)); \ + tmp->car = 0; tmp->cdr = 0; tmp->type = TYPE; \ + tmp->data = VALUE; \ + if (TREE->car) \ + LAST->cdr = tmp; \ + else \ + TREE->car = tmp; \ + LAST = tmp; \ +} while(0) + +struct tree * +make_something(int a, int b, int c) +{ + struct tree *rv; + struct tree *field; + + rv = malloc (sizeof (struct tree)); + rv->car = 0; + + APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */ + APPEND(rv, field, PTR_T, b); + APPEND(rv, field, INTEGER_T, c); + + return rv; +} diff --git a/tests/GCCTestSuite/uninit-6.hex.expected b/tests/GCCTestSuite/uninit-6.hex.expected new file mode 100644 index 0000000..05932db --- /dev/null +++ b/tests/GCCTestSuite/uninit-6.hex.expected @@ -0,0 +1,323 @@ +:100000000000E506758223C39582F506E507758332 +:10001000009583F507D0E0F50875E00E2506F5821A +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:100030000D2506F58275E0003507F583E508F075B6 +:10004000E0162506F58275E0003507F583E517F023 +:1000500075E0152506F58275E0003507F583E51690 +:10006000F075E0142506F58275E0003507F583E5A7 +:1000700015F075E0132506F58275E0003507F58368 +:10008000E514F075E0122506F58275E0003507F5F8 +:1000900083E513F075E0112506F58275E00035075C +:1000A000F583E512F075E0102506F58275E0003560 +:1000B00007F583E511F075E00F2506F58275E00080 +:1000C0003507F583E510F0E51FF515E51EF516E596 +:1000D0001DF51775E0042506F58275E0003507F576 +:1000E00083E51CF075E0082506F58275E00035070C +:1000F000F583E51BF075E0072506F58275E0003510 +:1001000007F583E51AF075E0062506F58275E0002F +:100110003507F583E519F075E0052506F58275E0EC +:10012000003507F583E518F0750923750001E50032 +:10013000F5F0E50995F0F509E506F500E500F5F0BF +:10014000E50925F0F509750100E507F500E500F57D +:10015000F0E50135F0F501E501F502E509F582E587 +:1001600002F583E0F50875E00C2506F58275E000E0 +:100170003507F583E508F0750923750002E500F5FC +:10018000F0E50995F0F509E506F500E500F5F0E57F +:100190000925F0F509750100E507F500E500F5F022 +:1001A000E50135F0F501E501F502E509F582E50225 +:1001B000F583E0F50875E00B2506F58275E000355E +:1001C00007F583E508F0750923750003E500F5F0F0 +:1001D000E50995F0F509E506F500E500F5F0E50916 +:1001E00025F0F509750100E507F500E500F5F0E5F6 +:1001F0000135F0F501E501F502E509F582E502F5C5 +:1002000083E0F50875E00A2506F58275E0003507FC +:10021000F583E508F0750923750004E500F5F0E5C0 +:100220000995F0F509E506F500E500F5F0E5092585 +:10023000F0F509750100E507F500E500F5F0E501C9 +:1002400035F0F501E501F502E509F582E502F583F2 +:10025000E0F50875E0092506F58275E0003507F53B +:1002600083E508F0751F0C751E00751D00751C00D8 +:10027000E582F502E583F503E502F510E503F511E6 +:10028000750100C3750000E501F5F0E51035F0F5E6 +:100290000BE500F5F0E51135F0F50C750900750A70 +:1002A00000750100C3750000E501F5F0E50B35F0C0 +:1002B000F501E500F5F0E50C35F0F500E509F5038D +:1002C000E500F502E501F582E502F583E503F07549 +:1002D0000101C3750000E501F5F0E50B35F0F5010E +:1002E000E500F5F0E50C35F0F500E50AF503E5006D +:1002F000F502E501F582E502F583E503F000751FDF +:100300000C751E00751D00751C00E582F502E58365 +:10031000F503E502F50EE503F50F750100C3750061 +:1003200000E501F5F0E50E35F0F50BE500F5F0E53B +:100330000F35F0F50C750900750A00750100C375DD +:100340000000E501F5F0E50B35F0F501E500F5F00D +:10035000E50C35F0F500E509F503E500F502E501EA +:10036000F582E502F583E503F0750101C375000030 +:10037000E501F5F0E50B35F0F501E500F5F0E50CEC +:1003800035F0F500E50AF503E500F502E501F58233 +:10039000E502F583E503F0750102C3750000E50190 +:1003A000F5F0E50E35F0F50BE500F5F0E50F35F06D +:1003B000F50C750900750A00750100C3750000E5AC +:1003C00001F5F0E50B35F0F501E500F5F0E50C354C +:1003D000F0F500E509F503E500F502E501F582E534 +:1003E00002F583E503F0750101C3750000E501F531 +:1003F000F0E50B35F0F501E500F5F0E50C35F0F52D +:1004000000E50AF503E500F502E501F582E502F5F0 +:1004100083E503F0750104C3750000E501F5F0E51F +:100420000E35F0F50CE500F5F0E50F35F0F50D753E +:100430000901750A00750B00751400750100C3757C +:100440000000E501F5F0E50C35F0F501E500F5F00B +:10045000E50D35F0F500E509F503E500F502E501E8 +:10046000F582E502F583E503F0750101C37500002F +:10047000E501F5F0E50C35F0F501E500F5F0E50DE9 +:1004800035F0F500E50AF503E500F502E501F58232 +:10049000E502F583E503F0750102C3750000E5018F +:1004A000F5F0E50C35F0F501E500F5F0E50D35F07A +:1004B000F500E50BF503E500F502E501F582E5023F +:1004C000F583E503F0750103C3750000E501F5F060 +:1004D000E50C35F0F501E500F5F0E50D35F0F5003A +:1004E000E514F503E500F502E501F582E502F58383 +:1004F000E503F0750108C3750000E501F5F0E50EB0 +:1005000035F0F509E500F5F0E50F35F0F50A750170 +:1005100000C3750000E501F5F0E50935F0F501E5EA +:1005200000F5F0E50A35F0F500E515F503E500F511 +:1005300002E501F582E502F583E503F0750101C3EB +:10054000750000E501F5F0E50935F0F501E500F588 +:10055000F0E50A35F0F500E516F503E500F502E5EE +:1005600001F582E502F583E503F0750102C375002C +:1005700000E501F5F0E50935F0F501E500F5F0E5F8 +:100580000A35F0F500E517F503E500F502E501F59C +:1005900082E502F583E503F0750103C3750000E50C +:1005A00001F5F0E50935F0F501E500F5F0E50A356E +:1005B000F0F50075E0042506F58275E0003507F5D5 +:1005C00083E0F508E508F503E500F502E501F582AD +:1005D000E502F583E503F0750100C3750000E50150 +:1005E000F5F0E51035F0F509E500F5F0E51135F029 +:1005F000F50A750100C3750000E501F5F0E5093560 +:10060000F0F501E500F5F0E50A35F0F500E500F557 +:1006100002E501F582E502F583E0F50B750101C302 +:10062000750000E501F5F0E50935F0F501E500F5A7 +:10063000F0E50A35F0F500E500F502E501F582E5A3 +:1006400002F583E0F501750000E50BF5F0E50045E6 +:10065000F0F500E501F5F0E50045F0F500E5007086 +:100660000280030213A400750100C3750000E501B8 +:10067000F5F0E51035F0F509E500F5F0E51135F098 +:10068000F50A750100C3750000E501F5F0E50935CF +:10069000F0F501E500F5F0E50A35F0F500E50EF5B9 +:1006A00003E500F502E501F582E502F583E503F0D7 +:1006B000750101C3750000E501F5F0E50935F0F5B8 +:1006C00001E500F5F0E50A35F0F500E50FF503E585 +:1006D00000F502E501F582E502F583E503F0E50E9C +:1006E000F512E50FF5137500007501007509007529 +:1006F0000A00750C01C3750B00E500F5F0E50B95DC +:10070000F0F50B750B00E50BF5F0E50B35F0F50B8F +:10071000E50BF5F0E50C65F0F50CC3750B00E50194 +:10072000F5F0E50B95F0F50B750B00E50BF5F0E535 +:100730000B35F0F50BE50BF5F0E50C65F0F50CC3AA +:10074000750B00E509F5F0E50B95F0F50B750B0061 +:10075000E50BF5F0E50B35F0F50BE50BF5F0E50CE9 +:1007600065F0F50CC3750B00E50AF5F0E50B95F0A7 +:10077000F50B750B00E50BF5F0E50B35F0F50BE52A +:100780000BF5F0E50C65F0F50C75010075090075C9 +:100790000A00750000E50CF5F0E50045F0F500E510 +:1007A00001F5F0E50045F0F500E509F5F0E5004557 +:1007B000F0F500E50AF5F0E50045F0F500E500701C +:1007C0000280030207C90202FD0000751F0C751E9E +:1007D00000751D00751C00E582F502E583F503E553 +:1007E00002F50EE503F50F750100C3750000E50184 +:1007F000F5F0E50E35F0F50BE500F5F0E50F35F019 +:10080000F50C750900750A00750100C3750000E557 +:1008100001F5F0E50B35F0F501E500F5F0E50C35F7 +:10082000F0F500E509F503E500F502E501F582E5DF +:1008300002F583E503F0750101C3750000E501F5DC +:10084000F0E50B35F0F501E500F5F0E50C35F0F5D8 +:1008500000E50AF503E500F502E501F582E502F59C +:1008600083E503F0750102C3750000E501F5F0E5CD +:100870000E35F0F50BE500F5F0E50F35F0F50C75EC +:100880000900750A00750100C3750000E501F5F067 +:10089000E50B35F0F501E500F5F0E50C35F0F50078 +:1008A000E509F503E500F502E501F582E502F583CA +:1008B000E503F0750101C3750000E501F5F0E50BF6 +:1008C00035F0F501E500F5F0E50C35F0F500E50A49 +:1008D000F503E500F502E501F582E502F583E503A0 +:1008E000F0750104C3750000E501F5F0E50E35F083 +:1008F000F50CE500F5F0E50F35F0F50D750902751D +:100900000A00750B00751400750100C3750000E541 +:1009100001F5F0E50C35F0F501E500F5F0E50D35F4 +:10092000F0F500E509F503E500F502E501F582E5DE +:1009300002F583E503F0750101C3750000E501F5DB +:10094000F0E50C35F0F501E500F5F0E50D35F0F5D5 +:1009500000E50AF503E500F502E501F582E502F59B +:1009600083E503F0750102C3750000E501F5F0E5CC +:100970000C35F0F501E500F5F0E50D35F0F500E595 +:100980000BF503E500F502E501F582E502F583E5E7 +:1009900003F0750103C3750000E501F5F0E50C35C2 +:1009A000F0F501E500F5F0E50D35F0F500E514F59D +:1009B00003E500F502E501F582E502F583E503F0C4 +:1009C000750108C3750000E501F5F0E50E35F0F599 +:1009D00009E500F5F0E50F35F0F50A750100C3757E +:1009E0000000E501F5F0E50935F0F501E500F5F069 +:1009F000E50A35F0F50075E0082506F58275E0009A +:100A00003507F583E0F508E508F503E500F502E5AF +:100A100001F582E502F583E503F0750101C3750078 +:100A200000E501F5F0E50935F0F501E500F5F0E543 +:100A30000A35F0F50075E0072506F58275E000350A +:100A400007F583E0F508E508F503E500F502E501A3 +:100A5000F582E502F583E503F0750102C375000038 +:100A6000E501F5F0E50935F0F501E500F5F0E50AF9 +:100A700035F0F50075E0062506F58275E0003507CE +:100A8000F583E0F508E508F503E500F502E501F575 +:100A900082E502F583E503F0750103C3750000E507 +:100AA00001F5F0E50935F0F501E500F5F0E50A3569 +:100AB000F0F50075E0052506F58275E0003507F5CF +:100AC00083E0F508E508F503E500F502E501F582A8 +:100AD000E502F583E503F0750100C3750000E5014B +:100AE000F5F0E51035F0F509E500F5F0E51135F024 +:100AF000F50A750100C3750000E501F5F0E509355B +:100B0000F0F501E500F5F0E50A35F0F500E500F552 +:100B100002E501F582E502F583E0F50B750101C3FD +:100B2000750000E501F5F0E50935F0F501E500F5A2 +:100B3000F0E50A35F0F500E500F502E501F582E59E +:100B400002F583E0F501750000E50BF5F0E50045E1 +:100B5000F0F500E501F5F0E50045F0F500E5007081 +:100B600002800302132900750100C3750000E5012E +:100B7000F5F0E51035F0F509E500F5F0E51135F093 +:100B8000F50A750100C3750000E501F5F0E50935CA +:100B9000F0F501E500F5F0E50A35F0F500E50EF5B4 +:100BA00003E500F502E501F582E502F583E503F0D2 +:100BB000750101C3750000E501F5F0E50935F0F5B3 +:100BC00001E500F5F0E50A35F0F500E50FF503E580 +:100BD00000F502E501F582E502F583E503F0E50E97 +:100BE000F512E50FF5137500007501007509007524 +:100BF0000A00750C01C3750B00E500F5F0E50B95D7 +:100C0000F0F50B750B00E50BF5F0E50B35F0F50B8A +:100C1000E50BF5F0E50C65F0F50CC3750B00E5018F +:100C2000F5F0E50B95F0F50B750B00E50BF5F0E530 +:100C30000B35F0F50BE50BF5F0E50C65F0F50CC3A5 +:100C4000750B00E509F5F0E50B95F0F50B750B005C +:100C5000E50BF5F0E50B35F0F50BE50BF5F0E50CE4 +:100C600065F0F50CC3750B00E50AF5F0E50B95F0A2 +:100C7000F50B750B00E50BF5F0E50B35F0F50BE525 +:100C80000BF5F0E50C65F0F50C75010075090075C4 +:100C90000A00750000E50CF5F0E50045F0F500E50B +:100CA00001F5F0E50045F0F500E509F5F0E5004552 +:100CB000F0F500E50AF5F0E50045F0F500E5007017 +:100CC000028003020CC90207CA0000751F0C751EC2 +:100CD00000751D00751C00E582F502E583F503E54E +:100CE00002F50EE503F50F750100C3750000E5017F +:100CF000F5F0E50E35F0F50BE500F5F0E50F35F014 +:100D0000F50C750900750A00750100C3750000E552 +:100D100001F5F0E50B35F0F501E500F5F0E50C35F2 +:100D2000F0F500E509F503E500F502E501F582E5DA +:100D300002F583E503F0750101C3750000E501F5D7 +:100D4000F0E50B35F0F501E500F5F0E50C35F0F5D3 +:100D500000E50AF503E500F502E501F582E502F597 +:100D600083E503F0750102C3750000E501F5F0E5C8 +:100D70000E35F0F50BE500F5F0E50F35F0F50C75E7 +:100D80000900750A00750100C3750000E501F5F062 +:100D9000E50B35F0F501E500F5F0E50C35F0F50073 +:100DA000E509F503E500F502E501F582E502F583C5 +:100DB000E503F0750101C3750000E501F5F0E50BF1 +:100DC00035F0F501E500F5F0E50C35F0F500E50A44 +:100DD000F503E500F502E501F582E502F583E5039B +:100DE000F0750104C3750000E501F5F0E50E35F07E +:100DF000F50CE500F5F0E50F35F0F50D7509017519 +:100E00000A00750B00751400750100C3750000E53C +:100E100001F5F0E50C35F0F501E500F5F0E50D35EF +:100E2000F0F500E509F503E500F502E501F582E5D9 +:100E300002F583E503F0750101C3750000E501F5D6 +:100E4000F0E50C35F0F501E500F5F0E50D35F0F5D0 +:100E500000E50AF503E500F502E501F582E502F596 +:100E600083E503F0750102C3750000E501F5F0E5C7 +:100E70000C35F0F501E500F5F0E50D35F0F500E590 +:100E80000BF503E500F502E501F582E502F583E5E2 +:100E900003F0750103C3750000E501F5F0E50C35BD +:100EA000F0F501E500F5F0E50D35F0F500E514F598 +:100EB00003E500F502E501F582E502F583E503F0BF +:100EC000750108C3750000E501F5F0E50E35F0F594 +:100ED00009E500F5F0E50F35F0F50A750100C37579 +:100EE0000000E501F5F0E50935F0F501E500F5F064 +:100EF000E50A35F0F50075E00C2506F58275E00091 +:100F00003507F583E0F508E508F503E500F502E5AA +:100F100001F582E502F583E503F0750101C3750073 +:100F200000E501F5F0E50935F0F501E500F5F0E53E +:100F30000A35F0F50075E00B2506F58275E0003501 +:100F400007F583E0F508E508F503E500F502E5019E +:100F5000F582E502F583E503F0750102C375000033 +:100F6000E501F5F0E50935F0F501E500F5F0E50AF4 +:100F700035F0F50075E00A2506F58275E0003507C5 +:100F8000F583E0F508E508F503E500F502E501F570 +:100F900082E502F583E503F0750103C3750000E502 +:100FA00001F5F0E50935F0F501E500F5F0E50A3564 +:100FB000F0F50075E0092506F58275E0003507F5C6 +:100FC00083E0F508E508F503E500F502E501F582A3 +:100FD000E502F583E503F0750100C3750000E50146 +:100FE000F5F0E51035F0F509E500F5F0E51135F01F +:100FF000F50A750100C3750000E501F5F0E5093556 +:10100000F0F501E500F5F0E50A35F0F500E500F54D +:1010100002E501F582E502F583E0F50B750101C3F8 +:10102000750000E501F5F0E50935F0F501E500F59D +:10103000F0E50A35F0F500E500F502E501F582E599 +:1010400002F583E0F501750000E50BF5F0E50045DC +:10105000F0F500E501F5F0E50045F0F500E500707C +:101060000280030212AE00750100C3750000E501A5 +:10107000F5F0E51035F0F509E500F5F0E51135F08E +:10108000F50A750100C3750000E501F5F0E50935C5 +:10109000F0F501E500F5F0E50A35F0F500E50EF5AF +:1010A00003E500F502E501F582E502F583E503F0CD +:1010B000750101C3750000E501F5F0E50935F0F5AE +:1010C00001E500F5F0E50A35F0F500E50FF503E57B +:1010D00000F502E501F582E502F583E503F0E50E92 +:1010E000F512E50FF513750000750100750900751F +:1010F0000A00750C01C3750B00E500F5F0E50B95D2 +:10110000F0F50B750B00E50BF5F0E50B35F0F50B85 +:10111000E50BF5F0E50C65F0F50CC3750B00E5018A +:10112000F5F0E50B95F0F50B750B00E50BF5F0E52B +:101130000B35F0F50BE50BF5F0E50C65F0F50CC3A0 +:10114000750B00E509F5F0E50B95F0F50B750B0057 +:10115000E50BF5F0E50B35F0F50BE50BF5F0E50CDF +:1011600065F0F50CC3750B00E50AF5F0E50B95F09D +:10117000F50B750B00E50BF5F0E50B35F0F50BE520 +:101180000BF5F0E50C65F0F50C75010075090075BF +:101190000A00750000E50CF5F0E50045F0F500E506 +:1011A00001F5F0E50045F0F500E509F5F0E500454D +:1011B000F0F500E50AF5F0E50045F0F500E5007012 +:1011C0000280030211C9020CCA00750000E510F587 +:1011D00002E511F503E500F504E500F50575E016F7 +:1011E0002506F58275E0003507F583E0F51775E013 +:1011F000152506F58275E0003507F583E0F51675CF +:10120000E0142506F58275E0003507F583E0F51555 +:1012100075E0132506F58275E0003507F583E0F5E6 +:101220001475E0122506F58275E0003507F583E0B8 +:10123000F51375E0112506F58275E0003507F58395 +:10124000E0F51275E0102506F58275E0003507F52A +:1012500083E0F51175E00F2506F58275E00035078E +:10126000F583E0F51075E00D2506F58275E0003593 +:1012700007F583E0F508E508C0E075E00E2506F502 +:101280008275E0003507F583E0F508E508C0E075F4 +:10129000E0232506F50675E0003507F507E502F5BC +:1012A00082E503F583E504F500E505F50122007507 +:1012B0000002C3750100E500F5F0E51235F0F50018 +:1012C000E501F5F0E51335F0F50A750900C3750180 +:1012D00000E509F5F0E50035F0F509E501F5F0E583 +:1012E0000A35F0F501E50EF503E501F502E509F52E +:1012F00082E502F583E503F0750901C3750100E598 +:1013000009F5F0E50035F0F509E501F5F0E50A35F8 +:10131000F0F501E50FF503E501F502E509F582E5D4 +:1013200002F583E503F00210DE00750002C37501CB +:1013300000E500F5F0E51235F0F500E501F5F0E522 +:101340001335F0F50A750900C3750100E509F5F0DC +:10135000E50035F0F509E501F5F0E50A35F0F501B0 +:10136000E50EF503E501F502E509F582E502F583F1 +:10137000E503F0750901C3750100E509F5F0E50025 +:1013800035F0F509E501F5F0E50A35F0F501E50F71 +:10139000F503E501F502E509F582E502F583E503CC +:1013A000F0020BDE00750002C3750100E500F5F0E8 +:1013B000E51235F0F500E501F5F0E51335F0F50A35 +:1013C000750900C3750100E509F5F0E50035F0F594 +:1013D00009E501F5F0E50A35F0F501E50EF503E55F +:1013E00001F502E509F582E502F583E503F07509EB +:1013F00001C3750100E509F5F0E50035F0F509E5F3 +:1014000001F5F0E50A35F0F501E50FF503E501F525 +:1014100002E509F582E502F583E503F00206DE0048 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-6.s.expected b/tests/GCCTestSuite/uninit-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-8.c b/tests/GCCTestSuite/uninit-8.c new file mode 100644 index 0000000..98700f4 --- /dev/null +++ b/tests/GCCTestSuite/uninit-8.c @@ -0,0 +1,32 @@ +/* Uninitialized variable warning tests... + Inspired by part of optabs.c:expand_binop. + May be the same as uninit-1.c. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include + +void +add_bignums (int *out, int *x, int *y) +{ + int p, sum; + int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */ + + p = 0; + for (; *x; x++, y++, out++, p++) + { + if (p) + sum = *x + *y + carry; + else + sum = *x + *y; + + if (sum < 0) + { + carry = 1; + sum -= INT_MAX; + } + else + carry = 0; + } +} diff --git a/tests/GCCTestSuite/uninit-8.c.expected b/tests/GCCTestSuite/uninit-8.c.expected new file mode 100644 index 0000000..98700f4 --- /dev/null +++ b/tests/GCCTestSuite/uninit-8.c.expected @@ -0,0 +1,32 @@ +/* Uninitialized variable warning tests... + Inspired by part of optabs.c:expand_binop. + May be the same as uninit-1.c. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include + +void +add_bignums (int *out, int *x, int *y) +{ + int p, sum; + int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */ + + p = 0; + for (; *x; x++, y++, out++, p++) + { + if (p) + sum = *x + *y + carry; + else + sum = *x + *y; + + if (sum < 0) + { + carry = 1; + sum -= INT_MAX; + } + else + carry = 0; + } +} diff --git a/tests/GCCTestSuite/uninit-8.hex.expected b/tests/GCCTestSuite/uninit-8.hex.expected new file mode 100644 index 0000000..5b2c0e9 --- /dev/null +++ b/tests/GCCTestSuite/uninit-8.hex.expected @@ -0,0 +1,190 @@ +:1000000000E506758210C39582F506E50775830045 +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F075E0E3 +:10004000092506F58275E0003507F583E517F0759B +:10005000E0082506F58275E0003507F583E516F022 +:1000600075E0072506F58275E0003507F583E5158F +:10007000F075E0062506F58275E0003507F583E5A5 +:1000800014F075E0052506F58275E0003507F58367 +:10009000E513F075E0042506F58275E0003507F5F7 +:1000A00083E512F075E0032506F58275E00035075B +:1000B000F583E511F075E0022506F58275E000355F +:1000C00007F583E510F0751800751900751E0075A9 +:1000D0001F00750B00C3750000E50BF5F0E51D353D +:1000E000F0F50BE500F5F0E51C35F0F50AE50AF54D +:1000F00002E50BF582E502F583E0F500750B01C31F +:10010000750100E50BF5F0E51D35F0F50BE501F5A2 +:10011000F0E51C35F0F50AE50AF502E50BF582E598 +:1001200002F583E0F501750B02C3750900E50BF5D7 +:10013000F0E51D35F0F50BE509F5F0E51C35F0F5BA +:100140000AE50AF502E50BF582E502F583E0F5091B +:10015000750B03C3750A00E50BF5F0E51D35F0F5E9 +:100160000BE50AF5F0E51C35F0F50AE50AF502E5C0 +:100170000BF582E502F583E0F50A750C01C3750BFA +:1001800000E500F5F0E50B95F0F50B750B00E50BC0 +:10019000F5F0E50B35F0F50BE50BF5F0E50C65F04A +:1001A000F50CC3750B00E501F5F0E50B95F0F50BCB +:1001B000750B00E50BF5F0E50B35F0F50BE50BF5F0 +:1001C000F0E50C65F0F50CC3750B00E509F5F0E5FD +:1001D0000B95F0F50B750B00E50BF5F0E50B35F025 +:1001E000F50BE50BF5F0E50C65F0F50CC3750B00B0 +:1001F000E50AF5F0E50B95F0F50B750B00E50BF551 +:10020000F0E50B35F0F50BE50BF5F0E50C65F0F5D9 +:100210000C750100750900750A00750000E50CF504 +:10022000F0E50045F0F500E501F5F0E50045F0F5F5 +:1002300000E509F5F0E50045F0F500E50AF5F0E523 +:100240000045F0F500E50070028003020ADC00754D +:100250000000E518F5F0E50045F0F500E519F5F0CA +:10026000E50045F0F500E51EF5F0E50045F0F50088 +:10027000E51FF5F0E50045F0F500E50070028003AC +:1002800002093000750100C3750000E501F5F0E5D5 +:100290001D35F0F501E500F5F0E51C35F0F500E55C +:1002A00000F502E501F582E502F583E0F50E750142 +:1002B00001C3750000E501F5F0E51D35F0F501E538 +:1002C00000F5F0E51C35F0F500E500F502E501F577 +:1002D00082E502F583E0F50D750102C3750000E5C6 +:1002E00001F5F0E51D35F0F501E500F5F0E51C350B +:1002F000F0F500E500F502E501F582E502F583E0A1 +:10030000F50B750103C3750000E501F5F0E51D353A +:10031000F0F501E500F5F0E51C35F0F500E500F538 +:1003200002E501F582E502F583E0F509750F00C3EA +:10033000750000E50FF5F0E51B35F0F50FE500F56C +:10034000F0E51A35F0F501E501F502E50FF582E576 +:1003500002F583E0F500750F01C3750100E50FF5A7 +:10036000F0E51B35F0F50FE501F5F0E51A35F0F590 +:1003700001E501F502E50FF582E502F583E0F50CF4 +:10038000750F02C3750100E50FF5F0E51B35F0F5BB +:100390000FE501F5F0E51A35F0F501E501F502E5A7 +:1003A0000FF582E502F583E0F50A750F03C37501C9 +:1003B00000E50FF5F0E51B35F0F50FE501F5F0E58B +:1003C0001A35F0F501E501F502E50FF582E502F5D4 +:1003D00083E0F501C3750F00E500F5F0E50E35F09B +:1003E000F500E50CF5F0E50D35F0F50DE50AF5F055 +:1003F000E50B35F0F50EE501F5F0E50935F0F50F03 +:10040000751600751200751000750C00E500F517E3 +:10041000750080E500F5F0E50F25F0F50FE500F536 +:10042000F0E50C25F0F50C750B0075130075140044 +:10043000751500750A00751101750001C3E50CF50D +:10044000F0E50F95F0F509E50AF5F0E50A35F0F568 +:1004500009E509F5F0E50055F0F500E500F5F0E5F2 +:100460000B45F0F50B750001C3E50CF5F0E50F95B4 +:10047000F0F509E50AF5F0E50A35F0F509E50FF5BF +:10048000F0E50C95F0F501E50AF5F0E50A35F0F533 +:1004900001E501F5F0E50945F0F509E511F5F0E5AF +:1004A0000965F0F509E509F5F0E50055F0F500C33B +:1004B000E510F5F0E50E95F0F509E50AF5F0E50A29 +:1004C00035F0F509E509F5F0E50055F0F500E50032 +:1004D000F5F0E50B45F0F50B750001C3E50CF5F003 +:1004E000E50F95F0F509E50AF5F0E50A35F0F509AF +:1004F000E50FF5F0E50C95F0F501E50AF5F0E50AF4 +:1005000035F0F501E501F5F0E50945F0F509E511EE +:10051000F5F0E50965F0F509E509F5F0E50055F0B8 +:10052000F500C3E510F5F0E50E95F0F509E50AF5DF +:10053000F0E50A35F0F509E50EF5F0E51095F0F572 +:1005400001E50AF5F0E50A35F0F501E501F5F0E51C +:100550000945F0F509E511F5F0E50965F0F509E55E +:1005600009F5F0E50055F0F500C3E512F5F0E50DED +:1005700095F0F509E50AF5F0E50A35F0F509E50924 +:10058000F5F0E50055F0F500E500F5F0E50B45F078 +:10059000F50B750001C3E50CF5F0E50F95F0F509D5 +:1005A000E50AF5F0E50A35F0F509E50FF5F0E50C9B +:1005B00095F0F501E50AF5F0E50A35F0F501E501FC +:1005C000F5F0E50945F0F509E511F5F0E50965F007 +:1005D000F509E509F5F0E50055F0F500C3E510F57E +:1005E000F0E50E95F0F509E50AF5F0E50A35F0F5C8 +:1005F00009E50EF5F0E51095F0F501E50AF5F0E5F1 +:100600000A35F0F501E501F5F0E50945F0F509E5F4 +:1006100011F5F0E50965F0F509E509F5F0E5005596 +:10062000F0F500C3E512F5F0E50D95F0F509E50AE2 +:10063000F5F0E50A35F0F509E50DF5F0E51295F070 +:10064000F501E50AF5F0E50A35F0F501E501F5F00B +:10065000E50945F0F509E511F5F0E50965F0F5095D +:10066000E509F5F0E50055F0F500C3E516F5F0E510 +:100670001795F0F509E50AF5F0E50A35F0F509E515 +:1006800009F5F0E50055F0F500E500F5F0E50B455E +:10069000F0F50B750000E50BF5F0E50045F0F50011 +:1006A000E513F5F0E50045F0F500E514F5F0E5009B +:1006B00045F0F500E515F5F0E50045F0F500E5003D +:1006C0007002800302091E0075100075110075127A +:1006D00000751300750001750100750C04750D009F +:1006E000750E00750F00C3750900E500F5F0E50C07 +:1006F000A4F50BE500F5F0E50CA4E5F0F50AE50B33 +:10070000F5F0E50935F0F509E501F5F0E50CA4F59E +:100710000BE501F5F0E50CA4E5F0F501E50BF5F0CE +:10072000E50A35F0F50AC3C3750100E509F5F0E502 +:100730000E35F0F50EE50AF5F0E50F35F0F50FC3CF +:10074000750A00E500F5F0E50DA4F50BE500F5F000 +:10075000E50DA4E5F0F501E50BF5F0E50A35F0F55A +:100760000A750900C3C3750000E509F5F0E50E350B +:10077000F0F50EE50AF5F0E50F35F0F50FC3750954 +:1007800000750A00C3C3750000E509F5F0E50E35F4 +:10079000F0F50EE50AF5F0E50F35F0F50FC3750934 +:1007A00000750A00C3C3750000E509F5F0E50E35D4 +:1007B000F0F50EE50AF5F0E50F35F0F50FC375001D +:1007C00000E50EF5F0E51D35F0F51DE50FF5F0E55A +:1007D0001C35F0F51C750001750100750C04750DD4 +:1007E00000750E00750F00C3750900E500F5F0E512 +:1007F0000CA4F50BE500F5F0E50CA4E5F0F50AE531 +:100800000BF5F0E50935F0F509E501F5F0E50CA487 +:10081000F50BE501F5F0E50CA4E5F0F501E50BF5C8 +:10082000F0E50A35F0F50AC3C3750100E509F5F0F6 +:10083000E50E35F0F50EE50AF5F0E50F35F0F50FAC +:10084000C3750A00E500F5F0E50DA4F50BE500F52C +:10085000F0E50DA4E5F0F501E50BF5F0E50A35F05E +:10086000F50A750900C3C3750000E509F5F0E50E4A +:1008700035F0F50EE50AF5F0E50F35F0F50FC37527 +:100880000900750A00C3C3750000E509F5F0E50E1F +:1008900035F0F50EE50AF5F0E50F35F0F50FC37507 +:1008A0000900750A00C3C3750000E509F5F0E50EFF +:1008B00035F0F50EE50AF5F0E50F35F0F50FC375E7 +:1008C0000000E50EF5F0E51B35F0F51BE50FF5F042 +:1008D000E51A35F0F51AC3C3C3C3C3C3C3C3C3C347 +:1008E000C3C3C3750101750900750A00750B00C308 +:1008F000750000E501F5F0E51835F0F518E509F5A6 +:10090000F0E51935F0F519E50AF5F0E51E35F0F5D5 +:100910001EE50BF5F0E51F35F0F51F0200D200755E +:100920001001751100751200751300D3C30206D4AF +:1009300000750100C3750000E501F5F0E51D35F017 +:10094000F501E500F5F0E51C35F0F500E500F502F0 +:10095000E501F582E502F583E0F50C750101C3754B +:100960000000E501F5F0E51D35F0F501E500F5F0D5 +:10097000E51C35F0F500E500F502E501F582E5023C +:10098000F583E0F50D750102C3750000E501F5F092 +:10099000E51D35F0F501E500F5F0E51C35F0F50055 +:1009A000E500F502E501F582E502F583E0F50E7557 +:1009B0000103C3750000E501F5F0E51D35F0F50113 +:1009C000E500F5F0E51C35F0F500E500F502E50180 +:1009D000F582E502F583E0F50F750100C3750000AF +:1009E000E501F5F0E51B35F0F501E500F5F0E51A58 +:1009F00035F0F500E500F502E501F582E502F58345 +:100A0000E0F509750101C3750000E501F5F0E51B8E +:100A100035F0F501E500F5F0E51A35F0F500E500F3 +:100A2000F502E501F582E502F583E0F50A750102BC +:100A3000C3750000E501F5F0E51B35F0F501E500B3 +:100A4000F5F0E51A35F0F500E500F502E501F5826F +:100A5000E502F583E0F50B750103C3750000E501C0 +:100A6000F5F0E51B35F0F501E500F5F0E51A35F098 +:100A7000F500E500F502E501F582E502F583E0F514 +:100A800000C3750100E509F5F0E50C35F0F501E569 +:100A90000AF5F0E50D35F0F509E50BF5F0E50E3555 +:100AA000F0F50AE500F5F0E50F35F0F50BC375003C +:100AB00000E510F5F0E50135F0F500E511F5F0E59C +:100AC0000935F0F50DE512F5F0E50A35F0F50EE51E +:100AD00013F5F0E50B35F0F50F020400007500008A +:100AE000E500F502E500F503E500F504E500F50590 +:100AF00075E0092506F58275E0003507F583E0F518 +:100B00001775E0082506F58275E0003507F583E0E6 +:100B1000F51675E0072506F58275E0003507F583C3 +:100B2000E0F51575E0062506F58275E0003507F558 +:100B300083E0F51475E0052506F58275E0003507BC +:100B4000F583E0F51375E0042506F58275E00035C0 +:100B500007F583E0F51275E0032506F58275E000E0 +:100B60003507F583E0F51175E0022506F58275E09D +:100B7000003507F583E0F51075E0002506F5827570 +:100B8000E0003507F583E0F508E508C0E075E00111 +:100B90002506F58275E0003507F583E0F508E508E0 +:100BA000C0E075E0102506F50675E0003507F5078D +:100BB000E502F582E503F583E504F500E505F501B9 +:100BC0002200000000000000000000000000000003 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-8.s.expected b/tests/GCCTestSuite/uninit-8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-B.c b/tests/GCCTestSuite/uninit-B.c new file mode 100644 index 0000000..450bb38 --- /dev/null +++ b/tests/GCCTestSuite/uninit-B.c @@ -0,0 +1,15 @@ +/* Origin: PR c/179 from Gray Watson , adapted as a testcase + by Joseph Myers . */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ +extern void foo (int *); +extern void bar (int); + +void +baz (void) +{ + int i; + if (i) /* { dg-warning "uninit" "uninit i warning" { xfail *-*-* } } */ + bar (i); + foo (&i); +} diff --git a/tests/GCCTestSuite/uninit-B.c.expected b/tests/GCCTestSuite/uninit-B.c.expected new file mode 100644 index 0000000..450bb38 --- /dev/null +++ b/tests/GCCTestSuite/uninit-B.c.expected @@ -0,0 +1,15 @@ +/* Origin: PR c/179 from Gray Watson , adapted as a testcase + by Joseph Myers . */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ +extern void foo (int *); +extern void bar (int); + +void +baz (void) +{ + int i; + if (i) /* { dg-warning "uninit" "uninit i warning" { xfail *-*-* } } */ + bar (i); + foo (&i); +} diff --git a/tests/GCCTestSuite/uninit-B.hex.expected b/tests/GCCTestSuite/uninit-B.hex.expected new file mode 100644 index 0000000..a917eb2 --- /dev/null +++ b/tests/GCCTestSuite/uninit-B.hex.expected @@ -0,0 +1,44 @@ +:10000000000000E506758206C39582F506E50775D2 +:1000100083009583F507D0E0F50875E0052506F522 +:100020008275E0003507F583E508F0D0E0F5087546 +:10003000E0042506F58275E0003507F583E508F054 +:10004000E506F509E507F50A750100C3750000E549 +:1000500001F5F0E50935F0F501E500F5F0E50A35C3 +:10006000F0F500E501F509E500F50A750100C37535 +:100070000000E501F5F0E50935F0F501E500F5F0E2 +:10008000E50A35F0F500E500F502E501F582E50247 +:10009000F583E0F50B750101C3750000E501F5F08E +:1000A000E50935F0F501E500F5F0E50A35F0F50074 +:1000B000E500F502E501F582E502F583E0F50C7552 +:1000C0000102C3750000E501F5F0E50935F0F50121 +:1000D000E500F5F0E50A35F0F500E500F502E5018B +:1000E000F582E502F583E0F50D750103C3750000A7 +:1000F000E501F5F0E50935F0F501E500F5F0E50A73 +:1001000035F0F500E500F502E501F582E502F5833D +:10011000E0F501750000E50BF5F0E50045F0F500B0 +:10012000E50CF5F0E50045F0F500E50DF5F0E5002E +:1001300045F0F500E501F5F0E50045F0F500E500D6 +:10014000700280030201CF00E506F509E507F50A14 +:10015000750100C3750000E501F5F0E50935F0F51E +:1001600001E500F5F0E50A35F0F500E501F51FE5DC +:1001700000F51E750000E500F502E500F503E50059 +:10018000F504E500F50575E0042506F58275E00047 +:100190003507F583E0F508E508C0E075E0052506BC +:1001A000F58275E0003507F583E0F508E508C0E065 +:1001B00075E0062506F50675E0003507F507E5024A +:1001C000F582E503F583E504F500E505F501220078 +:1001D000E506F509E507F50A750100C3750000E5B8 +:1001E00001F5F0E50935F0F501E500F5F0E50A3532 +:1001F000F0F500E501F509E500F50A750100C375A4 +:100200000000E501F5F0E50935F0F501E500F5F050 +:10021000E50A35F0F500E500F502E501F582E502B5 +:10022000F583E0F51F750101C3750000E501F5F0E8 +:10023000E50935F0F501E500F5F0E50A35F0F500E2 +:10024000E500F502E501F582E502F583E0F51E75AE +:100250000102C3750000E501F5F0E50935F0F5018F +:10026000E500F5F0E50A35F0F500E500F502E501F9 +:10027000F582E502F583E0F51D750103C375000005 +:10028000E501F5F0E50935F0F501E500F5F0E50AE1 +:1002900035F0F500E500F502E501F582E502F583AC +:1002A000E0F500E500F51C02014800000000000038 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-B.s.expected b/tests/GCCTestSuite/uninit-B.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-B.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-C.c b/tests/GCCTestSuite/uninit-C.c new file mode 100644 index 0000000..741106c --- /dev/null +++ b/tests/GCCTestSuite/uninit-C.c @@ -0,0 +1,21 @@ +/* Spurious uninitialized variable warning, inspired by libgcc2.c. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +/* Not all platforms support TImode integers. */ +#if defined(__LP64__) && !defined(__hppa__) +typedef int TItype __attribute__ ((mode (TI))); +#else +typedef long TItype; +#endif + + +TItype +__subvdi3 (TItype a, TItype b) +{ + TItype w; + + w = a - b; + + return w; +} diff --git a/tests/GCCTestSuite/uninit-C.c.expected b/tests/GCCTestSuite/uninit-C.c.expected new file mode 100644 index 0000000..741106c --- /dev/null +++ b/tests/GCCTestSuite/uninit-C.c.expected @@ -0,0 +1,21 @@ +/* Spurious uninitialized variable warning, inspired by libgcc2.c. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +/* Not all platforms support TImode integers. */ +#if defined(__LP64__) && !defined(__hppa__) +typedef int TItype __attribute__ ((mode (TI))); +#else +typedef long TItype; +#endif + + +TItype +__subvdi3 (TItype a, TItype b) +{ + TItype w; + + w = a - b; + + return w; +} diff --git a/tests/GCCTestSuite/uninit-C.hex.expected b/tests/GCCTestSuite/uninit-C.hex.expected new file mode 100644 index 0000000..d20221f --- /dev/null +++ b/tests/GCCTestSuite/uninit-C.hex.expected @@ -0,0 +1,10 @@ +:1000000000E506758208C39582F506E5077583004D +:100010009583F507D0E0F50CD0E0F50EE511F5017C +:10002000E510F50AC3E51BF5F0E51F95F0F500E5D1 +:100030001AF5F0E51E95F0F509E519F5F0E51D95C1 +:10004000F0F50BE518F5F0E51C95F0F50DE500F57C +:1000500002E509F503E50BF504E50DF505E501F508 +:1000600011E50AF510E50EC0E0E50CC0E075E0080A +:100070002506F50675E0003507F507E502F582E58A +:1000800003F583E504F500E505F501220000000015 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-C.s.expected b/tests/GCCTestSuite/uninit-C.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-C.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-D.c b/tests/GCCTestSuite/uninit-D.c new file mode 100644 index 0000000..ea957e4 --- /dev/null +++ b/tests/GCCTestSuite/uninit-D.c @@ -0,0 +1,9 @@ +/* Test we do not warn about initializing variable with self. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +int f() +{ + int i = i; + return i; +} diff --git a/tests/GCCTestSuite/uninit-D.c.expected b/tests/GCCTestSuite/uninit-D.c.expected new file mode 100644 index 0000000..ea957e4 --- /dev/null +++ b/tests/GCCTestSuite/uninit-D.c.expected @@ -0,0 +1,9 @@ +/* Test we do not warn about initializing variable with self. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +int f() +{ + int i = i; + return i; +} diff --git a/tests/GCCTestSuite/uninit-D.hex.expected b/tests/GCCTestSuite/uninit-D.hex.expected new file mode 100644 index 0000000..1f7859d --- /dev/null +++ b/tests/GCCTestSuite/uninit-D.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501E509F502E50AF5DC +:1000100003E50BF504E50CF505E501C0E0E500C0DE +:10002000E0E502F582E503F583E504F500E505F575 +:10003000012200000000000000000000000000009D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-D.s.expected b/tests/GCCTestSuite/uninit-D.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-D.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-E.c b/tests/GCCTestSuite/uninit-E.c new file mode 100644 index 0000000..eb356c3 --- /dev/null +++ b/tests/GCCTestSuite/uninit-E.c @@ -0,0 +1,9 @@ +/* Test we do warn about initializing variable with self when -Winit-self is supplied. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized -Winit-self" } */ + +int f() +{ + int i = i; /* { dg-warning "i" "uninitialized variable warning" } */ + return i; +} diff --git a/tests/GCCTestSuite/uninit-E.c.expected b/tests/GCCTestSuite/uninit-E.c.expected new file mode 100644 index 0000000..eb356c3 --- /dev/null +++ b/tests/GCCTestSuite/uninit-E.c.expected @@ -0,0 +1,9 @@ +/* Test we do warn about initializing variable with self when -Winit-self is supplied. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized -Winit-self" } */ + +int f() +{ + int i = i; /* { dg-warning "i" "uninitialized variable warning" } */ + return i; +} diff --git a/tests/GCCTestSuite/uninit-E.hex.expected b/tests/GCCTestSuite/uninit-E.hex.expected new file mode 100644 index 0000000..1f7859d --- /dev/null +++ b/tests/GCCTestSuite/uninit-E.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501E509F502E50AF5DC +:1000100003E50BF504E50CF505E501C0E0E500C0DE +:10002000E0E502F582E503F583E504F500E505F575 +:10003000012200000000000000000000000000009D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-E.s.expected b/tests/GCCTestSuite/uninit-E.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-E.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-F.c b/tests/GCCTestSuite/uninit-F.c new file mode 100644 index 0000000..1dbb365 --- /dev/null +++ b/tests/GCCTestSuite/uninit-F.c @@ -0,0 +1,9 @@ +/* Test we do warn about initializing variable with self in the initialization. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +int f() +{ + int i = i + 1; /* { dg-warning "i" "uninitialized variable warning" } */ + return i; +} diff --git a/tests/GCCTestSuite/uninit-F.c.expected b/tests/GCCTestSuite/uninit-F.c.expected new file mode 100644 index 0000000..1dbb365 --- /dev/null +++ b/tests/GCCTestSuite/uninit-F.c.expected @@ -0,0 +1,9 @@ +/* Test we do warn about initializing variable with self in the initialization. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +int f() +{ + int i = i + 1; /* { dg-warning "i" "uninitialized variable warning" } */ + return i; +} diff --git a/tests/GCCTestSuite/uninit-F.hex.expected b/tests/GCCTestSuite/uninit-F.hex.expected new file mode 100644 index 0000000..68dbf87 --- /dev/null +++ b/tests/GCCTestSuite/uninit-F.hex.expected @@ -0,0 +1,9 @@ +:1000000000D0E0F518D0E0F519E512F50F75000104 +:10001000750100750900750A00C3751200E500F549 +:10002000F0E50B35F0F50BE501F5F0E50C35F0F5F5 +:100030000CE509F5F0E50D35F0F50DE50AF5F0E50F +:100040000E35F0F50EE50BF502E50CF503E50DF5C3 +:1000500004E50EF505E50FF512E519C0E0E518C059 +:10006000E0E502F582E503F583E504F500E505F535 +:10007000012200000000000000000000000000005D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-F.s.expected b/tests/GCCTestSuite/uninit-F.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-F.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-G.c b/tests/GCCTestSuite/uninit-G.c new file mode 100644 index 0000000..08f5f53 --- /dev/null +++ b/tests/GCCTestSuite/uninit-G.c @@ -0,0 +1,9 @@ +/* Test we do not warn about initializing variable with address of self in the initialization. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +void *f() +{ + void *i = &i; + return i; +} diff --git a/tests/GCCTestSuite/uninit-G.c.expected b/tests/GCCTestSuite/uninit-G.c.expected new file mode 100644 index 0000000..08f5f53 --- /dev/null +++ b/tests/GCCTestSuite/uninit-G.c.expected @@ -0,0 +1,9 @@ +/* Test we do not warn about initializing variable with address of self in the initialization. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +void *f() +{ + void *i = &i; + return i; +} diff --git a/tests/GCCTestSuite/uninit-G.hex.expected b/tests/GCCTestSuite/uninit-G.hex.expected new file mode 100644 index 0000000..5b96c01 --- /dev/null +++ b/tests/GCCTestSuite/uninit-G.hex.expected @@ -0,0 +1,25 @@ +:1000000000E506758202C39582F506E50775830053 +:100010009583F507D0E0F50ED0E0F50FE510F50D6E +:10002000E506F50AE507F501750900C3750000E569 +:1000300009F5F0E50A35F0F50BE500F5F0E50135D9 +:10004000F0F50CE506F50AE507F501750900C3753D +:100050000000E509F5F0E50A35F0F509E500F5F0F1 +:10006000E50135F0F50A750100C3750000E501F5FD +:10007000F0E50B35F0F501E500F5F0E50C35F0F5B0 +:1000800000E509F503E500F502E501F582E502F575 +:1000900083E503F0750101C3750000E501F5F0E5A6 +:1000A0000B35F0F501E500F5F0E50C35F0F500E570 +:1000B0000AF503E500F502E501F582E502F583E5C1 +:1000C00003F0E506F509E507F50A750100C37500BB +:1000D00000E501F5F0E50935F0F501E500F5F0E59D +:1000E0000A35F0F500E501F509E500F50A750100AE +:1000F000C3750000E501F5F0E50935F0F501E5000F +:10010000F5F0E50A35F0F500E500F502E501F582C8 +:10011000E502F583E0F50B750101C3750000E5010B +:10012000F5F0E50935F0F501E500F5F0E50A35F003 +:10013000F500E500F502E501F582E502F583E0F55D +:1001400001750000E50BF502E501F503E500F50496 +:10015000E500F505E50DF510E50FC0E0E50EC0E0A2 +:1001600075E0022506F50675E0003507F507E5029E +:10017000F582E503F583E504F500E505F5012200C8 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-G.s.expected b/tests/GCCTestSuite/uninit-G.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-G.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-H.c b/tests/GCCTestSuite/uninit-H.c new file mode 100644 index 0000000..b93bf8d --- /dev/null +++ b/tests/GCCTestSuite/uninit-H.c @@ -0,0 +1,33 @@ +/* PR 14204 */ +/* { dg-do compile } */ +/* { dg-options "-O -Wall -Werror" } */ + +#if defined __alpha__ +# define ASM __asm__("$30") +#elif defined __i386__ +# define ASM __asm__("esp") +#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER) +# define ASM __asm__("r1") +#elif defined __s390__ +# define ASM __asm__("r15") +#elif defined __mips +# define ASM __asm__("$sp") +#elif defined __sparc__ +# define ASM __asm__("sp") +#elif defined __ia64__ +# define ASM __asm__("r12") +#elif defined __hppa__ +# define ASM __asm__("%r30") +#elif defined __xtensa__ +# define ASM __asm__("sp") +#else +/* The register name should be target-dependent so for other targets, + we just silence the test. */ +# define ASM = 0 +#endif + +void *load_PCB (void) +{ + register void *sp ASM; + return sp; /* { dg-bogus "uninitialized" } */ +} diff --git a/tests/GCCTestSuite/uninit-H.c.expected b/tests/GCCTestSuite/uninit-H.c.expected new file mode 100644 index 0000000..b93bf8d --- /dev/null +++ b/tests/GCCTestSuite/uninit-H.c.expected @@ -0,0 +1,33 @@ +/* PR 14204 */ +/* { dg-do compile } */ +/* { dg-options "-O -Wall -Werror" } */ + +#if defined __alpha__ +# define ASM __asm__("$30") +#elif defined __i386__ +# define ASM __asm__("esp") +#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER) +# define ASM __asm__("r1") +#elif defined __s390__ +# define ASM __asm__("r15") +#elif defined __mips +# define ASM __asm__("$sp") +#elif defined __sparc__ +# define ASM __asm__("sp") +#elif defined __ia64__ +# define ASM __asm__("r12") +#elif defined __hppa__ +# define ASM __asm__("%r30") +#elif defined __xtensa__ +# define ASM __asm__("sp") +#else +/* The register name should be target-dependent so for other targets, + we just silence the test. */ +# define ASM = 0 +#endif + +void *load_PCB (void) +{ + register void *sp ASM; + return sp; /* { dg-bogus "uninitialized" } */ +} diff --git a/tests/GCCTestSuite/uninit-H.hex.expected b/tests/GCCTestSuite/uninit-H.hex.expected new file mode 100644 index 0000000..2f63230 --- /dev/null +++ b/tests/GCCTestSuite/uninit-H.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750B00E509F50240 +:10001000E50AF503E50BF504E50BF505E501C0E0A0 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-H.s.expected b/tests/GCCTestSuite/uninit-H.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-H.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-I.c b/tests/GCCTestSuite/uninit-I.c new file mode 100644 index 0000000..7be60d7 --- /dev/null +++ b/tests/GCCTestSuite/uninit-I.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +int sys_msgctl (void) +{ + struct { int mode; } setbuf; /* { dg-warning "'setbuf\.mode' is used" } */ + return setbuf.mode; +} diff --git a/tests/GCCTestSuite/uninit-I.c.expected b/tests/GCCTestSuite/uninit-I.c.expected new file mode 100644 index 0000000..7be60d7 --- /dev/null +++ b/tests/GCCTestSuite/uninit-I.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +int sys_msgctl (void) +{ + struct { int mode; } setbuf; /* { dg-warning "'setbuf\.mode' is used" } */ + return setbuf.mode; +} diff --git a/tests/GCCTestSuite/uninit-I.hex.expected b/tests/GCCTestSuite/uninit-I.hex.expected new file mode 100644 index 0000000..ded3d6b --- /dev/null +++ b/tests/GCCTestSuite/uninit-I.hex.expected @@ -0,0 +1,23 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F518D0E0F519E511F50E58 +:10002000E510F50FE506F509E507F50A750100C3CA +:10003000750000E501F5F0E50935F0F501E500F59D +:10004000F0E50A35F0F50A750900C3750000E50909 +:10005000F5F0E50135F0F501E500F5F0E50A35F0DC +:10006000F500E501F509E500F50A750100C3750025 +:1000700000E501F5F0E50935F0F501E500F5F0E5FD +:100080000A35F0F500E500F502E501F582E502F537 +:1000900083E0F50B750101C3750000E501F5F0E59E +:1000A0000935F0F501E500F5F0E50A35F0F500E574 +:1000B00000F502E501F582E502F583E0F50C750136 +:1000C00002C3750000E501F5F0E50935F0F501E53D +:1000D00000F5F0E50A35F0F500E500F502E501F57B +:1000E00082E502F583E0F50D750103C3750000E5B7 +:1000F00001F5F0E50935F0F501E500F5F0E50A3523 +:10010000F0F500E500F502E501F582E502F583E092 +:10011000F500E50BF502E50CF503E50DF504E5004A +:10012000F505E50EF511E50FF510E519C0E0E51848 +:10013000C0E075E0042506F50675E0003507F50713 +:10014000E502F582E503F583E504F500E505F50133 +:10015000220000000000000000000000000000007D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/uninit-I.s.expected b/tests/GCCTestSuite/uninit-I.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/uninit-I.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unroll-1.c b/tests/GCCTestSuite/unroll-1.c new file mode 100644 index 0000000..5ff07e2 --- /dev/null +++ b/tests/GCCTestSuite/unroll-1.c @@ -0,0 +1,27 @@ +/* PR optimization/8599 */ +/* { dg-do run } */ +/* { dg-options "-O2 -funroll-loops" } */ +/* { dg-options "-mtune=k6 -O2 -funroll-loops" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + + +extern void abort (void); + +int array[6] = { 1,2,3,4,5,6 }; + +void foo() +{ + int i; + + for (i = 0; i < 5; i++) + array[i] = 0; +} + +int main() +{ + foo(); + if (array[0] || array [1] || array[2] || array[3] || array[4]) + abort (); + if (array[5] != 6) + abort (); + return 0; +} diff --git a/tests/GCCTestSuite/unroll-1.c.expected b/tests/GCCTestSuite/unroll-1.c.expected new file mode 100644 index 0000000..5ff07e2 --- /dev/null +++ b/tests/GCCTestSuite/unroll-1.c.expected @@ -0,0 +1,27 @@ +/* PR optimization/8599 */ +/* { dg-do run } */ +/* { dg-options "-O2 -funroll-loops" } */ +/* { dg-options "-mtune=k6 -O2 -funroll-loops" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + + +extern void abort (void); + +int array[6] = { 1,2,3,4,5,6 }; + +void foo() +{ + int i; + + for (i = 0; i < 5; i++) + array[i] = 0; +} + +int main() +{ + foo(); + if (array[0] || array [1] || array[2] || array[3] || array[4]) + abort (); + if (array[5] != 6) + abort (); + return 0; +} diff --git a/tests/GCCTestSuite/unroll-1.hex.expected b/tests/GCCTestSuite/unroll-1.hex.expected new file mode 100644 index 0000000..0a6c658 --- /dev/null +++ b/tests/GCCTestSuite/unroll-1.hex.expected @@ -0,0 +1,434 @@ +:1000000075812F7506FF7507FF12068102000C002F +:1000100000E506758203C39582F506E50775830042 +:100020009583F507D0E0F50875E0012506F58275A2 +:10003000E0003507F583E508F0D0E0F50875E0004D +:100040002506F58275E0003507F583E508F0E5172C +:10005000F519E516F51AE515F51BE514F51CE5137C +:10006000F51DE512F51EE511F51F75E0022506F5F3 +:100070008275E0003507F583E510F0751100751203 +:1000800000751300751700751805751600750E00BC +:10009000750F00E517F510750080E500F5F0E51027 +:1000A00025F0F510E500F5F0E50F25F0F50F750CDE +:1000B00000750D00751400751500750B00750A01AB +:1000C000750001C3E50FF5F0E51095F0F509E50BB6 +:1000D000F5F0E50B35F0F509E509F5F0E50055F02B +:1000E000F500E500F5F0E50C45F0F50C750001C3F1 +:1000F000E50FF5F0E51095F0F509E50BF5F0E50BEA +:1001000035F0F509E510F5F0E50F95F0F501E50B93 +:10011000F5F0E50B35F0F501E501F5F0E50945F001 +:10012000F509E50AF5F0E50965F0F509E509F5F0E9 +:10013000E50055F0F500C3E50EF5F0E51395F0F593 +:1001400009E50BF5F0E50B35F0F509E509F5F0E506 +:100150000055F0F500E500F5F0E50C45F0F50C75FF +:100160000001C3E50FF5F0E51095F0F509E50BF595 +:10017000F0E50B35F0F509E510F5F0E50F95F0F534 +:1001800001E50BF5F0E50B35F0F501E501F5F0E5DE +:100190000945F0F509E50AF5F0E50965F0F509E529 +:1001A00009F5F0E50055F0F500C3E50EF5F0E513AF +:1001B00095F0F509E50BF5F0E50B35F0F509E513DC +:1001C000F5F0E50E95F0F501E50BF5F0E50B35F0F2 +:1001D000F501E501F5F0E50945F0F509E50AF5F069 +:1001E000E50965F0F509E509F5F0E50055F0F500DC +:1001F000C3E516F5F0E51295F0F509E50BF5F0E528 +:100200000B35F0F509E509F5F0E50055F0F500E5E9 +:1002100000F5F0E50C45F0F50C750001C3E50FF5B0 +:10022000F0E51095F0F509E50BF5F0E50B35F0F587 +:1002300009E510F5F0E50F95F0F501E50BF5F0E5B2 +:100240000B35F0F501E501F5F0E50945F0F509E5B7 +:100250000AF5F0E50965F0F509E509F5F0E5005561 +:10026000F0F500C3E50EF5F0E51395F0F509E50BA3 +:10027000F5F0E50B35F0F509E513F5F0E50E95F031 +:10028000F501E50BF5F0E50B35F0F501E501F5F0CD +:10029000E50945F0F509E50AF5F0E50965F0F50928 +:1002A000E509F5F0E50055F0F500C3E516F5F0E5D4 +:1002B0001295F0F509E50BF5F0E50B35F0F509E5DC +:1002C00012F5F0E51695F0F501E50BF5F0E50B35C7 +:1002D000F0F501E501F5F0E50945F0F509E50AF568 +:1002E000F0E50965F0F509E509F5F0E50055F0F5EB +:1002F00000C3E518F5F0E51195F0F509E50BF5F00B +:10030000E50B35F0F509E509F5F0E50055F0F500E8 +:10031000E500F5F0E50C45F0F50C750101C375003D +:1003200000E50CF5F0E50095F0F500750000E5003E +:10033000F5F0E50035F0F500E500F5F0E50165F0D4 +:10034000F501C3750000E50DF5F0E50095F0F50049 +:10035000750000E500F5F0E50035F0F500E500F585 +:10036000F0E50165F0F501C3750000E514F5F0E571 +:100370000095F0F500750000E500F5F0E50035F0BA +:10038000F500E500F5F0E50165F0F501C375000045 +:10039000E515F5F0E50095F0F500750000E500F5D0 +:1003A000F0E50035F0F500E500F5F0E50165F0F564 +:1003B00001750900750A00750B00750000E501F56F +:1003C000F0E50045F0F500E509F5F0E50045F0F54C +:1003D00000E50AF5F0E50045F0F500E50BF5F0E580 +:1003E0000045F0F500E500700280030205F700907B +:1003F0000000E582F50E900000E583F50F75090415 +:10040000750B00750C00750D00C3750000E511F546 +:10041000F0E509A4F50AE511F5F0E509A4E5F0F524 +:1004200001E50AF5F0E50035F0F500E512F5F0E537 +:1004300009A4F50AE512F5F0E509A4E5F0F509E5EA +:100440000AF5F0E50135F0F501C3C3750900E500D3 +:10045000F5F0E50C35F0F50CE501F5F0E50D35F0BE +:10046000F50DC3750100E511F5F0E50BA4F50AE5FE +:1004700011F5F0E50BA4E5F0F509E50AF5F0E50165 +:1004800035F0F501750000C3C3750900E500F5F00E +:10049000E50C35F0F50CE501F5F0E50D35F0F50D61 +:1004A000C3750000750100C3C3750900E500F5F0D0 +:1004B000E50C35F0F50CE501F5F0E50D35F0F50D41 +:1004C000C3750000750100C3C3750900E500F5F0B0 +:1004D000E50C35F0F50CE501F5F0E50D35F0F50D21 +:1004E000C3750000E50CF5F0E50E35F0F500E50DFF +:1004F000F5F0E50F35F0F50E750A00750B00750C7B +:1005000000750D00750900C3750100E509F5F0E5FA +:100510000035F0F509E501F5F0E50E35F0F501E5FA +:100520000AF503E501F502E509F582E502F583E543 +:1005300003F0750901C3750100E509F5F0E5003523 +:10054000F0F509E501F5F0E50E35F0F501E50BF5FF +:1005500003E501F502E509F582E502F583E503F01F +:10056000750902C3750100E509F5F0E50035F0F500 +:1005700009E501F5F0E50E35F0F501E50CF503E5CB +:1005800001F502E509F582E502F583E503F0750959 +:1005900003C3750100E509F5F0E50035F0F509E55F +:1005A00001F5F0E50E35F0F501E50DF503E501F592 +:1005B00002E509F582E502F583E503F075010175B1 +:1005C0000900750A00750B00C3750000E501F5F020 +:1005D000E51135F0F511E509F5F0E51235F0F51204 +:1005E000E50AF5F0E51335F0F513E50BF5F0E51741 +:1005F00035F0F51702008700750000E500F502E50B +:1006000000F503E500F504E500F505E519F517E546 +:100610001AF516E51BF515E51CF514E51DF513E5B2 +:100620001EF512E51FF51175E0022506F58275E04D +:10063000003507F583E0F51075E0002506F58275B5 +:10064000E0003507F583E0F508E508C0E075E00156 +:100650002506F58275E0003507F583E0F508E50825 +:10066000C0E075E0032506F50675E0003507F507DF +:10067000E502F582E503F583E504F500E505F501FE +:100680002200E506758204C39582F506E5077583A9 +:10069000009583F507D0E0F50875E0012506F582A1 +:1006A00075E0003507F583E508F0D0E0F50875E062 +:1006B000002506F58275E0003507F583E508F0753D +:1006C000E0032506F58275E0003507F583E511F0B6 +:1006D00075E0022506F58275E0003507F583E51023 +:1006E000F0900000E582F50B900000E583F50075C1 +:1006F0000A00750900C3750100E509F5F0E50A3542 +:10070000F0F509C3750100E509F5F0E50B35F0F5E5 +:100710000DE501F5F0E50035F0F50E750901750AF6 +:1007200000750B00750C00750100C3750000E50134 +:10073000F5F0E50D35F0F501E500F5F0E50E35F0E5 +:10074000F500E509F503E500F502E501F582E502AE +:10075000F583E503F0750101C3750000E501F5F0CF +:10076000E50D35F0F501E500F5F0E50E35F0F500A5 +:10077000E50AF503E500F502E501F582E502F583FA +:10078000E503F0750102C3750000E501F5F0E50D24 +:1007900035F0F501E500F5F0E50E35F0F500E50B77 +:1007A000F503E500F502E501F582E502F583E503D1 +:1007B000F0750103C3750000E501F5F0E50D35F0B6 +:1007C000F501E500F5F0E50E35F0F500E50CF50373 +:1007D000E500F502E501F582E502F583E503F09019 +:1007E0000000E582F50B900000E583F500750A0036 +:1007F000750904C3750100E509F5F0E50A35F0F562 +:1008000009C3750100E509F5F0E50B35F0F50DE5D7 +:1008100001F5F0E50035F0F50E750902750A007571 +:100820000B00750C00750100C3750000E501F5F0C3 +:10083000E50D35F0F501E500F5F0E50E35F0F500D4 +:10084000E509F503E500F502E501F582E502F5832A +:10085000E503F0750101C3750000E501F5F0E50D54 +:1008600035F0F501E500F5F0E50E35F0F500E50AA7 +:10087000F503E500F502E501F582E502F583E50300 +:10088000F0750102C3750000E501F5F0E50D35F0E6 +:10089000F501E500F5F0E50E35F0F500E50BF503A3 +:1008A000E500F502E501F582E502F583E503F07563 +:1008B0000103C3750000E501F5F0E50D35F0F50124 +:1008C000E500F5F0E50E35F0F500E50CF503E50083 +:1008D000F502E501F582E502F583E503F0900000FD +:1008E000E582F50B900000E583F500750A007509B7 +:1008F00008C3750100E509F5F0E50A35F0F509C30F +:10090000750100E509F5F0E50B35F0F50DE501F5AC +:10091000F0E50035F0F50E750903750A00750B005A +:10092000750C00750100C3750000E501F5F0E50DDB +:1009300035F0F501E500F5F0E50E35F0F500E509D7 +:10094000F503E500F502E501F582E502F583E5032F +:10095000F0750101C3750000E501F5F0E50D35F016 +:10096000F501E500F5F0E50E35F0F500E50AF503D3 +:10097000E500F502E501F582E502F583E503F07592 +:100980000102C3750000E501F5F0E50D35F0F50154 +:10099000E500F5F0E50E35F0F500E50BF503E500B3 +:1009A000F502E501F582E502F583E503F075010343 +:1009B000C3750000E501F5F0E50D35F0F501E50042 +:1009C000F5F0E50E35F0F500E50CF503E500F50270 +:1009D000E501F582E502F583E503F0900000E5828C +:1009E000F50B900000E583F500750A0075090CC34E +:1009F000750100E509F5F0E50A35F0F509C3750163 +:100A000000E509F5F0E50B35F0F50DE501F5F0E54C +:100A10000035F0F50E750904750A00750B00750CAC +:100A200000750100C3750000E501F5F0E50D35F036 +:100A3000F501E500F5F0E50E35F0F500E509F50303 +:100A4000E500F502E501F582E502F583E503F075C1 +:100A50000101C3750000E501F5F0E50D35F0F50184 +:100A6000E500F5F0E50E35F0F500E50AF503E500E3 +:100A7000F502E501F582E502F583E503F075010273 +:100A8000C3750000E501F5F0E50D35F0F501E50071 +:100A9000F5F0E50E35F0F500E50BF503E500F502A0 +:100AA000E501F582E502F583E503F0750103C37501 +:100AB0000000E501F5F0E50D35F0F501E500F5F094 +:100AC000E50E35F0F500E50CF503E500F502E5016E +:100AD000F582E502F583E503F0900000E582F50B71 +:100AE000900000E583F500750A00750910C37501D3 +:100AF00000E509F5F0E50A35F0F509C3750100E5F3 +:100B000009F5F0E50B35F0F50DE501F5F0E50035FB +:100B1000F0F50E750905750A00750B00750C00756A +:100B20000100C3750000E501F5F0E50D35F0F501B4 +:100B3000E500F5F0E50E35F0F500E509F503E50013 +:100B4000F502E501F582E502F583E503F0750101A3 +:100B5000C3750000E501F5F0E50D35F0F501E500A0 +:100B6000F5F0E50E35F0F500E50AF503E500F502D0 +:100B7000E501F582E502F583E503F0750102C37531 +:100B80000000E501F5F0E50D35F0F501E500F5F0C3 +:100B9000E50E35F0F500E50BF503E500F502E5019E +:100BA000F582E502F583E503F0750103C3750000E6 +:100BB000E501F5F0E50D35F0F501E500F5F0E50EA0 +:100BC00035F0F500E50CF503E500F502E501F582E9 +:100BD000E502F583E503F0900000E582F50B900057 +:100BE00000E583F500750A00750914C3750100E579 +:100BF00009F5F0E50A35F0F509C3750100E509F5D9 +:100C0000F0E50B35F0F50DE501F5F0E50035F0F513 +:100C10000E750906750A00750B00750C007501004C +:100C2000C3750000E501F5F0E50D35F0F501E500CF +:100C3000F5F0E50E35F0F500E509F503E500F50200 +:100C4000E501F582E502F583E503F0750101C37561 +:100C50000000E501F5F0E50D35F0F501E500F5F0F2 +:100C6000E50E35F0F500E50AF503E500F502E501CE +:100C7000F582E502F583E503F0750102C375000016 +:100C8000E501F5F0E50D35F0F501E500F5F0E50ECF +:100C900035F0F500E50BF503E500F502E501F58219 +:100CA000E502F583E503F0750103C3750000E50176 +:100CB000F5F0E50D35F0F501E500F5F0E50E35F060 +:100CC000F500E50CF503E500F502E501F582E50226 +:100CD000F583E503F0120010900000E582F5109016 +:100CE0000000E583F511750000750100750C0475B1 +:100CF0000D00750E00750F00C3750900E500F5F0D5 +:100D0000E50CA4F50BE500F5F0E50CA4E5F0F50A1B +:100D1000E50BF5F0E50935F0F509E501F5F0E50C31 +:100D2000A4F50BE501F5F0E50CA4E5F0F501E50B04 +:100D3000F5F0E50A35F0F50AC3C3750100E509F5DC +:100D4000F0E50E35F0F50EE50AF5F0E50F35F0F5B6 +:100D50000FC3750A00E500F5F0E50DA4F50BE500FD +:100D6000F5F0E50DA4E5F0F501E50BF5F0E50A3544 +:100D7000F0F50A750900C3C3750000E509F5F0E553 +:100D80000E35F0F50EE50AF5F0E50F35F0F50FC379 +:100D9000750900750A00C3C3750000E509F5F0E5A3 +:100DA0000E35F0F50EE50AF5F0E50F35F0F50FC359 +:100DB000750900750A00C3C3750000E509F5F0E583 +:100DC0000E35F0F50EE50AF5F0E50F35F0F50FC339 +:100DD000750000E50EF5F0E51035F0F500E50FF5CE +:100DE000F0E51135F0F501E500F509E501F50A75C5 +:100DF0000100C3750000E501F5F0E50935F0F501E6 +:100E0000E500F5F0E50A35F0F500E500F502E5014D +:100E1000F582E502F583E0F50B750101C37500006D +:100E2000E501F5F0E50935F0F501E500F5F0E50A35 +:100E300035F0F500E500F502E501F582E502F58300 +:100E4000E0F50C750102C3750000E501F5F0E50958 +:100E500035F0F501E500F5F0E50A35F0F500E500BF +:100E6000F502E501F582E502F583E0F50D75010374 +:100E7000C3750000E501F5F0E50935F0F501E50081 +:100E8000F5F0E50A35F0F500E500F502E501F5823B +:100E9000E502F583E0F501750000E50BF5F0E500EE +:100EA00045F0F500E50CF5F0E50045F0F500E50D41 +:100EB000F5F0E50045F0F500E501F5F0E50045F059 +:100EC000F500E50070028003021AFF00900000E5C3 +:100ED00082F510900000E583F511750001750100A1 +:100EE000750C04750D00750E00750F00C3750900B3 +:100EF000E500F5F0E50CA4F50BE500F5F0E50CA434 +:100F0000E5F0F50AE50BF5F0E50935F0F509E50141 +:100F1000F5F0E50CA4F50BE501F5F0E50CA4E5F022 +:100F2000F501E50BF5F0E50A35F0F50AC3C37501E7 +:100F300000E509F5F0E50E35F0F50EE50AF5F0E50A +:100F40000F35F0F50FC3750A00E500F5F0E50DA4C7 +:100F5000F50BE500F5F0E50DA4E5F0F501E50BF581 +:100F6000F0E50A35F0F50A750900C3C3750000E520 +:100F700009F5F0E50E35F0F50EE50AF5F0E50F356B +:100F8000F0F50FC3750900750A00C3C3750000E5CD +:100F900009F5F0E50E35F0F50EE50AF5F0E50F354B +:100FA000F0F50FC3750900750A00C3C3750000E5AD +:100FB00009F5F0E50E35F0F50EE50AF5F0E50F352B +:100FC000F0F50FC3750000E50EF5F0E51035F0F50E +:100FD00000E50FF5F0E51135F0F501E500F509E55F +:100FE00001F50A750100C3750000E501F5F0E5099A +:100FF00035F0F501E500F5F0E50A35F0F500E5001E +:10100000F502E501F582E502F583E0F50B750101D6 +:10101000C3750000E501F5F0E50935F0F501E500DF +:10102000F5F0E50A35F0F500E500F502E501F58299 +:10103000E502F583E0F50C750102C3750000E501DA +:10104000F5F0E50935F0F501E500F5F0E50A35F0D4 +:10105000F500E500F502E501F582E502F583E0F52E +:101060000D750103C3750000E501F5F0E50935F0E4 +:10107000F501E500F5F0E50A35F0F500E500F502CB +:10108000E501F582E502F583E0F501750000E50B69 +:10109000F5F0E50045F0F500E50CF5F0E50045F06C +:1010A000F500E50DF5F0E50045F0F500E501F5F09A +:1010B000E50045F0F500E50070028003021AEF003C +:1010C000750100750900750A00750B00750000E5D3 +:1010D00001F5F0E50045F0F500E509F5F0E500451E +:1010E000F0F500E50AF5F0E50045F0F500E50BF553 +:1010F000F0E50045F0F500E50070028003021ADF1C +:1011000000900000E582F510900000E583F5117570 +:101110000002750100750C04750D00750E00750F49 +:1011200000C3750900E500F5F0E50CA4F50BE5003A +:10113000F5F0E50CA4E5F0F50AE50BF5F0E5093569 +:10114000F0F509E501F5F0E50CA4F50BE501F5F086 +:10115000E50CA4E5F0F501E50BF5F0E50A35F0F551 +:101160000AC3C3750100E509F5F0E50E35F0F50E8B +:10117000E50AF5F0E50F35F0F50FC3750A00E50057 +:10118000F5F0E50DA4F50BE500F5F0E50DA4E5F0AF +:10119000F501E50BF5F0E50A35F0F50A750900C330 +:1011A000C3750000E509F5F0E50E35F0F50EE50A2A +:1011B000F5F0E50F35F0F50FC3750900750A00C3AA +:1011C000C3750000E509F5F0E50E35F0F50EE50A0A +:1011D000F5F0E50F35F0F50FC3750900750A00C38A +:1011E000C3750000E509F5F0E50E35F0F50EE50AEA +:1011F000F5F0E50F35F0F50FC3750000E50EF5F0DD +:10120000E51035F0F500E50FF5F0E51135F0F501E5 +:10121000E500F509E501F50A750100C3750000E573 +:1012200001F5F0E50935F0F501E500F5F0E50A35E1 +:10123000F0F500E500F502E501F582E502F583E051 +:10124000F50B750101C3750000E501F5F0E5093501 +:10125000F0F501E500F5F0E50A35F0F500E500F5FB +:1012600002E501F582E502F583E0F50C750102C3A4 +:10127000750000E501F5F0E50935F0F501E500F54B +:10128000F0E50A35F0F500E500F502E501F582E547 +:1012900002F583E0F50D750103C3750000E501F566 +:1012A000F0E50935F0F501E500F5F0E50A35F0F572 +:1012B00000E500F502E501F582E502F583E0F501C0 +:1012C000750000E50BF5F0E50045F0F500E50CF5DF +:1012D000F0E50045F0F500E50DF5F0E50045F0F529 +:1012E00000E501F5F0E50045F0F500E5007002804D +:1012F00003021ACF00750100750900750A00750B0D +:1013000000750000E501F5F0E50045F0F500E509A0 +:10131000F5F0E50045F0F500E50AF5F0E50045F0EB +:10132000F500E50BF5F0E50045F0F500E50070028D +:101330008003021ABF00900000E582F510900000C3 +:10134000E583F511750003750100750C04750D003A +:10135000750E00750F00C3750900E500F5F0E50C8A +:10136000A4F50BE500F5F0E50CA4E5F0F50AE50BB6 +:10137000F5F0E50935F0F509E501F5F0E50CA4F522 +:101380000BE501F5F0E50CA4E5F0F501E50BF5F052 +:10139000E50A35F0F50AC3C3750100E509F5F0E586 +:1013A0000E35F0F50EE50AF5F0E50F35F0F50FC353 +:1013B000750A00E500F5F0E50DA4F50BE500F5F084 +:1013C000E50DA4E5F0F501E50BF5F0E50A35F0F5DE +:1013D0000A750900C3C3750000E509F5F0E50E358F +:1013E000F0F50EE50AF5F0E50F35F0F50FC37509D8 +:1013F00000750A00C3C3750000E509F5F0E50E3578 +:10140000F0F50EE50AF5F0E50F35F0F50FC37509B7 +:1014100000750A00C3C3750000E509F5F0E50E3557 +:10142000F0F50EE50AF5F0E50F35F0F50FC37500A0 +:1014300000E50EF5F0E51035F0F500E50FF5F0E507 +:101440001135F0F501E500F509E501F50A75010032 +:10145000C3750000E501F5F0E50935F0F501E5009B +:10146000F5F0E50A35F0F500E500F502E501F58255 +:10147000E502F583E0F50B750101C3750000E50198 +:10148000F5F0E50935F0F501E500F5F0E50A35F090 +:10149000F500E500F502E501F582E502F583E0F5EA +:1014A0000C750102C3750000E501F5F0E50935F0A2 +:1014B000F501E500F5F0E50A35F0F500E500F50287 +:1014C000E501F582E502F583E0F50D750103C375CD +:1014D0000000E501F5F0E50935F0F501E500F5F06E +:1014E000E50A35F0F500E500F502E501F582E502D3 +:1014F000F583E0F501750000E50BF5F0E50045F03A +:10150000F500E50CF5F0E50045F0F500E50DF5F02A +:10151000E50045F0F500E501F5F0E50045F0F500E2 +:10152000E50070028003021AAF0075010075090022 +:10153000750A00750B00750000E501F5F0E5004542 +:10154000F0F500E509F5F0E50045F0F500E50AF5F0 +:10155000F0E50045F0F500E50BF5F0E50045F0F5A8 +:1015600000E50070028003021A9F00900000E582EF +:10157000F510900000E583F5117500047501007504 +:101580000C04750D00750E00750F00C3750900E59C +:1015900000F5F0E50CA4F50BE500F5F0E50CA4E58D +:1015A000F0F50AE50BF5F0E50935F0F509E501F58B +:1015B000F0E50CA4F50BE501F5F0E50CA4E5F0F57C +:1015C00001E50BF5F0E50A35F0F50AC3C375010036 +:1015D000E509F5F0E50E35F0F50EE50AF5F0E50F55 +:1015E00035F0F50FC3750A00E500F5F0E50DA4F53B +:1015F0000BE500F5F0E50DA4E5F0F501E50BF5F0E0 +:10160000E50A35F0F50A750900C3C3750000E50960 +:10161000F5F0E50E35F0F50EE50AF5F0E50F35F0DD +:10162000F50FC3750900750A00C3C3750000E5090D +:10163000F5F0E50E35F0F50EE50AF5F0E50F35F0BD +:10164000F50FC3750900750A00C3C3750000E509ED +:10165000F5F0E50E35F0F50EE50AF5F0E50F35F09D +:10166000F50FC3750000E50EF5F0E51035F0F50057 +:10167000E50FF5F0E51135F0F501E500F509E501B7 +:10168000F50A750100C3750000E501F5F0E50935BF +:10169000F0F501E500F5F0E50A35F0F500E500F5B7 +:1016A00002E501F582E502F583E0F50B750101C362 +:1016B000750000E501F5F0E50935F0F501E500F507 +:1016C000F0E50A35F0F500E500F502E501F582E503 +:1016D00002F583E0F50C750102C3750000E501F524 +:1016E000F0E50935F0F501E500F5F0E50A35F0F52E +:1016F00000E500F502E501F582E502F583E0F50D70 +:10170000750103C3750000E501F5F0E50935F0F555 +:1017100001E500F5F0E50A35F0F500E500F502E534 +:1017200001F582E502F583E0F501750000E50BF5B2 +:10173000F0E50045F0F500E50CF5F0E50045F0F5C5 +:1017400000E50DF5F0E50045F0F500E501F5F0E503 +:101750000045F0F500E50070028003021A8F007565 +:101760000100750900750A00750B00750000E501A0 +:10177000F5F0E50045F0F500E509F5F0E50045F088 +:10178000F500E50AF5F0E50045F0F500E50BF5F0AC +:10179000E50045F0F500E50070028003021A8B00B9 +:1017A000900000E582F510900000E583F5117500CA +:1017B00005750100750C04750D00750E00750F00A0 +:1017C000C3750900E500F5F0E50CA4F50BE500F59F +:1017D000F0E50CA4E5F0F50AE50BF5F0E50935F0C8 +:1017E000F509E501F5F0E50CA4F50BE501F5F0E5EB +:1017F0000CA4E5F0F501E50BF5F0E50A35F0F50A86 +:10180000C3C3750100E509F5F0E50E35F0F50EE509 +:101810000AF5F0E50F35F0F50FC3750A00E500F5A0 +:10182000F0E50DA4F50BE500F5F0E50DA4E5F0F508 +:1018300001E50BF5F0E50A35F0F50A750900C3C3BB +:10184000750000E509F5F0E50E35F0F50EE50AF551 +:10185000F0E50F35F0F50FC3750900750A00C3C335 +:10186000750000E509F5F0E50E35F0F50EE50AF531 +:10187000F0E50F35F0F50FC3750900750A00C3C315 +:10188000750000E509F5F0E50E35F0F50EE50AF511 +:10189000F0E50F35F0F50FC3750000E50EF5F0E546 +:1018A0001035F0F500E50FF5F0E51135F0F501E53F +:1018B00000F509E501F50A750100C3750000E501B1 +:1018C000F5F0E50935F0F501E500F5F0E50A35F04C +:1018D000F500E500F502E501F582E502F583E0F5A6 +:1018E0000B750101C3750000E501F5F0E50935F060 +:1018F000F501E500F5F0E50A35F0F500E500F50243 +:10190000E501F582E502F583E0F50C750102C3758A +:101910000000E501F5F0E50935F0F501E500F5F029 +:10192000E50A35F0F500E500F502E501F582E5028E +:10193000F583E0F50D750103C3750000E501F5F0D1 +:10194000E50935F0F501E500F5F0E50A35F0F500BB +:10195000E500F502E501F582E502F583E0F50E7597 +:101960000006750100750900750A00750F00C3E5D2 +:1019700000F5F0E50B95F0F500E500F5F0E50F4515 +:10198000F0F50FC3E501F5F0E50C95F0F500E50085 +:10199000F5F0E50F45F0F50FC3E509F5F0E50D9518 +:1019A000F0F500E500F5F0E50F45F0F50FC3E50AA9 +:1019B000F5F0E50E95F0F500E500F5F0E50F45F0E2 +:1019C000F50F750100750900750A00750000E50F37 +:1019D000F5F0E50045F0F500E501F5F0E50045F02E +:1019E000F500E509F5F0E50045F0F500E50AF5F04C +:1019F000E50045F0F500E50070028003021A87005B +:101A0000750000750100750900750A00E500F50212 +:101A1000E501F503E509F504E50AF50575E003259B +:101A200006F58275E0003507F583E0F51175E002F3 +:101A30002506F58275E0003507F583E0F51075E0C1 +:101A4000002506F58275E0003507F583E0F508E529 +:101A500008C0E075E0012506F58275E0003507F560 +:101A600083E0F508E508C0E075E0042506F5067595 +:101A7000E0003507F507E502F582E503F583E504A7 +:101A8000F500E505F5012200021A00000217A0008A +:101A9000750101750900750A00750B0002176B00CE +:101AA000750101750900750A00750B0002176B00BE +:101AB000750101750900750A00750B0002153600E5 +:101AC000750101750900750A00750B0002153600D5 +:101AD000750101750900750A00750B0002130100FC +:101AE000750101750900750A00750B0002130100EC +:101AF000750101750900750A00750B000210CC0014 +:101B0000750101750900750A00750B000210CC0003 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unroll-1.s.expected b/tests/GCCTestSuite/unroll-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unroll-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-1.c b/tests/GCCTestSuite/unused-1.c new file mode 100644 index 0000000..8db7c2c --- /dev/null +++ b/tests/GCCTestSuite/unused-1.c @@ -0,0 +1,11 @@ +/* Missing `unused parameter' warning. + egcs-1.1.2 fails, egcs-ss-19990418 passes. + http://gcc.gnu.org/ml/gcc-bugs/1998-09/msg00199.html */ +/* { dg-do compile } */ +/* { dg-options "-O -Wall -W" } */ +int +f(c) + char c; /* { dg-warning "unused parameter" "unused parameter warning" } */ +{ + return 0; +} diff --git a/tests/GCCTestSuite/unused-1.c.expected b/tests/GCCTestSuite/unused-1.c.expected new file mode 100644 index 0000000..8db7c2c --- /dev/null +++ b/tests/GCCTestSuite/unused-1.c.expected @@ -0,0 +1,11 @@ +/* Missing `unused parameter' warning. + egcs-1.1.2 fails, egcs-ss-19990418 passes. + http://gcc.gnu.org/ml/gcc-bugs/1998-09/msg00199.html */ +/* { dg-do compile } */ +/* { dg-options "-O -Wall -W" } */ +int +f(c) + char c; /* { dg-warning "unused parameter" "unused parameter warning" } */ +{ + return 0; +} diff --git a/tests/GCCTestSuite/unused-1.hex.expected b/tests/GCCTestSuite/unused-1.hex.expected new file mode 100644 index 0000000..e3c792d --- /dev/null +++ b/tests/GCCTestSuite/unused-1.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758201C39582F506E50775830054 +:100010009583F507D0E0F500D0E0F501750900758E +:100020000A00750B00750C00E509F502E50AF503F9 +:10003000E50BF504E50CF505E501C0E0E500C0E0E1 +:1000400075E0012506F50675E0003507F507E502C0 +:10005000F582E503F583E504F500E505F5012200E9 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-1.s.expected b/tests/GCCTestSuite/unused-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-2.c b/tests/GCCTestSuite/unused-2.c new file mode 100644 index 0000000..454606e --- /dev/null +++ b/tests/GCCTestSuite/unused-2.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -finline-functions -Wunused -Wreturn-type" } */ + +static void +foo () +{ + skip_it: ; /* { dg-warning "defined but not used" "unused label warning" } */ +} + +void +bar () +{ + foo (); +} diff --git a/tests/GCCTestSuite/unused-2.c.expected b/tests/GCCTestSuite/unused-2.c.expected new file mode 100644 index 0000000..454606e --- /dev/null +++ b/tests/GCCTestSuite/unused-2.c.expected @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -finline-functions -Wunused -Wreturn-type" } */ + +static void +foo () +{ + skip_it: ; /* { dg-warning "defined but not used" "unused label warning" } */ +} + +void +bar () +{ + foo (); +} diff --git a/tests/GCCTestSuite/unused-2.hex.expected b/tests/GCCTestSuite/unused-2.hex.expected new file mode 100644 index 0000000..db50dab --- /dev/null +++ b/tests/GCCTestSuite/unused-2.hex.expected @@ -0,0 +1,15 @@ +:1000000000D0E0F500D0E0F50100750900E509F544 +:1000100002E509F503E509F504E509F505E501C083 +:10002000E0E500C0E0E502F582E503F583E504F5CF +:1000300000E505F5012200E506758202C39582F50B +:1000400006E5077583009583F507D0E0F50875E0B0 +:10005000012506F58275E0003507F583E508F0D047 +:10006000E0F50875E0002506F58275E0003507F536 +:1000700083E508F0120000750000E500F502E500D8 +:10008000F503E500F504E500F50575E0002506F546 +:100090008275E0003507F583E0F508E508C0E075F6 +:1000A000E0012506F58275E0003507F583E0F508E7 +:1000B000E508C0E075E0022506F50675E0003507A5 +:1000C000F507E502F582E503F583E504F500E505AE +:1000D000F501220000000000000000000000000008 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-2.s.expected b/tests/GCCTestSuite/unused-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-3.c b/tests/GCCTestSuite/unused-3.c new file mode 100644 index 0000000..1205624 --- /dev/null +++ b/tests/GCCTestSuite/unused-3.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation. */ +/* Added extra line-breaks to check that diagnostics refer to correct token. + --Per Bothner. */ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ + +typedef short unused_type __attribute__ ((unused)); +main () +{ + short + x /* { dg-warning "unused variable" "unused variable warning" } */ + ; + unused_type y; +} diff --git a/tests/GCCTestSuite/unused-3.c.expected b/tests/GCCTestSuite/unused-3.c.expected new file mode 100644 index 0000000..1205624 --- /dev/null +++ b/tests/GCCTestSuite/unused-3.c.expected @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation. */ +/* Added extra line-breaks to check that diagnostics refer to correct token. + --Per Bothner. */ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ + +typedef short unused_type __attribute__ ((unused)); +main () +{ + short + x /* { dg-warning "unused variable" "unused variable warning" } */ + ; + unused_type y; +} diff --git a/tests/GCCTestSuite/unused-3.hex.expected b/tests/GCCTestSuite/unused-3.hex.expected new file mode 100644 index 0000000..923c6d3 --- /dev/null +++ b/tests/GCCTestSuite/unused-3.hex.expected @@ -0,0 +1,6 @@ +:1000000075812F7506FF7507FF12000F02000C00A7 +:10001000D0E0F500D0E0F501E509F502E509F503CA +:10002000E509F504E509F505E501C0E0E500C0E0F6 +:10003000E502F582E503F583E504F500E505F50144 +:10004000220000000000000000000000000000008E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-3.s.expected b/tests/GCCTestSuite/unused-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-4.c b/tests/GCCTestSuite/unused-4.c new file mode 100644 index 0000000..99e845f --- /dev/null +++ b/tests/GCCTestSuite/unused-4.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused -O3" } */ + +static const int i = 0; +static void f() { } /* { dg-warning "defined but not used" } */ +static inline void g() { } diff --git a/tests/GCCTestSuite/unused-4.c.expected b/tests/GCCTestSuite/unused-4.c.expected new file mode 100644 index 0000000..99e845f --- /dev/null +++ b/tests/GCCTestSuite/unused-4.c.expected @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused -O3" } */ + +static const int i = 0; +static void f() { } /* { dg-warning "defined but not used" } */ +static inline void g() { } diff --git a/tests/GCCTestSuite/unused-4.hex.expected b/tests/GCCTestSuite/unused-4.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/unused-4.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-4.s.expected b/tests/GCCTestSuite/unused-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-5.c b/tests/GCCTestSuite/unused-5.c new file mode 100644 index 0000000..5ccc3f3 --- /dev/null +++ b/tests/GCCTestSuite/unused-5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ +/* { dg-final { scan-assembler "string_to_look_for" } } */ + +/* 'volatile' variables get output and don't produce a warning about being + unused. */ +static volatile char string[] + = "string_to_look_for"; /* { dg-bogus "not used" } */ diff --git a/tests/GCCTestSuite/unused-5.c.expected b/tests/GCCTestSuite/unused-5.c.expected new file mode 100644 index 0000000..5ccc3f3 --- /dev/null +++ b/tests/GCCTestSuite/unused-5.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ +/* { dg-final { scan-assembler "string_to_look_for" } } */ + +/* 'volatile' variables get output and don't produce a warning about being + unused. */ +static volatile char string[] + = "string_to_look_for"; /* { dg-bogus "not used" } */ diff --git a/tests/GCCTestSuite/unused-5.hex.expected b/tests/GCCTestSuite/unused-5.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/unused-5.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-5.s.expected b/tests/GCCTestSuite/unused-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-6.c b/tests/GCCTestSuite/unused-6.c new file mode 100644 index 0000000..7651ecb --- /dev/null +++ b/tests/GCCTestSuite/unused-6.c @@ -0,0 +1,11 @@ + +/* { dg-do compile } */ +/* { dg-options "-O3 -Wunused-parameter" } */ +static int t(int i) /* { dg-warning "unused parameter" "unused parameter warning" } */ +{ + return 0; +} +int tt() +{ + return t(0); +} diff --git a/tests/GCCTestSuite/unused-6.c.expected b/tests/GCCTestSuite/unused-6.c.expected new file mode 100644 index 0000000..7651ecb --- /dev/null +++ b/tests/GCCTestSuite/unused-6.c.expected @@ -0,0 +1,11 @@ + +/* { dg-do compile } */ +/* { dg-options "-O3 -Wunused-parameter" } */ +static int t(int i) /* { dg-warning "unused parameter" "unused parameter warning" } */ +{ + return 0; +} +int tt() +{ + return t(0); +} diff --git a/tests/GCCTestSuite/unused-6.hex.expected b/tests/GCCTestSuite/unused-6.hex.expected new file mode 100644 index 0000000..cfaf75c --- /dev/null +++ b/tests/GCCTestSuite/unused-6.hex.expected @@ -0,0 +1,20 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900758E +:100020000A00750B00750C00E509F502E50AF503F9 +:10003000E50BF504E50CF505E501C0E0E500C0E0E1 +:1000400075E0042506F50675E0003507F507E502BD +:10005000F582E503F583E504F500E505F5012200E9 +:10006000E506758202C39582F506E507758300955E +:1000700083F507D0E0F50875E0012506F58275E007 +:10008000003507F583E508F0D0E0F50875E00025B8 +:1000900006F58275E0003507F583E508F0751F0069 +:1000A000751E00751D00751C00120000E582F5022A +:1000B000E583F503E500F504E501F505E502F50046 +:1000C000E503F501E504F509E505F50AE500F502A6 +:1000D000E501F503E509F504E50AF50575E00025F8 +:1000E00006F58275E0003507F583E0F508E508C000 +:1000F000E075E0012506F58275E0003507F583E03F +:10010000F508E508C0E075E0022506F50675E00093 +:100110003507F507E502F582E503F583E504F5000B +:10012000E505F501220000000000000000000000CD +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-6.s.expected b/tests/GCCTestSuite/unused-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-7.c b/tests/GCCTestSuite/unused-7.c new file mode 100644 index 0000000..d2b9c3c --- /dev/null +++ b/tests/GCCTestSuite/unused-7.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ + +static int a = 10; /* { dg-warning "defined but not used" } */ + diff --git a/tests/GCCTestSuite/unused-7.c.expected b/tests/GCCTestSuite/unused-7.c.expected new file mode 100644 index 0000000..d2b9c3c --- /dev/null +++ b/tests/GCCTestSuite/unused-7.c.expected @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ + +static int a = 10; /* { dg-warning "defined but not used" } */ + diff --git a/tests/GCCTestSuite/unused-7.hex.expected b/tests/GCCTestSuite/unused-7.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/unused-7.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/unused-7.s.expected b/tests/GCCTestSuite/unused-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/unused-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/verbose-asm.c b/tests/GCCTestSuite/verbose-asm.c new file mode 100644 index 0000000..c54478f --- /dev/null +++ b/tests/GCCTestSuite/verbose-asm.c @@ -0,0 +1,28 @@ +/* Test whether -fverbose-asm works. */ +/* { dg-do compile } */ +/* { dg-options "-fverbose-asm" } */ + +void foo (int *x) +{ + (*x)++; +} + +int bar (int *y) +{ + int a, b; + b = 10; + a = 26; + foo (&a); + a += 10; + foo (&a); + *y--; + return b; +} + +int +main () +{ + int argc; + int r =bar (&argc); + return 0; +} diff --git a/tests/GCCTestSuite/verbose-asm.c.expected b/tests/GCCTestSuite/verbose-asm.c.expected new file mode 100644 index 0000000..c54478f --- /dev/null +++ b/tests/GCCTestSuite/verbose-asm.c.expected @@ -0,0 +1,28 @@ +/* Test whether -fverbose-asm works. */ +/* { dg-do compile } */ +/* { dg-options "-fverbose-asm" } */ + +void foo (int *x) +{ + (*x)++; +} + +int bar (int *y) +{ + int a, b; + b = 10; + a = 26; + foo (&a); + a += 10; + foo (&a); + *y--; + return b; +} + +int +main () +{ + int argc; + int r =bar (&argc); + return 0; +} diff --git a/tests/GCCTestSuite/verbose-asm.hex.expected b/tests/GCCTestSuite/verbose-asm.hex.expected new file mode 100644 index 0000000..9e69d89 --- /dev/null +++ b/tests/GCCTestSuite/verbose-asm.hex.expected @@ -0,0 +1,121 @@ +:1000000075812F7506FF7507FF1206AA02000C0006 +:10001000E506758202C39582F506E50775830095AE +:1000200083F507D0E0F518D0E0F519E514F50F7564 +:100030000100C3750000E501F5F0E51F35F0F5019D +:10004000E500F5F0E51E35F0F500E500F502E50107 +:10005000F582E502F583E0F50B750101C37500003B +:10006000E501F5F0E51F35F0F501E500F5F0E51ED9 +:1000700035F0F500E500F502E501F582E502F583CE +:10008000E0F50C750102C3750000E501F5F0E51F10 +:1000900035F0F501E500F5F0E51E35F0F500E50079 +:1000A000F502E501F582E502F583E0F50D75010342 +:1000B000C3750000E501F5F0E51F35F0F501E50039 +:1000C000F5F0E51E35F0F500E500F502E501F582F5 +:1000D000E502F583E0F50E75000175010075090074 +:1000E000750A00C3751400E500F5F0E50B35F0F571 +:1000F00000E501F5F0E50C35F0F501E509F5F0E571 +:100100000D35F0F509E50AF5F0E50E35F0F50C755D +:100110000B00C3750A00E50BF5F0E51F35F0F50B94 +:10012000E50AF5F0E51E35F0F50AE500F503E50A08 +:10013000F502E50BF582E502F583E503F0750B01A9 +:10014000C3750000E50BF5F0E51F35F0F50BE50094 +:10015000F5F0E51E35F0F50AE501F503E50AF502CF +:10016000E50BF582E502F583E503F0750B02C37537 +:100170000000E50BF5F0E51F35F0F50BE500F5F0B7 +:10018000E51E35F0F50AE509F503E50AF502E50B8C +:10019000F582E502F583E503F0750B03C3750000F6 +:1001A000E50BF5F0E51F35F0F50BE500F5F0E51E84 +:1001B00035F0F50AE50CF503E50AF502E50BF582E5 +:1001C000E502F583E503F0750000E500F502E500C2 +:1001D000F503E500F504E500F505E50FF514E5196F +:1001E000C0E0E518C0E075E0022506F50675E00000 +:1001F0003507F507E502F582E503F583E504F5002B +:10020000E505F5012200E50675820EC39582F50627 +:10021000E5077583009583F507D0E0F50875E005DF +:100220002506F58275E0003507F583E508F0D0E096 +:10023000F50875E0042506F58275E0003507F583BD +:10024000E508F075E00B2506F58275E0003507F549 +:1002500083E515F075E00A2506F58275E00035079F +:10026000F583E514F075E0092506F58275E00035A3 +:1002700007F583E513F075E0082506F58275E000C3 +:100280003507F583E512F075E0072506F58275E080 +:10029000003507F583E511F075E0062506F5827552 +:1002A000E0003507F583E510F075100A751100754B +:1002B0001200751300E506F50AE507F5017509005A +:1002C000C3750000E509F5F0E50A35F0F50DE50028 +:1002D000F5F0E50135F0F50E75091A750A00750B94 +:1002E00000750C00750100C3750000E501F5F0E52F +:1002F0000D35F0F501E500F5F0E50E35F0F500E51A +:1003000009F503E500F502E501F582E502F583E56F +:1003100003F0750101C3750000E501F5F0E50D3549 +:10032000F0F501E500F5F0E50E35F0F500E50AF52C +:1003300003E500F502E501F582E502F583E503F04A +:10034000750102C3750000E501F5F0E50D35F0F526 +:1003500001E500F5F0E50E35F0F500E50BF503E5F8 +:1003600000F502E501F582E502F583E503F075018C +:1003700003C3750000E501F5F0E50D35F0F501E585 +:1003800000F5F0E50E35F0F500E50CF503E500F5B8 +:1003900002E501F582E502F583E503F0E506F509DE +:1003A000E507F50A750100C3750000E501F5F0E504 +:1003B0000935F0F501E500F5F0E50A35F0F500E561 +:1003C00001F51FE500F51E12000FE506F50AE50729 +:1003D000F501750900C3750000E509F5F0E50A357A +:1003E000F0F50EE500F5F0E50135F0F50FE506F561 +:1003F00009E507F50A750100C3750000E501F5F090 +:10040000E50935F0F501E500F5F0E50A35F0F50010 +:10041000E501F509E500F50A750100C3750000E581 +:1004200001F5F0E50935F0F501E500F5F0E50A35EF +:10043000F0F500E500F502E501F582E502F583E05F +:10044000F50B750101C3750000E501F5F0E509350F +:10045000F0F501E500F5F0E50A35F0F500E500F509 +:1004600002E501F582E502F583E0F50C750102C3B2 +:10047000750000E501F5F0E50935F0F501E500F559 +:10048000F0E50A35F0F500E500F502E501F582E555 +:1004900002F583E0F50D750103C3750000E501F574 +:1004A000F0E50935F0F501E500F5F0E50A35F0F580 +:1004B00000E500F502E501F582E502F583E0F514BB +:1004C00075000A750100750900750A00C3751500ED +:1004D000E500F5F0E50B35F0F500E501F5F0E50C8C +:1004E00035F0F501E509F5F0E50D35F0F509E50A1A +:1004F000F5F0E51435F0F50C750B00C3750A00E551 +:100500000BF5F0E50E35F0F50BE50AF5F0E50F35E6 +:10051000F0F50AE500F503E50AF502E50BF582E5DD +:1005200002F583E503F0750B01C3750000E50BF5DB +:10053000F0E50E35F0F50BE500F5F0E50F35F0F5DB +:100540000AE501F503E50AF502E50BF582E502F59A +:1005500083E503F0750B02C3750000E50BF5F0E5CC +:100560000E35F0F50BE500F5F0E50F35F0F50AE591 +:1005700009F503E50AF502E50BF582E502F583E5E9 +:1005800003F0750B03C3750000E50BF5F0E50E35C0 +:10059000F0F50BE500F5F0E50F35F0F50AE50CF5A3 +:1005A00003E50AF502E50BF582E502F583E503F0C4 +:1005B000E506F509E507F50A750100C3750000E5D4 +:1005C00001F5F0E50935F0F501E500F5F0E50A354E +:1005D000F0F500E501F51FE500F51E12000FC3C39D +:1005E000C3C3C3C3C3C3C3C3C3C3C3E510F502E5D9 +:1005F00011F503E512F504E513F50575E00B250685 +:10060000F58275E0003507F583E0F51575E00A25FC +:1006100006F58275E0003507F583E0F51475E0090D +:100620002506F58275E0003507F583E0F51375E0E2 +:10063000082506F58275E0003507F583E0F51275AB +:10064000E0072506F58275E0003507F583E0F51132 +:1006500075E0062506F58275E0003507F583E0F5BF +:100660001075E0042506F58275E0003507F583E096 +:10067000F508E508C0E075E0052506F58275E0009F +:100680003507F583E0F508E508C0E075E00E2506BE +:10069000F50675E0003507F507E502F582E503F597 +:1006A00083E504F500E505F5012200E506758206FF +:1006B000C39582F506E5077583009583F507D0E0BD +:1006C000F50875E0052506F58275E0003507F58328 +:1006D000E508F0D0E0F50875E0042506F58275E040 +:1006E000003507F583E508F0E506F509E507F50AA5 +:1006F000750100C3750000E501F5F0E50935F0F579 +:1007000001E500F5F0E50A35F0F500E501F51FE536 +:1007100000F51E12020575000075010075090075CF +:100720000A00E500F502E501F503E509F504E50A2F +:10073000F50575E0042506F58275E0003507F583BB +:10074000E0F508E508C0E075E0052506F58275E0EE +:10075000003507F583E0F508E508C0E075E00625FB +:1007600006F50675E0003507F507E502F582E503B5 +:10077000F583E504F500E505F50122000000000021 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/verbose-asm.s.expected b/tests/GCCTestSuite/verbose-asm.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/verbose-asm.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-1.c b/tests/GCCTestSuite/visibility-1.c new file mode 100644 index 0000000..864b971 --- /dev/null +++ b/tests/GCCTestSuite/visibility-1.c @@ -0,0 +1,9 @@ +/* Test visibility attribute on function definition. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void +__attribute__((visibility ("hidden"))) +foo() +{ } diff --git a/tests/GCCTestSuite/visibility-1.c.expected b/tests/GCCTestSuite/visibility-1.c.expected new file mode 100644 index 0000000..864b971 --- /dev/null +++ b/tests/GCCTestSuite/visibility-1.c.expected @@ -0,0 +1,9 @@ +/* Test visibility attribute on function definition. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void +__attribute__((visibility ("hidden"))) +foo() +{ } diff --git a/tests/GCCTestSuite/visibility-1.hex.expected b/tests/GCCTestSuite/visibility-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/visibility-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-1.s.expected b/tests/GCCTestSuite/visibility-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-10.c b/tests/GCCTestSuite/visibility-10.c new file mode 100644 index 0000000..d86ce1b --- /dev/null +++ b/tests/GCCTestSuite/visibility-10.c @@ -0,0 +1,19 @@ +/* Test that a definition marked with dllexport has default + visibility. */ +/* { dg-require-visibility "" } */ +/* { dg-require-dll "" } */ +/* { dg-options "-fvisibility=hidden" } */ +/* { dg-final { scan-not-hidden "g" } } */ +/* { dg-final { scan-not-hidden "h" } } */ +/* { dg-final { scan-not-hidden "k" } } */ +/* { dg-final { scan-not-hidden "l" } } */ + +__declspec(dllexport) void g() {} + +__declspec(dllexport) void h(); +void h() {} + +__declspec(dllexport) int k; + +__declspec(dllexport) extern int l; +int l; diff --git a/tests/GCCTestSuite/visibility-10.c.expected b/tests/GCCTestSuite/visibility-10.c.expected new file mode 100644 index 0000000..d86ce1b --- /dev/null +++ b/tests/GCCTestSuite/visibility-10.c.expected @@ -0,0 +1,19 @@ +/* Test that a definition marked with dllexport has default + visibility. */ +/* { dg-require-visibility "" } */ +/* { dg-require-dll "" } */ +/* { dg-options "-fvisibility=hidden" } */ +/* { dg-final { scan-not-hidden "g" } } */ +/* { dg-final { scan-not-hidden "h" } } */ +/* { dg-final { scan-not-hidden "k" } } */ +/* { dg-final { scan-not-hidden "l" } } */ + +__declspec(dllexport) void g() {} + +__declspec(dllexport) void h(); +void h() {} + +__declspec(dllexport) int k; + +__declspec(dllexport) extern int l; +int l; diff --git a/tests/GCCTestSuite/visibility-10.hex.expected b/tests/GCCTestSuite/visibility-10.hex.expected new file mode 100644 index 0000000..64d1011 --- /dev/null +++ b/tests/GCCTestSuite/visibility-10.hex.expected @@ -0,0 +1,8 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F501220000000000002D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-10.s.expected b/tests/GCCTestSuite/visibility-10.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-10.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-2.c b/tests/GCCTestSuite/visibility-2.c new file mode 100644 index 0000000..0977aba --- /dev/null +++ b/tests/GCCTestSuite/visibility-2.c @@ -0,0 +1,10 @@ +/* Test that visibility attribute on declaration extends to definition. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void +__attribute__((visibility ("hidden"))) +foo(); + +void foo() { } diff --git a/tests/GCCTestSuite/visibility-2.c.expected b/tests/GCCTestSuite/visibility-2.c.expected new file mode 100644 index 0000000..0977aba --- /dev/null +++ b/tests/GCCTestSuite/visibility-2.c.expected @@ -0,0 +1,10 @@ +/* Test that visibility attribute on declaration extends to definition. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void +__attribute__((visibility ("hidden"))) +foo(); + +void foo() { } diff --git a/tests/GCCTestSuite/visibility-2.hex.expected b/tests/GCCTestSuite/visibility-2.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/visibility-2.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-2.s.expected b/tests/GCCTestSuite/visibility-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-3.c b/tests/GCCTestSuite/visibility-3.c new file mode 100644 index 0000000..cb5a715 --- /dev/null +++ b/tests/GCCTestSuite/visibility-3.c @@ -0,0 +1,8 @@ +/* Test visibility attribute on forward declaration of global variable */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +int +__attribute__((visibility ("hidden"))) +xyzzy = 5; diff --git a/tests/GCCTestSuite/visibility-3.c.expected b/tests/GCCTestSuite/visibility-3.c.expected new file mode 100644 index 0000000..cb5a715 --- /dev/null +++ b/tests/GCCTestSuite/visibility-3.c.expected @@ -0,0 +1,8 @@ +/* Test visibility attribute on forward declaration of global variable */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +int +__attribute__((visibility ("hidden"))) +xyzzy = 5; diff --git a/tests/GCCTestSuite/visibility-3.hex.expected b/tests/GCCTestSuite/visibility-3.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/visibility-3.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-3.s.expected b/tests/GCCTestSuite/visibility-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-4.c b/tests/GCCTestSuite/visibility-4.c new file mode 100644 index 0000000..af0d461 --- /dev/null +++ b/tests/GCCTestSuite/visibility-4.c @@ -0,0 +1,10 @@ +/* Test visibility attribute on forward declaration of global variable */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +extern int +__attribute__((visibility ("hidden"))) +xyzzy; + +int xyzzy = 5; diff --git a/tests/GCCTestSuite/visibility-4.c.expected b/tests/GCCTestSuite/visibility-4.c.expected new file mode 100644 index 0000000..af0d461 --- /dev/null +++ b/tests/GCCTestSuite/visibility-4.c.expected @@ -0,0 +1,10 @@ +/* Test visibility attribute on forward declaration of global variable */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +extern int +__attribute__((visibility ("hidden"))) +xyzzy; + +int xyzzy = 5; diff --git a/tests/GCCTestSuite/visibility-4.hex.expected b/tests/GCCTestSuite/visibility-4.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/visibility-4.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-4.s.expected b/tests/GCCTestSuite/visibility-4.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-4.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-5.c b/tests/GCCTestSuite/visibility-5.c new file mode 100644 index 0000000..0302768 --- /dev/null +++ b/tests/GCCTestSuite/visibility-5.c @@ -0,0 +1,12 @@ +/* Test visibility attribute on definition of a function that has + already had a forward declaration. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void foo(); + +void + __attribute__((visibility ("hidden"))) +foo() +{ } diff --git a/tests/GCCTestSuite/visibility-5.c.expected b/tests/GCCTestSuite/visibility-5.c.expected new file mode 100644 index 0000000..0302768 --- /dev/null +++ b/tests/GCCTestSuite/visibility-5.c.expected @@ -0,0 +1,12 @@ +/* Test visibility attribute on definition of a function that has + already had a forward declaration. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void foo(); + +void + __attribute__((visibility ("hidden"))) +foo() +{ } diff --git a/tests/GCCTestSuite/visibility-5.hex.expected b/tests/GCCTestSuite/visibility-5.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/visibility-5.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-5.s.expected b/tests/GCCTestSuite/visibility-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-6.c b/tests/GCCTestSuite/visibility-6.c new file mode 100644 index 0000000..4e9deeb --- /dev/null +++ b/tests/GCCTestSuite/visibility-6.c @@ -0,0 +1,11 @@ +/* Test visibility attribute on definition of global variable that has + already had a forward declaration. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +extern int xyzzy; + +int +__attribute__((visibility ("hidden"))) +xyzzy = 5; diff --git a/tests/GCCTestSuite/visibility-6.c.expected b/tests/GCCTestSuite/visibility-6.c.expected new file mode 100644 index 0000000..4e9deeb --- /dev/null +++ b/tests/GCCTestSuite/visibility-6.c.expected @@ -0,0 +1,11 @@ +/* Test visibility attribute on definition of global variable that has + already had a forward declaration. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +extern int xyzzy; + +int +__attribute__((visibility ("hidden"))) +xyzzy = 5; diff --git a/tests/GCCTestSuite/visibility-6.hex.expected b/tests/GCCTestSuite/visibility-6.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/visibility-6.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-6.s.expected b/tests/GCCTestSuite/visibility-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-7.c b/tests/GCCTestSuite/visibility-7.c new file mode 100644 index 0000000..aaa8165 --- /dev/null +++ b/tests/GCCTestSuite/visibility-7.c @@ -0,0 +1,12 @@ +/* Test warning from conflicting visibility specifications. */ +/* { dg-do compile } */ +/* { dg-require-visibility "protected" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +extern int +__attribute__((visibility ("hidden"))) +xyzzy; /* { dg-warning "previous declaration" "" } */ + +int +__attribute__((visibility ("protected"))) +xyzzy = 5; /* { dg-warning "different visibility" "" } */ diff --git a/tests/GCCTestSuite/visibility-7.c.expected b/tests/GCCTestSuite/visibility-7.c.expected new file mode 100644 index 0000000..aaa8165 --- /dev/null +++ b/tests/GCCTestSuite/visibility-7.c.expected @@ -0,0 +1,12 @@ +/* Test warning from conflicting visibility specifications. */ +/* { dg-do compile } */ +/* { dg-require-visibility "protected" } */ +/* { dg-final { scan-hidden "xyzzy" } } */ + +extern int +__attribute__((visibility ("hidden"))) +xyzzy; /* { dg-warning "previous declaration" "" } */ + +int +__attribute__((visibility ("protected"))) +xyzzy = 5; /* { dg-warning "different visibility" "" } */ diff --git a/tests/GCCTestSuite/visibility-7.hex.expected b/tests/GCCTestSuite/visibility-7.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/visibility-7.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-7.s.expected b/tests/GCCTestSuite/visibility-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-8.c b/tests/GCCTestSuite/visibility-8.c new file mode 100644 index 0000000..89f89c0 --- /dev/null +++ b/tests/GCCTestSuite/visibility-8.c @@ -0,0 +1,16 @@ +/* Test hidden visibility on built-in functions (for libc). PR 13856. */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "__GI_fputs_unlocked" } } */ + +int fputs_unlocked (const char *restrict, int *restrict) + __asm__ ("__GI_fputs_unlocked") + __attribute__ ((visibility ("hidden"))); + +int +fputs_unlocked (str, fp) + const char *str; + int *fp; +{ +} diff --git a/tests/GCCTestSuite/visibility-8.c.expected b/tests/GCCTestSuite/visibility-8.c.expected new file mode 100644 index 0000000..89f89c0 --- /dev/null +++ b/tests/GCCTestSuite/visibility-8.c.expected @@ -0,0 +1,16 @@ +/* Test hidden visibility on built-in functions (for libc). PR 13856. */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "__GI_fputs_unlocked" } } */ + +int fputs_unlocked (const char *restrict, int *restrict) + __asm__ ("__GI_fputs_unlocked") + __attribute__ ((visibility ("hidden"))); + +int +fputs_unlocked (str, fp) + const char *str; + int *fp; +{ +} diff --git a/tests/GCCTestSuite/visibility-8.hex.expected b/tests/GCCTestSuite/visibility-8.hex.expected new file mode 100644 index 0000000..c059f8b --- /dev/null +++ b/tests/GCCTestSuite/visibility-8.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501E509F5029C +:10002000E509F503E509F504E509F505E501C0E095 +:10003000E500C0E075E0042506F50675E00035072B +:10004000F507E502F582E503F583E504F500E5052E +:10005000F501220000000000000000000000000088 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-8.s.expected b/tests/GCCTestSuite/visibility-8.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-8.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-9.c b/tests/GCCTestSuite/visibility-9.c new file mode 100644 index 0000000..9d57516 --- /dev/null +++ b/tests/GCCTestSuite/visibility-9.c @@ -0,0 +1,9 @@ +/* Test that -fvisibility works. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-options "-fvisibility=hidden" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void foo(); + +void foo() { } diff --git a/tests/GCCTestSuite/visibility-9.c.expected b/tests/GCCTestSuite/visibility-9.c.expected new file mode 100644 index 0000000..9d57516 --- /dev/null +++ b/tests/GCCTestSuite/visibility-9.c.expected @@ -0,0 +1,9 @@ +/* Test that -fvisibility works. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-options "-fvisibility=hidden" } */ +/* { dg-final { scan-hidden "foo" } } */ + +void foo(); + +void foo() { } diff --git a/tests/GCCTestSuite/visibility-9.hex.expected b/tests/GCCTestSuite/visibility-9.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/visibility-9.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-9.s.expected b/tests/GCCTestSuite/visibility-9.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-9.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-a.c b/tests/GCCTestSuite/visibility-a.c new file mode 100644 index 0000000..23a51d7 --- /dev/null +++ b/tests/GCCTestSuite/visibility-a.c @@ -0,0 +1,10 @@ +/* Test that #pragma GCC visibility works. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +#pragma GCC visibility push(hidden) +void foo(); +#pragma GCC visibility pop + +void foo() { } diff --git a/tests/GCCTestSuite/visibility-a.c.expected b/tests/GCCTestSuite/visibility-a.c.expected new file mode 100644 index 0000000..23a51d7 --- /dev/null +++ b/tests/GCCTestSuite/visibility-a.c.expected @@ -0,0 +1,10 @@ +/* Test that #pragma GCC visibility works. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +#pragma GCC visibility push(hidden) +void foo(); +#pragma GCC visibility pop + +void foo() { } diff --git a/tests/GCCTestSuite/visibility-a.hex.expected b/tests/GCCTestSuite/visibility-a.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/visibility-a.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-a.s.expected b/tests/GCCTestSuite/visibility-a.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-a.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-b.c b/tests/GCCTestSuite/visibility-b.c new file mode 100644 index 0000000..b1f1575 --- /dev/null +++ b/tests/GCCTestSuite/visibility-b.c @@ -0,0 +1,13 @@ +/* { dg-do assemble { target *-*-darwin* } } */ + +#define __private_extern__ extern __attribute__((visibility ("hidden"))) + +__private_extern__ int n; + +int +mach_error_type(int sub) +{ + if (sub >= n) + return 1; + return 0; +} diff --git a/tests/GCCTestSuite/visibility-b.c.expected b/tests/GCCTestSuite/visibility-b.c.expected new file mode 100644 index 0000000..b1f1575 --- /dev/null +++ b/tests/GCCTestSuite/visibility-b.c.expected @@ -0,0 +1,13 @@ +/* { dg-do assemble { target *-*-darwin* } } */ + +#define __private_extern__ extern __attribute__((visibility ("hidden"))) + +__private_extern__ int n; + +int +mach_error_type(int sub) +{ + if (sub >= n) + return 1; + return 0; +} diff --git a/tests/GCCTestSuite/visibility-b.hex.expected b/tests/GCCTestSuite/visibility-b.hex.expected new file mode 100644 index 0000000..f730101 --- /dev/null +++ b/tests/GCCTestSuite/visibility-b.hex.expected @@ -0,0 +1,88 @@ +:1000000000E506758209C39582F506E5077583004C +:100010009583F507D0E0F50875E0012506F58275B2 +:10002000E0003507F583E508F0D0E0F50875E0005D +:100030002506F58275E0003507F583E508F0E5163D +:10004000F518E515F519E514F51AE513F51B75E036 +:10005000042506F58275E0003507F583E512F07595 +:10006000E0032506F58275E0003507F583E511F01C +:1000700075E0022506F58275E0003507F583E51089 +:10008000F0E51FF500E51EF501E51DF509900000FE +:10009000E582F50C900000E583F50D750B00C37546 +:1000A0000A00E50BF5F0E50C35F0F50BE50AF5F087 +:1000B000E50D35F0F50AE50AF502E50BF582E502F6 +:1000C000F583E0F514750B01C3750A00E50BF5F037 +:1000D000E50C35F0F50BE50AF5F0E50D35F0F50A20 +:1000E000E50AF502E50BF582E502F583E0F510750A +:1000F0000B02C3750A00E50BF5F0E50C35F0F50BC6 +:10010000E50AF5F0E50D35F0F50AE50AF502E50B2F +:10011000F582E502F583E0F511750B03C3750A005E +:10012000E50BF5F0E50C35F0F50BE50AF5F0E50D1E +:1001300035F0F50AE50AF502E50BF582E502F583EF +:10014000E0F512E500F516E501F515E509F513757D +:100150000080E500F5F0E51C25F0F51CE500F5F064 +:10016000E51225F0F512750C00750D00750E007581 +:100170000F00750B00750A01750001C3E512F5F05B +:10018000E51C95F0F509E50BF5F0E50B35F0F50903 +:10019000E509F5F0E50055F0F500E500F5F0E50CB2 +:1001A00045F0F50C750001C3E512F5F0E51C95F07E +:1001B000F509E50BF5F0E50B35F0F509E51CF5F073 +:1001C000E51295F0F501E50BF5F0E50B35F0F501DD +:1001D000E501F5F0E50945F0F509E50AF5F0E50971 +:1001E00065F0F509E509F5F0E50055F0F500C3E522 +:1001F00011F5F0E51395F0F509E50BF5F0E50B3594 +:10020000F0F509E509F5F0E50055F0F500E500F534 +:10021000F0E50C45F0F50C750001C3E512F5F0E5CD +:100220001C95F0F509E50BF5F0E50B35F0F509E562 +:100230001CF5F0E51295F0F501E50BF5F0E50B3551 +:10024000F0F501E501F5F0E50945F0F509E50AF5F8 +:10025000F0E50965F0F509E509F5F0E50055F0F57B +:1002600000C3E511F5F0E51395F0F509E50BF5F0A0 +:10027000E50B35F0F509E513F5F0E51195F0F5011D +:10028000E50BF5F0E50B35F0F501E501F5F0E509D5 +:1002900045F0F509E50AF5F0E50965F0F509E50928 +:1002A000F5F0E50055F0F500C3E510F5F0E515951E +:1002B000F0F509E50BF5F0E50B35F0F509E509F585 +:1002C000F0E50055F0F500E500F5F0E50C45F0F53A +:1002D0000C750001C3E512F5F0E51C95F0F509E594 +:1002E0000BF5F0E50B35F0F509E51CF5F0E5129599 +:1002F000F0F501E50BF5F0E50B35F0F501E501F55D +:10030000F0E50945F0F509E50AF5F0E50965F0F5D0 +:1003100009E509F5F0E50055F0F500C3E511F5F044 +:10032000E51395F0F509E50BF5F0E50B35F0F5096A +:10033000E513F5F0E51195F0F501E50BF5F0E50BAA +:1003400035F0F501E501F5F0E50945F0F509E50AB7 +:10035000F5F0E50965F0F509E509F5F0E50055F07A +:10036000F500C3E510F5F0E51595F0F509E50BF599 +:10037000F0E50B35F0F509E515F5F0E51095F0F52C +:1003800001E50BF5F0E50B35F0F501E501F5F0E5DC +:100390000945F0F509E50AF5F0E50965F0F509E527 +:1003A00009F5F0E50055F0F500C3E514F5F0E516A4 +:1003B00095F0F509E50BF5F0E50B35F0F509E509E4 +:1003C000F5F0E50055F0F500E500F5F0E50C45F039 +:1003D000F50CE50CF500E50EF501750C01C375098A +:1003E00000E500F5F0E50995F0F509750900E50966 +:1003F000F5F0E50935F0F509E509F5F0E50C65F0EE +:10040000F50CC3750900E50DF5F0E50995F0F50962 +:10041000750900E509F5F0E50935F0F509E509F597 +:10042000F0E50C65F0F50CC3750900E501F5F0E5A4 +:100430000995F0F509750900E509F5F0E50935F0CC +:10044000F509E509F5F0E50C65F0F50CC375090053 +:10045000E50FF5F0E50995F0F509750900E509F5F1 +:10046000F0E50935F0F509E509F5F0E50C65F0F57D +:100470000C750D00750E00750F00750000E50CF58C +:10048000F0E50045F0F500E50DF5F0E50045F0F587 +:1004900000E50EF5F0E50045F0F500E50FF5F0E5B7 +:1004A0000045F0F500E50070028003020557007575 +:1004B0000000750100750900750A00E500F502E508 +:1004C00001F503E509F504E50AF505E518F516E576 +:1004D00019F515E51AF514E51BF51375E004250665 +:1004E000F58275E0003507F583E0F51275E0032528 +:1004F00006F58275E0003507F583E0F51175E00239 +:100500002506F58275E0003507F583E0F51075E006 +:10051000002506F58275E0003507F583E0F508E56E +:1005200008C0E075E0012506F58275E0003507F5A5 +:1005300083E0F508E508C0E075E0092506F50675D5 +:10054000E0003507F507E502F582E503F583E504EC +:10055000F500E505F501220075000175010075093A +:1005600000750A000204BB0000000000000000004B +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-b.s.expected b/tests/GCCTestSuite/visibility-b.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-b.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-c.c b/tests/GCCTestSuite/visibility-c.c new file mode 100644 index 0000000..22412e0 --- /dev/null +++ b/tests/GCCTestSuite/visibility-c.c @@ -0,0 +1,10 @@ +/* Test that visibility works on common symbols also. */ +/* { dg-do assemble } */ +/* { dg-require-visibility "" } */ + +int options __attribute__((__visibility__("hidden"))); + +void f(void) +{ + options = 0; +} diff --git a/tests/GCCTestSuite/visibility-c.c.expected b/tests/GCCTestSuite/visibility-c.c.expected new file mode 100644 index 0000000..22412e0 --- /dev/null +++ b/tests/GCCTestSuite/visibility-c.c.expected @@ -0,0 +1,10 @@ +/* Test that visibility works on common symbols also. */ +/* { dg-do assemble } */ +/* { dg-require-visibility "" } */ + +int options __attribute__((__visibility__("hidden"))); + +void f(void) +{ + options = 0; +} diff --git a/tests/GCCTestSuite/visibility-c.hex.expected b/tests/GCCTestSuite/visibility-c.hex.expected new file mode 100644 index 0000000..24eb86c --- /dev/null +++ b/tests/GCCTestSuite/visibility-c.hex.expected @@ -0,0 +1,18 @@ +:1000000000D0E0F518D0E0F519E512F50F900000EA +:10001000E582F50D900000E583F50E750900750A7F +:1000200000750B00750C00750100C3750000E5013B +:10003000F5F0E50D35F0F501E500F5F0E50E35F0EC +:10004000F500E509F503E500F502E501F582E502B5 +:10005000F583E503F0750101C3750000E501F5F0D6 +:10006000E50D35F0F501E500F5F0E50E35F0F500AC +:10007000E50AF503E500F502E501F582E502F58301 +:10008000E503F0750102C3750000E501F5F0E50D2B +:1000900035F0F501E500F5F0E50E35F0F500E50B7E +:1000A000F503E500F502E501F582E502F583E503D8 +:1000B000F0750103C3750000E501F5F0E50D35F0BD +:1000C000F501E500F5F0E50E35F0F500E50CF5037A +:1000D000E500F502E501F582E502F583E503F0753B +:1000E0000000E500F502E500F503E500F504E50094 +:1000F000F505E50FF512E519C0E0E518C0E0E502E9 +:10010000F582E503F583E504F500E505F501220038 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-c.s.expected b/tests/GCCTestSuite/visibility-c.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-c.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-d.c b/tests/GCCTestSuite/visibility-d.c new file mode 100644 index 0000000..6f8851b --- /dev/null +++ b/tests/GCCTestSuite/visibility-d.c @@ -0,0 +1,205 @@ +/* PR middle-end/20303 */ +/* Test nesting of #pragma GCC visibility. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-not-hidden "foo00" } } */ +/* { dg-final { scan-hidden "foo01" } } */ +/* { dg-final { scan-not-hidden "foo02" } } */ +/* { dg-final { scan-hidden "foo03" } } */ +/* { dg-final { scan-not-hidden "foo04" } } */ +/* { dg-final { scan-not-hidden "foo05" } } */ +/* { dg-final { scan-not-hidden "foo06" } } */ +/* { dg-final { scan-hidden "foo07" } } */ +/* { dg-final { scan-not-hidden "foo08" } } */ +/* { dg-final { scan-hidden "foo09" } } */ +/* { dg-final { scan-not-hidden "foo10" } } */ +/* { dg-final { scan-hidden "foo11" } } */ +/* { dg-final { scan-hidden "foo12" } } */ +/* { dg-final { scan-hidden "foo13" } } */ +/* { dg-final { scan-not-hidden "foo14" } } */ +/* { dg-final { scan-hidden "foo15" } } */ +/* { dg-final { scan-not-hidden "foo16" } } */ +/* { dg-final { scan-hidden "foo17" } } */ +/* { dg-final { scan-not-hidden "foo18" } } */ +/* { dg-final { scan-hidden "foo19" } } */ +/* { dg-final { scan-not-hidden "foo20" } } */ +/* { dg-final { scan-hidden "foo21" } } */ +/* { dg-final { scan-not-hidden "foo22" } } */ +/* { dg-final { scan-hidden "foo23" } } */ +/* { dg-final { scan-not-hidden "foo24" } } */ +/* { dg-final { scan-hidden "foo25" } } */ +/* { dg-final { scan-not-hidden "foo26" } } */ +/* { dg-final { scan-hidden "foo27" } } */ +/* { dg-final { scan-not-hidden "foo28" } } */ +/* { dg-final { scan-hidden "foo29" } } */ +/* { dg-final { scan-not-hidden "foo30" } } */ +/* { dg-final { scan-hidden "foo31" } } */ +/* { dg-final { scan-not-hidden "foo32" } } */ +/* { dg-final { scan-hidden "foo33" } } */ +/* { dg-final { scan-not-hidden "foo34" } } */ +/* { dg-final { scan-hidden "foo35" } } */ +/* { dg-final { scan-not-hidden "foo36" } } */ +/* { dg-final { scan-hidden "foo37" } } */ +/* { dg-final { scan-not-hidden "foo38" } } */ +/* { dg-final { scan-hidden "foo39" } } */ +/* { dg-final { scan-not-hidden "foo40" } } */ +/* { dg-final { scan-hidden "foo41" } } */ +/* { dg-final { scan-not-hidden "foo42" } } */ +/* { dg-final { scan-hidden "foo43" } } */ +/* { dg-final { scan-not-hidden "foo44" } } */ +/* { dg-final { scan-hidden "foo45" } } */ +/* { dg-final { scan-hidden "foo46" } } */ +/* { dg-final { scan-hidden "foo47" } } */ +/* { dg-final { scan-not-hidden "foo48" } } */ +/* { dg-final { scan-hidden "foo49" } } */ +/* { dg-final { scan-not-hidden "foo50" } } */ +/* { dg-final { scan-hidden "foo51" } } */ +/* { dg-final { scan-not-hidden "foo52" } } */ +/* { dg-final { scan-not-hidden "foo53" } } */ +/* { dg-final { scan-not-hidden "foo54" } } */ +/* { dg-final { scan-hidden "foo55" } } */ +/* { dg-final { scan-not-hidden "foo56" } } */ +/* { dg-final { scan-hidden "foo57" } } */ +/* { dg-final { scan-not-hidden "foo58" } } */ +/* { dg-final { scan-hidden "foo59" } } */ + +#pragma GCC visibility push(default) +void foo00(); +#pragma GCC visibility push(hidden) +void foo01(); +#pragma GCC visibility push(default) +void foo02(); +#pragma GCC visibility push(hidden) +void foo03(); +#pragma GCC visibility push(default) +void foo04(); +#pragma GCC visibility push(default) +void foo05(); +#pragma GCC visibility push(default) +void foo06(); +#pragma GCC visibility push(hidden) +void foo07(); +#pragma GCC visibility push(default) +void foo08(); +#pragma GCC visibility push(hidden) +void foo09(); +#pragma GCC visibility push(default) +void foo10(); +#pragma GCC visibility push(hidden) +void foo11(); +#pragma GCC visibility push(hidden) +void foo12(); +#pragma GCC visibility push(hidden) +void foo13(); +#pragma GCC visibility push(default) +void foo14(); +#pragma GCC visibility push(hidden) +void foo15(); +#pragma GCC visibility push(default) +void foo16(); +#pragma GCC visibility push(hidden) +void foo17(); +#pragma GCC visibility push(default) +void foo18(); +#pragma GCC visibility push(hidden) +void foo19(); +#pragma GCC visibility push(default) +void foo20(); +#pragma GCC visibility push(hidden) +void foo21(); +#pragma GCC visibility push(default) +void foo22(); +#pragma GCC visibility push(hidden) +void foo23(); +#pragma GCC visibility push(default) +void foo24(); +#pragma GCC visibility push(hidden) +void foo25(); +#pragma GCC visibility push(default) +void foo26(); +#pragma GCC visibility push(hidden) +void foo27(); +#pragma GCC visibility push(default) +void foo28(); +#pragma GCC visibility push(hidden) +void foo29(); +#pragma GCC visibility pop +void foo30(); +#pragma GCC visibility pop +void foo31(); +#pragma GCC visibility pop +void foo32(); +#pragma GCC visibility pop +void foo33(); +#pragma GCC visibility pop +void foo34(); +#pragma GCC visibility pop +void foo35(); +#pragma GCC visibility pop +void foo36(); +#pragma GCC visibility pop +void foo37(); +#pragma GCC visibility pop +void foo38(); +#pragma GCC visibility pop +void foo39(); +#pragma GCC visibility pop +void foo40(); +#pragma GCC visibility pop +void foo41(); +#pragma GCC visibility pop +void foo42(); +#pragma GCC visibility pop +void foo43(); +#pragma GCC visibility pop +void foo44(); +#pragma GCC visibility pop +void foo45(); +#pragma GCC visibility pop +void foo46(); +#pragma GCC visibility pop +void foo47(); +#pragma GCC visibility pop +void foo48(); +#pragma GCC visibility pop +void foo49(); +#pragma GCC visibility pop +void foo50(); +#pragma GCC visibility pop +void foo51(); +#pragma GCC visibility pop +void foo52(); +#pragma GCC visibility pop +void foo53(); +#pragma GCC visibility pop +void foo54(); +#pragma GCC visibility pop +void foo55(); +#pragma GCC visibility pop +void foo56(); +#pragma GCC visibility pop +void foo57(); +#pragma GCC visibility pop +void foo58(); +#pragma GCC visibility push (hidden) +void foo59(); +#pragma GCC visibility pop +#pragma GCC visibility pop + +#define D(N) \ +void foo##N##0() { } \ +void foo##N##1() { } \ +void foo##N##2() { } \ +void foo##N##3() { } \ +void foo##N##4() { } \ +void foo##N##5() { } \ +void foo##N##6() { } \ +void foo##N##7() { } \ +void foo##N##8() { } \ +void foo##N##9() { } +D(0) +D(1) +D(2) +D(3) +D(4) +D(5) diff --git a/tests/GCCTestSuite/visibility-d.c.expected b/tests/GCCTestSuite/visibility-d.c.expected new file mode 100644 index 0000000..6f8851b --- /dev/null +++ b/tests/GCCTestSuite/visibility-d.c.expected @@ -0,0 +1,205 @@ +/* PR middle-end/20303 */ +/* Test nesting of #pragma GCC visibility. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-not-hidden "foo00" } } */ +/* { dg-final { scan-hidden "foo01" } } */ +/* { dg-final { scan-not-hidden "foo02" } } */ +/* { dg-final { scan-hidden "foo03" } } */ +/* { dg-final { scan-not-hidden "foo04" } } */ +/* { dg-final { scan-not-hidden "foo05" } } */ +/* { dg-final { scan-not-hidden "foo06" } } */ +/* { dg-final { scan-hidden "foo07" } } */ +/* { dg-final { scan-not-hidden "foo08" } } */ +/* { dg-final { scan-hidden "foo09" } } */ +/* { dg-final { scan-not-hidden "foo10" } } */ +/* { dg-final { scan-hidden "foo11" } } */ +/* { dg-final { scan-hidden "foo12" } } */ +/* { dg-final { scan-hidden "foo13" } } */ +/* { dg-final { scan-not-hidden "foo14" } } */ +/* { dg-final { scan-hidden "foo15" } } */ +/* { dg-final { scan-not-hidden "foo16" } } */ +/* { dg-final { scan-hidden "foo17" } } */ +/* { dg-final { scan-not-hidden "foo18" } } */ +/* { dg-final { scan-hidden "foo19" } } */ +/* { dg-final { scan-not-hidden "foo20" } } */ +/* { dg-final { scan-hidden "foo21" } } */ +/* { dg-final { scan-not-hidden "foo22" } } */ +/* { dg-final { scan-hidden "foo23" } } */ +/* { dg-final { scan-not-hidden "foo24" } } */ +/* { dg-final { scan-hidden "foo25" } } */ +/* { dg-final { scan-not-hidden "foo26" } } */ +/* { dg-final { scan-hidden "foo27" } } */ +/* { dg-final { scan-not-hidden "foo28" } } */ +/* { dg-final { scan-hidden "foo29" } } */ +/* { dg-final { scan-not-hidden "foo30" } } */ +/* { dg-final { scan-hidden "foo31" } } */ +/* { dg-final { scan-not-hidden "foo32" } } */ +/* { dg-final { scan-hidden "foo33" } } */ +/* { dg-final { scan-not-hidden "foo34" } } */ +/* { dg-final { scan-hidden "foo35" } } */ +/* { dg-final { scan-not-hidden "foo36" } } */ +/* { dg-final { scan-hidden "foo37" } } */ +/* { dg-final { scan-not-hidden "foo38" } } */ +/* { dg-final { scan-hidden "foo39" } } */ +/* { dg-final { scan-not-hidden "foo40" } } */ +/* { dg-final { scan-hidden "foo41" } } */ +/* { dg-final { scan-not-hidden "foo42" } } */ +/* { dg-final { scan-hidden "foo43" } } */ +/* { dg-final { scan-not-hidden "foo44" } } */ +/* { dg-final { scan-hidden "foo45" } } */ +/* { dg-final { scan-hidden "foo46" } } */ +/* { dg-final { scan-hidden "foo47" } } */ +/* { dg-final { scan-not-hidden "foo48" } } */ +/* { dg-final { scan-hidden "foo49" } } */ +/* { dg-final { scan-not-hidden "foo50" } } */ +/* { dg-final { scan-hidden "foo51" } } */ +/* { dg-final { scan-not-hidden "foo52" } } */ +/* { dg-final { scan-not-hidden "foo53" } } */ +/* { dg-final { scan-not-hidden "foo54" } } */ +/* { dg-final { scan-hidden "foo55" } } */ +/* { dg-final { scan-not-hidden "foo56" } } */ +/* { dg-final { scan-hidden "foo57" } } */ +/* { dg-final { scan-not-hidden "foo58" } } */ +/* { dg-final { scan-hidden "foo59" } } */ + +#pragma GCC visibility push(default) +void foo00(); +#pragma GCC visibility push(hidden) +void foo01(); +#pragma GCC visibility push(default) +void foo02(); +#pragma GCC visibility push(hidden) +void foo03(); +#pragma GCC visibility push(default) +void foo04(); +#pragma GCC visibility push(default) +void foo05(); +#pragma GCC visibility push(default) +void foo06(); +#pragma GCC visibility push(hidden) +void foo07(); +#pragma GCC visibility push(default) +void foo08(); +#pragma GCC visibility push(hidden) +void foo09(); +#pragma GCC visibility push(default) +void foo10(); +#pragma GCC visibility push(hidden) +void foo11(); +#pragma GCC visibility push(hidden) +void foo12(); +#pragma GCC visibility push(hidden) +void foo13(); +#pragma GCC visibility push(default) +void foo14(); +#pragma GCC visibility push(hidden) +void foo15(); +#pragma GCC visibility push(default) +void foo16(); +#pragma GCC visibility push(hidden) +void foo17(); +#pragma GCC visibility push(default) +void foo18(); +#pragma GCC visibility push(hidden) +void foo19(); +#pragma GCC visibility push(default) +void foo20(); +#pragma GCC visibility push(hidden) +void foo21(); +#pragma GCC visibility push(default) +void foo22(); +#pragma GCC visibility push(hidden) +void foo23(); +#pragma GCC visibility push(default) +void foo24(); +#pragma GCC visibility push(hidden) +void foo25(); +#pragma GCC visibility push(default) +void foo26(); +#pragma GCC visibility push(hidden) +void foo27(); +#pragma GCC visibility push(default) +void foo28(); +#pragma GCC visibility push(hidden) +void foo29(); +#pragma GCC visibility pop +void foo30(); +#pragma GCC visibility pop +void foo31(); +#pragma GCC visibility pop +void foo32(); +#pragma GCC visibility pop +void foo33(); +#pragma GCC visibility pop +void foo34(); +#pragma GCC visibility pop +void foo35(); +#pragma GCC visibility pop +void foo36(); +#pragma GCC visibility pop +void foo37(); +#pragma GCC visibility pop +void foo38(); +#pragma GCC visibility pop +void foo39(); +#pragma GCC visibility pop +void foo40(); +#pragma GCC visibility pop +void foo41(); +#pragma GCC visibility pop +void foo42(); +#pragma GCC visibility pop +void foo43(); +#pragma GCC visibility pop +void foo44(); +#pragma GCC visibility pop +void foo45(); +#pragma GCC visibility pop +void foo46(); +#pragma GCC visibility pop +void foo47(); +#pragma GCC visibility pop +void foo48(); +#pragma GCC visibility pop +void foo49(); +#pragma GCC visibility pop +void foo50(); +#pragma GCC visibility pop +void foo51(); +#pragma GCC visibility pop +void foo52(); +#pragma GCC visibility pop +void foo53(); +#pragma GCC visibility pop +void foo54(); +#pragma GCC visibility pop +void foo55(); +#pragma GCC visibility pop +void foo56(); +#pragma GCC visibility pop +void foo57(); +#pragma GCC visibility pop +void foo58(); +#pragma GCC visibility push (hidden) +void foo59(); +#pragma GCC visibility pop +#pragma GCC visibility pop + +#define D(N) \ +void foo##N##0() { } \ +void foo##N##1() { } \ +void foo##N##2() { } \ +void foo##N##3() { } \ +void foo##N##4() { } \ +void foo##N##5() { } \ +void foo##N##6() { } \ +void foo##N##7() { } \ +void foo##N##8() { } \ +void foo##N##9() { } +D(0) +D(1) +D(2) +D(3) +D(4) +D(5) diff --git a/tests/GCCTestSuite/visibility-d.hex.expected b/tests/GCCTestSuite/visibility-d.hex.expected new file mode 100644 index 0000000..08b68e1 --- /dev/null +++ b/tests/GCCTestSuite/visibility-d.hex.expected @@ -0,0 +1,200 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F5012200D0E0F500D0B8 +:10007000E0F501750900E509F502E509F503E50973 +:10008000F504E509F505E501C0E0E500C0E0E5029D +:10009000F582E503F583E504F500E505F5012200A9 +:1000A000D0E0F500D0E0F501750900E509F502E5BD +:1000B00009F503E509F504E509F505E501C0E0E505 +:1000C00000C0E0E502F582E503F583E504F500E50F +:1000D00005F5012200D0E0F500D0E0F5017509003A +:1000E000E509F502E509F503E509F504E509F50576 +:1000F000E501C0E0E500C0E0E502F582E503F58337 +:10010000E504F500E505F5012200D0E0F500D0E0BA +:10011000F501750900E509F502E509F503E509F5BD +:1001200004E509F505E501C0E0E500C0E0E502F5FC +:1001300082E503F583E504F500E505F5012200D02D +:10014000E0F500D0E0F501750900E509F502E509E3 +:10015000F503E509F504E509F505E501C0E0E5006D +:10016000C0E0E502F582E503F583E504F500E50569 +:10017000F5012200D0E0F500D0E0F501750900E5B9 +:1001800009F502E509F503E509F504E509F505E5D5 +:1001900001C0E0E500C0E0E502F582E503F583E596 +:1001A00004F500E505F5012200D0E0F500D0E0F50A +:1001B00001750900E509F502E509F503E509F5040E +:1001C000E509F505E501C0E0E500C0E0E502F582DE +:1001D000E503F583E504F500E505F5012200D0E02F +:1001E000F500D0E0F501750900E509F502E509F52E +:1001F00003E509F504E509F505E501C0E0E500C002 +:10020000E0E502F582E503F583E504F500E505F593 +:10021000012200D0E0F500D0E0F501750900E50904 +:10022000F502E509F503E509F504E509F505E5013C +:10023000C0E0E500C0E0E502F582E503F583E504F2 +:10024000F500E505F5012200D0E0F500D0E0F5016C +:10025000750900E509F502E509F503E509F504E589 +:1002600009F505E501C0E0E500C0E0E502F582E53D +:1002700003F583E504F500E505F5012200D0E0F57E +:1002800000D0E0F501750900E509F502E509F5037F +:10029000E509F504E509F505E501C0E0E500C0E084 +:1002A000E502F582E503F583E504F500E505F501D2 +:1002B0002200D0E0F500D0E0F501750900E509F570 +:1002C00002E509F503E509F504E509F505E501C0D1 +:1002D000E0E500C0E0E502F582E503F583E504F51D +:1002E00000E505F5012200D0E0F500D0E0F501754C +:1002F0000900E509F502E509F503E509F504E50955 +:10030000F505E501C0E0E500C0E0E502F582E503A2 +:10031000F583E504F500E505F5012200D0E0F500E0 +:10032000D0E0F501750900E509F502E509F503E5F9 +:1003300009F504E509F505E501C0E0E500C0E0E5E3 +:1003400002F582E503F583E504F500E505F50122F4 +:1003500000D0E0F500D0E0F501750900E509F502EF +:10036000E509F503E509F504E509F505E501C0E052 +:10037000E500C0E0E502F582E503F583E504F5005C +:10038000E505F5012200D0E0F500D0E0F5017509A2 +:1003900000E509F502E509F503E509F504E509F5C8 +:1003A00005E501C0E0E500C0E0E502F582E503F502 +:1003B00083E504F500E505F5012200D0E0F500D065 +:1003C000E0F501750900E509F502E509F503E50920 +:1003D000F504E509F505E501C0E0E500C0E0E5024A +:1003E000F582E503F583E504F500E505F501220056 +:1003F000D0E0F500D0E0F501750900E509F502E56A +:1004000009F503E509F504E509F505E501C0E0E5B1 +:1004100000C0E0E502F582E503F583E504F500E5BB +:1004200005F5012200D0E0F500D0E0F501750900E6 +:10043000E509F502E509F503E509F504E509F50522 +:10044000E501C0E0E500C0E0E502F582E503F583E3 +:10045000E504F500E505F5012200D0E0F500D0E067 +:10046000F501750900E509F502E509F503E509F56A +:1004700004E509F505E501C0E0E500C0E0E502F5A9 +:1004800082E503F583E504F500E505F5012200D0DA +:10049000E0F500D0E0F501750900E509F502E50990 +:1004A000F503E509F504E509F505E501C0E0E5001A +:1004B000C0E0E502F582E503F583E504F500E50516 +:1004C000F5012200D0E0F500D0E0F501750900E566 +:1004D00009F502E509F503E509F504E509F505E582 +:1004E00001C0E0E500C0E0E502F582E503F583E543 +:1004F00004F500E505F5012200D0E0F500D0E0F5B7 +:1005000001750900E509F502E509F503E509F504BA +:10051000E509F505E501C0E0E500C0E0E502F5828A +:10052000E503F583E504F500E505F5012200D0E0DB +:10053000F500D0E0F501750900E509F502E509F5DA +:1005400003E509F504E509F505E501C0E0E500C0AE +:10055000E0E502F582E503F583E504F500E505F540 +:10056000012200D0E0F500D0E0F501750900E509B1 +:10057000F502E509F503E509F504E509F505E501E9 +:10058000C0E0E500C0E0E502F582E503F583E5049F +:10059000F500E505F5012200D0E0F500D0E0F50119 +:1005A000750900E509F502E509F503E509F504E536 +:1005B00009F505E501C0E0E500C0E0E502F582E5EA +:1005C00003F583E504F500E505F5012200D0E0F52B +:1005D00000D0E0F501750900E509F502E509F5032C +:1005E000E509F504E509F505E501C0E0E500C0E031 +:1005F000E502F582E503F583E504F500E505F5017F +:100600002200D0E0F500D0E0F501750900E509F51C +:1006100002E509F503E509F504E509F505E501C07D +:10062000E0E500C0E0E502F582E503F583E504F5C9 +:1006300000E505F5012200D0E0F500D0E0F50175F8 +:100640000900E509F502E509F503E509F504E50901 +:10065000F505E501C0E0E500C0E0E502F582E5034F +:10066000F583E504F500E505F5012200D0E0F5008D +:10067000D0E0F501750900E509F502E509F503E5A6 +:1006800009F504E509F505E501C0E0E500C0E0E590 +:1006900002F582E503F583E504F500E505F50122A1 +:1006A00000D0E0F500D0E0F501750900E509F5029C +:1006B000E509F503E509F504E509F505E501C0E0FF +:1006C000E500C0E0E502F582E503F583E504F50009 +:1006D000E505F5012200D0E0F500D0E0F50175094F +:1006E00000E509F502E509F503E509F504E509F575 +:1006F00005E501C0E0E500C0E0E502F582E503F5AF +:1007000083E504F500E505F5012200D0E0F500D011 +:10071000E0F501750900E509F502E509F503E509CC +:10072000F504E509F505E501C0E0E500C0E0E502F6 +:10073000F582E503F583E504F500E505F501220002 +:10074000D0E0F500D0E0F501750900E509F502E516 +:1007500009F503E509F504E509F505E501C0E0E55E +:1007600000C0E0E502F582E503F583E504F500E568 +:1007700005F5012200D0E0F500D0E0F50175090093 +:10078000E509F502E509F503E509F504E509F505CF +:10079000E501C0E0E500C0E0E502F582E503F58390 +:1007A000E504F500E505F5012200D0E0F500D0E014 +:1007B000F501750900E509F502E509F503E509F517 +:1007C00004E509F505E501C0E0E500C0E0E502F556 +:1007D00082E503F583E504F500E505F5012200D087 +:1007E000E0F500D0E0F501750900E509F502E5093D +:1007F000F503E509F504E509F505E501C0E0E500C7 +:10080000C0E0E502F582E503F583E504F500E505C2 +:10081000F5012200D0E0F500D0E0F501750900E512 +:1008200009F502E509F503E509F504E509F505E52E +:1008300001C0E0E500C0E0E502F582E503F583E5EF +:1008400004F500E505F5012200D0E0F500D0E0F563 +:1008500001750900E509F502E509F503E509F50467 +:10086000E509F505E501C0E0E500C0E0E502F58237 +:10087000E503F583E504F500E505F5012200D0E088 +:10088000F500D0E0F501750900E509F502E509F587 +:1008900003E509F504E509F505E501C0E0E500C05B +:1008A000E0E502F582E503F583E504F500E505F5ED +:1008B000012200D0E0F500D0E0F501750900E5095E +:1008C000F502E509F503E509F504E509F505E50196 +:1008D000C0E0E500C0E0E502F582E503F583E5044C +:1008E000F500E505F5012200D0E0F500D0E0F501C6 +:1008F000750900E509F502E509F503E509F504E5E3 +:1009000009F505E501C0E0E500C0E0E502F582E596 +:1009100003F583E504F500E505F5012200D0E0F5D7 +:1009200000D0E0F501750900E509F502E509F503D8 +:10093000E509F504E509F505E501C0E0E500C0E0DD +:10094000E502F582E503F583E504F500E505F5012B +:100950002200D0E0F500D0E0F501750900E509F5C9 +:1009600002E509F503E509F504E509F505E501C02A +:10097000E0E500C0E0E502F582E503F583E504F576 +:1009800000E505F5012200D0E0F500D0E0F50175A5 +:100990000900E509F502E509F503E509F504E509AE +:1009A000F505E501C0E0E500C0E0E502F582E503FC +:1009B000F583E504F500E505F5012200D0E0F5003A +:1009C000D0E0F501750900E509F502E509F503E553 +:1009D00009F504E509F505E501C0E0E500C0E0E53D +:1009E00002F582E503F583E504F500E505F501224E +:1009F00000D0E0F500D0E0F501750900E509F50249 +:100A0000E509F503E509F504E509F505E501C0E0AB +:100A1000E500C0E0E502F582E503F583E504F500B5 +:100A2000E505F5012200D0E0F500D0E0F5017509FB +:100A300000E509F502E509F503E509F504E509F521 +:100A400005E501C0E0E500C0E0E502F582E503F55B +:100A500083E504F500E505F5012200D0E0F500D0BE +:100A6000E0F501750900E509F502E509F503E50979 +:100A7000F504E509F505E501C0E0E500C0E0E502A3 +:100A8000F582E503F583E504F500E505F5012200AF +:100A9000D0E0F500D0E0F501750900E509F502E5C3 +:100AA00009F503E509F504E509F505E501C0E0E50B +:100AB00000C0E0E502F582E503F583E504F500E515 +:100AC00005F5012200D0E0F500D0E0F50175090040 +:100AD000E509F502E509F503E509F504E509F5057C +:100AE000E501C0E0E500C0E0E502F582E503F5833D +:100AF000E504F500E505F5012200D0E0F500D0E0C1 +:100B0000F501750900E509F502E509F503E509F5C3 +:100B100004E509F505E501C0E0E500C0E0E502F502 +:100B200082E503F583E504F500E505F5012200D033 +:100B3000E0F500D0E0F501750900E509F502E509E9 +:100B4000F503E509F504E509F505E501C0E0E50073 +:100B5000C0E0E502F582E503F583E504F500E5056F +:100B6000F5012200D0E0F500D0E0F501750900E5BF +:100B700009F502E509F503E509F504E509F505E5DB +:100B800001C0E0E500C0E0E502F582E503F583E59C +:100B900004F500E505F5012200D0E0F500D0E0F510 +:100BA00001750900E509F502E509F503E509F50414 +:100BB000E509F505E501C0E0E500C0E0E502F582E4 +:100BC000E503F583E504F500E505F5012200D0E035 +:100BD000F500D0E0F501750900E509F502E509F534 +:100BE00003E509F504E509F505E501C0E0E500C008 +:100BF000E0E502F582E503F583E504F500E505F59A +:100C0000012200D0E0F500D0E0F501750900E5090A +:100C1000F502E509F503E509F504E509F505E50142 +:100C2000C0E0E500C0E0E502F582E503F583E504F8 +:100C3000F500E505F5012200D0E0F500D0E0F50172 +:100C4000750900E509F502E509F503E509F504E58F +:100C500009F505E501C0E0E500C0E0E502F582E543 +:100C600003F583E504F500E505F501220000000029 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/visibility-d.s.expected b/tests/GCCTestSuite/visibility-d.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/visibility-d.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/void-cast-1.c b/tests/GCCTestSuite/void-cast-1.c new file mode 100644 index 0000000..bd4e7b3 --- /dev/null +++ b/tests/GCCTestSuite/void-cast-1.c @@ -0,0 +1,11 @@ +/* Don't warn where the left-hand side of a comma expression is a + comma expression whose right-hand side is cast to void. Bug + 21159. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int a, b, c, d; +int e(void) { return (void)a, b; } +int f(void) { return (void)a, (void)b, c; } +int g(void) { return (void)a, (void)b, (void)c, d; } diff --git a/tests/GCCTestSuite/void-cast-1.c.expected b/tests/GCCTestSuite/void-cast-1.c.expected new file mode 100644 index 0000000..bd4e7b3 --- /dev/null +++ b/tests/GCCTestSuite/void-cast-1.c.expected @@ -0,0 +1,11 @@ +/* Don't warn where the left-hand side of a comma expression is a + comma expression whose right-hand side is cast to void. Bug + 21159. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int a, b, c, d; +int e(void) { return (void)a, b; } +int f(void) { return (void)a, (void)b, c; } +int g(void) { return (void)a, (void)b, (void)c, d; } diff --git a/tests/GCCTestSuite/void-cast-1.hex.expected b/tests/GCCTestSuite/void-cast-1.hex.expected new file mode 100644 index 0000000..3aa304a --- /dev/null +++ b/tests/GCCTestSuite/void-cast-1.hex.expected @@ -0,0 +1,48 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F900004E582F509900004E583F50A7568 +:100020000100C3750000E501F5F0E50935F0F501C3 +:10003000E500F5F0E50A35F0F500E500F502E5012B +:10004000F582E502F583E0F50B750101C37500004B +:10005000E501F5F0E50935F0F501E500F5F0E50A13 +:1000600035F0F500E500F502E501F582E502F583DE +:10007000E0F50C750102C3750000E501F5F0E50936 +:1000800035F0F501E500F5F0E50A35F0F500E5009D +:10009000F502E501F582E502F583E0F50D75010352 +:1000A000C3750000E501F5F0E50935F0F501E5005F +:1000B000F5F0E50A35F0F500E500F502E501F58219 +:1000C000E502F583E0F500E50BF502E50CF503E547 +:1000D0000DF504E500F505E50EF511E50FF510E564 +:1000E00019C0E0E518C0E0E502F582E503F583E517 +:1000F00004F500E505F5012200D0E0F518D0E0F5A3 +:1001000019E511F50EE510F50F900008E582F509E7 +:10011000900008E583F50A750100C3750000E5014C +:10012000F5F0E50935F0F501E500F5F0E50A35F003 +:10013000F500E500F502E501F582E502F583E0F55D +:100140000B750101C3750000E501F5F0E50935F017 +:10015000F501E500F5F0E50A35F0F500E500F502FA +:10016000E501F582E502F583E0F50C750102C37542 +:100170000000E501F5F0E50935F0F501E500F5F0E1 +:10018000E50A35F0F500E500F502E501F582E50246 +:10019000F583E0F50D750103C3750000E501F5F089 +:1001A000E50935F0F501E500F5F0E50A35F0F50073 +:1001B000E500F502E501F582E502F583E0F500E5ED +:1001C0000BF502E50CF503E50DF504E500F505E595 +:1001D0000EF511E50FF510E519C0E0E518C0E0E5F2 +:1001E00002F582E503F583E504F500E505F5012256 +:1001F00000D0E0F518D0E0F519E511F50EE510F5A1 +:100200000F90000CE582F50990000CE583F50A7566 +:100210000100C3750000E501F5F0E50935F0F501D1 +:10022000E500F5F0E50A35F0F500E500F502E50139 +:10023000F582E502F583E0F50B750101C375000059 +:10024000E501F5F0E50935F0F501E500F5F0E50A21 +:1002500035F0F500E500F502E501F582E502F583EC +:10026000E0F50C750102C3750000E501F5F0E50944 +:1002700035F0F501E500F5F0E50A35F0F500E500AB +:10028000F502E501F582E502F583E0F50D75010360 +:10029000C3750000E501F5F0E50935F0F501E5006D +:1002A000F5F0E50A35F0F500E500F502E501F58227 +:1002B000E502F583E0F500E50BF502E50CF503E555 +:1002C0000DF504E500F505E50EF511E50FF510E572 +:1002D00019C0E0E518C0E0E502F582E503F583E525 +:1002E00004F500E505F50122000000000000000013 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/void-cast-1.s.expected b/tests/GCCTestSuite/void-cast-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/void-cast-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/void-cast-2.c b/tests/GCCTestSuite/void-cast-2.c new file mode 100644 index 0000000..c51e91a --- /dev/null +++ b/tests/GCCTestSuite/void-cast-2.c @@ -0,0 +1,8 @@ +/* Test further cases of warnings for comma expressions, with and + without casts to void. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +int a, b, c, d; +int e(void) { return (char)a, b; } /* { dg-warning "warning: left-hand operand of comma expression has no effect" } */ +int f(void) { return (a ? (void)b : (void)c), d; } /* { dg-warning "warning: left-hand operand of comma expression has no effect" } */ diff --git a/tests/GCCTestSuite/void-cast-2.c.expected b/tests/GCCTestSuite/void-cast-2.c.expected new file mode 100644 index 0000000..c51e91a --- /dev/null +++ b/tests/GCCTestSuite/void-cast-2.c.expected @@ -0,0 +1,8 @@ +/* Test further cases of warnings for comma expressions, with and + without casts to void. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +int a, b, c, d; +int e(void) { return (char)a, b; } /* { dg-warning "warning: left-hand operand of comma expression has no effect" } */ +int f(void) { return (a ? (void)b : (void)c), d; } /* { dg-warning "warning: left-hand operand of comma expression has no effect" } */ diff --git a/tests/GCCTestSuite/void-cast-2.hex.expected b/tests/GCCTestSuite/void-cast-2.hex.expected new file mode 100644 index 0000000..60b2fc3 --- /dev/null +++ b/tests/GCCTestSuite/void-cast-2.hex.expected @@ -0,0 +1,32 @@ +:1000000000D0E0F518D0E0F519E511F50EE510F592 +:100010000F900004E582F509900004E583F50A7568 +:100020000100C3750000E501F5F0E50935F0F501C3 +:10003000E500F5F0E50A35F0F500E500F502E5012B +:10004000F582E502F583E0F50B750101C37500004B +:10005000E501F5F0E50935F0F501E500F5F0E50A13 +:1000600035F0F500E500F502E501F582E502F583DE +:10007000E0F50C750102C3750000E501F5F0E50936 +:1000800035F0F501E500F5F0E50A35F0F500E5009D +:10009000F502E501F582E502F583E0F50D75010352 +:1000A000C3750000E501F5F0E50935F0F501E5005F +:1000B000F5F0E50A35F0F500E500F502E501F58219 +:1000C000E502F583E0F500E50BF502E50CF503E547 +:1000D0000DF504E500F505E50EF511E50FF510E564 +:1000E00019C0E0E518C0E0E502F582E503F583E517 +:1000F00004F500E505F5012200D0E0F518D0E0F5A3 +:1001000019E511F50EE510F50F90000CE582F509E3 +:1001100090000CE583F50A750100C3750000E50148 +:10012000F5F0E50935F0F501E500F5F0E50A35F003 +:10013000F500E500F502E501F582E502F583E0F55D +:100140000B750101C3750000E501F5F0E50935F017 +:10015000F501E500F5F0E50A35F0F500E500F502FA +:10016000E501F582E502F583E0F50C750102C37542 +:100170000000E501F5F0E50935F0F501E500F5F0E1 +:10018000E50A35F0F500E500F502E501F582E50246 +:10019000F583E0F50D750103C3750000E501F5F089 +:1001A000E50935F0F501E500F5F0E50A35F0F50073 +:1001B000E500F502E501F582E502F583E0F500E5ED +:1001C0000BF502E50CF503E50DF504E500F505E595 +:1001D0000EF511E50FF510E519C0E0E518C0E0E5F2 +:1001E00002F582E503F583E504F500E505F5012256 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/void-cast-2.s.expected b/tests/GCCTestSuite/void-cast-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/void-cast-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/volatile1.c b/tests/GCCTestSuite/volatile1.c new file mode 100644 index 0000000..61a3979 --- /dev/null +++ b/tests/GCCTestSuite/volatile1.c @@ -0,0 +1,9 @@ +/* PR c/12553: we were erroneously setting TREE_SIDE_EFFECTS on &y, which + confused tree-ssa. */ + +void f() +{ + int x; + volatile int y; + &x == &y; +} diff --git a/tests/GCCTestSuite/volatile1.c.expected b/tests/GCCTestSuite/volatile1.c.expected new file mode 100644 index 0000000..61a3979 --- /dev/null +++ b/tests/GCCTestSuite/volatile1.c.expected @@ -0,0 +1,9 @@ +/* PR c/12553: we were erroneously setting TREE_SIDE_EFFECTS on &y, which + confused tree-ssa. */ + +void f() +{ + int x; + volatile int y; + &x == &y; +} diff --git a/tests/GCCTestSuite/volatile1.hex.expected b/tests/GCCTestSuite/volatile1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/volatile1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/volatile1.s.expected b/tests/GCCTestSuite/volatile1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/volatile1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/warn-1.c b/tests/GCCTestSuite/warn-1.c new file mode 100644 index 0000000..dc2cd0e --- /dev/null +++ b/tests/GCCTestSuite/warn-1.c @@ -0,0 +1,16 @@ +/* The compiler used to say passing arg 0 of, which is wrong. */ +/* Radar 3069179 */ + +/* { dg-options "-O3" } */ + +static void foo (p) + int p; +{ +} + +void bar (void) +{ + void *vp; + + foo (vp); /* { dg-warning "passing argument 1 of" } */ +} diff --git a/tests/GCCTestSuite/warn-1.c.expected b/tests/GCCTestSuite/warn-1.c.expected new file mode 100644 index 0000000..dc2cd0e --- /dev/null +++ b/tests/GCCTestSuite/warn-1.c.expected @@ -0,0 +1,16 @@ +/* The compiler used to say passing arg 0 of, which is wrong. */ +/* Radar 3069179 */ + +/* { dg-options "-O3" } */ + +static void foo (p) + int p; +{ +} + +void bar (void) +{ + void *vp; + + foo (vp); /* { dg-warning "passing argument 1 of" } */ +} diff --git a/tests/GCCTestSuite/warn-1.hex.expected b/tests/GCCTestSuite/warn-1.hex.expected new file mode 100644 index 0000000..31697af --- /dev/null +++ b/tests/GCCTestSuite/warn-1.hex.expected @@ -0,0 +1,17 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F501750900E51E +:1000200009F502E509F503E509F504E509F505E536 +:1000300001C0E0E500C0E075E0042506F50675E0C6 +:10004000003507F507E502F582E503F583E504F5DC +:1000500000E505F5012200E506758202C39582F5EB +:1000600006E5077583009583F507D0E0F50875E090 +:10007000012506F58275E0003507F583E508F0D027 +:10008000E0F50875E0002506F58275E0003507F516 +:1000900083E508F0751D00751C0012000075000056 +:1000A000E500F502E500F503E500F504E500F505DA +:1000B00075E0002506F58275E0003507F583E0F56B +:1000C00008E508C0E075E0012506F58275E0003519 +:1000D00007F583E0F508E508C0E075E0022506F5C0 +:1000E0000675E0003507F507E502F582E503F583BF +:1000F000E504F500E505F501220000000000000020 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/warn-1.s.expected b/tests/GCCTestSuite/warn-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/warn-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wchar_t-1.c b/tests/GCCTestSuite/wchar_t-1.c new file mode 100644 index 0000000..6d95c69 --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +/* Compile with -Wall to get a warning if built-in and system wchar_t don't + match. */ + +#define _STDDEF_H +#include + +__WCHAR_TYPE__ __wc_t__; +wchar_t *wc_t_p; + +void +wct (void) +{ + wc_t_p = &__wc_t__; +} diff --git a/tests/GCCTestSuite/wchar_t-1.c.expected b/tests/GCCTestSuite/wchar_t-1.c.expected new file mode 100644 index 0000000..6d95c69 --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-1.c.expected @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +/* Compile with -Wall to get a warning if built-in and system wchar_t don't + match. */ + +#define _STDDEF_H +#include + +__WCHAR_TYPE__ __wc_t__; +wchar_t *wc_t_p; + +void +wct (void) +{ + wc_t_p = &__wc_t__; +} diff --git a/tests/GCCTestSuite/wchar_t-1.hex.expected b/tests/GCCTestSuite/wchar_t-1.hex.expected new file mode 100644 index 0000000..3e51af4 --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-1.hex.expected @@ -0,0 +1,13 @@ +:1000000000D0E0F50ED0E0F50FE510F50D900004FE +:10001000E582F50B900004E583F50C900000E58285 +:10002000F509900000E583F50A750100C37500002D +:10003000E501F5F0E50B35F0F501E500F5F0E50C2F +:1000400035F0F500E509F503E500F502E501F58277 +:10005000E502F583E503F0750101C3750000E501D4 +:10006000F5F0E50B35F0F501E500F5F0E50C35F0C0 +:10007000F500E50AF503E500F502E501F582E50284 +:10008000F583E503F0750000E500F502E500F503F2 +:10009000E500F504E500F505E50DF510E50FC0E018 +:1000A000E50EC0E0E502F582E503F583E504F50021 +:1000B000E505F5012200000000000000000000003E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wchar_t-1.s.expected b/tests/GCCTestSuite/wchar_t-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wchar_t-2.c b/tests/GCCTestSuite/wchar_t-2.c new file mode 100644 index 0000000..95ddca0 --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-2.c @@ -0,0 +1,6 @@ +/* { dg-options "-fshort-wchar" } */ +/* Check that "-fshort-wchar" makes wchar_t the same size as "unsigned + short". */ + +extern int i[sizeof (L'a')]; +int i[sizeof (unsigned short)]; diff --git a/tests/GCCTestSuite/wchar_t-2.c.expected b/tests/GCCTestSuite/wchar_t-2.c.expected new file mode 100644 index 0000000..95ddca0 --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-2.c.expected @@ -0,0 +1,6 @@ +/* { dg-options "-fshort-wchar" } */ +/* Check that "-fshort-wchar" makes wchar_t the same size as "unsigned + short". */ + +extern int i[sizeof (L'a')]; +int i[sizeof (unsigned short)]; diff --git a/tests/GCCTestSuite/wchar_t-2.hex.expected b/tests/GCCTestSuite/wchar_t-2.hex.expected new file mode 100644 index 0000000..7ef5593 --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-2.hex.expected @@ -0,0 +1 @@ +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wchar_t-2.s.expected b/tests/GCCTestSuite/wchar_t-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wchar_t-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-1.c b/tests/GCCTestSuite/winline-1.c new file mode 100644 index 0000000..ac2ae82 --- /dev/null +++ b/tests/GCCTestSuite/winline-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ + +void q(void); +inline int t(void) +{ + int ret; + q(); + ret = t(); /* We define sane semantics for inline keyword on recursive + functions, so do not warn here. */ + q(); + return ret; +} diff --git a/tests/GCCTestSuite/winline-1.c.expected b/tests/GCCTestSuite/winline-1.c.expected new file mode 100644 index 0000000..ac2ae82 --- /dev/null +++ b/tests/GCCTestSuite/winline-1.c.expected @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ + +void q(void); +inline int t(void) +{ + int ret; + q(); + ret = t(); /* We define sane semantics for inline keyword on recursive + functions, so do not warn here. */ + q(); + return ret; +} diff --git a/tests/GCCTestSuite/winline-1.hex.expected b/tests/GCCTestSuite/winline-1.hex.expected new file mode 100644 index 0000000..5c35517 --- /dev/null +++ b/tests/GCCTestSuite/winline-1.hex.expected @@ -0,0 +1,22 @@ +:100000000000E506758206C39582F506E50775834F +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:10004000E0052506F58275E0003507F583E513F038 +:1000500075E0042506F58275E0003507F583E512A5 +:10006000F075E0032506F58275E0003507F583E5B8 +:1000700011F075E0022506F58275E0003507F5837D +:10008000E510F0120001E582F502E583F503E500D5 +:10009000F504E501F505E502F510E503F511E504C4 +:1000A000F512E505F513E510F502E511F503E51286 +:1000B000F504E513F50575E0052506F58275E00004 +:1000C0003507F583E0F51375E0042506F58275E044 +:1000D000003507F583E0F51275E0032506F5827516 +:1000E000E0003507F583E0F51175E0022506F5829D +:1000F00075E0003507F583E0F51075E0002506F59D +:100100008275E0003507F583E0F508E508C0E07585 +:10011000E0012506F58275E0003507F583E0F50876 +:10012000E508C0E075E0062506F50675E000350730 +:10013000F507E502F582E503F583E504F500E5053D +:10014000F501220000000000000000000000000097 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-1.s.expected b/tests/GCCTestSuite/winline-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/winline-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-2.c b/tests/GCCTestSuite/winline-2.c new file mode 100644 index 0000000..584c68f --- /dev/null +++ b/tests/GCCTestSuite/winline-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ + +inline int q(void); /* { dg-warning "body not available" "" } */ +inline int t(void) +{ + return q(); /* { dg-warning "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/winline-2.c.expected b/tests/GCCTestSuite/winline-2.c.expected new file mode 100644 index 0000000..584c68f --- /dev/null +++ b/tests/GCCTestSuite/winline-2.c.expected @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ + +inline int q(void); /* { dg-warning "body not available" "" } */ +inline int t(void) +{ + return q(); /* { dg-warning "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/winline-2.hex.expected b/tests/GCCTestSuite/winline-2.hex.expected new file mode 100644 index 0000000..d3ba75f --- /dev/null +++ b/tests/GCCTestSuite/winline-2.hex.expected @@ -0,0 +1,13 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F0E553 +:1000400082F502E583F503E500F504E501F505E534 +:1000500002F500E503F501E504F509E505F50AE516 +:1000600000F502E501F503E509F504E50AF5057576 +:10007000E0002506F58275E0003507F583E0F50818 +:10008000E508C0E075E0012506F58275E00035075A +:10009000F583E0F508E508C0E075E0022506F50601 +:1000A00075E0003507F507E502F582E503F583E520 +:1000B00004F500E505F50122000000000000000045 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-2.s.expected b/tests/GCCTestSuite/winline-2.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/winline-2.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-3.c b/tests/GCCTestSuite/winline-3.c new file mode 100644 index 0000000..ce9e080 --- /dev/null +++ b/tests/GCCTestSuite/winline-3.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2 --param max-inline-insns-single=1" } */ + +void big (void); +inline int q(void) +{ /* { dg-warning "max-inline-insns-single" "" } */ + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); +} +inline int t (void) +{ + return q (); /* { dg-warning "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/winline-3.c.expected b/tests/GCCTestSuite/winline-3.c.expected new file mode 100644 index 0000000..ce9e080 --- /dev/null +++ b/tests/GCCTestSuite/winline-3.c.expected @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2 --param max-inline-insns-single=1" } */ + +void big (void); +inline int q(void) +{ /* { dg-warning "max-inline-insns-single" "" } */ + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); +} +inline int t (void) +{ + return q (); /* { dg-warning "called from here" "" } */ +} diff --git a/tests/GCCTestSuite/winline-3.hex.expected b/tests/GCCTestSuite/winline-3.hex.expected new file mode 100644 index 0000000..4064cf1 --- /dev/null +++ b/tests/GCCTestSuite/winline-3.hex.expected @@ -0,0 +1,26 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0022506F58226 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000012506F58275E0003507F583E508F075C2 +:10004000E0002506F58275E0003507F583E0F5024E +:1000500075E0002506F58275E0003507F583E0F5CB +:100060000375E0002506F58275E0003507F583E0AD +:10007000F50475E0002506F58275E0003507F58387 +:10008000E0F50575E0012506F58275E0003507F518 +:1000900083E0F508E508C0E075E0022506F5827505 +:1000A000E0003507F583E0F508E508C0E075E003FA +:1000B0002506F50675E0003507F507E502F582E54A +:1000C00003F583E504F500E505F5012200E5067575 +:1000D0008202C39582F506E5077583009583F507CF +:1000E000D0E0F50875E0012506F58275E0003507DA +:1000F000F583E508F0D0E0F50875E0002506F58207 +:1001000075E0003507F583E508F0120001E582F59A +:1001100002E583F503E500F504E501F505E502F5E3 +:1001200000E503F501E504F509E505F50AE500F547 +:1001300002E501F503E509F504E50AF50575E000BA +:100140002506F58275E0003507F583E0F508E5083A +:10015000C0E075E0012506F58275E0003507F583FE +:10016000E0F508E508C0E075E0022506F50675E053 +:10017000003507F507E502F582E503F583E504F5AB +:1001800000E505F50122000000000000000000006D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-3.s.expected b/tests/GCCTestSuite/winline-3.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/winline-3.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-5.c b/tests/GCCTestSuite/winline-5.c new file mode 100644 index 0000000..57fa393 --- /dev/null +++ b/tests/GCCTestSuite/winline-5.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2 --param inline-unit-growth=0 --param large-unit-insns=0" } */ + +void big (void); +inline int q(void) +{ /* { dg-warning "inline-unit-growth" } */ + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); +} +inline int q1(void) +{ + big(); + big(); + big(); +} +int t (void) +{ + /* We allow one inlining over limit. */ + q1(); + return q (); /* { dg-warning "called from here" } */ +} diff --git a/tests/GCCTestSuite/winline-5.c.expected b/tests/GCCTestSuite/winline-5.c.expected new file mode 100644 index 0000000..57fa393 --- /dev/null +++ b/tests/GCCTestSuite/winline-5.c.expected @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2 --param inline-unit-growth=0 --param large-unit-insns=0" } */ + +void big (void); +inline int q(void) +{ /* { dg-warning "inline-unit-growth" } */ + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); +} +inline int q1(void) +{ + big(); + big(); + big(); +} +int t (void) +{ + /* We allow one inlining over limit. */ + q1(); + return q (); /* { dg-warning "called from here" } */ +} diff --git a/tests/GCCTestSuite/winline-5.hex.expected b/tests/GCCTestSuite/winline-5.hex.expected new file mode 100644 index 0000000..b00aa0c --- /dev/null +++ b/tests/GCCTestSuite/winline-5.hex.expected @@ -0,0 +1,39 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0022506F58226 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000012506F58275E0003507F583E508F075C2 +:10004000E0002506F58275E0003507F583E0F5024E +:1000500075E0002506F58275E0003507F583E0F5CB +:100060000375E0002506F58275E0003507F583E0AD +:10007000F50475E0002506F58275E0003507F58387 +:10008000E0F50575E0012506F58275E0003507F518 +:1000900083E0F508E508C0E075E0022506F5827505 +:1000A000E0003507F583E0F508E508C0E075E003FA +:1000B0002506F50675E0003507F507E502F582E54A +:1000C00003F583E504F500E505F5012200E5067575 +:1000D0008203C39582F506E5077583009583F507CE +:1000E000D0E0F50875E0022506F58275E0003507D9 +:1000F000F583E508F0D0E0F50875E0012506F58206 +:1001000075E0003507F583E508F075E0002506F594 +:100110008275E0003507F583E0F50275E0002506FD +:10012000F58275E0003507F583E0F50375E00025FD +:1001300006F58275E0003507F583E0F50475E0000B +:100140002506F58275E0003507F583E0F50575E0D5 +:10015000012506F58275E0003507F583E0F508E531 +:1001600008C0E075E0022506F58275E0003507F568 +:1001700083E0F508E508C0E075E0032506F506759F +:10018000E0003507F507E502F582E503F583E504B0 +:10019000F500E505F5012200E506758202C39582AA +:1001A000F506E5077583009583F507D0E0F508753A +:1001B000E0012506F58275E0003507F583E508F0D6 +:1001C000D0E0F50875E0002506F58275E0003507FA +:1001D000F583E508F01200CC120001E582F502E596 +:1001E00083F503E500F504E501F505E502F500E515 +:1001F00003F501E504F509E505F50AE500F502E575 +:1002000001F503E509F504E50AF50575E0002506A5 +:10021000F58275E0003507F583E0F508E508C0E0F4 +:1002200075E0012506F58275E0003507F583E0F5F8 +:1002300008E508C0E075E0022506F50675E0003522 +:1002400007F507E502F582E503F583E504F500E52A +:1002500005F5012200000000000000000000000081 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-5.s.expected b/tests/GCCTestSuite/winline-5.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/winline-5.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-6.c b/tests/GCCTestSuite/winline-6.c new file mode 100644 index 0000000..dd8d3a8 --- /dev/null +++ b/tests/GCCTestSuite/winline-6.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2 --param large-function-growth=0 --param large-function-insns=1" } */ + +void big (void); +inline int q(void) +{ /* { dg-warning "large-function-growth" } */ + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); +} +inline int t (void) +{ + return q () + 1; /* { dg-warning "called from here" } */ +} diff --git a/tests/GCCTestSuite/winline-6.c.expected b/tests/GCCTestSuite/winline-6.c.expected new file mode 100644 index 0000000..dd8d3a8 --- /dev/null +++ b/tests/GCCTestSuite/winline-6.c.expected @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2 --param large-function-growth=0 --param large-function-insns=1" } */ + +void big (void); +inline int q(void) +{ /* { dg-warning "large-function-growth" } */ + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); + big(); +} +inline int t (void) +{ + return q () + 1; /* { dg-warning "called from here" } */ +} diff --git a/tests/GCCTestSuite/winline-6.hex.expected b/tests/GCCTestSuite/winline-6.hex.expected new file mode 100644 index 0000000..05839a8 --- /dev/null +++ b/tests/GCCTestSuite/winline-6.hex.expected @@ -0,0 +1,29 @@ +:100000000000E506758203C39582F506E507758352 +:10001000009583F507D0E0F50875E0022506F58226 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000012506F58275E0003507F583E508F075C2 +:10004000E0002506F58275E0003507F583E0F5024E +:1000500075E0002506F58275E0003507F583E0F5CB +:100060000375E0002506F58275E0003507F583E0AD +:10007000F50475E0002506F58275E0003507F58387 +:10008000E0F50575E0012506F58275E0003507F518 +:1000900083E0F508E508C0E075E0022506F5827505 +:1000A000E0003507F583E0F508E508C0E075E003FA +:1000B0002506F50675E0003507F507E502F582E54A +:1000C00003F583E504F500E505F5012200E5067575 +:1000D0008202C39582F506E5077583009583F507CF +:1000E000D0E0F50875E0012506F58275E0003507DA +:1000F000F583E508F0D0E0F50875E0002506F58207 +:1001000075E0003507F583E508F0120001E582F59A +:1001100002E583F503E500F504E501F505E502F5E3 +:100120000BE503F50CE504F50DE505F50E7500018D +:10013000750100750900750A00C3750F00E500F52B +:10014000F0E50B35F0F500E501F5F0E50C35F0F5DF +:1001500001E509F5F0E50D35F0F509E50AF5F0E5FD +:100160000E35F0F50AE500F502E501F503E509F5C0 +:1001700004E50AF50575E0002506F58275E0003511 +:1001800007F583E0F508E508C0E075E0012506F510 +:100190008275E0003507F583E0F508E508C0E075F5 +:1001A000E0022506F50675E0003507F507E502F5DE +:1001B00082E503F583E504F500E505F5012200007D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-6.s.expected b/tests/GCCTestSuite/winline-6.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/winline-6.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-7.c b/tests/GCCTestSuite/winline-7.c new file mode 100644 index 0000000..bab82a2 --- /dev/null +++ b/tests/GCCTestSuite/winline-7.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ + +extern void *alloca (__SIZE_TYPE__); + +void big (void); +inline void *q (void) +{ /* { dg-warning "(function not inlinable|alloca)" } */ + return alloca (10); +} +inline void *t (void) +{ + return q (); /* { dg-warning "called from here" } */ +} diff --git a/tests/GCCTestSuite/winline-7.c.expected b/tests/GCCTestSuite/winline-7.c.expected new file mode 100644 index 0000000..bab82a2 --- /dev/null +++ b/tests/GCCTestSuite/winline-7.c.expected @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Winline -O2" } */ + +extern void *alloca (__SIZE_TYPE__); + +void big (void); +inline void *q (void) +{ /* { dg-warning "(function not inlinable|alloca)" } */ + return alloca (10); +} +inline void *t (void) +{ + return q (); /* { dg-warning "called from here" } */ +} diff --git a/tests/GCCTestSuite/winline-7.hex.expected b/tests/GCCTestSuite/winline-7.hex.expected new file mode 100644 index 0000000..7f3cdee --- /dev/null +++ b/tests/GCCTestSuite/winline-7.hex.expected @@ -0,0 +1,24 @@ +:100000000000E506758202C39582F506E507758353 +:10001000009583F507D0E0F50875E0012506F58227 +:1000200075E0003507F583E508F0D0E0F50875E0E8 +:10003000002506F58275E0003507F583E508F075C3 +:100040001F0A751E00751D00751C00E582F502E58E +:1000500083F503E502F500E503F501750900E50008 +:10006000F502E501F503E509F504E509F50575E097 +:10007000002506F58275E0003507F583E0F508E513 +:1000800008C0E075E0012506F58275E0003507F54A +:1000900083E0F508E508C0E075E0022506F5067581 +:1000A000E0003507F507E502F582E503F583E50491 +:1000B000F500E505F5012200E506758202C395828B +:1000C000F506E5077583009583F507D0E0F508751B +:1000D000E0012506F58275E0003507F583E508F0B7 +:1000E000D0E0F50875E0002506F58275E0003507DB +:1000F000F583E508F0120001E582F502E583F503DA +:10010000E502F500E503F501750900E500F502E5F6 +:1001100001F503E509F504E509F50575E000250697 +:10012000F58275E0003507F583E0F508E508C0E0E5 +:1001300075E0012506F58275E0003507F583E0F5E9 +:1001400008E508C0E075E0022506F50675E0003513 +:1001500007F507E502F582E503F583E504F500E51B +:1001600005F5012200000000000000000000000072 +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/winline-7.s.expected b/tests/GCCTestSuite/winline-7.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/winline-7.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wint_t-1.c b/tests/GCCTestSuite/wint_t-1.c new file mode 100644 index 0000000..3f88dcb --- /dev/null +++ b/tests/GCCTestSuite/wint_t-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +/* Compile with -Wall to get a warning if built-in and system wint_t don't + match. */ + +#define _STDDEF_H +#include + +__WINT_TYPE__ __wi_t__; +wint_t *wi_t_p; + +void +wit (void) +{ + wi_t_p = &__wi_t__; +} diff --git a/tests/GCCTestSuite/wint_t-1.c.expected b/tests/GCCTestSuite/wint_t-1.c.expected new file mode 100644 index 0000000..3f88dcb --- /dev/null +++ b/tests/GCCTestSuite/wint_t-1.c.expected @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +/* Compile with -Wall to get a warning if built-in and system wint_t don't + match. */ + +#define _STDDEF_H +#include + +__WINT_TYPE__ __wi_t__; +wint_t *wi_t_p; + +void +wit (void) +{ + wi_t_p = &__wi_t__; +} diff --git a/tests/GCCTestSuite/wint_t-1.hex.expected b/tests/GCCTestSuite/wint_t-1.hex.expected new file mode 100644 index 0000000..3e51af4 --- /dev/null +++ b/tests/GCCTestSuite/wint_t-1.hex.expected @@ -0,0 +1,13 @@ +:1000000000D0E0F50ED0E0F50FE510F50D900004FE +:10001000E582F50B900004E583F50C900000E58285 +:10002000F509900000E583F50A750100C37500002D +:10003000E501F5F0E50B35F0F501E500F5F0E50C2F +:1000400035F0F500E509F503E500F502E501F58277 +:10005000E502F583E503F0750101C3750000E501D4 +:10006000F5F0E50B35F0F501E500F5F0E50C35F0C0 +:10007000F500E50AF503E500F502E501F582E50284 +:10008000F583E503F0750000E500F502E500F503F2 +:10009000E500F504E500F505E50DF510E50FC0E018 +:1000A000E50EC0E0E502F582E503F583E504F50021 +:1000B000E505F5012200000000000000000000003E +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wint_t-1.s.expected b/tests/GCCTestSuite/wint_t-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wint_t-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-escape-1.c b/tests/GCCTestSuite/wtr-escape-1.c new file mode 100644 index 0000000..7f48de5 --- /dev/null +++ b/tests/GCCTestSuite/wtr-escape-1.c @@ -0,0 +1,22 @@ +/* Test for -Wtraditional warnings on escape characters. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc () +{ + char c; + + c = '\a'; /* { dg-warning "the meaning of" "escaped character warning " } */ + c = '\x2'; /* { dg-warning "the meaning of" "escaped character warning " } */ + c = '\n'; + +# 17 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + c = '\a'; + c = '\x2'; + c = '\n'; +} diff --git a/tests/GCCTestSuite/wtr-escape-1.c.expected b/tests/GCCTestSuite/wtr-escape-1.c.expected new file mode 100644 index 0000000..7f48de5 --- /dev/null +++ b/tests/GCCTestSuite/wtr-escape-1.c.expected @@ -0,0 +1,22 @@ +/* Test for -Wtraditional warnings on escape characters. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc () +{ + char c; + + c = '\a'; /* { dg-warning "the meaning of" "escaped character warning " } */ + c = '\x2'; /* { dg-warning "the meaning of" "escaped character warning " } */ + c = '\n'; + +# 17 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + c = '\a'; + c = '\x2'; + c = '\n'; +} diff --git a/tests/GCCTestSuite/wtr-escape-1.hex.expected b/tests/GCCTestSuite/wtr-escape-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/wtr-escape-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-escape-1.s.expected b/tests/GCCTestSuite/wtr-escape-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wtr-escape-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-static-1.c b/tests/GCCTestSuite/wtr-static-1.c new file mode 100644 index 0000000..42760e8 --- /dev/null +++ b/tests/GCCTestSuite/wtr-static-1.c @@ -0,0 +1,14 @@ +/* Test for -Wtraditional warnings on static/non-static mismatches. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +static void testfunc1(void); /* { dg-warning "previous declaration" } */ +void testfunc1() {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */ + +# 11 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +static void testfunc2(void); +void testfunc2() {} diff --git a/tests/GCCTestSuite/wtr-static-1.c.expected b/tests/GCCTestSuite/wtr-static-1.c.expected new file mode 100644 index 0000000..42760e8 --- /dev/null +++ b/tests/GCCTestSuite/wtr-static-1.c.expected @@ -0,0 +1,14 @@ +/* Test for -Wtraditional warnings on static/non-static mismatches. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +static void testfunc1(void); /* { dg-warning "previous declaration" } */ +void testfunc1() {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */ + +# 11 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +static void testfunc2(void); +void testfunc2() {} diff --git a/tests/GCCTestSuite/wtr-static-1.hex.expected b/tests/GCCTestSuite/wtr-static-1.hex.expected new file mode 100644 index 0000000..64d1011 --- /dev/null +++ b/tests/GCCTestSuite/wtr-static-1.hex.expected @@ -0,0 +1,8 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F5012200D0E0F500D0E0F5017509F5 +:1000400000E509F502E509F503E509F504E509F51B +:1000500005E501C0E0E500C0E0E502F582E503F555 +:1000600083E504F500E505F501220000000000002D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-static-1.s.expected b/tests/GCCTestSuite/wtr-static-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wtr-static-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-switch-1.c b/tests/GCCTestSuite/wtr-switch-1.c new file mode 100644 index 0000000..f0381bc --- /dev/null +++ b/tests/GCCTestSuite/wtr-switch-1.c @@ -0,0 +1,25 @@ +/* Test for -Wtraditional warnings on switch operands of type long. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc (l) + long l; +{ + switch (l) /* { dg-warning "switch expression" "switch expression" } */ + { + default: + break; + } + +# 17 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + switch (l) + { + default: + break; + } +} diff --git a/tests/GCCTestSuite/wtr-switch-1.c.expected b/tests/GCCTestSuite/wtr-switch-1.c.expected new file mode 100644 index 0000000..f0381bc --- /dev/null +++ b/tests/GCCTestSuite/wtr-switch-1.c.expected @@ -0,0 +1,25 @@ +/* Test for -Wtraditional warnings on switch operands of type long. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc (l) + long l; +{ + switch (l) /* { dg-warning "switch expression" "switch expression" } */ + { + default: + break; + } + +# 17 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + switch (l) + { + default: + break; + } +} diff --git a/tests/GCCTestSuite/wtr-switch-1.hex.expected b/tests/GCCTestSuite/wtr-switch-1.hex.expected new file mode 100644 index 0000000..52c5e50 --- /dev/null +++ b/tests/GCCTestSuite/wtr-switch-1.hex.expected @@ -0,0 +1,7 @@ +:1000000000E506758204C39582F506E50775830051 +:100010009583F507D0E0F500D0E0F5010000000081 +:10002000750900E509F502E509F503E509F504E5BB +:1000300009F505E501C0E0E500C0E075E00425062E +:10004000F50675E0003507F507E502F582E503F5ED +:1000500083E504F500E505F501220000000000003D +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-switch-1.s.expected b/tests/GCCTestSuite/wtr-switch-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wtr-switch-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-unary-plus-1.c b/tests/GCCTestSuite/wtr-unary-plus-1.c new file mode 100644 index 0000000..aee892c --- /dev/null +++ b/tests/GCCTestSuite/wtr-unary-plus-1.c @@ -0,0 +1,20 @@ +/* Test for -Wtraditional warnings on the unary plus operator. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc () +{ + int i; + + i = +1; /* { dg-warning "unary plus operator" "unary plus operator" } */ + i = +i; /* { dg-warning "unary plus operator" "unary plus operator" } */ + +# 16 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + i = +1; + i = +i; +} diff --git a/tests/GCCTestSuite/wtr-unary-plus-1.c.expected b/tests/GCCTestSuite/wtr-unary-plus-1.c.expected new file mode 100644 index 0000000..aee892c --- /dev/null +++ b/tests/GCCTestSuite/wtr-unary-plus-1.c.expected @@ -0,0 +1,20 @@ +/* Test for -Wtraditional warnings on the unary plus operator. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc () +{ + int i; + + i = +1; /* { dg-warning "unary plus operator" "unary plus operator" } */ + i = +i; /* { dg-warning "unary plus operator" "unary plus operator" } */ + +# 16 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + i = +1; + i = +i; +} diff --git a/tests/GCCTestSuite/wtr-unary-plus-1.hex.expected b/tests/GCCTestSuite/wtr-unary-plus-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/wtr-unary-plus-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-unary-plus-1.s.expected b/tests/GCCTestSuite/wtr-unary-plus-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wtr-unary-plus-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-union-init-1.c b/tests/GCCTestSuite/wtr-union-init-1.c new file mode 100644 index 0000000..b6a814d --- /dev/null +++ b/tests/GCCTestSuite/wtr-union-init-1.c @@ -0,0 +1,25 @@ +/* Test for -Wtraditional warnings on union initialization. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +union foo +{ + int i; + long l; +}; + +void +testfunc () +{ + /* Note we only warn for nonzero initializers. */ + static union foo f1 = { 0 }; + static union foo f2 = { 1 }; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */ + +# 21 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + static union foo f3 = { 0 }; + static union foo f4 = { 1 }; +} diff --git a/tests/GCCTestSuite/wtr-union-init-1.c.expected b/tests/GCCTestSuite/wtr-union-init-1.c.expected new file mode 100644 index 0000000..b6a814d --- /dev/null +++ b/tests/GCCTestSuite/wtr-union-init-1.c.expected @@ -0,0 +1,25 @@ +/* Test for -Wtraditional warnings on union initialization. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +union foo +{ + int i; + long l; +}; + +void +testfunc () +{ + /* Note we only warn for nonzero initializers. */ + static union foo f1 = { 0 }; + static union foo f2 = { 1 }; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */ + +# 21 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + static union foo f3 = { 0 }; + static union foo f4 = { 1 }; +} diff --git a/tests/GCCTestSuite/wtr-union-init-1.hex.expected b/tests/GCCTestSuite/wtr-union-init-1.hex.expected new file mode 100644 index 0000000..666796d --- /dev/null +++ b/tests/GCCTestSuite/wtr-union-init-1.hex.expected @@ -0,0 +1,5 @@ +:1000000000D0E0F500D0E0F501750900E509F50242 +:10001000E509F503E509F504E509F505E501C0E0A5 +:10002000E500C0E0E502F582E503F583E504F500AF +:10003000E505F501220000000000000000000000BE +:00000001FF \ No newline at end of file diff --git a/tests/GCCTestSuite/wtr-union-init-1.s.expected b/tests/GCCTestSuite/wtr-union-init-1.s.expected new file mode 100644 index 0000000..a3385dc --- /dev/null +++ b/tests/GCCTestSuite/wtr-union-init-1.s.expected @@ -0,0 +1 @@ +Pretty print not requested \ No newline at end of file diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..c6ad9be --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,9 @@ +.PHONY: check + +SUBDIRS=GCCTestSuite + +check: + for i in $(SUBDIRS); do $(MAKE) -C $$i check; done + +clean: + for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done \ No newline at end of file diff --git a/tests/benchs/Makefile b/tests/benchs/Makefile new file mode 100644 index 0000000..2bec82f --- /dev/null +++ b/tests/benchs/Makefile @@ -0,0 +1,63 @@ +.PHONY: clean all bench prepare + +SOURCES=$(wildcard *.c) +BASENAMES=$(SOURCES:.c=) +GCCEXES=$(SOURCES:.c=.gcc) +GCCEXES=$(SOURCES:.c=.ogcc) +ACCEXES=$(SOURCES:.c=.acc) +EXES=$(GCCEXES) $(ACCEXES) +RESULTS=$(SOURCES:.c=.result) + +GCC=gcc +CFLAGS=-O0 +OFLAGS=-O2 + +ACC=./acc.run +TIME=./meantime.sh + +all: bench + +%.gcc: %.c + @ $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ $< + +%.ogcc: %.c + @ $(GCC) $(CPPFLAGS) $(OFLAGS) -o $@ $< + +%.s: %.c + @ $(ACC) $< + +%.acc: %.s + @ $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ $< + +%.acc-run: %.acc + @ $(TIME) -f %U ./$< > $@ + +%.gcc-run: %.gcc + @ $(TIME) -f %U ./$< > $@ + +%.ogcc-run: %.ogcc + @ $(TIME) -f %U ./$< > $@ + +%.ratio1: %.acc-run %.gcc-run + @ echo "print round(`cat $*.acc-run` / `cat $*.gcc-run`, 2)" | python > $@ + +%.ratio2: %.acc-run %.ogcc-run + @ echo "print round(`cat $*.acc-run` / `cat $*.ogcc-run`, 2)" | python > $@ + +%.announce: + @ echo Benchmarking "$*.c"... + @ echo "$*.c" > $@ + +%.result: %.announce %.acc-run %.gcc-run %.ogcc-run %.ratio1 %.ratio2 + @ cat $^ | tr '\n' '&' > $@ + +prepare: + rm --force *.announce + +bench: prepare $(RESULTS) + @ echo '& acc & gcc -O0 & gcc -O2 & 1/2 & 1/3 \\' + @ for i in $(BASENAMES); do cat $$i.result; echo '\\'; done + +clean: + rm --force $(EXES) $(RESULTS) \ + *.gcc-run *.ogcc-run *.acc-run *.ratio* *.announce *.Clight *.ASM \ No newline at end of file diff --git a/tests/benchs/acc.run b/tests/benchs/acc.run new file mode 100755 index 0000000..d06dfb9 --- /dev/null +++ b/tests/benchs/acc.run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# On MIPS Debian, I had trouble loading cparser.so file... +# FIXME: This should be investigated. +LD_LIBRARY_PATH=../../lib:$LD_LIBRARY_PATH ../../acc -no-annotation $* diff --git a/tests/benchs/badsort.c b/tests/benchs/badsort.c new file mode 100644 index 0000000..7440397 --- /dev/null +++ b/tests/benchs/badsort.c @@ -0,0 +1,85 @@ + +/* function badsort: sorting algorithm of quadratic complexity + ran 10000000 times on 3 lists of size 100 */ + + +int tab1[] = + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99}; +int tab2[] = + {99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, + 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, + 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, + 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, + 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, + 2, 1, 0}; + +int min (int tab[], int size, int n) { + int i, min_index, min; + + if (size == 0) return 0; + + min_index = n; + min = tab[min_index]; + for (i = n+1 ; i < size ; i++) { + if (tab[i] < min) { + min_index = i; + min = tab[min_index]; + } + } + + return min_index; +} + +void swap (int tab[], int i, int j) { + int t; + t = tab[i] ; tab[i] = tab[j] ; tab[j] = t; +} + +void badsort(int tab[], int size) { + int i, min_index; + + for (i = 0 ; i < size ; i++) { + min_index = min(tab, size, i); + swap(tab, i, min_index); + } +} + +void copy (int dest[], int src[], int size) { + int i; + + for (i = 0 ; i < size ; i++) + dest[i] = src[i]; +} + +void run (int tab[]) { + int size, tmp[100]; + + size = sizeof(tab) / sizeof(int); + copy(tmp, tab, size); + badsort(tmp, size); +} + +int main () { + int i; + int tab3[] = + {-21, 19, -26, -62, -72, 33, -14, 20, 85, 92, -26, -33, 38, -14, -88, -35, + -51, 29, -84, -98, -92, -60, -52, 53, 53, -11, -99, 72, -55, 90, -83, 98, + 29, -25, -32, -33, -98, 14, -86, 99, 77, -38, -1, -7, -98, 57, 5, -64, 72, + 60, -5, -66, -7, -84, -97, 92, 2, 11, 70, -27, -56, -16, -81, 86, 27, 24, + 68, -54, -15, -45, 60, 25, -31, 67, 7, -14, -41, -67, 51, -27, -1, -98, + -97, -16, -41, 33, -8, -45, 48, -44, -1, 56, -70, 59, -60, 64, 5, 32, 86, + -72}; + + for (i = 0 ; i < 10000000 ; i++) { + run(tab1); + run(tab2); + run(tab3); + } + + return 0; +} diff --git a/tests/benchs/fib.c b/tests/benchs/fib.c new file mode 100644 index 0000000..40e8ba4 --- /dev/null +++ b/tests/benchs/fib.c @@ -0,0 +1,20 @@ + +/* Fibonacci function ran 100 times for values 10, 20 and 30 */ + + +int fib (int n) { + if (n < 2) return 1; + else return (fib (n-1) + fib (n-2)); +} + +int main () { + int i, res1, res2, res3; + + for (i = 0 ; i < 100 ; i++) { + res1 = fib (10); + res2 = fib (20); + res3 = fib (30); + } + + return 0; +} diff --git a/tests/benchs/mat_det.c b/tests/benchs/mat_det.c new file mode 100644 index 0000000..16ea23e --- /dev/null +++ b/tests/benchs/mat_det.c @@ -0,0 +1,54 @@ + +/* function det: computes the determinant of a square matrice in exponential + complexity + ran 50 times on 3 matrices of dimension 3*3 */ + + +int mat1[9] = {-5, 2, -2, -10, 7, -1, 4, -8, 5}; +int mat2[9] = {7, -9, 4, 8, 8, 10, -8, 10, 1}; + +void lmatrice (int mat[], int lmat[], int n, int l) { + int i, j, line = 0, m = n-1; + + for (i = 0; i < n ; i++) { + if (i != l) { + for (j = 1 ; j < n ; j++) + lmat[line*m + j-1] = mat[i*n + j]; + line++; + } + } +} + +int det (int mat[], int n) { + int res = 0, signe = 1, i; + int lmat[100]; + + if (n == 0) return 0; + if (n == 1) return mat[0]; + + for (i = 0 ; i < n ; i++) { + lmatrice(mat, lmat, n, i); + /* The real computation has been disable to avoid overflow, but the + complexity is the same. */ + res = det(lmat, n-1); + // res += signe * mat[i] * det(lmat, n-1); + // signe = -signe; + } + + return res; +} + +int main () { + int i, res1, res2, res3; + int size = 9; + + int mat3[9] = {7, -9, 7, 6, -10, -10, -5, -4, 1}; + + for (i = 0 ; i < 50 ; i++) { + res1 = det(mat1, size); + res2 = det(mat2, size); + res3 = det(mat3, size); + } + + return 0; +} diff --git a/tests/benchs/meantime.sh b/tests/benchs/meantime.sh new file mode 100755 index 0000000..9f15890 --- /dev/null +++ b/tests/benchs/meantime.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +RUNS=2 +COUNT=$RUNS +VAL=0. +while [ $COUNT -gt 0 ]; do + R=`/usr/bin/time -f %U $* 2>&1 | tail -n1` + VAL=`echo "print $VAL + $R" | bc` + COUNT=$(($COUNT - 1)) +done +echo "print $VAL / $RUNS" | python diff --git a/tests/benchs/min.c b/tests/benchs/min.c new file mode 100644 index 0000000..1a926ea --- /dev/null +++ b/tests/benchs/min.c @@ -0,0 +1,48 @@ + +/* function min: minimum of a list in linear complexity + ran 100000000 times on 3 lists of size 100 */ + +int tab1[100] = + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99}; +int tab2[100] = + {99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, + 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, + 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, + 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, + 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, + 2, 1, 0}; + +int min (int tab[100]) { + int i, min; + + min = tab[0]; + for (i = 1 ; i < 100 ; i++) { + if (tab[i] < min) min = tab[i]; + } + + return min; +} + +int main () { + int i, sum; + int tab3[100] = + {-21, 19, -26, -62, -72, 33, -14, 20, 85, 92, -26, -33, 38, -14, -88, -35, + -51, 29, -84, -98, -92, -60, -52, 53, 53, -11, -99, 72, -55, 90, -83, 98, + 29, -25, -32, -33, -98, 14, -86, 99, 77, -38, -1, -7, -98, 57, 5, -64, 72, + 60, -5, -66, -7, -84, -97, 92, 2, 11, 70, -27, -56, -16, -81, 86, 27, 24, + 68, -54, -15, -45, 60, 25, -31, 67, 7, -14, -41, -67, 51, -27, -1, -98, + -97, -16, -41, 33, -8, -45, 48, -44, -1, 56, -70, 59, -60, 64, 5, 32, 86, + -72}; + + sum = 0; + for (i = 0 ; i < 100000000 ; i++) { + sum += i & 1 == 0 ? min(tab1) : i & 2 == 0 ? min(tab2) : min(tab3); + } + + return (sum); +} diff --git a/tests/benchs/quicksort.c b/tests/benchs/quicksort.c new file mode 100644 index 0000000..bf541b4 --- /dev/null +++ b/tests/benchs/quicksort.c @@ -0,0 +1,84 @@ + +/* function quicksort: sorting algorithm of n*log(n) complexity + ran 10000000 times on 3 lists of size 100 */ + + +int a1[] = + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99}; +int a2[] = + {99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, + 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, + 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, + 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, + 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, + 2, 1, 0}; + +void swap (int a[], int i, int j) { + int t; + t = a[i] ; a[i] = a[j] ; a[j] = t; +} + +int partition (int a[], int l, int r) { + int pivot, i, j; + pivot = a[l]; + i = l; j = r+1; + + while (1) { + do ++i; while (a[i] <= pivot && i <= r); + do --j; while (a[j] > pivot); + if (i >= j) break; + swap(a, i, j); + } + swap(a, l, j); + return j; +} + +void quickSort (int a[], int l, int r) { + int j; + + if (l < r) { + j = partition(a, l, r); + quickSort(a, l, j-1); + quickSort(a, j+1, r); + } +} + +void copy (int dest[], int src[], int size) { + int i; + + for (i = 0 ; i < size ; i++) + dest[i] = src[i]; +} + +void run (int a[]) { + int size, tab[100]; + + size = sizeof(a) / sizeof(int); + copy(tab, a, size); + quickSort(tab, 0, size-1); +} + +int main () { + int i; + int a3[] = + {-21, 19, -26, -62, -72, 33, -14, 20, 85, 92, -26, -33, 38, -14, -88, -35, + -51, 29, -84, -98, -92, -60, -52, 53, 53, -11, -99, 72, -55, 90, -83, 98, + 29, -25, -32, -33, -98, 14, -86, 99, 77, -38, -1, -7, -98, 57, 5, -64, 72, + 60, -5, -66, -7, -84, -97, 92, 2, 11, 70, -27, -56, -16, -81, 86, 27, 24, + 68, -54, -15, -45, 60, 25, -31, 67, 7, -14, -41, -67, 51, -27, -1, -98, + -97, -16, -41, 33, -8, -45, 48, -44, -1, 56, -70, 59, -60, 64, 5, 32, 86, + -72}; + + for (i = 0 ; i < 10000000 ; i++) { + run(a1); + run(a2); + run(a3); + } + + return 0; +} diff --git a/tests/benchs/search.c b/tests/benchs/search.c new file mode 100644 index 0000000..e3ea9bc --- /dev/null +++ b/tests/benchs/search.c @@ -0,0 +1,59 @@ + +/* function search: element searching in a sorted list in logarithmic complexity + ran 100000000 times on 3 lists of size 100 */ +#define N 100 + +int tab1[] = + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99}; +int tab2[] = + {99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, + 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, + 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, + 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, + 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, + 2, 1, 0}; + +int search (int tab[], int e) { + int i, size, left, right, previous, middle; + + size = 100; + + if (size == 0) return 0; + + left = 0; + right = size; + middle = (left + right) / 2; + while ((middle != left) && (middle != right)) { + if (e == tab[middle]) return 1; + if (e > tab[middle]) left = middle; + else right = middle; + middle = (left + right) / 2; + } + + return 0; +} + +int main () { + int i, search1, search2, search3; + int tab3[] = + {-21, 19, -26, -62, -72, 33, -14, 20, 85, 92, -26, -33, 38, -14, -88, -35, + -51, 29, -84, -98, -92, -60, -52, 53, 53, -11, -99, 72, -55, 90, -83, 98, + 29, -25, -32, -33, -98, 14, -86, 99, 77, -38, -1, -7, -98, 57, 5, -64, 72, + 60, -5, -66, -7, -84, -97, 92, 2, 11, 70, -27, -56, -16, -81, 86, 27, 24, + 68, -54, -15, -45, 60, 25, -31, 67, 7, -14, -41, -67, 51, -27, -1, -98, + -97, -16, -41, 33, -8, -45, 48, -44, -1, 56, -70, 59, -60, 64, 5, 32, 86, + -72}; + + for (i = 0 ; i < 100000000 ; i++) { + search1 = search(tab1, 18); + search2 = search(tab2, -1); + search3 = search(tab3, 36); + } + + return 0; +} diff --git a/tests/clight/Makefile b/tests/clight/Makefile new file mode 100644 index 0000000..cefdd09 --- /dev/null +++ b/tests/clight/Makefile @@ -0,0 +1,73 @@ +# -*- Makefile -*- +.PHONY: prepare-check check clean prepare-expected expected all + +all: check + +-include ../../Makefile.local + +IN_EXT=c +OUT_EXT=ASM +OPTIONS=$(shell if test -f options; then cat options; else echo ""; fi) +PROGRAM=../../$(TARGET) -d $(OPTIONS) + +# Compute the set of input files. +INPUTS=$(shell find . -name "*.$(IN_EXT)") + +OUTPUTS=$(INPUTS:$(IN_EXT)=$(OUT_EXT)) + +# We run the compiler in debugging mode on each input file. +# This will produce an $(OUTEXT) file as well as a lot of +# files that contain execution traces. We check that these +# traces are the ones that are expected. +%.$(OUT_EXT): %.$(IN_EXT) ../../$(TARGET) + @ echo ----------------------------------------\ + -------------------------------------- + @ echo -n Checking $* ... + @ (($(PROGRAM) -d $< 2> $*.log 1> $*.log && (echo OK | tee -a ok-counter)) \ + || (echo "KO"; echo " ($*.log for details)" | tee -a ko-counter)) + @ for i in `ls $** | grep -v expected | grep -v log`; do \ + if [ ! -e $$i.expected ]; then \ + echo No reference to compare to.; \ + if [ x`cat generate` == x1 ]; then \ + echo "Current output becomes expected behavior, as asked."; \ + cp $$i $$i.expected; \ + fi; \ + elif diff -u $$i $$i.expected 2> /dev/null 1> /dev/null; then \ + echo " [OK] $$i" | tee -a ok-counter; \ + else \ + echo " [KO] $$i" | tee -a ko-counter; \ + fi; \ + done + +prepare-check: + @ rm --force ok-counter ko-counter + @ touch ok-counter + @ touch ko-counter + +check: clean prepare-check $(OUTPUTS) + @ cat ok-counter ko-counter > total-counter + @ echo ----------------------------------------\ + -------------------------------------- + @ echo ----------------------------------------\ + -------------------------------------- + @ echo Total: \ + `wc -l ok-counter | cut -f1 -d' '` \ + /`wc -l total-counter | cut -f1 -d' '` + @ echo ----------------------------------------\ + -------------------------------------- + +prepare-expected: + @ GENERATE=1 + @ export GENERATE + @ echo You asked for overwriting of the expected outputs. + @ echo -n "Are you sure? [Y/N] " + @ read R; if [ $$R == "Y" ]; then \ + echo 1 > generate; \ + else \ + echo 0 > generate; \ + fi + +expected: clean prepare-expected check + +clean: + rm --force *.ASM *.Clight *.Cminor *.RTLabs *.RTL *.ERTL *.LTL *.LIN *.log \ No newline at end of file diff --git a/tests/clight/array.ASM.expected b/tests/clight/array.ASM.expected new file mode 100644 index 0000000..94c6af1 --- /dev/null +++ b/tests/clight/array.ASM.expected @@ -0,0 +1,680 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main181 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin array_param +array_param79: +c37: +li $a3, 1 +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c36: +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c35: +c34: +li $a1, 7 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c33: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +c32: +c31: +jr $ra +# end array_param + + +# begin array_mixte +array_mixte223: +addi $sp, $sp, -40 +c30: +li $t0, 0 +move $a3, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c29: +move $t0, $sp +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c28: +move $t0, $sp +li $a3, 2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c27: +move $t0, $sp +li $a3, 3 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c26: +move $t0, $sp +li $a3, 4 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c25: +move $t0, $sp +li $a3, 5 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c24: +move $t0, $sp +li $a3, 6 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c23: +move $t0, $sp +li $a3, 7 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c22: +move $t0, $sp +li $a3, 8 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c21: +move $t0, $sp +li $a3, 9 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c20: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +li $v0, 1 +add $t0, $a3, $v0 +move $a3, $sp +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c19: +move $a3, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +lw $a3, 0($v0) +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c18: +li $a2, 1 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $a2, 0($v0) +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $a2, 0($v0) +c17: +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +addi $sp, $sp, 40 +jr $ra +# end array_mixte + + +# begin array_local +array_local234: +addi $sp, $sp, -40 +c16: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c15: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c14: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c13: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c12: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c11: +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c10: +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c9: +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c8: +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c7: +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +li $a1, 1 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c5: +li $a2, 5 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c4: +c3: +li $a2, 7 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c2: +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +c1: +c0: +addi $sp, $sp, 40 +jr $ra +# end array_local + + +# begin _main +main181: +addi $sp, $sp, -52 +sw $ra, 48($sp) +sw $s1, 44($sp) +sw $s0, 40($sp) +c51: +li $a1, 1 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c50: +li $a2, 2 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c49: +li $a2, 3 +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c48: +li $a2, 4 +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c47: +li $a2, 5 +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c46: +li $a2, 6 +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c45: +li $a2, 7 +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c44: +li $a2, 8 +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c43: +li $a2, 9 +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c42: +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c41: +la $v0, array_local234 +jalr $v0 +move $s0, $v0 +c40: +move $a0, $sp +li $a1, 2 +li $a2, 3 +la $v0, array_mixte223 +jalr $v0 +move $s1, $v0 +c39: +move $a0, $sp +li $a1, 2 +li $a2, 3 +la $v0, array_param79 +jalr $v0 +c38: +add $a0, $s0, $s1 +add $v0, $a0, $v0 +lw $ra, 48($sp) +lw $s1, 44($sp) +lw $s0, 40($sp) +addi $sp, $sp, 52 +jr $ra +# end _main diff --git a/tests/clight/array.Clight.expected b/tests/clight/array.Clight.expected new file mode 100644 index 0000000..ce1ca8a --- /dev/null +++ b/tests/clight/array.Clight.expected @@ -0,0 +1,399 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int array_local(void) +{ + int i; + int j; + int a; + int b; + int tab[10]; + c16: + tab[0] = 0; + c15: + tab[1] = 0; + c14: + tab[2] = 0; + c13: + tab[3] = 0; + c12: + tab[4] = 0; + c11: + tab[5] = 0; + c10: + tab[6] = 0; + c9: + tab[7] = 0; + c8: + tab[8] = 0; + c7: + tab[9] = 0; + c6: + tab[0] = 1; + c5: + tab[1] = 5; + c4: + a = tab[0]; + c3: + tab[1] = 7; + c2: + a = tab[1]; + c1: + b = tab[0]; + c0: + return a; +} + +int array_mixte(int *tab1, int a, int b) +{ + int tab2[10]; + c30: + tab2[0] = 0; + c29: + tab2[1] = 0; + c28: + tab2[2] = 0; + c27: + tab2[3] = 0; + c26: + tab2[4] = 0; + c25: + tab2[5] = 0; + c24: + tab2[6] = 0; + c23: + tab2[7] = 0; + c22: + tab2[8] = 0; + c21: + tab2[9] = 0; + c20: + tab2[a] = tab1[b] + 1; + c19: + tab1[b] = tab2[0]; + c18: + tab1[a] = tab1[1]; + c17: + return tab2[a]; +} + +int array_param(int *tab, int c, int d) +{ + int i; + int j; + int a; + int b; + c37: + tab[0] = 1; + c36: + tab[1] = c; + c35: + a = tab[0]; + c34: + tab[d] = 7; + c33: + a = tab[d]; + c32: + b = tab[0]; + c31: + return a; +} + +int main(void) +{ + int t[10]; + int a; + int b; + int c; + c51: + t[0] = 1; + c50: + t[1] = 2; + c49: + t[2] = 3; + c48: + t[3] = 4; + c47: + t[4] = 5; + c46: + t[5] = 6; + c45: + t[6] = 7; + c44: + t[7] = 8; + c43: + t[8] = 9; + c42: + t[9] = 0; + c41: + a = array_local(); + c40: + b = array_mixte(t, 2, 3); + c39: + c = array_param(t, 2, 3); + c38: + return (a + b) + c; +} + + diff --git a/tests/clight/array.Cminor.expected b/tests/clight/array.Cminor.expected new file mode 100644 index 0000000..e664112 --- /dev/null +++ b/tests/clight/array.Cminor.expected @@ -0,0 +1,541 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"array_local" () : int { + + stack 40; + + var j, i, b, a; + + c16: + int32[&0 + (0 * 4)] = 0; + c15: + int32[&0 + (1 * 4)] = 0; + c14: + int32[&0 + (2 * 4)] = 0; + c13: + int32[&0 + (3 * 4)] = 0; + c12: + int32[&0 + (4 * 4)] = 0; + c11: + int32[&0 + (5 * 4)] = 0; + c10: + int32[&0 + (6 * 4)] = 0; + c9: + int32[&0 + (7 * 4)] = 0; + c8: + int32[&0 + (8 * 4)] = 0; + c7: + int32[&0 + (9 * 4)] = 0; + c6: + int32[&0 + (0 * 4)] = 1; + c5: + int32[&0 + (1 * 4)] = 5; + c4: + a = int32[&0 + (0 * 4)]; + c3: + int32[&0 + (1 * 4)] = 7; + c2: + a = int32[&0 + (1 * 4)]; + c1: + b = int32[&0 + (0 * 4)]; + c0: + return a; + +} + + +"array_mixte" (tab1, a, b) : int -> int -> int -> int { + + stack 40; + + c30: + int32[&0 + (0 * 4)] = 0; + c29: + int32[&0 + (1 * 4)] = 0; + c28: + int32[&0 + (2 * 4)] = 0; + c27: + int32[&0 + (3 * 4)] = 0; + c26: + int32[&0 + (4 * 4)] = 0; + c25: + int32[&0 + (5 * 4)] = 0; + c24: + int32[&0 + (6 * 4)] = 0; + c23: + int32[&0 + (7 * 4)] = 0; + c22: + int32[&0 + (8 * 4)] = 0; + c21: + int32[&0 + (9 * 4)] = 0; + c20: + int32[&0 + (a * 4)] = int32[tab1 + (b * 4)] + 1; + c19: + int32[tab1 + (b * 4)] = int32[&0 + (0 * 4)]; + c18: + int32[tab1 + (a * 4)] = int32[tab1 + (1 * 4)]; + c17: + return int32[&0 + (a * 4)]; + +} + + +"array_param" (tab, c, d) : int -> int -> int -> int { + + stack 0; + + var j, i, b, a; + + c37: + int32[tab + (0 * 4)] = 1; + c36: + int32[tab + (1 * 4)] = c; + c35: + a = int32[tab + (0 * 4)]; + c34: + int32[tab + (d * 4)] = 7; + c33: + a = int32[tab + (d * 4)]; + c32: + b = int32[tab + (0 * 4)]; + c31: + return a; + +} + + +"main" () : int { + + stack 40; + + var c, b, a; + + c51: + int32[&0 + (0 * 4)] = 1; + c50: + int32[&0 + (1 * 4)] = 2; + c49: + int32[&0 + (2 * 4)] = 3; + c48: + int32[&0 + (3 * 4)] = 4; + c47: + int32[&0 + (4 * 4)] = 5; + c46: + int32[&0 + (5 * 4)] = 6; + c45: + int32[&0 + (6 * 4)] = 7; + c44: + int32[&0 + (7 * 4)] = 8; + c43: + int32[&0 + (8 * 4)] = 9; + c42: + int32[&0 + (9 * 4)] = 0; + c41: + a = "array_local"() : int; + c40: + b = "array_mixte"(&0, 2, 3) : int -> int -> int -> int; + c39: + c = "array_param"(&0, 2, 3) : int -> int -> int -> int; + c38: + return (a + b) + c; + +} + + diff --git a/tests/clight/array.ERTL.expected b/tests/clight/array.ERTL.expected new file mode 100644 index 0000000..9ce9ec6 --- /dev/null +++ b/tests/clight/array.ERTL.expected @@ -0,0 +1,1287 @@ +program + +globals 0 + +procedure array_param(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40 +entry array_param79 +array_param79: newframe --> array_param78 +array_param78: move %40, $ra --> array_param77 +array_param77: move %39, $s7 --> array_param76 +array_param76: move %38, $s6 --> array_param75 +array_param75: move %37, $s5 --> array_param74 +array_param74: move %36, $s4 --> array_param73 +array_param73: move %35, $s3 --> array_param72 +array_param72: move %34, $s2 --> array_param71 +array_param71: move %33, $s1 --> array_param70 +array_param70: move %32, $s0 --> array_param69 +array_param69: move %0, $a0 --> array_param68 +array_param68: move %1, $a1 --> array_param67 +array_param67: move %2, $a2 --> array_param66 +array_param66: li %3, 0 --> array_param65 +array_param65: li %4, 0 --> array_param64 +array_param64: li %5, 0 --> array_param63 +array_param63: li %6, 0 --> array_param62 +array_param62: li %8, 0 --> array_param61 +array_param61: li %9, 0 --> array_param60 +array_param60: li %10, 0 --> array_param59 +array_param59: li %11, 0 --> array_param58 +array_param58: li %12, 0 --> array_param57 +array_param57: li %13, 0 --> array_param56 +array_param56: li %14, 0 --> array_param55 +array_param55: li %15, 0 --> array_param54 +array_param54: li %16, 0 --> array_param53 +array_param53: li %17, 0 --> array_param52 +array_param52: li %18, 0 --> array_param51 +array_param51: li %19, 0 --> array_param50 +array_param50: li %20, 0 --> array_param49 +array_param49: li %21, 0 --> array_param48 +array_param48: li %22, 0 --> array_param47 +array_param47: li %23, 0 --> array_param46 +array_param46: li %24, 0 --> array_param45 +array_param45: li %25, 0 --> array_param44 +array_param44: li %26, 0 --> array_param43 +array_param43: li %27, 0 --> array_param42 +array_param42: li %28, 0 --> array_param41 +array_param41: li %29, 0 --> array_param40 +array_param40: li %30, 0 --> array_param39 +array_param39: li %31, 0 --> array_param32 +array_param32: emit c37 --> array_param31 +array_param31: li %22, 1 --> array_param30 +array_param30: li %24, 0 --> array_param29 +array_param29: li %25, 4 --> array_param28 +array_param28: mulo %23, %24, %25 --> array_param27 +array_param27: add %29, %0, %23 --> array_param36 +array_param36: sw %22, 0(%29) --> array_param26 +array_param26: emit c36 --> array_param25 +array_param25: li %20, 1 --> array_param24 +array_param24: li %21, 4 --> array_param23 +array_param23: mulo %19, %20, %21 --> array_param22 +array_param22: add %28, %0, %19 --> array_param35 +array_param35: sw %1, 0(%28) --> array_param21 +array_param21: emit c35 --> array_param20 +array_param20: li %17, 0 --> array_param19 +array_param19: li %18, 4 --> array_param18 +array_param18: mulo %16, %17, %18 --> array_param17 +array_param17: add %27, %0, %16 --> array_param34 +array_param34: lw %6, 0(%27) --> array_param16 +array_param16: emit c34 --> array_param15 +array_param15: li %13, 7 --> array_param14 +array_param14: li %15, 4 --> array_param13 +array_param13: mulo %14, %2, %15 --> array_param12 +array_param12: add %26, %0, %14 --> array_param33 +array_param33: sw %13, 0(%26) --> array_param11 +array_param11: emit c33 --> array_param10 +array_param10: li %12, 4 --> array_param9 +array_param9 : mulo %11, %2, %12 --> array_param8 +array_param8 : add %31, %0, %11 --> array_param38 +array_param38: lw %6, 0(%31) --> array_param7 +array_param7 : emit c32 --> array_param6 +array_param6 : li %9, 0 --> array_param5 +array_param5 : li %10, 4 --> array_param4 +array_param4 : mulo %8, %9, %10 --> array_param3 +array_param3 : add %30, %0, %8 --> array_param37 +array_param37: lw %5, 0(%30) --> array_param2 +array_param2 : emit c31 --> array_param1 +array_param1 : move %7, %6 --> array_param0 +array_param0 : j --> array_param91 +array_param91: move $v0, %7 --> array_param90 +array_param90: move $ra, %40 --> array_param89 +array_param89: move $s7, %39 --> array_param88 +array_param88: move $s6, %38 --> array_param87 +array_param87: move $s5, %37 --> array_param86 +array_param86: move $s4, %36 --> array_param85 +array_param85: move $s3, %35 --> array_param84 +array_param84: move $s2, %34 --> array_param83 +array_param83: move $s1, %33 --> array_param82 +array_param82: move $s0, %32 --> array_param81 +array_param81: delframe --> array_param80 +array_param80: jr $ra (xmits $v0) + +procedure array_mixte(3) +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103 +entry array_mixte223 +array_mixte223: newframe --> array_mixte222 +array_mixte222: move %103, $ra --> array_mixte221 +array_mixte221: move %102, $s7 --> array_mixte220 +array_mixte220: move %101, $s6 --> array_mixte219 +array_mixte219: move %100, $s5 --> array_mixte218 +array_mixte218: move %99, $s4 --> array_mixte217 +array_mixte217: move %98, $s3 --> array_mixte216 +array_mixte216: move %97, $s2 --> array_mixte215 +array_mixte215: move %96, $s1 --> array_mixte214 +array_mixte214: move %95, $s0 --> array_mixte213 +array_mixte213: move %0, $a0 --> array_mixte212 +array_mixte212: move %1, $a1 --> array_mixte211 +array_mixte211: move %2, $a2 --> array_mixte210 +array_mixte210: li %4, 0 --> array_mixte209 +array_mixte209: li %5, 0 --> array_mixte208 +array_mixte208: li %6, 0 --> array_mixte207 +array_mixte207: li %7, 0 --> array_mixte206 +array_mixte206: li %8, 0 --> array_mixte205 +array_mixte205: li %9, 0 --> array_mixte204 +array_mixte204: li %10, 0 --> array_mixte203 +array_mixte203: li %11, 0 --> array_mixte202 +array_mixte202: li %12, 0 --> array_mixte201 +array_mixte201: li %13, 0 --> array_mixte200 +array_mixte200: li %14, 0 --> array_mixte199 +array_mixte199: li %15, 0 --> array_mixte198 +array_mixte198: li %16, 0 --> array_mixte197 +array_mixte197: li %17, 0 --> array_mixte196 +array_mixte196: li %18, 0 --> array_mixte195 +array_mixte195: li %19, 0 --> array_mixte194 +array_mixte194: li %20, 0 --> array_mixte193 +array_mixte193: li %21, 0 --> array_mixte192 +array_mixte192: li %22, 0 --> array_mixte191 +array_mixte191: li %23, 0 --> array_mixte190 +array_mixte190: li %24, 0 --> array_mixte189 +array_mixte189: li %25, 0 --> array_mixte188 +array_mixte188: li %26, 0 --> array_mixte187 +array_mixte187: li %27, 0 --> array_mixte186 +array_mixte186: li %28, 0 --> array_mixte185 +array_mixte185: li %29, 0 --> array_mixte184 +array_mixte184: li %30, 0 --> array_mixte183 +array_mixte183: li %31, 0 --> array_mixte182 +array_mixte182: li %32, 0 --> array_mixte181 +array_mixte181: li %33, 0 --> array_mixte180 +array_mixte180: li %34, 0 --> array_mixte179 +array_mixte179: li %35, 0 --> array_mixte178 +array_mixte178: li %36, 0 --> array_mixte177 +array_mixte177: li %37, 0 --> array_mixte176 +array_mixte176: li %38, 0 --> array_mixte175 +array_mixte175: li %39, 0 --> array_mixte174 +array_mixte174: li %40, 0 --> array_mixte173 +array_mixte173: li %41, 0 --> array_mixte172 +array_mixte172: li %42, 0 --> array_mixte171 +array_mixte171: li %43, 0 --> array_mixte170 +array_mixte170: li %44, 0 --> array_mixte169 +array_mixte169: li %45, 0 --> array_mixte168 +array_mixte168: li %46, 0 --> array_mixte167 +array_mixte167: li %47, 0 --> array_mixte166 +array_mixte166: li %48, 0 --> array_mixte165 +array_mixte165: li %49, 0 --> array_mixte164 +array_mixte164: li %50, 0 --> array_mixte163 +array_mixte163: li %51, 0 --> array_mixte162 +array_mixte162: li %52, 0 --> array_mixte161 +array_mixte161: li %53, 0 --> array_mixte160 +array_mixte160: li %54, 0 --> array_mixte159 +array_mixte159: li %55, 0 --> array_mixte158 +array_mixte158: li %56, 0 --> array_mixte157 +array_mixte157: li %57, 0 --> array_mixte156 +array_mixte156: li %58, 0 --> array_mixte155 +array_mixte155: li %59, 0 --> array_mixte154 +array_mixte154: li %60, 0 --> array_mixte153 +array_mixte153: li %61, 0 --> array_mixte152 +array_mixte152: li %62, 0 --> array_mixte151 +array_mixte151: li %63, 0 --> array_mixte150 +array_mixte150: li %64, 0 --> array_mixte149 +array_mixte149: li %65, 0 --> array_mixte148 +array_mixte148: li %66, 0 --> array_mixte147 +array_mixte147: li %67, 0 --> array_mixte146 +array_mixte146: li %68, 0 --> array_mixte145 +array_mixte145: li %69, 0 --> array_mixte144 +array_mixte144: li %70, 0 --> array_mixte143 +array_mixte143: li %71, 0 --> array_mixte142 +array_mixte142: li %72, 0 --> array_mixte141 +array_mixte141: li %73, 0 --> array_mixte140 +array_mixte140: li %74, 0 --> array_mixte139 +array_mixte139: li %75, 0 --> array_mixte138 +array_mixte138: li %76, 0 --> array_mixte137 +array_mixte137: li %77, 0 --> array_mixte136 +array_mixte136: li %78, 0 --> array_mixte135 +array_mixte135: li %79, 0 --> array_mixte134 +array_mixte134: li %80, 0 --> array_mixte133 +array_mixte133: li %81, 0 --> array_mixte132 +array_mixte132: li %82, 0 --> array_mixte131 +array_mixte131: li %83, 0 --> array_mixte130 +array_mixte130: li %84, 0 --> array_mixte129 +array_mixte129: li %85, 0 --> array_mixte128 +array_mixte128: li %86, 0 --> array_mixte127 +array_mixte127: li %87, 0 --> array_mixte126 +array_mixte126: li %88, 0 --> array_mixte125 +array_mixte125: li %89, 0 --> array_mixte124 +array_mixte124: li %90, 0 --> array_mixte123 +array_mixte123: li %91, 0 --> array_mixte122 +array_mixte122: li %92, 0 --> array_mixte121 +array_mixte121: li %93, 0 --> array_mixte120 +array_mixte120: li %94, 0 --> array_mixte102 +array_mixte102: emit c30 --> array_mixte101 +array_mixte101: li %73, 0 --> array_mixte100 +array_mixte100: move %74, $sp --> array_mixte236 +array_mixte236: move %74, %74 --> array_mixte99 +array_mixte99 : li %76, 0 --> array_mixte98 +array_mixte98 : li %77, 4 --> array_mixte97 +array_mixte97 : mulo %75, %76, %77 --> array_mixte96 +array_mixte96 : add %94, %74, %75 --> array_mixte119 +array_mixte119: sw %73, 0(%94) --> array_mixte95 +array_mixte95 : emit c29 --> array_mixte94 +array_mixte94 : li %68, 0 --> array_mixte93 +array_mixte93 : move %69, $sp --> array_mixte248 +array_mixte248: move %69, %69 --> array_mixte92 +array_mixte92 : li %71, 1 --> array_mixte91 +array_mixte91 : li %72, 4 --> array_mixte90 +array_mixte90 : mulo %70, %71, %72 --> array_mixte89 +array_mixte89 : add %92, %69, %70 --> array_mixte117 +array_mixte117: sw %68, 0(%92) --> array_mixte88 +array_mixte88 : emit c28 --> array_mixte87 +array_mixte87 : li %63, 0 --> array_mixte86 +array_mixte86 : move %64, $sp --> array_mixte247 +array_mixte247: move %64, %64 --> array_mixte85 +array_mixte85 : li %66, 2 --> array_mixte84 +array_mixte84 : li %67, 4 --> array_mixte83 +array_mixte83 : mulo %65, %66, %67 --> array_mixte82 +array_mixte82 : add %91, %64, %65 --> array_mixte116 +array_mixte116: sw %63, 0(%91) --> array_mixte81 +array_mixte81 : emit c27 --> array_mixte80 +array_mixte80 : li %58, 0 --> array_mixte79 +array_mixte79 : move %59, $sp --> array_mixte246 +array_mixte246: move %59, %59 --> array_mixte78 +array_mixte78 : li %61, 3 --> array_mixte77 +array_mixte77 : li %62, 4 --> array_mixte76 +array_mixte76 : mulo %60, %61, %62 --> array_mixte75 +array_mixte75 : add %90, %59, %60 --> array_mixte115 +array_mixte115: sw %58, 0(%90) --> array_mixte74 +array_mixte74 : emit c26 --> array_mixte73 +array_mixte73 : li %53, 0 --> array_mixte72 +array_mixte72 : move %54, $sp --> array_mixte245 +array_mixte245: move %54, %54 --> array_mixte71 +array_mixte71 : li %56, 4 --> array_mixte70 +array_mixte70 : li %57, 4 --> array_mixte69 +array_mixte69 : mulo %55, %56, %57 --> array_mixte68 +array_mixte68 : add %89, %54, %55 --> array_mixte114 +array_mixte114: sw %53, 0(%89) --> array_mixte67 +array_mixte67 : emit c25 --> array_mixte66 +array_mixte66 : li %48, 0 --> array_mixte65 +array_mixte65 : move %49, $sp --> array_mixte244 +array_mixte244: move %49, %49 --> array_mixte64 +array_mixte64 : li %51, 5 --> array_mixte63 +array_mixte63 : li %52, 4 --> array_mixte62 +array_mixte62 : mulo %50, %51, %52 --> array_mixte61 +array_mixte61 : add %88, %49, %50 --> array_mixte113 +array_mixte113: sw %48, 0(%88) --> array_mixte60 +array_mixte60 : emit c24 --> array_mixte59 +array_mixte59 : li %43, 0 --> array_mixte58 +array_mixte58 : move %44, $sp --> array_mixte243 +array_mixte243: move %44, %44 --> array_mixte57 +array_mixte57 : li %46, 6 --> array_mixte56 +array_mixte56 : li %47, 4 --> array_mixte55 +array_mixte55 : mulo %45, %46, %47 --> array_mixte54 +array_mixte54 : add %86, %44, %45 --> array_mixte111 +array_mixte111: sw %43, 0(%86) --> array_mixte53 +array_mixte53 : emit c23 --> array_mixte52 +array_mixte52 : li %38, 0 --> array_mixte51 +array_mixte51 : move %39, $sp --> array_mixte242 +array_mixte242: move %39, %39 --> array_mixte50 +array_mixte50 : li %41, 7 --> array_mixte49 +array_mixte49 : li %42, 4 --> array_mixte48 +array_mixte48 : mulo %40, %41, %42 --> array_mixte47 +array_mixte47 : add %85, %39, %40 --> array_mixte110 +array_mixte110: sw %38, 0(%85) --> array_mixte46 +array_mixte46 : emit c22 --> array_mixte45 +array_mixte45 : li %33, 0 --> array_mixte44 +array_mixte44 : move %34, $sp --> array_mixte241 +array_mixte241: move %34, %34 --> array_mixte43 +array_mixte43 : li %36, 8 --> array_mixte42 +array_mixte42 : li %37, 4 --> array_mixte41 +array_mixte41 : mulo %35, %36, %37 --> array_mixte40 +array_mixte40 : add %84, %34, %35 --> array_mixte109 +array_mixte109: sw %33, 0(%84) --> array_mixte39 +array_mixte39 : emit c21 --> array_mixte38 +array_mixte38 : li %28, 0 --> array_mixte37 +array_mixte37 : move %29, $sp --> array_mixte239 +array_mixte239: move %29, %29 --> array_mixte36 +array_mixte36 : li %31, 9 --> array_mixte35 +array_mixte35 : li %32, 4 --> array_mixte34 +array_mixte34 : mulo %30, %31, %32 --> array_mixte33 +array_mixte33 : add %83, %29, %30 --> array_mixte108 +array_mixte108: sw %28, 0(%83) --> array_mixte32 +array_mixte32 : emit c20 --> array_mixte31 +array_mixte31 : li %27, 4 --> array_mixte30 +array_mixte30 : mulo %26, %2, %27 --> array_mixte29 +array_mixte29 : add %82, %0, %26 --> array_mixte107 +array_mixte107: lw %24, 0(%82) --> array_mixte28 +array_mixte28 : li %25, 1 --> array_mixte27 +array_mixte27 : add %20, %24, %25 --> array_mixte26 +array_mixte26 : move %21, $sp --> array_mixte238 +array_mixte238: move %21, %21 --> array_mixte25 +array_mixte25 : li %23, 4 --> array_mixte24 +array_mixte24 : mulo %22, %1, %23 --> array_mixte23 +array_mixte23 : add %81, %21, %22 --> array_mixte106 +array_mixte106: sw %20, 0(%81) --> array_mixte22 +array_mixte22 : emit c19 --> array_mixte21 +array_mixte21 : move %16, $sp --> array_mixte237 +array_mixte237: move %16, %16 --> array_mixte20 +array_mixte20 : li %18, 0 --> array_mixte19 +array_mixte19 : li %19, 4 --> array_mixte18 +array_mixte18 : mulo %17, %18, %19 --> array_mixte17 +array_mixte17 : add %80, %16, %17 --> array_mixte105 +array_mixte105: lw %13, 0(%80) --> array_mixte16 +array_mixte16 : li %15, 4 --> array_mixte15 +array_mixte15 : mulo %14, %2, %15 --> array_mixte14 +array_mixte14 : add %79, %0, %14 --> array_mixte104 +array_mixte104: sw %13, 0(%79) --> array_mixte13 +array_mixte13 : emit c18 --> array_mixte12 +array_mixte12 : li %11, 1 --> array_mixte11 +array_mixte11 : li %12, 4 --> array_mixte10 +array_mixte10 : mulo %10, %11, %12 --> array_mixte9 +array_mixte9 : add %93, %0, %10 --> array_mixte118 +array_mixte118: lw %7, 0(%93) --> array_mixte8 +array_mixte8 : li %9, 4 --> array_mixte7 +array_mixte7 : mulo %8, %1, %9 --> array_mixte6 +array_mixte6 : add %87, %0, %8 --> array_mixte112 +array_mixte112: sw %7, 0(%87) --> array_mixte5 +array_mixte5 : emit c17 --> array_mixte4 +array_mixte4 : move %4, $sp --> array_mixte240 +array_mixte240: move %4, %4 --> array_mixte3 +array_mixte3 : li %6, 4 --> array_mixte2 +array_mixte2 : mulo %5, %1, %6 --> array_mixte1 +array_mixte1 : add %78, %4, %5 --> array_mixte103 +array_mixte103: lw %3, 0(%78) --> array_mixte0 +array_mixte0 : j --> array_mixte235 +array_mixte235: move $v0, %3 --> array_mixte234 +array_mixte234: move $ra, %103 --> array_mixte233 +array_mixte233: move $s7, %102 --> array_mixte232 +array_mixte232: move $s6, %101 --> array_mixte231 +array_mixte231: move $s5, %100 --> array_mixte230 +array_mixte230: move $s4, %99 --> array_mixte229 +array_mixte229: move $s3, %98 --> array_mixte228 +array_mixte228: move $s2, %97 --> array_mixte227 +array_mixte227: move $s1, %96 --> array_mixte226 +array_mixte226: move $s0, %95 --> array_mixte225 +array_mixte225: delframe --> array_mixte224 +array_mixte224: jr $ra (xmits $v0) + +procedure array_local(0) +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106 +entry array_local234 +array_local234: newframe --> array_local233 +array_local233: move %106, $ra --> array_local232 +array_local232: move %105, $s7 --> array_local231 +array_local231: move %104, $s6 --> array_local230 +array_local230: move %103, $s5 --> array_local229 +array_local229: move %102, $s4 --> array_local228 +array_local228: move %101, $s3 --> array_local227 +array_local227: move %100, $s2 --> array_local226 +array_local226: move %99, $s1 --> array_local225 +array_local225: move %98, $s0 --> array_local224 +array_local224: li %0, 0 --> array_local223 +array_local223: li %1, 0 --> array_local222 +array_local222: li %2, 0 --> array_local221 +array_local221: li %3, 0 --> array_local220 +array_local220: li %5, 0 --> array_local219 +array_local219: li %6, 0 --> array_local218 +array_local218: li %7, 0 --> array_local217 +array_local217: li %8, 0 --> array_local216 +array_local216: li %9, 0 --> array_local215 +array_local215: li %10, 0 --> array_local214 +array_local214: li %11, 0 --> array_local213 +array_local213: li %12, 0 --> array_local212 +array_local212: li %13, 0 --> array_local211 +array_local211: li %14, 0 --> array_local210 +array_local210: li %15, 0 --> array_local209 +array_local209: li %16, 0 --> array_local208 +array_local208: li %17, 0 --> array_local207 +array_local207: li %18, 0 --> array_local206 +array_local206: li %19, 0 --> array_local205 +array_local205: li %20, 0 --> array_local204 +array_local204: li %21, 0 --> array_local203 +array_local203: li %22, 0 --> array_local202 +array_local202: li %23, 0 --> array_local201 +array_local201: li %24, 0 --> array_local200 +array_local200: li %25, 0 --> array_local199 +array_local199: li %26, 0 --> array_local198 +array_local198: li %27, 0 --> array_local197 +array_local197: li %28, 0 --> array_local196 +array_local196: li %29, 0 --> array_local195 +array_local195: li %30, 0 --> array_local194 +array_local194: li %31, 0 --> array_local193 +array_local193: li %32, 0 --> array_local192 +array_local192: li %33, 0 --> array_local191 +array_local191: li %34, 0 --> array_local190 +array_local190: li %35, 0 --> array_local189 +array_local189: li %36, 0 --> array_local188 +array_local188: li %37, 0 --> array_local187 +array_local187: li %38, 0 --> array_local186 +array_local186: li %39, 0 --> array_local185 +array_local185: li %40, 0 --> array_local184 +array_local184: li %41, 0 --> array_local183 +array_local183: li %42, 0 --> array_local182 +array_local182: li %43, 0 --> array_local181 +array_local181: li %44, 0 --> array_local180 +array_local180: li %45, 0 --> array_local179 +array_local179: li %46, 0 --> array_local178 +array_local178: li %47, 0 --> array_local177 +array_local177: li %48, 0 --> array_local176 +array_local176: li %49, 0 --> array_local175 +array_local175: li %50, 0 --> array_local174 +array_local174: li %51, 0 --> array_local173 +array_local173: li %52, 0 --> array_local172 +array_local172: li %53, 0 --> array_local171 +array_local171: li %54, 0 --> array_local170 +array_local170: li %55, 0 --> array_local169 +array_local169: li %56, 0 --> array_local168 +array_local168: li %57, 0 --> array_local167 +array_local167: li %58, 0 --> array_local166 +array_local166: li %59, 0 --> array_local165 +array_local165: li %60, 0 --> array_local164 +array_local164: li %61, 0 --> array_local163 +array_local163: li %62, 0 --> array_local162 +array_local162: li %63, 0 --> array_local161 +array_local161: li %64, 0 --> array_local160 +array_local160: li %65, 0 --> array_local159 +array_local159: li %66, 0 --> array_local158 +array_local158: li %67, 0 --> array_local157 +array_local157: li %68, 0 --> array_local156 +array_local156: li %69, 0 --> array_local155 +array_local155: li %70, 0 --> array_local154 +array_local154: li %71, 0 --> array_local153 +array_local153: li %72, 0 --> array_local152 +array_local152: li %73, 0 --> array_local151 +array_local151: li %74, 0 --> array_local150 +array_local150: li %75, 0 --> array_local149 +array_local149: li %76, 0 --> array_local148 +array_local148: li %77, 0 --> array_local147 +array_local147: li %78, 0 --> array_local146 +array_local146: li %79, 0 --> array_local145 +array_local145: li %80, 0 --> array_local144 +array_local144: li %81, 0 --> array_local143 +array_local143: li %82, 0 --> array_local142 +array_local142: li %83, 0 --> array_local141 +array_local141: li %84, 0 --> array_local140 +array_local140: li %85, 0 --> array_local139 +array_local139: li %86, 0 --> array_local138 +array_local138: li %87, 0 --> array_local137 +array_local137: li %88, 0 --> array_local136 +array_local136: li %89, 0 --> array_local135 +array_local135: li %90, 0 --> array_local134 +array_local134: li %91, 0 --> array_local133 +array_local133: li %92, 0 --> array_local132 +array_local132: li %93, 0 --> array_local131 +array_local131: li %94, 0 --> array_local130 +array_local130: li %95, 0 --> array_local129 +array_local129: li %96, 0 --> array_local128 +array_local128: li %97, 0 --> array_local111 +array_local111: emit c16 --> array_local110 +array_local110: li %77, 0 --> array_local109 +array_local109: move %78, $sp --> array_local248 +array_local248: move %78, %78 --> array_local108 +array_local108: li %80, 0 --> array_local107 +array_local107: li %81, 4 --> array_local106 +array_local106: mulo %79, %80, %81 --> array_local105 +array_local105: add %82, %78, %79 --> array_local112 +array_local112: sw %77, 0(%82) --> array_local104 +array_local104: emit c15 --> array_local103 +array_local103: li %72, 0 --> array_local102 +array_local102: move %73, $sp --> array_local247 +array_local247: move %73, %73 --> array_local101 +array_local101: li %75, 1 --> array_local100 +array_local100: li %76, 4 --> array_local99 +array_local99 : mulo %74, %75, %76 --> array_local98 +array_local98 : add %97, %73, %74 --> array_local127 +array_local127: sw %72, 0(%97) --> array_local97 +array_local97 : emit c14 --> array_local96 +array_local96 : li %67, 0 --> array_local95 +array_local95 : move %68, $sp --> array_local262 +array_local262: move %68, %68 --> array_local94 +array_local94 : li %70, 2 --> array_local93 +array_local93 : li %71, 4 --> array_local92 +array_local92 : mulo %69, %70, %71 --> array_local91 +array_local91 : add %96, %68, %69 --> array_local126 +array_local126: sw %67, 0(%96) --> array_local90 +array_local90 : emit c13 --> array_local89 +array_local89 : li %62, 0 --> array_local88 +array_local88 : move %63, $sp --> array_local261 +array_local261: move %63, %63 --> array_local87 +array_local87 : li %65, 3 --> array_local86 +array_local86 : li %66, 4 --> array_local85 +array_local85 : mulo %64, %65, %66 --> array_local84 +array_local84 : add %94, %63, %64 --> array_local124 +array_local124: sw %62, 0(%94) --> array_local83 +array_local83 : emit c12 --> array_local82 +array_local82 : li %57, 0 --> array_local81 +array_local81 : move %58, $sp --> array_local260 +array_local260: move %58, %58 --> array_local80 +array_local80 : li %60, 4 --> array_local79 +array_local79 : li %61, 4 --> array_local78 +array_local78 : mulo %59, %60, %61 --> array_local77 +array_local77 : add %93, %58, %59 --> array_local123 +array_local123: sw %57, 0(%93) --> array_local76 +array_local76 : emit c11 --> array_local75 +array_local75 : li %52, 0 --> array_local74 +array_local74 : move %53, $sp --> array_local259 +array_local259: move %53, %53 --> array_local73 +array_local73 : li %55, 5 --> array_local72 +array_local72 : li %56, 4 --> array_local71 +array_local71 : mulo %54, %55, %56 --> array_local70 +array_local70 : add %92, %53, %54 --> array_local122 +array_local122: sw %52, 0(%92) --> array_local69 +array_local69 : emit c10 --> array_local68 +array_local68 : li %47, 0 --> array_local67 +array_local67 : move %48, $sp --> array_local257 +array_local257: move %48, %48 --> array_local66 +array_local66 : li %50, 6 --> array_local65 +array_local65 : li %51, 4 --> array_local64 +array_local64 : mulo %49, %50, %51 --> array_local63 +array_local63 : add %91, %48, %49 --> array_local121 +array_local121: sw %47, 0(%91) --> array_local62 +array_local62 : emit c9 --> array_local61 +array_local61 : li %42, 0 --> array_local60 +array_local60 : move %43, $sp --> array_local256 +array_local256: move %43, %43 --> array_local59 +array_local59 : li %45, 7 --> array_local58 +array_local58 : li %46, 4 --> array_local57 +array_local57 : mulo %44, %45, %46 --> array_local56 +array_local56 : add %90, %43, %44 --> array_local120 +array_local120: sw %42, 0(%90) --> array_local55 +array_local55 : emit c8 --> array_local54 +array_local54 : li %37, 0 --> array_local53 +array_local53 : move %38, $sp --> array_local255 +array_local255: move %38, %38 --> array_local52 +array_local52 : li %40, 8 --> array_local51 +array_local51 : li %41, 4 --> array_local50 +array_local50 : mulo %39, %40, %41 --> array_local49 +array_local49 : add %89, %38, %39 --> array_local119 +array_local119: sw %37, 0(%89) --> array_local48 +array_local48 : emit c7 --> array_local47 +array_local47 : li %32, 0 --> array_local46 +array_local46 : move %33, $sp --> array_local254 +array_local254: move %33, %33 --> array_local45 +array_local45 : li %35, 9 --> array_local44 +array_local44 : li %36, 4 --> array_local43 +array_local43 : mulo %34, %35, %36 --> array_local42 +array_local42 : add %88, %33, %34 --> array_local118 +array_local118: sw %32, 0(%88) --> array_local41 +array_local41 : emit c6 --> array_local40 +array_local40 : li %27, 1 --> array_local39 +array_local39 : move %28, $sp --> array_local253 +array_local253: move %28, %28 --> array_local38 +array_local38 : li %30, 0 --> array_local37 +array_local37 : li %31, 4 --> array_local36 +array_local36 : mulo %29, %30, %31 --> array_local35 +array_local35 : add %87, %28, %29 --> array_local117 +array_local117: sw %27, 0(%87) --> array_local34 +array_local34 : emit c5 --> array_local33 +array_local33 : li %22, 5 --> array_local32 +array_local32 : move %23, $sp --> array_local252 +array_local252: move %23, %23 --> array_local31 +array_local31 : li %25, 1 --> array_local30 +array_local30 : li %26, 4 --> array_local29 +array_local29 : mulo %24, %25, %26 --> array_local28 +array_local28 : add %85, %23, %24 --> array_local115 +array_local115: sw %22, 0(%85) --> array_local27 +array_local27 : emit c4 --> array_local26 +array_local26 : move %18, $sp --> array_local251 +array_local251: move %18, %18 --> array_local25 +array_local25 : li %20, 0 --> array_local24 +array_local24 : li %21, 4 --> array_local23 +array_local23 : mulo %19, %20, %21 --> array_local22 +array_local22 : add %84, %18, %19 --> array_local114 +array_local114: lw %3, 0(%84) --> array_local21 +array_local21 : emit c3 --> array_local20 +array_local20 : li %13, 7 --> array_local19 +array_local19 : move %14, $sp --> array_local250 +array_local250: move %14, %14 --> array_local18 +array_local18 : li %16, 1 --> array_local17 +array_local17 : li %17, 4 --> array_local16 +array_local16 : mulo %15, %16, %17 --> array_local15 +array_local15 : add %83, %14, %15 --> array_local113 +array_local113: sw %13, 0(%83) --> array_local14 +array_local14 : emit c2 --> array_local13 +array_local13 : move %9, $sp --> array_local249 +array_local249: move %9, %9 --> array_local12 +array_local12 : li %11, 1 --> array_local11 +array_local11 : li %12, 4 --> array_local10 +array_local10 : mulo %10, %11, %12 --> array_local9 +array_local9 : add %95, %9, %10 --> array_local125 +array_local125: lw %3, 0(%95) --> array_local8 +array_local8 : emit c1 --> array_local7 +array_local7 : move %5, $sp --> array_local258 +array_local258: move %5, %5 --> array_local6 +array_local6 : li %7, 0 --> array_local5 +array_local5 : li %8, 4 --> array_local4 +array_local4 : mulo %6, %7, %8 --> array_local3 +array_local3 : add %86, %5, %6 --> array_local116 +array_local116: lw %2, 0(%86) --> array_local2 +array_local2 : emit c0 --> array_local1 +array_local1 : move %4, %3 --> array_local0 +array_local0 : j --> array_local246 +array_local246: move $v0, %4 --> array_local245 +array_local245: move $ra, %106 --> array_local244 +array_local244: move $s7, %105 --> array_local243 +array_local243: move $s6, %104 --> array_local242 +array_local242: move $s5, %103 --> array_local241 +array_local241: move $s4, %102 --> array_local240 +array_local240: move $s3, %101 --> array_local239 +array_local239: move $s2, %100 --> array_local238 +array_local238: move $s1, %99 --> array_local237 +array_local237: move $s0, %98 --> array_local236 +array_local236: delframe --> array_local235 +array_local235: jr $ra (xmits $v0) + +procedure _main(0) +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82 +entry main181 +main181: newframe --> main180 +main180: move %82, $ra --> main179 +main179: move %81, $s7 --> main178 +main178: move %80, $s6 --> main177 +main177: move %79, $s5 --> main176 +main176: move %78, $s4 --> main175 +main175: move %77, $s3 --> main174 +main174: move %76, $s2 --> main173 +main173: move %75, $s1 --> main172 +main172: move %74, $s0 --> main171 +main171: li %0, 0 --> main170 +main170: li %1, 0 --> main169 +main169: li %2, 0 --> main168 +main168: li %4, 0 --> main167 +main167: li %5, 0 --> main166 +main166: li %6, 0 --> main165 +main165: li %7, 0 --> main164 +main164: li %8, 0 --> main163 +main163: li %9, 0 --> main162 +main162: li %10, 0 --> main161 +main161: li %11, 0 --> main160 +main160: li %12, 0 --> main159 +main159: li %13, 0 --> main158 +main158: li %14, 0 --> main157 +main157: li %15, 0 --> main156 +main156: li %16, 0 --> main155 +main155: li %17, 0 --> main154 +main154: li %18, 0 --> main153 +main153: li %19, 0 --> main152 +main152: li %20, 0 --> main151 +main151: li %21, 0 --> main150 +main150: li %22, 0 --> main149 +main149: li %23, 0 --> main148 +main148: li %24, 0 --> main147 +main147: li %25, 0 --> main146 +main146: li %26, 0 --> main145 +main145: li %27, 0 --> main144 +main144: li %28, 0 --> main143 +main143: li %29, 0 --> main142 +main142: li %30, 0 --> main141 +main141: li %31, 0 --> main140 +main140: li %32, 0 --> main139 +main139: li %33, 0 --> main138 +main138: li %34, 0 --> main137 +main137: li %35, 0 --> main136 +main136: li %36, 0 --> main135 +main135: li %37, 0 --> main134 +main134: li %38, 0 --> main133 +main133: li %39, 0 --> main132 +main132: li %40, 0 --> main131 +main131: li %41, 0 --> main130 +main130: li %42, 0 --> main129 +main129: li %43, 0 --> main128 +main128: li %44, 0 --> main127 +main127: li %45, 0 --> main126 +main126: li %46, 0 --> main125 +main125: li %47, 0 --> main124 +main124: li %48, 0 --> main123 +main123: li %49, 0 --> main122 +main122: li %50, 0 --> main121 +main121: li %51, 0 --> main120 +main120: li %52, 0 --> main119 +main119: li %53, 0 --> main118 +main118: li %54, 0 --> main117 +main117: li %55, 0 --> main116 +main116: li %56, 0 --> main115 +main115: li %57, 0 --> main114 +main114: li %58, 0 --> main113 +main113: li %59, 0 --> main112 +main112: li %60, 0 --> main111 +main111: li %61, 0 --> main110 +main110: li %62, 0 --> main109 +main109: li %63, 0 --> main108 +main108: li %64, 0 --> main107 +main107: li %65, 0 --> main106 +main106: li %66, 0 --> main105 +main105: li %67, 0 --> main104 +main104: li %68, 0 --> main103 +main103: li %69, 0 --> main102 +main102: li %70, 0 --> main101 +main101: li %71, 0 --> main100 +main100: li %72, 0 --> main99 +main99 : li %73, 0 --> main85 +main85 : emit c51 --> main84 +main84 : li %56, 1 --> main83 +main83 : move %57, $sp --> main205 +main205: move %57, %57 --> main82 +main82 : li %59, 0 --> main81 +main81 : li %60, 4 --> main80 +main80 : mulo %58, %59, %60 --> main79 +main79 : add %72, %57, %58 --> main97 +main97 : sw %56, 0(%72) --> main78 +main78 : emit c50 --> main77 +main77 : li %51, 2 --> main76 +main76 : move %52, $sp --> main204 +main204: move %52, %52 --> main75 +main75 : li %54, 1 --> main74 +main74 : li %55, 4 --> main73 +main73 : mulo %53, %54, %55 --> main72 +main72 : add %71, %52, %53 --> main96 +main96 : sw %51, 0(%71) --> main71 +main71 : emit c49 --> main70 +main70 : li %46, 3 --> main69 +main69 : move %47, $sp --> main202 +main202: move %47, %47 --> main68 +main68 : li %49, 2 --> main67 +main67 : li %50, 4 --> main66 +main66 : mulo %48, %49, %50 --> main65 +main65 : add %70, %47, %48 --> main95 +main95 : sw %46, 0(%70) --> main64 +main64 : emit c48 --> main63 +main63 : li %41, 4 --> main62 +main62 : move %42, $sp --> main201 +main201: move %42, %42 --> main61 +main61 : li %44, 3 --> main60 +main60 : li %45, 4 --> main59 +main59 : mulo %43, %44, %45 --> main58 +main58 : add %69, %42, %43 --> main94 +main94 : sw %41, 0(%69) --> main57 +main57 : emit c47 --> main56 +main56 : li %36, 5 --> main55 +main55 : move %37, $sp --> main200 +main200: move %37, %37 --> main54 +main54 : li %39, 4 --> main53 +main53 : li %40, 4 --> main52 +main52 : mulo %38, %39, %40 --> main51 +main51 : add %68, %37, %38 --> main93 +main93 : sw %36, 0(%68) --> main50 +main50 : emit c46 --> main49 +main49 : li %31, 6 --> main48 +main48 : move %32, $sp --> main199 +main199: move %32, %32 --> main47 +main47 : li %34, 5 --> main46 +main46 : li %35, 4 --> main45 +main45 : mulo %33, %34, %35 --> main44 +main44 : add %67, %32, %33 --> main92 +main92 : sw %31, 0(%67) --> main43 +main43 : emit c45 --> main42 +main42 : li %26, 7 --> main41 +main41 : move %27, $sp --> main198 +main198: move %27, %27 --> main40 +main40 : li %29, 6 --> main39 +main39 : li %30, 4 --> main38 +main38 : mulo %28, %29, %30 --> main37 +main37 : add %65, %27, %28 --> main90 +main90 : sw %26, 0(%65) --> main36 +main36 : emit c44 --> main35 +main35 : li %21, 8 --> main34 +main34 : move %22, $sp --> main197 +main197: move %22, %22 --> main33 +main33 : li %24, 7 --> main32 +main32 : li %25, 4 --> main31 +main31 : mulo %23, %24, %25 --> main30 +main30 : add %64, %22, %23 --> main89 +main89 : sw %21, 0(%64) --> main29 +main29 : emit c43 --> main28 +main28 : li %16, 9 --> main27 +main27 : move %17, $sp --> main196 +main196: move %17, %17 --> main26 +main26 : li %19, 8 --> main25 +main25 : li %20, 4 --> main24 +main24 : mulo %18, %19, %20 --> main23 +main23 : add %63, %17, %18 --> main88 +main88 : sw %16, 0(%63) --> main22 +main22 : emit c42 --> main21 +main21 : li %11, 0 --> main20 +main20 : move %12, $sp --> main195 +main195: move %12, %12 --> main19 +main19 : li %14, 9 --> main18 +main18 : li %15, 4 --> main17 +main17 : mulo %13, %14, %15 --> main16 +main16 : add %62, %12, %13 --> main87 +main87 : sw %11, 0(%62) --> main15 +main15 : emit c41 --> main14 +main14 : la %61, array_local --> main86 +main86 : j --> main207 +main207: call %61(0) --> main206 +main206: move %2, $v0 --> main13 +main13 : emit c40 --> main12 +main12 : move %8, $sp --> main194 +main194: move %8, %8 --> main11 +main11 : li %9, 2 --> main10 +main10 : li %10, 3 --> main9 +main9 : la %73, array_mixte --> main98 +main98 : j --> main217 +main217: move $a0, %8 --> main216 +main216: move $a1, %9 --> main215 +main215: move $a2, %10 --> main214 +main214: call %73(3) --> main213 +main213: move %1, $v0 --> main8 +main8 : emit c39 --> main7 +main7 : move %5, $sp --> main203 +main203: move %5, %5 --> main6 +main6 : li %6, 2 --> main5 +main5 : li %7, 3 --> main4 +main4 : la %66, array_param --> main91 +main91 : j --> main212 +main212: move $a0, %5 --> main211 +main211: move $a1, %6 --> main210 +main210: move $a2, %7 --> main209 +main209: call %66(3) --> main208 +main208: move %0, $v0 --> main3 +main3 : emit c38 --> main2 +main2 : add %4, %2, %1 --> main1 +main1 : add %3, %4, %0 --> main0 +main0 : j --> main193 +main193: move $v0, %3 --> main192 +main192: move $ra, %82 --> main191 +main191: move $s7, %81 --> main190 +main190: move $s6, %80 --> main189 +main189: move $s5, %79 --> main188 +main188: move $s4, %78 --> main187 +main187: move $s3, %77 --> main186 +main186: move $s2, %76 --> main185 +main185: move $s1, %75 --> main184 +main184: move $s0, %74 --> main183 +main183: delframe --> main182 +main182: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/array.LIN.expected b/tests/clight/array.LIN.expected new file mode 100644 index 0000000..e6c4722 --- /dev/null +++ b/tests/clight/array.LIN.expected @@ -0,0 +1,767 @@ +program + +globals 0 + +procedure array_param(3) +var 0 +array_param79: +newframe +c37: +li $a3, 1 +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c36: +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c35: +c34: +li $a1, 7 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c33: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +c32: +c31: +delframe +jr $ra + +procedure array_mixte(3) +var 40 +array_mixte223: +newframe +c30: +li $t0, 0 +move $a3, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c29: +move $t0, $sp +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c28: +move $t0, $sp +li $a3, 2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c27: +move $t0, $sp +li $a3, 3 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c26: +move $t0, $sp +li $a3, 4 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c25: +move $t0, $sp +li $a3, 5 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c24: +move $t0, $sp +li $a3, 6 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c23: +move $t0, $sp +li $a3, 7 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c22: +move $t0, $sp +li $a3, 8 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c21: +move $t0, $sp +li $a3, 9 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c20: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +li $v0, 1 +add $t0, $a3, $v0 +move $a3, $sp +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c19: +move $a3, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +lw $a3, 0($v0) +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c18: +li $a2, 1 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $a2, 0($v0) +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $a2, 0($v0) +c17: +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +delframe +jr $ra + +procedure array_local(0) +var 40 +array_local234: +newframe +c16: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c15: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c14: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c13: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c12: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c11: +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c10: +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c9: +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c8: +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c7: +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +li $a1, 1 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c5: +li $a2, 5 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c4: +c3: +li $a2, 7 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c2: +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +c1: +c0: +delframe +jr $ra + +procedure _main(0) +var 52 +main181: +newframe +sw $ra, 48($sp) +sw $s1, 44($sp) +sw $s0, 40($sp) +c51: +li $a1, 1 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c50: +li $a2, 2 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c49: +li $a2, 3 +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c48: +li $a2, 4 +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c47: +li $a2, 5 +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c46: +li $a2, 6 +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c45: +li $a2, 7 +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c44: +li $a2, 8 +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c43: +li $a2, 9 +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c42: +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c41: +la $v0, array_local +call $v0 +move $s0, $v0 +c40: +move $a0, $sp +li $a1, 2 +li $a2, 3 +la $v0, array_mixte +call $v0 +move $s1, $v0 +c39: +move $a0, $sp +li $a1, 2 +li $a2, 3 +la $v0, array_param +call $v0 +c38: +add $a0, $s0, $s1 +add $v0, $a0, $v0 +lw $ra, 48($sp) +lw $s1, 44($sp) +lw $s0, 40($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/array.LTL.expected b/tests/clight/array.LTL.expected new file mode 100644 index 0000000..dae642e --- /dev/null +++ b/tests/clight/array.LTL.expected @@ -0,0 +1,1238 @@ +program + +globals 0 + +procedure array_param(3) +var 0 +entry array_param79 +array_param79: newframe --> array_param78 +array_param78: j --> array_param77 +array_param77: j --> array_param76 +array_param76: j --> array_param75 +array_param75: j --> array_param74 +array_param74: j --> array_param73 +array_param73: j --> array_param72 +array_param72: j --> array_param71 +array_param71: j --> array_param70 +array_param70: j --> array_param69 +array_param69: j --> array_param68 +array_param68: j --> array_param67 +array_param67: j --> array_param66 +array_param66: j --> array_param65 +array_param65: j --> array_param64 +array_param64: j --> array_param63 +array_param63: j --> array_param62 +array_param62: j --> array_param61 +array_param61: j --> array_param60 +array_param60: j --> array_param59 +array_param59: j --> array_param58 +array_param58: j --> array_param57 +array_param57: j --> array_param56 +array_param56: j --> array_param55 +array_param55: j --> array_param54 +array_param54: j --> array_param53 +array_param53: j --> array_param52 +array_param52: j --> array_param51 +array_param51: j --> array_param50 +array_param50: j --> array_param49 +array_param49: j --> array_param48 +array_param48: j --> array_param47 +array_param47: j --> array_param46 +array_param46: j --> array_param45 +array_param45: j --> array_param44 +array_param44: j --> array_param43 +array_param43: j --> array_param42 +array_param42: j --> array_param41 +array_param41: j --> array_param40 +array_param40: j --> array_param39 +array_param39: j --> array_param32 +array_param32: emit c37 --> array_param31 +array_param31: li $a3, 1 --> array_param30 +array_param30: j --> array_param29 +array_param29: li $v0, 4 --> array_param28 +array_param28: mulo $v0, $zero, $v0 --> array_param27 +array_param27: add $v0, $a0, $v0 --> array_param36 +array_param36: lw $a3, 0($v0) --> array_param26 +array_param26: emit c36 --> array_param25 +array_param25: li $a3, 1 --> array_param24 +array_param24: li $v0, 4 --> array_param23 +array_param23: mulo $v0, $a3, $v0 --> array_param22 +array_param22: add $v0, $a0, $v0 --> array_param35 +array_param35: lw $a1, 0($v0) --> array_param21 +array_param21: emit c35 --> array_param20 +array_param20: j --> array_param19 +array_param19: j --> array_param18 +array_param18: j --> array_param17 +array_param17: j --> array_param34 +array_param34: j --> array_param16 +array_param16: emit c34 --> array_param15 +array_param15: li $a1, 7 --> array_param14 +array_param14: li $v0, 4 --> array_param13 +array_param13: mulo $v0, $a2, $v0 --> array_param12 +array_param12: add $v0, $a0, $v0 --> array_param33 +array_param33: lw $a1, 0($v0) --> array_param11 +array_param11: emit c33 --> array_param10 +array_param10: li $v0, 4 --> array_param9 +array_param9 : mulo $v0, $a2, $v0 --> array_param8 +array_param8 : add $v0, $a0, $v0 --> array_param38 +array_param38: lw $v0, 0($v0) --> array_param7 +array_param7 : emit c32 --> array_param6 +array_param6 : j --> array_param5 +array_param5 : j --> array_param4 +array_param4 : j --> array_param3 +array_param3 : j --> array_param37 +array_param37: j --> array_param2 +array_param2 : emit c31 --> array_param1 +array_param1 : j --> array_param0 +array_param0 : j --> array_param91 +array_param91: j --> array_param90 +array_param90: j --> array_param89 +array_param89: j --> array_param88 +array_param88: j --> array_param87 +array_param87: j --> array_param86 +array_param86: j --> array_param85 +array_param85: j --> array_param84 +array_param84: j --> array_param83 +array_param83: j --> array_param82 +array_param82: j --> array_param81 +array_param81: delframe --> array_param80 +array_param80: jr $ra + +procedure array_mixte(3) +var 40 +entry array_mixte223 +array_mixte223: newframe --> array_mixte222 +array_mixte222: j --> array_mixte221 +array_mixte221: j --> array_mixte220 +array_mixte220: j --> array_mixte219 +array_mixte219: j --> array_mixte218 +array_mixte218: j --> array_mixte217 +array_mixte217: j --> array_mixte216 +array_mixte216: j --> array_mixte215 +array_mixte215: j --> array_mixte214 +array_mixte214: j --> array_mixte213 +array_mixte213: j --> array_mixte212 +array_mixte212: j --> array_mixte211 +array_mixte211: j --> array_mixte210 +array_mixte210: j --> array_mixte209 +array_mixte209: j --> array_mixte208 +array_mixte208: j --> array_mixte207 +array_mixte207: j --> array_mixte206 +array_mixte206: j --> array_mixte205 +array_mixte205: j --> array_mixte204 +array_mixte204: j --> array_mixte203 +array_mixte203: j --> array_mixte202 +array_mixte202: j --> array_mixte201 +array_mixte201: j --> array_mixte200 +array_mixte200: j --> array_mixte199 +array_mixte199: j --> array_mixte198 +array_mixte198: j --> array_mixte197 +array_mixte197: j --> array_mixte196 +array_mixte196: j --> array_mixte195 +array_mixte195: j --> array_mixte194 +array_mixte194: j --> array_mixte193 +array_mixte193: j --> array_mixte192 +array_mixte192: j --> array_mixte191 +array_mixte191: j --> array_mixte190 +array_mixte190: j --> array_mixte189 +array_mixte189: j --> array_mixte188 +array_mixte188: j --> array_mixte187 +array_mixte187: j --> array_mixte186 +array_mixte186: j --> array_mixte185 +array_mixte185: j --> array_mixte184 +array_mixte184: j --> array_mixte183 +array_mixte183: j --> array_mixte182 +array_mixte182: j --> array_mixte181 +array_mixte181: j --> array_mixte180 +array_mixte180: j --> array_mixte179 +array_mixte179: j --> array_mixte178 +array_mixte178: j --> array_mixte177 +array_mixte177: j --> array_mixte176 +array_mixte176: j --> array_mixte175 +array_mixte175: j --> array_mixte174 +array_mixte174: j --> array_mixte173 +array_mixte173: j --> array_mixte172 +array_mixte172: j --> array_mixte171 +array_mixte171: j --> array_mixte170 +array_mixte170: j --> array_mixte169 +array_mixte169: j --> array_mixte168 +array_mixte168: j --> array_mixte167 +array_mixte167: j --> array_mixte166 +array_mixte166: j --> array_mixte165 +array_mixte165: j --> array_mixte164 +array_mixte164: j --> array_mixte163 +array_mixte163: j --> array_mixte162 +array_mixte162: j --> array_mixte161 +array_mixte161: j --> array_mixte160 +array_mixte160: j --> array_mixte159 +array_mixte159: j --> array_mixte158 +array_mixte158: j --> array_mixte157 +array_mixte157: j --> array_mixte156 +array_mixte156: j --> array_mixte155 +array_mixte155: j --> array_mixte154 +array_mixte154: j --> array_mixte153 +array_mixte153: j --> array_mixte152 +array_mixte152: j --> array_mixte151 +array_mixte151: j --> array_mixte150 +array_mixte150: j --> array_mixte149 +array_mixte149: j --> array_mixte148 +array_mixte148: j --> array_mixte147 +array_mixte147: j --> array_mixte146 +array_mixte146: j --> array_mixte145 +array_mixte145: j --> array_mixte144 +array_mixte144: j --> array_mixte143 +array_mixte143: j --> array_mixte142 +array_mixte142: j --> array_mixte141 +array_mixte141: j --> array_mixte140 +array_mixte140: j --> array_mixte139 +array_mixte139: j --> array_mixte138 +array_mixte138: j --> array_mixte137 +array_mixte137: j --> array_mixte136 +array_mixte136: j --> array_mixte135 +array_mixte135: j --> array_mixte134 +array_mixte134: j --> array_mixte133 +array_mixte133: j --> array_mixte132 +array_mixte132: j --> array_mixte131 +array_mixte131: j --> array_mixte130 +array_mixte130: j --> array_mixte129 +array_mixte129: j --> array_mixte128 +array_mixte128: j --> array_mixte127 +array_mixte127: j --> array_mixte126 +array_mixte126: j --> array_mixte125 +array_mixte125: j --> array_mixte124 +array_mixte124: j --> array_mixte123 +array_mixte123: j --> array_mixte122 +array_mixte122: j --> array_mixte121 +array_mixte121: j --> array_mixte120 +array_mixte120: j --> array_mixte102 +array_mixte102: emit c30 --> array_mixte101 +array_mixte101: li $t0, 0 --> array_mixte100 +array_mixte100: move $a3, $sp --> array_mixte236 +array_mixte236: j --> array_mixte99 +array_mixte99 : j --> array_mixte98 +array_mixte98 : li $v0, 4 --> array_mixte97 +array_mixte97 : mulo $v0, $zero, $v0 --> array_mixte96 +array_mixte96 : add $v0, $a3, $v0 --> array_mixte119 +array_mixte119: lw $t0, 0($v0) --> array_mixte95 +array_mixte95 : emit c29 --> array_mixte94 +array_mixte94 : j --> array_mixte93 +array_mixte93 : move $t0, $sp --> array_mixte248 +array_mixte248: j --> array_mixte92 +array_mixte92 : li $a3, 1 --> array_mixte91 +array_mixte91 : li $v0, 4 --> array_mixte90 +array_mixte90 : mulo $v0, $a3, $v0 --> array_mixte89 +array_mixte89 : add $v0, $t0, $v0 --> array_mixte117 +array_mixte117: lw $zero, 0($v0) --> array_mixte88 +array_mixte88 : emit c28 --> array_mixte87 +array_mixte87 : j --> array_mixte86 +array_mixte86 : move $t0, $sp --> array_mixte247 +array_mixte247: j --> array_mixte85 +array_mixte85 : li $a3, 2 --> array_mixte84 +array_mixte84 : li $v0, 4 --> array_mixte83 +array_mixte83 : mulo $v0, $a3, $v0 --> array_mixte82 +array_mixte82 : add $v0, $t0, $v0 --> array_mixte116 +array_mixte116: lw $zero, 0($v0) --> array_mixte81 +array_mixte81 : emit c27 --> array_mixte80 +array_mixte80 : j --> array_mixte79 +array_mixte79 : move $t0, $sp --> array_mixte246 +array_mixte246: j --> array_mixte78 +array_mixte78 : li $a3, 3 --> array_mixte77 +array_mixte77 : li $v0, 4 --> array_mixte76 +array_mixte76 : mulo $v0, $a3, $v0 --> array_mixte75 +array_mixte75 : add $v0, $t0, $v0 --> array_mixte115 +array_mixte115: lw $zero, 0($v0) --> array_mixte74 +array_mixte74 : emit c26 --> array_mixte73 +array_mixte73 : j --> array_mixte72 +array_mixte72 : move $t0, $sp --> array_mixte245 +array_mixte245: j --> array_mixte71 +array_mixte71 : li $a3, 4 --> array_mixte70 +array_mixte70 : li $v0, 4 --> array_mixte69 +array_mixte69 : mulo $v0, $a3, $v0 --> array_mixte68 +array_mixte68 : add $v0, $t0, $v0 --> array_mixte114 +array_mixte114: lw $zero, 0($v0) --> array_mixte67 +array_mixte67 : emit c25 --> array_mixte66 +array_mixte66 : j --> array_mixte65 +array_mixte65 : move $t0, $sp --> array_mixte244 +array_mixte244: j --> array_mixte64 +array_mixte64 : li $a3, 5 --> array_mixte63 +array_mixte63 : li $v0, 4 --> array_mixte62 +array_mixte62 : mulo $v0, $a3, $v0 --> array_mixte61 +array_mixte61 : add $v0, $t0, $v0 --> array_mixte113 +array_mixte113: lw $zero, 0($v0) --> array_mixte60 +array_mixte60 : emit c24 --> array_mixte59 +array_mixte59 : j --> array_mixte58 +array_mixte58 : move $t0, $sp --> array_mixte243 +array_mixte243: j --> array_mixte57 +array_mixte57 : li $a3, 6 --> array_mixte56 +array_mixte56 : li $v0, 4 --> array_mixte55 +array_mixte55 : mulo $v0, $a3, $v0 --> array_mixte54 +array_mixte54 : add $v0, $t0, $v0 --> array_mixte111 +array_mixte111: lw $zero, 0($v0) --> array_mixte53 +array_mixte53 : emit c23 --> array_mixte52 +array_mixte52 : j --> array_mixte51 +array_mixte51 : move $t0, $sp --> array_mixte242 +array_mixte242: j --> array_mixte50 +array_mixte50 : li $a3, 7 --> array_mixte49 +array_mixte49 : li $v0, 4 --> array_mixte48 +array_mixte48 : mulo $v0, $a3, $v0 --> array_mixte47 +array_mixte47 : add $v0, $t0, $v0 --> array_mixte110 +array_mixte110: lw $zero, 0($v0) --> array_mixte46 +array_mixte46 : emit c22 --> array_mixte45 +array_mixte45 : j --> array_mixte44 +array_mixte44 : move $t0, $sp --> array_mixte241 +array_mixte241: j --> array_mixte43 +array_mixte43 : li $a3, 8 --> array_mixte42 +array_mixte42 : li $v0, 4 --> array_mixte41 +array_mixte41 : mulo $v0, $a3, $v0 --> array_mixte40 +array_mixte40 : add $v0, $t0, $v0 --> array_mixte109 +array_mixte109: lw $zero, 0($v0) --> array_mixte39 +array_mixte39 : emit c21 --> array_mixte38 +array_mixte38 : j --> array_mixte37 +array_mixte37 : move $t0, $sp --> array_mixte239 +array_mixte239: j --> array_mixte36 +array_mixte36 : li $a3, 9 --> array_mixte35 +array_mixte35 : li $v0, 4 --> array_mixte34 +array_mixte34 : mulo $v0, $a3, $v0 --> array_mixte33 +array_mixte33 : add $v0, $t0, $v0 --> array_mixte108 +array_mixte108: lw $zero, 0($v0) --> array_mixte32 +array_mixte32 : emit c20 --> array_mixte31 +array_mixte31 : li $v0, 4 --> array_mixte30 +array_mixte30 : mulo $v0, $a2, $v0 --> array_mixte29 +array_mixte29 : add $v0, $a0, $v0 --> array_mixte107 +array_mixte107: lw $a3, 0($v0) --> array_mixte28 +array_mixte28 : li $v0, 1 --> array_mixte27 +array_mixte27 : add $t0, $a3, $v0 --> array_mixte26 +array_mixte26 : move $a3, $sp --> array_mixte238 +array_mixte238: j --> array_mixte25 +array_mixte25 : li $v0, 4 --> array_mixte24 +array_mixte24 : mulo $v0, $a1, $v0 --> array_mixte23 +array_mixte23 : add $v0, $a3, $v0 --> array_mixte106 +array_mixte106: lw $t0, 0($v0) --> array_mixte22 +array_mixte22 : emit c19 --> array_mixte21 +array_mixte21 : move $a3, $sp --> array_mixte237 +array_mixte237: j --> array_mixte20 +array_mixte20 : j --> array_mixte19 +array_mixte19 : li $v0, 4 --> array_mixte18 +array_mixte18 : mulo $v0, $zero, $v0 --> array_mixte17 +array_mixte17 : add $v0, $a3, $v0 --> array_mixte105 +array_mixte105: lw $a3, 0($v0) --> array_mixte16 +array_mixte16 : li $v0, 4 --> array_mixte15 +array_mixte15 : mulo $v0, $a2, $v0 --> array_mixte14 +array_mixte14 : add $v0, $a0, $v0 --> array_mixte104 +array_mixte104: lw $a3, 0($v0) --> array_mixte13 +array_mixte13 : emit c18 --> array_mixte12 +array_mixte12 : li $a2, 1 --> array_mixte11 +array_mixte11 : li $v0, 4 --> array_mixte10 +array_mixte10 : mulo $v0, $a2, $v0 --> array_mixte9 +array_mixte9 : add $v0, $a0, $v0 --> array_mixte118 +array_mixte118: lw $a2, 0($v0) --> array_mixte8 +array_mixte8 : li $v0, 4 --> array_mixte7 +array_mixte7 : mulo $v0, $a1, $v0 --> array_mixte6 +array_mixte6 : add $v0, $a0, $v0 --> array_mixte112 +array_mixte112: lw $a2, 0($v0) --> array_mixte5 +array_mixte5 : emit c17 --> array_mixte4 +array_mixte4 : j --> array_mixte240 +array_mixte240: j --> array_mixte3 +array_mixte3 : li $v0, 4 --> array_mixte2 +array_mixte2 : mulo $v0, $a1, $v0 --> array_mixte1 +array_mixte1 : add $v0, $sp, $v0 --> array_mixte103 +array_mixte103: lw $v0, 0($v0) --> array_mixte0 +array_mixte0 : j --> array_mixte235 +array_mixte235: j --> array_mixte234 +array_mixte234: j --> array_mixte233 +array_mixte233: j --> array_mixte232 +array_mixte232: j --> array_mixte231 +array_mixte231: j --> array_mixte230 +array_mixte230: j --> array_mixte229 +array_mixte229: j --> array_mixte228 +array_mixte228: j --> array_mixte227 +array_mixte227: j --> array_mixte226 +array_mixte226: j --> array_mixte225 +array_mixte225: delframe --> array_mixte224 +array_mixte224: jr $ra + +procedure array_local(0) +var 40 +entry array_local234 +array_local234: newframe --> array_local233 +array_local233: j --> array_local232 +array_local232: j --> array_local231 +array_local231: j --> array_local230 +array_local230: j --> array_local229 +array_local229: j --> array_local228 +array_local228: j --> array_local227 +array_local227: j --> array_local226 +array_local226: j --> array_local225 +array_local225: j --> array_local224 +array_local224: j --> array_local223 +array_local223: j --> array_local222 +array_local222: j --> array_local221 +array_local221: j --> array_local220 +array_local220: j --> array_local219 +array_local219: j --> array_local218 +array_local218: j --> array_local217 +array_local217: j --> array_local216 +array_local216: j --> array_local215 +array_local215: j --> array_local214 +array_local214: j --> array_local213 +array_local213: j --> array_local212 +array_local212: j --> array_local211 +array_local211: j --> array_local210 +array_local210: j --> array_local209 +array_local209: j --> array_local208 +array_local208: j --> array_local207 +array_local207: j --> array_local206 +array_local206: j --> array_local205 +array_local205: j --> array_local204 +array_local204: j --> array_local203 +array_local203: j --> array_local202 +array_local202: j --> array_local201 +array_local201: j --> array_local200 +array_local200: j --> array_local199 +array_local199: j --> array_local198 +array_local198: j --> array_local197 +array_local197: j --> array_local196 +array_local196: j --> array_local195 +array_local195: j --> array_local194 +array_local194: j --> array_local193 +array_local193: j --> array_local192 +array_local192: j --> array_local191 +array_local191: j --> array_local190 +array_local190: j --> array_local189 +array_local189: j --> array_local188 +array_local188: j --> array_local187 +array_local187: j --> array_local186 +array_local186: j --> array_local185 +array_local185: j --> array_local184 +array_local184: j --> array_local183 +array_local183: j --> array_local182 +array_local182: j --> array_local181 +array_local181: j --> array_local180 +array_local180: j --> array_local179 +array_local179: j --> array_local178 +array_local178: j --> array_local177 +array_local177: j --> array_local176 +array_local176: j --> array_local175 +array_local175: j --> array_local174 +array_local174: j --> array_local173 +array_local173: j --> array_local172 +array_local172: j --> array_local171 +array_local171: j --> array_local170 +array_local170: j --> array_local169 +array_local169: j --> array_local168 +array_local168: j --> array_local167 +array_local167: j --> array_local166 +array_local166: j --> array_local165 +array_local165: j --> array_local164 +array_local164: j --> array_local163 +array_local163: j --> array_local162 +array_local162: j --> array_local161 +array_local161: j --> array_local160 +array_local160: j --> array_local159 +array_local159: j --> array_local158 +array_local158: j --> array_local157 +array_local157: j --> array_local156 +array_local156: j --> array_local155 +array_local155: j --> array_local154 +array_local154: j --> array_local153 +array_local153: j --> array_local152 +array_local152: j --> array_local151 +array_local151: j --> array_local150 +array_local150: j --> array_local149 +array_local149: j --> array_local148 +array_local148: j --> array_local147 +array_local147: j --> array_local146 +array_local146: j --> array_local145 +array_local145: j --> array_local144 +array_local144: j --> array_local143 +array_local143: j --> array_local142 +array_local142: j --> array_local141 +array_local141: j --> array_local140 +array_local140: j --> array_local139 +array_local139: j --> array_local138 +array_local138: j --> array_local137 +array_local137: j --> array_local136 +array_local136: j --> array_local135 +array_local135: j --> array_local134 +array_local134: j --> array_local133 +array_local133: j --> array_local132 +array_local132: j --> array_local131 +array_local131: j --> array_local130 +array_local130: j --> array_local129 +array_local129: j --> array_local128 +array_local128: j --> array_local111 +array_local111: emit c16 --> array_local110 +array_local110: li $a1, 0 --> array_local109 +array_local109: move $a0, $sp --> array_local248 +array_local248: j --> array_local108 +array_local108: j --> array_local107 +array_local107: li $v0, 4 --> array_local106 +array_local106: mulo $v0, $zero, $v0 --> array_local105 +array_local105: add $v0, $a0, $v0 --> array_local112 +array_local112: lw $a1, 0($v0) --> array_local104 +array_local104: emit c15 --> array_local103 +array_local103: j --> array_local102 +array_local102: move $a1, $sp --> array_local247 +array_local247: j --> array_local101 +array_local101: li $a0, 1 --> array_local100 +array_local100: li $v0, 4 --> array_local99 +array_local99 : mulo $v0, $a0, $v0 --> array_local98 +array_local98 : add $v0, $a1, $v0 --> array_local127 +array_local127: lw $zero, 0($v0) --> array_local97 +array_local97 : emit c14 --> array_local96 +array_local96 : j --> array_local95 +array_local95 : move $a1, $sp --> array_local262 +array_local262: j --> array_local94 +array_local94 : li $a0, 2 --> array_local93 +array_local93 : li $v0, 4 --> array_local92 +array_local92 : mulo $v0, $a0, $v0 --> array_local91 +array_local91 : add $v0, $a1, $v0 --> array_local126 +array_local126: lw $zero, 0($v0) --> array_local90 +array_local90 : emit c13 --> array_local89 +array_local89 : j --> array_local88 +array_local88 : move $a1, $sp --> array_local261 +array_local261: j --> array_local87 +array_local87 : li $a0, 3 --> array_local86 +array_local86 : li $v0, 4 --> array_local85 +array_local85 : mulo $v0, $a0, $v0 --> array_local84 +array_local84 : add $v0, $a1, $v0 --> array_local124 +array_local124: lw $zero, 0($v0) --> array_local83 +array_local83 : emit c12 --> array_local82 +array_local82 : j --> array_local81 +array_local81 : move $a1, $sp --> array_local260 +array_local260: j --> array_local80 +array_local80 : li $a0, 4 --> array_local79 +array_local79 : li $v0, 4 --> array_local78 +array_local78 : mulo $v0, $a0, $v0 --> array_local77 +array_local77 : add $v0, $a1, $v0 --> array_local123 +array_local123: lw $zero, 0($v0) --> array_local76 +array_local76 : emit c11 --> array_local75 +array_local75 : j --> array_local74 +array_local74 : move $a1, $sp --> array_local259 +array_local259: j --> array_local73 +array_local73 : li $a0, 5 --> array_local72 +array_local72 : li $v0, 4 --> array_local71 +array_local71 : mulo $v0, $a0, $v0 --> array_local70 +array_local70 : add $v0, $a1, $v0 --> array_local122 +array_local122: lw $zero, 0($v0) --> array_local69 +array_local69 : emit c10 --> array_local68 +array_local68 : j --> array_local67 +array_local67 : move $a1, $sp --> array_local257 +array_local257: j --> array_local66 +array_local66 : li $a0, 6 --> array_local65 +array_local65 : li $v0, 4 --> array_local64 +array_local64 : mulo $v0, $a0, $v0 --> array_local63 +array_local63 : add $v0, $a1, $v0 --> array_local121 +array_local121: lw $zero, 0($v0) --> array_local62 +array_local62 : emit c9 --> array_local61 +array_local61 : j --> array_local60 +array_local60 : move $a1, $sp --> array_local256 +array_local256: j --> array_local59 +array_local59 : li $a0, 7 --> array_local58 +array_local58 : li $v0, 4 --> array_local57 +array_local57 : mulo $v0, $a0, $v0 --> array_local56 +array_local56 : add $v0, $a1, $v0 --> array_local120 +array_local120: lw $zero, 0($v0) --> array_local55 +array_local55 : emit c8 --> array_local54 +array_local54 : j --> array_local53 +array_local53 : move $a1, $sp --> array_local255 +array_local255: j --> array_local52 +array_local52 : li $a0, 8 --> array_local51 +array_local51 : li $v0, 4 --> array_local50 +array_local50 : mulo $v0, $a0, $v0 --> array_local49 +array_local49 : add $v0, $a1, $v0 --> array_local119 +array_local119: lw $zero, 0($v0) --> array_local48 +array_local48 : emit c7 --> array_local47 +array_local47 : j --> array_local46 +array_local46 : move $a1, $sp --> array_local254 +array_local254: j --> array_local45 +array_local45 : li $a0, 9 --> array_local44 +array_local44 : li $v0, 4 --> array_local43 +array_local43 : mulo $v0, $a0, $v0 --> array_local42 +array_local42 : add $v0, $a1, $v0 --> array_local118 +array_local118: lw $zero, 0($v0) --> array_local41 +array_local41 : emit c6 --> array_local40 +array_local40 : li $a1, 1 --> array_local39 +array_local39 : move $a0, $sp --> array_local253 +array_local253: j --> array_local38 +array_local38 : j --> array_local37 +array_local37 : li $v0, 4 --> array_local36 +array_local36 : mulo $v0, $zero, $v0 --> array_local35 +array_local35 : add $v0, $a0, $v0 --> array_local117 +array_local117: lw $a1, 0($v0) --> array_local34 +array_local34 : emit c5 --> array_local33 +array_local33 : li $a2, 5 --> array_local32 +array_local32 : move $a1, $sp --> array_local252 +array_local252: j --> array_local31 +array_local31 : li $a0, 1 --> array_local30 +array_local30 : li $v0, 4 --> array_local29 +array_local29 : mulo $v0, $a0, $v0 --> array_local28 +array_local28 : add $v0, $a1, $v0 --> array_local115 +array_local115: lw $a2, 0($v0) --> array_local27 +array_local27 : emit c4 --> array_local26 +array_local26 : j --> array_local251 +array_local251: j --> array_local25 +array_local25 : j --> array_local24 +array_local24 : j --> array_local23 +array_local23 : j --> array_local22 +array_local22 : j --> array_local114 +array_local114: j --> array_local21 +array_local21 : emit c3 --> array_local20 +array_local20 : li $a2, 7 --> array_local19 +array_local19 : move $a1, $sp --> array_local250 +array_local250: j --> array_local18 +array_local18 : li $a0, 1 --> array_local17 +array_local17 : li $v0, 4 --> array_local16 +array_local16 : mulo $v0, $a0, $v0 --> array_local15 +array_local15 : add $v0, $a1, $v0 --> array_local113 +array_local113: lw $a2, 0($v0) --> array_local14 +array_local14 : emit c2 --> array_local13 +array_local13 : j --> array_local249 +array_local249: j --> array_local12 +array_local12 : li $a0, 1 --> array_local11 +array_local11 : li $v0, 4 --> array_local10 +array_local10 : mulo $v0, $a0, $v0 --> array_local9 +array_local9 : add $v0, $sp, $v0 --> array_local125 +array_local125: lw $v0, 0($v0) --> array_local8 +array_local8 : emit c1 --> array_local7 +array_local7 : j --> array_local258 +array_local258: j --> array_local6 +array_local6 : j --> array_local5 +array_local5 : j --> array_local4 +array_local4 : j --> array_local3 +array_local3 : j --> array_local116 +array_local116: j --> array_local2 +array_local2 : emit c0 --> array_local1 +array_local1 : j --> array_local0 +array_local0 : j --> array_local246 +array_local246: j --> array_local245 +array_local245: j --> array_local244 +array_local244: j --> array_local243 +array_local243: j --> array_local242 +array_local242: j --> array_local241 +array_local241: j --> array_local240 +array_local240: j --> array_local239 +array_local239: j --> array_local238 +array_local238: j --> array_local237 +array_local237: j --> array_local236 +array_local236: delframe --> array_local235 +array_local235: jr $ra + +procedure _main(0) +var 52 +entry main181 +main181: newframe --> main180 +main180: lw $ra, 48($sp) --> main179 +main179: j --> main178 +main178: j --> main177 +main177: j --> main176 +main176: j --> main175 +main175: j --> main174 +main174: j --> main173 +main173: lw $s1, 44($sp) --> main172 +main172: lw $s0, 40($sp) --> main171 +main171: j --> main170 +main170: j --> main169 +main169: j --> main168 +main168: j --> main167 +main167: j --> main166 +main166: j --> main165 +main165: j --> main164 +main164: j --> main163 +main163: j --> main162 +main162: j --> main161 +main161: j --> main160 +main160: j --> main159 +main159: j --> main158 +main158: j --> main157 +main157: j --> main156 +main156: j --> main155 +main155: j --> main154 +main154: j --> main153 +main153: j --> main152 +main152: j --> main151 +main151: j --> main150 +main150: j --> main149 +main149: j --> main148 +main148: j --> main147 +main147: j --> main146 +main146: j --> main145 +main145: j --> main144 +main144: j --> main143 +main143: j --> main142 +main142: j --> main141 +main141: j --> main140 +main140: j --> main139 +main139: j --> main138 +main138: j --> main137 +main137: j --> main136 +main136: j --> main135 +main135: j --> main134 +main134: j --> main133 +main133: j --> main132 +main132: j --> main131 +main131: j --> main130 +main130: j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: j --> main126 +main126: j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: j --> main122 +main122: j --> main121 +main121: j --> main120 +main120: j --> main119 +main119: j --> main118 +main118: j --> main117 +main117: j --> main116 +main116: j --> main115 +main115: j --> main114 +main114: j --> main113 +main113: j --> main112 +main112: j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: j --> main108 +main108: j --> main107 +main107: j --> main106 +main106: j --> main105 +main105: j --> main104 +main104: j --> main103 +main103: j --> main102 +main102: j --> main101 +main101: j --> main100 +main100: j --> main99 +main99 : j --> main85 +main85 : emit c51 --> main84 +main84 : li $a1, 1 --> main83 +main83 : move $a0, $sp --> main205 +main205: j --> main82 +main82 : j --> main81 +main81 : li $v0, 4 --> main80 +main80 : mulo $v0, $zero, $v0 --> main79 +main79 : add $v0, $a0, $v0 --> main97 +main97 : lw $a1, 0($v0) --> main78 +main78 : emit c50 --> main77 +main77 : li $a2, 2 --> main76 +main76 : move $a1, $sp --> main204 +main204: j --> main75 +main75 : li $a0, 1 --> main74 +main74 : li $v0, 4 --> main73 +main73 : mulo $v0, $a0, $v0 --> main72 +main72 : add $v0, $a1, $v0 --> main96 +main96 : lw $a2, 0($v0) --> main71 +main71 : emit c49 --> main70 +main70 : li $a2, 3 --> main69 +main69 : move $a1, $sp --> main202 +main202: j --> main68 +main68 : li $a0, 2 --> main67 +main67 : li $v0, 4 --> main66 +main66 : mulo $v0, $a0, $v0 --> main65 +main65 : add $v0, $a1, $v0 --> main95 +main95 : lw $a2, 0($v0) --> main64 +main64 : emit c48 --> main63 +main63 : li $a2, 4 --> main62 +main62 : move $a1, $sp --> main201 +main201: j --> main61 +main61 : li $a0, 3 --> main60 +main60 : li $v0, 4 --> main59 +main59 : mulo $v0, $a0, $v0 --> main58 +main58 : add $v0, $a1, $v0 --> main94 +main94 : lw $a2, 0($v0) --> main57 +main57 : emit c47 --> main56 +main56 : li $a2, 5 --> main55 +main55 : move $a1, $sp --> main200 +main200: j --> main54 +main54 : li $a0, 4 --> main53 +main53 : li $v0, 4 --> main52 +main52 : mulo $v0, $a0, $v0 --> main51 +main51 : add $v0, $a1, $v0 --> main93 +main93 : lw $a2, 0($v0) --> main50 +main50 : emit c46 --> main49 +main49 : li $a2, 6 --> main48 +main48 : move $a1, $sp --> main199 +main199: j --> main47 +main47 : li $a0, 5 --> main46 +main46 : li $v0, 4 --> main45 +main45 : mulo $v0, $a0, $v0 --> main44 +main44 : add $v0, $a1, $v0 --> main92 +main92 : lw $a2, 0($v0) --> main43 +main43 : emit c45 --> main42 +main42 : li $a2, 7 --> main41 +main41 : move $a1, $sp --> main198 +main198: j --> main40 +main40 : li $a0, 6 --> main39 +main39 : li $v0, 4 --> main38 +main38 : mulo $v0, $a0, $v0 --> main37 +main37 : add $v0, $a1, $v0 --> main90 +main90 : lw $a2, 0($v0) --> main36 +main36 : emit c44 --> main35 +main35 : li $a2, 8 --> main34 +main34 : move $a1, $sp --> main197 +main197: j --> main33 +main33 : li $a0, 7 --> main32 +main32 : li $v0, 4 --> main31 +main31 : mulo $v0, $a0, $v0 --> main30 +main30 : add $v0, $a1, $v0 --> main89 +main89 : lw $a2, 0($v0) --> main29 +main29 : emit c43 --> main28 +main28 : li $a2, 9 --> main27 +main27 : move $a1, $sp --> main196 +main196: j --> main26 +main26 : li $a0, 8 --> main25 +main25 : li $v0, 4 --> main24 +main24 : mulo $v0, $a0, $v0 --> main23 +main23 : add $v0, $a1, $v0 --> main88 +main88 : lw $a2, 0($v0) --> main22 +main22 : emit c42 --> main21 +main21 : j --> main20 +main20 : move $a1, $sp --> main195 +main195: j --> main19 +main19 : li $a0, 9 --> main18 +main18 : li $v0, 4 --> main17 +main17 : mulo $v0, $a0, $v0 --> main16 +main16 : add $v0, $a1, $v0 --> main87 +main87 : lw $zero, 0($v0) --> main15 +main15 : emit c41 --> main14 +main14 : la $v0, array_local --> main86 +main86 : j --> main207 +main207: call $v0 --> main206 +main206: move $s0, $v0 --> main13 +main13 : emit c40 --> main12 +main12 : move $a0, $sp --> main194 +main194: j --> main11 +main11 : li $a1, 2 --> main10 +main10 : li $a2, 3 --> main9 +main9 : la $v0, array_mixte --> main98 +main98 : j --> main217 +main217: j --> main216 +main216: j --> main215 +main215: j --> main214 +main214: call $v0 --> main213 +main213: move $s1, $v0 --> main8 +main8 : emit c39 --> main7 +main7 : move $a0, $sp --> main203 +main203: j --> main6 +main6 : li $a1, 2 --> main5 +main5 : li $a2, 3 --> main4 +main4 : la $v0, array_param --> main91 +main91 : j --> main212 +main212: j --> main211 +main211: j --> main210 +main210: j --> main209 +main209: call $v0 --> main208 +main208: j --> main3 +main3 : emit c38 --> main2 +main2 : add $a0, $s0, $s1 --> main1 +main1 : add $v0, $a0, $v0 --> main0 +main0 : j --> main193 +main193: j --> main192 +main192: lw $ra, 48($sp) --> main191 +main191: j --> main190 +main190: j --> main189 +main189: j --> main188 +main188: j --> main187 +main187: j --> main186 +main186: j --> main185 +main185: lw $s1, 44($sp) --> main184 +main184: lw $s0, 40($sp) --> main183 +main183: delframe --> main182 +main182: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/array.RTL.expected b/tests/clight/array.RTL.expected new file mode 100644 index 0000000..1eba49c --- /dev/null +++ b/tests/clight/array.RTL.expected @@ -0,0 +1,1135 @@ +program + +globals 0 + +function array_param(%0; %1; %2) : %7 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31 +entry array_param66 +array_param66: li %3, 0 --> array_param65 +array_param65: li %4, 0 --> array_param64 +array_param64: li %5, 0 --> array_param63 +array_param63: li %6, 0 --> array_param62 +array_param62: li %8, 0 --> array_param61 +array_param61: li %9, 0 --> array_param60 +array_param60: li %10, 0 --> array_param59 +array_param59: li %11, 0 --> array_param58 +array_param58: li %12, 0 --> array_param57 +array_param57: li %13, 0 --> array_param56 +array_param56: li %14, 0 --> array_param55 +array_param55: li %15, 0 --> array_param54 +array_param54: li %16, 0 --> array_param53 +array_param53: li %17, 0 --> array_param52 +array_param52: li %18, 0 --> array_param51 +array_param51: li %19, 0 --> array_param50 +array_param50: li %20, 0 --> array_param49 +array_param49: li %21, 0 --> array_param48 +array_param48: li %22, 0 --> array_param47 +array_param47: li %23, 0 --> array_param46 +array_param46: li %24, 0 --> array_param45 +array_param45: li %25, 0 --> array_param44 +array_param44: li %26, 0 --> array_param43 +array_param43: li %27, 0 --> array_param42 +array_param42: li %28, 0 --> array_param41 +array_param41: li %29, 0 --> array_param40 +array_param40: li %30, 0 --> array_param39 +array_param39: li %31, 0 --> array_param32 +array_param32: emit c37 --> array_param31 +array_param31: li %22, 1 --> array_param30 +array_param30: li %24, 0 --> array_param29 +array_param29: li %25, 4 --> array_param28 +array_param28: mulo %23, %24, %25 --> array_param27 +array_param27: add %29, %0, %23 --> array_param36 +array_param36: sw %22, 0(%29) --> array_param26 +array_param26: emit c36 --> array_param25 +array_param25: li %20, 1 --> array_param24 +array_param24: li %21, 4 --> array_param23 +array_param23: mulo %19, %20, %21 --> array_param22 +array_param22: add %28, %0, %19 --> array_param35 +array_param35: sw %1, 0(%28) --> array_param21 +array_param21: emit c35 --> array_param20 +array_param20: li %17, 0 --> array_param19 +array_param19: li %18, 4 --> array_param18 +array_param18: mulo %16, %17, %18 --> array_param17 +array_param17: add %27, %0, %16 --> array_param34 +array_param34: lw %6, 0(%27) --> array_param16 +array_param16: emit c34 --> array_param15 +array_param15: li %13, 7 --> array_param14 +array_param14: li %15, 4 --> array_param13 +array_param13: mulo %14, %2, %15 --> array_param12 +array_param12: add %26, %0, %14 --> array_param33 +array_param33: sw %13, 0(%26) --> array_param11 +array_param11: emit c33 --> array_param10 +array_param10: li %12, 4 --> array_param9 +array_param9 : mulo %11, %2, %12 --> array_param8 +array_param8 : add %31, %0, %11 --> array_param38 +array_param38: lw %6, 0(%31) --> array_param7 +array_param7 : emit c32 --> array_param6 +array_param6 : li %9, 0 --> array_param5 +array_param5 : li %10, 4 --> array_param4 +array_param4 : mulo %8, %9, %10 --> array_param3 +array_param3 : add %30, %0, %8 --> array_param37 +array_param37: lw %5, 0(%30) --> array_param2 +array_param2 : emit c31 --> array_param1 +array_param1 : move %7, %6 --> array_param0 +array_param0 : return %7 + +function array_mixte(%0; %1; %2) : %3 +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94 +entry array_mixte210 +array_mixte210: li %4, 0 --> array_mixte209 +array_mixte209: li %5, 0 --> array_mixte208 +array_mixte208: li %6, 0 --> array_mixte207 +array_mixte207: li %7, 0 --> array_mixte206 +array_mixte206: li %8, 0 --> array_mixte205 +array_mixte205: li %9, 0 --> array_mixte204 +array_mixte204: li %10, 0 --> array_mixte203 +array_mixte203: li %11, 0 --> array_mixte202 +array_mixte202: li %12, 0 --> array_mixte201 +array_mixte201: li %13, 0 --> array_mixte200 +array_mixte200: li %14, 0 --> array_mixte199 +array_mixte199: li %15, 0 --> array_mixte198 +array_mixte198: li %16, 0 --> array_mixte197 +array_mixte197: li %17, 0 --> array_mixte196 +array_mixte196: li %18, 0 --> array_mixte195 +array_mixte195: li %19, 0 --> array_mixte194 +array_mixte194: li %20, 0 --> array_mixte193 +array_mixte193: li %21, 0 --> array_mixte192 +array_mixte192: li %22, 0 --> array_mixte191 +array_mixte191: li %23, 0 --> array_mixte190 +array_mixte190: li %24, 0 --> array_mixte189 +array_mixte189: li %25, 0 --> array_mixte188 +array_mixte188: li %26, 0 --> array_mixte187 +array_mixte187: li %27, 0 --> array_mixte186 +array_mixte186: li %28, 0 --> array_mixte185 +array_mixte185: li %29, 0 --> array_mixte184 +array_mixte184: li %30, 0 --> array_mixte183 +array_mixte183: li %31, 0 --> array_mixte182 +array_mixte182: li %32, 0 --> array_mixte181 +array_mixte181: li %33, 0 --> array_mixte180 +array_mixte180: li %34, 0 --> array_mixte179 +array_mixte179: li %35, 0 --> array_mixte178 +array_mixte178: li %36, 0 --> array_mixte177 +array_mixte177: li %37, 0 --> array_mixte176 +array_mixte176: li %38, 0 --> array_mixte175 +array_mixte175: li %39, 0 --> array_mixte174 +array_mixte174: li %40, 0 --> array_mixte173 +array_mixte173: li %41, 0 --> array_mixte172 +array_mixte172: li %42, 0 --> array_mixte171 +array_mixte171: li %43, 0 --> array_mixte170 +array_mixte170: li %44, 0 --> array_mixte169 +array_mixte169: li %45, 0 --> array_mixte168 +array_mixte168: li %46, 0 --> array_mixte167 +array_mixte167: li %47, 0 --> array_mixte166 +array_mixte166: li %48, 0 --> array_mixte165 +array_mixte165: li %49, 0 --> array_mixte164 +array_mixte164: li %50, 0 --> array_mixte163 +array_mixte163: li %51, 0 --> array_mixte162 +array_mixte162: li %52, 0 --> array_mixte161 +array_mixte161: li %53, 0 --> array_mixte160 +array_mixte160: li %54, 0 --> array_mixte159 +array_mixte159: li %55, 0 --> array_mixte158 +array_mixte158: li %56, 0 --> array_mixte157 +array_mixte157: li %57, 0 --> array_mixte156 +array_mixte156: li %58, 0 --> array_mixte155 +array_mixte155: li %59, 0 --> array_mixte154 +array_mixte154: li %60, 0 --> array_mixte153 +array_mixte153: li %61, 0 --> array_mixte152 +array_mixte152: li %62, 0 --> array_mixte151 +array_mixte151: li %63, 0 --> array_mixte150 +array_mixte150: li %64, 0 --> array_mixte149 +array_mixte149: li %65, 0 --> array_mixte148 +array_mixte148: li %66, 0 --> array_mixte147 +array_mixte147: li %67, 0 --> array_mixte146 +array_mixte146: li %68, 0 --> array_mixte145 +array_mixte145: li %69, 0 --> array_mixte144 +array_mixte144: li %70, 0 --> array_mixte143 +array_mixte143: li %71, 0 --> array_mixte142 +array_mixte142: li %72, 0 --> array_mixte141 +array_mixte141: li %73, 0 --> array_mixte140 +array_mixte140: li %74, 0 --> array_mixte139 +array_mixte139: li %75, 0 --> array_mixte138 +array_mixte138: li %76, 0 --> array_mixte137 +array_mixte137: li %77, 0 --> array_mixte136 +array_mixte136: li %78, 0 --> array_mixte135 +array_mixte135: li %79, 0 --> array_mixte134 +array_mixte134: li %80, 0 --> array_mixte133 +array_mixte133: li %81, 0 --> array_mixte132 +array_mixte132: li %82, 0 --> array_mixte131 +array_mixte131: li %83, 0 --> array_mixte130 +array_mixte130: li %84, 0 --> array_mixte129 +array_mixte129: li %85, 0 --> array_mixte128 +array_mixte128: li %86, 0 --> array_mixte127 +array_mixte127: li %87, 0 --> array_mixte126 +array_mixte126: li %88, 0 --> array_mixte125 +array_mixte125: li %89, 0 --> array_mixte124 +array_mixte124: li %90, 0 --> array_mixte123 +array_mixte123: li %91, 0 --> array_mixte122 +array_mixte122: li %92, 0 --> array_mixte121 +array_mixte121: li %93, 0 --> array_mixte120 +array_mixte120: li %94, 0 --> array_mixte102 +array_mixte102: emit c30 --> array_mixte101 +array_mixte101: li %73, 0 --> array_mixte100 +array_mixte100: addi %74, STACK, 0 --> array_mixte99 +array_mixte99 : li %76, 0 --> array_mixte98 +array_mixte98 : li %77, 4 --> array_mixte97 +array_mixte97 : mulo %75, %76, %77 --> array_mixte96 +array_mixte96 : add %94, %74, %75 --> array_mixte119 +array_mixte119: sw %73, 0(%94) --> array_mixte95 +array_mixte95 : emit c29 --> array_mixte94 +array_mixte94 : li %68, 0 --> array_mixte93 +array_mixte93 : addi %69, STACK, 0 --> array_mixte92 +array_mixte92 : li %71, 1 --> array_mixte91 +array_mixte91 : li %72, 4 --> array_mixte90 +array_mixte90 : mulo %70, %71, %72 --> array_mixte89 +array_mixte89 : add %92, %69, %70 --> array_mixte117 +array_mixte117: sw %68, 0(%92) --> array_mixte88 +array_mixte88 : emit c28 --> array_mixte87 +array_mixte87 : li %63, 0 --> array_mixte86 +array_mixte86 : addi %64, STACK, 0 --> array_mixte85 +array_mixte85 : li %66, 2 --> array_mixte84 +array_mixte84 : li %67, 4 --> array_mixte83 +array_mixte83 : mulo %65, %66, %67 --> array_mixte82 +array_mixte82 : add %91, %64, %65 --> array_mixte116 +array_mixte116: sw %63, 0(%91) --> array_mixte81 +array_mixte81 : emit c27 --> array_mixte80 +array_mixte80 : li %58, 0 --> array_mixte79 +array_mixte79 : addi %59, STACK, 0 --> array_mixte78 +array_mixte78 : li %61, 3 --> array_mixte77 +array_mixte77 : li %62, 4 --> array_mixte76 +array_mixte76 : mulo %60, %61, %62 --> array_mixte75 +array_mixte75 : add %90, %59, %60 --> array_mixte115 +array_mixte115: sw %58, 0(%90) --> array_mixte74 +array_mixte74 : emit c26 --> array_mixte73 +array_mixte73 : li %53, 0 --> array_mixte72 +array_mixte72 : addi %54, STACK, 0 --> array_mixte71 +array_mixte71 : li %56, 4 --> array_mixte70 +array_mixte70 : li %57, 4 --> array_mixte69 +array_mixte69 : mulo %55, %56, %57 --> array_mixte68 +array_mixte68 : add %89, %54, %55 --> array_mixte114 +array_mixte114: sw %53, 0(%89) --> array_mixte67 +array_mixte67 : emit c25 --> array_mixte66 +array_mixte66 : li %48, 0 --> array_mixte65 +array_mixte65 : addi %49, STACK, 0 --> array_mixte64 +array_mixte64 : li %51, 5 --> array_mixte63 +array_mixte63 : li %52, 4 --> array_mixte62 +array_mixte62 : mulo %50, %51, %52 --> array_mixte61 +array_mixte61 : add %88, %49, %50 --> array_mixte113 +array_mixte113: sw %48, 0(%88) --> array_mixte60 +array_mixte60 : emit c24 --> array_mixte59 +array_mixte59 : li %43, 0 --> array_mixte58 +array_mixte58 : addi %44, STACK, 0 --> array_mixte57 +array_mixte57 : li %46, 6 --> array_mixte56 +array_mixte56 : li %47, 4 --> array_mixte55 +array_mixte55 : mulo %45, %46, %47 --> array_mixte54 +array_mixte54 : add %86, %44, %45 --> array_mixte111 +array_mixte111: sw %43, 0(%86) --> array_mixte53 +array_mixte53 : emit c23 --> array_mixte52 +array_mixte52 : li %38, 0 --> array_mixte51 +array_mixte51 : addi %39, STACK, 0 --> array_mixte50 +array_mixte50 : li %41, 7 --> array_mixte49 +array_mixte49 : li %42, 4 --> array_mixte48 +array_mixte48 : mulo %40, %41, %42 --> array_mixte47 +array_mixte47 : add %85, %39, %40 --> array_mixte110 +array_mixte110: sw %38, 0(%85) --> array_mixte46 +array_mixte46 : emit c22 --> array_mixte45 +array_mixte45 : li %33, 0 --> array_mixte44 +array_mixte44 : addi %34, STACK, 0 --> array_mixte43 +array_mixte43 : li %36, 8 --> array_mixte42 +array_mixte42 : li %37, 4 --> array_mixte41 +array_mixte41 : mulo %35, %36, %37 --> array_mixte40 +array_mixte40 : add %84, %34, %35 --> array_mixte109 +array_mixte109: sw %33, 0(%84) --> array_mixte39 +array_mixte39 : emit c21 --> array_mixte38 +array_mixte38 : li %28, 0 --> array_mixte37 +array_mixte37 : addi %29, STACK, 0 --> array_mixte36 +array_mixte36 : li %31, 9 --> array_mixte35 +array_mixte35 : li %32, 4 --> array_mixte34 +array_mixte34 : mulo %30, %31, %32 --> array_mixte33 +array_mixte33 : add %83, %29, %30 --> array_mixte108 +array_mixte108: sw %28, 0(%83) --> array_mixte32 +array_mixte32 : emit c20 --> array_mixte31 +array_mixte31 : li %27, 4 --> array_mixte30 +array_mixte30 : mulo %26, %2, %27 --> array_mixte29 +array_mixte29 : add %82, %0, %26 --> array_mixte107 +array_mixte107: lw %24, 0(%82) --> array_mixte28 +array_mixte28 : li %25, 1 --> array_mixte27 +array_mixte27 : add %20, %24, %25 --> array_mixte26 +array_mixte26 : addi %21, STACK, 0 --> array_mixte25 +array_mixte25 : li %23, 4 --> array_mixte24 +array_mixte24 : mulo %22, %1, %23 --> array_mixte23 +array_mixte23 : add %81, %21, %22 --> array_mixte106 +array_mixte106: sw %20, 0(%81) --> array_mixte22 +array_mixte22 : emit c19 --> array_mixte21 +array_mixte21 : addi %16, STACK, 0 --> array_mixte20 +array_mixte20 : li %18, 0 --> array_mixte19 +array_mixte19 : li %19, 4 --> array_mixte18 +array_mixte18 : mulo %17, %18, %19 --> array_mixte17 +array_mixte17 : add %80, %16, %17 --> array_mixte105 +array_mixte105: lw %13, 0(%80) --> array_mixte16 +array_mixte16 : li %15, 4 --> array_mixte15 +array_mixte15 : mulo %14, %2, %15 --> array_mixte14 +array_mixte14 : add %79, %0, %14 --> array_mixte104 +array_mixte104: sw %13, 0(%79) --> array_mixte13 +array_mixte13 : emit c18 --> array_mixte12 +array_mixte12 : li %11, 1 --> array_mixte11 +array_mixte11 : li %12, 4 --> array_mixte10 +array_mixte10 : mulo %10, %11, %12 --> array_mixte9 +array_mixte9 : add %93, %0, %10 --> array_mixte118 +array_mixte118: lw %7, 0(%93) --> array_mixte8 +array_mixte8 : li %9, 4 --> array_mixte7 +array_mixte7 : mulo %8, %1, %9 --> array_mixte6 +array_mixte6 : add %87, %0, %8 --> array_mixte112 +array_mixte112: sw %7, 0(%87) --> array_mixte5 +array_mixte5 : emit c17 --> array_mixte4 +array_mixte4 : addi %4, STACK, 0 --> array_mixte3 +array_mixte3 : li %6, 4 --> array_mixte2 +array_mixte2 : mulo %5, %1, %6 --> array_mixte1 +array_mixte1 : add %78, %4, %5 --> array_mixte103 +array_mixte103: lw %3, 0(%78) --> array_mixte0 +array_mixte0 : return %3 + +function array_local() : %4 +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97 +entry array_local224 +array_local224: li %0, 0 --> array_local223 +array_local223: li %1, 0 --> array_local222 +array_local222: li %2, 0 --> array_local221 +array_local221: li %3, 0 --> array_local220 +array_local220: li %5, 0 --> array_local219 +array_local219: li %6, 0 --> array_local218 +array_local218: li %7, 0 --> array_local217 +array_local217: li %8, 0 --> array_local216 +array_local216: li %9, 0 --> array_local215 +array_local215: li %10, 0 --> array_local214 +array_local214: li %11, 0 --> array_local213 +array_local213: li %12, 0 --> array_local212 +array_local212: li %13, 0 --> array_local211 +array_local211: li %14, 0 --> array_local210 +array_local210: li %15, 0 --> array_local209 +array_local209: li %16, 0 --> array_local208 +array_local208: li %17, 0 --> array_local207 +array_local207: li %18, 0 --> array_local206 +array_local206: li %19, 0 --> array_local205 +array_local205: li %20, 0 --> array_local204 +array_local204: li %21, 0 --> array_local203 +array_local203: li %22, 0 --> array_local202 +array_local202: li %23, 0 --> array_local201 +array_local201: li %24, 0 --> array_local200 +array_local200: li %25, 0 --> array_local199 +array_local199: li %26, 0 --> array_local198 +array_local198: li %27, 0 --> array_local197 +array_local197: li %28, 0 --> array_local196 +array_local196: li %29, 0 --> array_local195 +array_local195: li %30, 0 --> array_local194 +array_local194: li %31, 0 --> array_local193 +array_local193: li %32, 0 --> array_local192 +array_local192: li %33, 0 --> array_local191 +array_local191: li %34, 0 --> array_local190 +array_local190: li %35, 0 --> array_local189 +array_local189: li %36, 0 --> array_local188 +array_local188: li %37, 0 --> array_local187 +array_local187: li %38, 0 --> array_local186 +array_local186: li %39, 0 --> array_local185 +array_local185: li %40, 0 --> array_local184 +array_local184: li %41, 0 --> array_local183 +array_local183: li %42, 0 --> array_local182 +array_local182: li %43, 0 --> array_local181 +array_local181: li %44, 0 --> array_local180 +array_local180: li %45, 0 --> array_local179 +array_local179: li %46, 0 --> array_local178 +array_local178: li %47, 0 --> array_local177 +array_local177: li %48, 0 --> array_local176 +array_local176: li %49, 0 --> array_local175 +array_local175: li %50, 0 --> array_local174 +array_local174: li %51, 0 --> array_local173 +array_local173: li %52, 0 --> array_local172 +array_local172: li %53, 0 --> array_local171 +array_local171: li %54, 0 --> array_local170 +array_local170: li %55, 0 --> array_local169 +array_local169: li %56, 0 --> array_local168 +array_local168: li %57, 0 --> array_local167 +array_local167: li %58, 0 --> array_local166 +array_local166: li %59, 0 --> array_local165 +array_local165: li %60, 0 --> array_local164 +array_local164: li %61, 0 --> array_local163 +array_local163: li %62, 0 --> array_local162 +array_local162: li %63, 0 --> array_local161 +array_local161: li %64, 0 --> array_local160 +array_local160: li %65, 0 --> array_local159 +array_local159: li %66, 0 --> array_local158 +array_local158: li %67, 0 --> array_local157 +array_local157: li %68, 0 --> array_local156 +array_local156: li %69, 0 --> array_local155 +array_local155: li %70, 0 --> array_local154 +array_local154: li %71, 0 --> array_local153 +array_local153: li %72, 0 --> array_local152 +array_local152: li %73, 0 --> array_local151 +array_local151: li %74, 0 --> array_local150 +array_local150: li %75, 0 --> array_local149 +array_local149: li %76, 0 --> array_local148 +array_local148: li %77, 0 --> array_local147 +array_local147: li %78, 0 --> array_local146 +array_local146: li %79, 0 --> array_local145 +array_local145: li %80, 0 --> array_local144 +array_local144: li %81, 0 --> array_local143 +array_local143: li %82, 0 --> array_local142 +array_local142: li %83, 0 --> array_local141 +array_local141: li %84, 0 --> array_local140 +array_local140: li %85, 0 --> array_local139 +array_local139: li %86, 0 --> array_local138 +array_local138: li %87, 0 --> array_local137 +array_local137: li %88, 0 --> array_local136 +array_local136: li %89, 0 --> array_local135 +array_local135: li %90, 0 --> array_local134 +array_local134: li %91, 0 --> array_local133 +array_local133: li %92, 0 --> array_local132 +array_local132: li %93, 0 --> array_local131 +array_local131: li %94, 0 --> array_local130 +array_local130: li %95, 0 --> array_local129 +array_local129: li %96, 0 --> array_local128 +array_local128: li %97, 0 --> array_local111 +array_local111: emit c16 --> array_local110 +array_local110: li %77, 0 --> array_local109 +array_local109: addi %78, STACK, 0 --> array_local108 +array_local108: li %80, 0 --> array_local107 +array_local107: li %81, 4 --> array_local106 +array_local106: mulo %79, %80, %81 --> array_local105 +array_local105: add %82, %78, %79 --> array_local112 +array_local112: sw %77, 0(%82) --> array_local104 +array_local104: emit c15 --> array_local103 +array_local103: li %72, 0 --> array_local102 +array_local102: addi %73, STACK, 0 --> array_local101 +array_local101: li %75, 1 --> array_local100 +array_local100: li %76, 4 --> array_local99 +array_local99 : mulo %74, %75, %76 --> array_local98 +array_local98 : add %97, %73, %74 --> array_local127 +array_local127: sw %72, 0(%97) --> array_local97 +array_local97 : emit c14 --> array_local96 +array_local96 : li %67, 0 --> array_local95 +array_local95 : addi %68, STACK, 0 --> array_local94 +array_local94 : li %70, 2 --> array_local93 +array_local93 : li %71, 4 --> array_local92 +array_local92 : mulo %69, %70, %71 --> array_local91 +array_local91 : add %96, %68, %69 --> array_local126 +array_local126: sw %67, 0(%96) --> array_local90 +array_local90 : emit c13 --> array_local89 +array_local89 : li %62, 0 --> array_local88 +array_local88 : addi %63, STACK, 0 --> array_local87 +array_local87 : li %65, 3 --> array_local86 +array_local86 : li %66, 4 --> array_local85 +array_local85 : mulo %64, %65, %66 --> array_local84 +array_local84 : add %94, %63, %64 --> array_local124 +array_local124: sw %62, 0(%94) --> array_local83 +array_local83 : emit c12 --> array_local82 +array_local82 : li %57, 0 --> array_local81 +array_local81 : addi %58, STACK, 0 --> array_local80 +array_local80 : li %60, 4 --> array_local79 +array_local79 : li %61, 4 --> array_local78 +array_local78 : mulo %59, %60, %61 --> array_local77 +array_local77 : add %93, %58, %59 --> array_local123 +array_local123: sw %57, 0(%93) --> array_local76 +array_local76 : emit c11 --> array_local75 +array_local75 : li %52, 0 --> array_local74 +array_local74 : addi %53, STACK, 0 --> array_local73 +array_local73 : li %55, 5 --> array_local72 +array_local72 : li %56, 4 --> array_local71 +array_local71 : mulo %54, %55, %56 --> array_local70 +array_local70 : add %92, %53, %54 --> array_local122 +array_local122: sw %52, 0(%92) --> array_local69 +array_local69 : emit c10 --> array_local68 +array_local68 : li %47, 0 --> array_local67 +array_local67 : addi %48, STACK, 0 --> array_local66 +array_local66 : li %50, 6 --> array_local65 +array_local65 : li %51, 4 --> array_local64 +array_local64 : mulo %49, %50, %51 --> array_local63 +array_local63 : add %91, %48, %49 --> array_local121 +array_local121: sw %47, 0(%91) --> array_local62 +array_local62 : emit c9 --> array_local61 +array_local61 : li %42, 0 --> array_local60 +array_local60 : addi %43, STACK, 0 --> array_local59 +array_local59 : li %45, 7 --> array_local58 +array_local58 : li %46, 4 --> array_local57 +array_local57 : mulo %44, %45, %46 --> array_local56 +array_local56 : add %90, %43, %44 --> array_local120 +array_local120: sw %42, 0(%90) --> array_local55 +array_local55 : emit c8 --> array_local54 +array_local54 : li %37, 0 --> array_local53 +array_local53 : addi %38, STACK, 0 --> array_local52 +array_local52 : li %40, 8 --> array_local51 +array_local51 : li %41, 4 --> array_local50 +array_local50 : mulo %39, %40, %41 --> array_local49 +array_local49 : add %89, %38, %39 --> array_local119 +array_local119: sw %37, 0(%89) --> array_local48 +array_local48 : emit c7 --> array_local47 +array_local47 : li %32, 0 --> array_local46 +array_local46 : addi %33, STACK, 0 --> array_local45 +array_local45 : li %35, 9 --> array_local44 +array_local44 : li %36, 4 --> array_local43 +array_local43 : mulo %34, %35, %36 --> array_local42 +array_local42 : add %88, %33, %34 --> array_local118 +array_local118: sw %32, 0(%88) --> array_local41 +array_local41 : emit c6 --> array_local40 +array_local40 : li %27, 1 --> array_local39 +array_local39 : addi %28, STACK, 0 --> array_local38 +array_local38 : li %30, 0 --> array_local37 +array_local37 : li %31, 4 --> array_local36 +array_local36 : mulo %29, %30, %31 --> array_local35 +array_local35 : add %87, %28, %29 --> array_local117 +array_local117: sw %27, 0(%87) --> array_local34 +array_local34 : emit c5 --> array_local33 +array_local33 : li %22, 5 --> array_local32 +array_local32 : addi %23, STACK, 0 --> array_local31 +array_local31 : li %25, 1 --> array_local30 +array_local30 : li %26, 4 --> array_local29 +array_local29 : mulo %24, %25, %26 --> array_local28 +array_local28 : add %85, %23, %24 --> array_local115 +array_local115: sw %22, 0(%85) --> array_local27 +array_local27 : emit c4 --> array_local26 +array_local26 : addi %18, STACK, 0 --> array_local25 +array_local25 : li %20, 0 --> array_local24 +array_local24 : li %21, 4 --> array_local23 +array_local23 : mulo %19, %20, %21 --> array_local22 +array_local22 : add %84, %18, %19 --> array_local114 +array_local114: lw %3, 0(%84) --> array_local21 +array_local21 : emit c3 --> array_local20 +array_local20 : li %13, 7 --> array_local19 +array_local19 : addi %14, STACK, 0 --> array_local18 +array_local18 : li %16, 1 --> array_local17 +array_local17 : li %17, 4 --> array_local16 +array_local16 : mulo %15, %16, %17 --> array_local15 +array_local15 : add %83, %14, %15 --> array_local113 +array_local113: sw %13, 0(%83) --> array_local14 +array_local14 : emit c2 --> array_local13 +array_local13 : addi %9, STACK, 0 --> array_local12 +array_local12 : li %11, 1 --> array_local11 +array_local11 : li %12, 4 --> array_local10 +array_local10 : mulo %10, %11, %12 --> array_local9 +array_local9 : add %95, %9, %10 --> array_local125 +array_local125: lw %3, 0(%95) --> array_local8 +array_local8 : emit c1 --> array_local7 +array_local7 : addi %5, STACK, 0 --> array_local6 +array_local6 : li %7, 0 --> array_local5 +array_local5 : li %8, 4 --> array_local4 +array_local4 : mulo %6, %7, %8 --> array_local3 +array_local3 : add %86, %5, %6 --> array_local116 +array_local116: lw %2, 0(%86) --> array_local2 +array_local2 : emit c0 --> array_local1 +array_local1 : move %4, %3 --> array_local0 +array_local0 : return %4 + +function _main() : %3 +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73 +entry main171 +main171: li %0, 0 --> main170 +main170: li %1, 0 --> main169 +main169: li %2, 0 --> main168 +main168: li %4, 0 --> main167 +main167: li %5, 0 --> main166 +main166: li %6, 0 --> main165 +main165: li %7, 0 --> main164 +main164: li %8, 0 --> main163 +main163: li %9, 0 --> main162 +main162: li %10, 0 --> main161 +main161: li %11, 0 --> main160 +main160: li %12, 0 --> main159 +main159: li %13, 0 --> main158 +main158: li %14, 0 --> main157 +main157: li %15, 0 --> main156 +main156: li %16, 0 --> main155 +main155: li %17, 0 --> main154 +main154: li %18, 0 --> main153 +main153: li %19, 0 --> main152 +main152: li %20, 0 --> main151 +main151: li %21, 0 --> main150 +main150: li %22, 0 --> main149 +main149: li %23, 0 --> main148 +main148: li %24, 0 --> main147 +main147: li %25, 0 --> main146 +main146: li %26, 0 --> main145 +main145: li %27, 0 --> main144 +main144: li %28, 0 --> main143 +main143: li %29, 0 --> main142 +main142: li %30, 0 --> main141 +main141: li %31, 0 --> main140 +main140: li %32, 0 --> main139 +main139: li %33, 0 --> main138 +main138: li %34, 0 --> main137 +main137: li %35, 0 --> main136 +main136: li %36, 0 --> main135 +main135: li %37, 0 --> main134 +main134: li %38, 0 --> main133 +main133: li %39, 0 --> main132 +main132: li %40, 0 --> main131 +main131: li %41, 0 --> main130 +main130: li %42, 0 --> main129 +main129: li %43, 0 --> main128 +main128: li %44, 0 --> main127 +main127: li %45, 0 --> main126 +main126: li %46, 0 --> main125 +main125: li %47, 0 --> main124 +main124: li %48, 0 --> main123 +main123: li %49, 0 --> main122 +main122: li %50, 0 --> main121 +main121: li %51, 0 --> main120 +main120: li %52, 0 --> main119 +main119: li %53, 0 --> main118 +main118: li %54, 0 --> main117 +main117: li %55, 0 --> main116 +main116: li %56, 0 --> main115 +main115: li %57, 0 --> main114 +main114: li %58, 0 --> main113 +main113: li %59, 0 --> main112 +main112: li %60, 0 --> main111 +main111: li %61, 0 --> main110 +main110: li %62, 0 --> main109 +main109: li %63, 0 --> main108 +main108: li %64, 0 --> main107 +main107: li %65, 0 --> main106 +main106: li %66, 0 --> main105 +main105: li %67, 0 --> main104 +main104: li %68, 0 --> main103 +main103: li %69, 0 --> main102 +main102: li %70, 0 --> main101 +main101: li %71, 0 --> main100 +main100: li %72, 0 --> main99 +main99 : li %73, 0 --> main85 +main85 : emit c51 --> main84 +main84 : li %56, 1 --> main83 +main83 : addi %57, STACK, 0 --> main82 +main82 : li %59, 0 --> main81 +main81 : li %60, 4 --> main80 +main80 : mulo %58, %59, %60 --> main79 +main79 : add %72, %57, %58 --> main97 +main97 : sw %56, 0(%72) --> main78 +main78 : emit c50 --> main77 +main77 : li %51, 2 --> main76 +main76 : addi %52, STACK, 0 --> main75 +main75 : li %54, 1 --> main74 +main74 : li %55, 4 --> main73 +main73 : mulo %53, %54, %55 --> main72 +main72 : add %71, %52, %53 --> main96 +main96 : sw %51, 0(%71) --> main71 +main71 : emit c49 --> main70 +main70 : li %46, 3 --> main69 +main69 : addi %47, STACK, 0 --> main68 +main68 : li %49, 2 --> main67 +main67 : li %50, 4 --> main66 +main66 : mulo %48, %49, %50 --> main65 +main65 : add %70, %47, %48 --> main95 +main95 : sw %46, 0(%70) --> main64 +main64 : emit c48 --> main63 +main63 : li %41, 4 --> main62 +main62 : addi %42, STACK, 0 --> main61 +main61 : li %44, 3 --> main60 +main60 : li %45, 4 --> main59 +main59 : mulo %43, %44, %45 --> main58 +main58 : add %69, %42, %43 --> main94 +main94 : sw %41, 0(%69) --> main57 +main57 : emit c47 --> main56 +main56 : li %36, 5 --> main55 +main55 : addi %37, STACK, 0 --> main54 +main54 : li %39, 4 --> main53 +main53 : li %40, 4 --> main52 +main52 : mulo %38, %39, %40 --> main51 +main51 : add %68, %37, %38 --> main93 +main93 : sw %36, 0(%68) --> main50 +main50 : emit c46 --> main49 +main49 : li %31, 6 --> main48 +main48 : addi %32, STACK, 0 --> main47 +main47 : li %34, 5 --> main46 +main46 : li %35, 4 --> main45 +main45 : mulo %33, %34, %35 --> main44 +main44 : add %67, %32, %33 --> main92 +main92 : sw %31, 0(%67) --> main43 +main43 : emit c45 --> main42 +main42 : li %26, 7 --> main41 +main41 : addi %27, STACK, 0 --> main40 +main40 : li %29, 6 --> main39 +main39 : li %30, 4 --> main38 +main38 : mulo %28, %29, %30 --> main37 +main37 : add %65, %27, %28 --> main90 +main90 : sw %26, 0(%65) --> main36 +main36 : emit c44 --> main35 +main35 : li %21, 8 --> main34 +main34 : addi %22, STACK, 0 --> main33 +main33 : li %24, 7 --> main32 +main32 : li %25, 4 --> main31 +main31 : mulo %23, %24, %25 --> main30 +main30 : add %64, %22, %23 --> main89 +main89 : sw %21, 0(%64) --> main29 +main29 : emit c43 --> main28 +main28 : li %16, 9 --> main27 +main27 : addi %17, STACK, 0 --> main26 +main26 : li %19, 8 --> main25 +main25 : li %20, 4 --> main24 +main24 : mulo %18, %19, %20 --> main23 +main23 : add %63, %17, %18 --> main88 +main88 : sw %16, 0(%63) --> main22 +main22 : emit c42 --> main21 +main21 : li %11, 0 --> main20 +main20 : addi %12, STACK, 0 --> main19 +main19 : li %14, 9 --> main18 +main18 : li %15, 4 --> main17 +main17 : mulo %13, %14, %15 --> main16 +main16 : add %62, %12, %13 --> main87 +main87 : sw %11, 0(%62) --> main15 +main15 : emit c41 --> main14 +main14 : la %61, array_local --> main86 +main86 : call %2, %61() --> main13 +main13 : emit c40 --> main12 +main12 : addi %8, STACK, 0 --> main11 +main11 : li %9, 2 --> main10 +main10 : li %10, 3 --> main9 +main9 : la %73, array_mixte --> main98 +main98 : call %1, %73(%8, %9, %10) --> main8 +main8 : emit c39 --> main7 +main7 : addi %5, STACK, 0 --> main6 +main6 : li %6, 2 --> main5 +main5 : li %7, 3 --> main4 +main4 : la %66, array_param --> main91 +main91 : call %0, %66(%5, %6, %7) --> main3 +main3 : emit c38 --> main2 +main2 : add %4, %2, %1 --> main1 +main1 : add %3, %4, %0 --> main0 +main0 : return %3 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/array.RTLabs.expected b/tests/clight/array.RTLabs.expected new file mode 100644 index 0000000..0194bc3 --- /dev/null +++ b/tests/clight/array.RTLabs.expected @@ -0,0 +1,772 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "array_local"(): int + locals: %4, %0, %1, %2, %3, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77, %78, %79, %80, %81 + result: %4 + stacksize: 40 + entry: array_local111 + exit: array_local0 + + array_local99: mul %74, %75, %76 --> array_local98 + array_local98: store int32, add, %73, %74, %72 --> array_local97 + array_local97: emit c14 --> array_local96 + array_local96: imm_int 0, %67, --> array_local95 + array_local95: imm_addr 0($sp), %68, --> array_local94 + array_local94: imm_int 2, %70, --> array_local93 + array_local93: imm_int 4, %71, --> array_local92 + array_local92: mul %69, %70, %71 --> array_local91 + array_local91: store int32, add, %68, %69, %67 --> array_local90 + array_local90: emit c13 --> array_local89 + array_local9: load int32, add, %9, %10, %3 --> array_local8 + array_local89: imm_int 0, %62, --> array_local88 + array_local88: imm_addr 0($sp), %63, --> array_local87 + array_local87: imm_int 3, %65, --> array_local86 + array_local86: imm_int 4, %66, --> array_local85 + array_local85: mul %64, %65, %66 --> array_local84 + array_local84: store int32, add, %63, %64, %62 --> array_local83 + array_local83: emit c12 --> array_local82 + array_local82: imm_int 0, %57, --> array_local81 + array_local81: imm_addr 0($sp), %58, --> array_local80 + array_local80: imm_int 4, %60, --> array_local79 + array_local8: emit c1 --> array_local7 + array_local79: imm_int 4, %61, --> array_local78 + array_local78: mul %59, %60, %61 --> array_local77 + array_local77: store int32, add, %58, %59, %57 --> array_local76 + array_local76: emit c11 --> array_local75 + array_local75: imm_int 0, %52, --> array_local74 + array_local74: imm_addr 0($sp), %53, --> array_local73 + array_local73: imm_int 5, %55, --> array_local72 + array_local72: imm_int 4, %56, --> array_local71 + array_local71: mul %54, %55, %56 --> array_local70 + array_local70: store int32, add, %53, %54, %52 --> array_local69 + array_local7: imm_addr 0($sp), %5, --> array_local6 + array_local69: emit c10 --> array_local68 + array_local68: imm_int 0, %47, --> array_local67 + array_local67: imm_addr 0($sp), %48, --> array_local66 + array_local66: imm_int 6, %50, --> array_local65 + array_local65: imm_int 4, %51, --> array_local64 + array_local64: mul %49, %50, %51 --> array_local63 + array_local63: store int32, add, %48, %49, %47 --> array_local62 + array_local62: emit c9 --> array_local61 + array_local61: imm_int 0, %42, --> array_local60 + array_local60: imm_addr 0($sp), %43, --> array_local59 + array_local6: imm_int 0, %7, --> array_local5 + array_local59: imm_int 7, %45, --> array_local58 + array_local58: imm_int 4, %46, --> array_local57 + array_local57: mul %44, %45, %46 --> array_local56 + array_local56: store int32, add, %43, %44, %42 --> array_local55 + array_local55: emit c8 --> array_local54 + array_local54: imm_int 0, %37, --> array_local53 + array_local53: imm_addr 0($sp), %38, --> array_local52 + array_local52: imm_int 8, %40, --> array_local51 + array_local51: imm_int 4, %41, --> array_local50 + array_local50: mul %39, %40, %41 --> array_local49 + array_local5: imm_int 4, %8, --> array_local4 + array_local49: store int32, add, %38, %39, %37 --> array_local48 + array_local48: emit c7 --> array_local47 + array_local47: imm_int 0, %32, --> array_local46 + array_local46: imm_addr 0($sp), %33, --> array_local45 + array_local45: imm_int 9, %35, --> array_local44 + array_local44: imm_int 4, %36, --> array_local43 + array_local43: mul %34, %35, %36 --> array_local42 + array_local42: store int32, add, %33, %34, %32 --> array_local41 + array_local41: emit c6 --> array_local40 + array_local40: imm_int 1, %27, --> array_local39 + array_local4: mul %6, %7, %8 --> array_local3 + array_local39: imm_addr 0($sp), %28, --> array_local38 + array_local38: imm_int 0, %30, --> array_local37 + array_local37: imm_int 4, %31, --> array_local36 + array_local36: mul %29, %30, %31 --> array_local35 + array_local35: store int32, add, %28, %29, %27 --> array_local34 + array_local34: emit c5 --> array_local33 + array_local33: imm_int 5, %22, --> array_local32 + array_local32: imm_addr 0($sp), %23, --> array_local31 + array_local31: imm_int 1, %25, --> array_local30 + array_local30: imm_int 4, %26, --> array_local29 + array_local3: load int32, add, %5, %6, %2 --> array_local2 + array_local29: mul %24, %25, %26 --> array_local28 + array_local28: store int32, add, %23, %24, %22 --> array_local27 + array_local27: emit c4 --> array_local26 + array_local26: imm_addr 0($sp), %18, --> array_local25 + array_local25: imm_int 0, %20, --> array_local24 + array_local24: imm_int 4, %21, --> array_local23 + array_local23: mul %19, %20, %21 --> array_local22 + array_local22: load int32, add, %18, %19, %3 --> array_local21 + array_local21: emit c3 --> array_local20 + array_local20: imm_int 7, %13, --> array_local19 + array_local2: emit c0 --> array_local1 + array_local19: imm_addr 0($sp), %14, --> array_local18 + array_local18: imm_int 1, %16, --> array_local17 + array_local17: imm_int 4, %17, --> array_local16 + array_local16: mul %15, %16, %17 --> array_local15 + array_local15: store int32, add, %14, %15, %13 --> array_local14 + array_local14: emit c2 --> array_local13 + array_local13: imm_addr 0($sp), %9, --> array_local12 + array_local12: imm_int 1, %11, --> array_local11 + array_local111: emit c16 --> array_local110 + array_local110: imm_int 0, %77, --> array_local109 + array_local11: imm_int 4, %12, --> array_local10 + array_local109: imm_addr 0($sp), %78, --> array_local108 + array_local108: imm_int 0, %80, --> array_local107 + array_local107: imm_int 4, %81, --> array_local106 + array_local106: mul %79, %80, %81 --> array_local105 + array_local105: store int32, add, %78, %79, %77 --> array_local104 + array_local104: emit c15 --> array_local103 + array_local103: imm_int 0, %72, --> array_local102 + array_local102: imm_addr 0($sp), %73, --> array_local101 + array_local101: imm_int 1, %75, --> array_local100 + array_local100: imm_int 4, %76, --> array_local99 + array_local10: mul %10, %11, %12 --> array_local9 + array_local1: mov %4, %3 --> array_local0 + array_local0: return %4 + + + "array_mixte"(%0, %1, %2): int -> int -> int -> int + locals: %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77 + result: %3 + stacksize: 40 + entry: array_mixte102 + exit: array_mixte0 + + array_mixte99: imm_int 0, %76, --> array_mixte98 + array_mixte98: imm_int 4, %77, --> array_mixte97 + array_mixte97: mul %75, %76, %77 --> array_mixte96 + array_mixte96: store int32, add, %74, %75, %73 --> array_mixte95 + array_mixte95: emit c29 --> array_mixte94 + array_mixte94: imm_int 0, %68, --> array_mixte93 + array_mixte93: imm_addr 0($sp), %69, --> array_mixte92 + array_mixte92: imm_int 1, %71, --> array_mixte91 + array_mixte91: imm_int 4, %72, --> array_mixte90 + array_mixte90: mul %70, %71, %72 --> array_mixte89 + array_mixte9: load int32, add, %0, %10, %7 --> array_mixte8 + array_mixte89: store int32, add, %69, %70, %68 --> array_mixte88 + array_mixte88: emit c28 --> array_mixte87 + array_mixte87: imm_int 0, %63, --> array_mixte86 + array_mixte86: imm_addr 0($sp), %64, --> array_mixte85 + array_mixte85: imm_int 2, %66, --> array_mixte84 + array_mixte84: imm_int 4, %67, --> array_mixte83 + array_mixte83: mul %65, %66, %67 --> array_mixte82 + array_mixte82: store int32, add, %64, %65, %63 --> array_mixte81 + array_mixte81: emit c27 --> array_mixte80 + array_mixte80: imm_int 0, %58, --> array_mixte79 + array_mixte8: imm_int 4, %9, --> array_mixte7 + array_mixte79: imm_addr 0($sp), %59, --> array_mixte78 + array_mixte78: imm_int 3, %61, --> array_mixte77 + array_mixte77: imm_int 4, %62, --> array_mixte76 + array_mixte76: mul %60, %61, %62 --> array_mixte75 + array_mixte75: store int32, add, %59, %60, %58 --> array_mixte74 + array_mixte74: emit c26 --> array_mixte73 + array_mixte73: imm_int 0, %53, --> array_mixte72 + array_mixte72: imm_addr 0($sp), %54, --> array_mixte71 + array_mixte71: imm_int 4, %56, --> array_mixte70 + array_mixte70: imm_int 4, %57, --> array_mixte69 + array_mixte7: mul %8, %1, %9 --> array_mixte6 + array_mixte69: mul %55, %56, %57 --> array_mixte68 + array_mixte68: store int32, add, %54, %55, %53 --> array_mixte67 + array_mixte67: emit c25 --> array_mixte66 + array_mixte66: imm_int 0, %48, --> array_mixte65 + array_mixte65: imm_addr 0($sp), %49, --> array_mixte64 + array_mixte64: imm_int 5, %51, --> array_mixte63 + array_mixte63: imm_int 4, %52, --> array_mixte62 + array_mixte62: mul %50, %51, %52 --> array_mixte61 + array_mixte61: store int32, add, %49, %50, %48 --> array_mixte60 + array_mixte60: emit c24 --> array_mixte59 + array_mixte6: store int32, add, %0, %8, %7 --> array_mixte5 + array_mixte59: imm_int 0, %43, --> array_mixte58 + array_mixte58: imm_addr 0($sp), %44, --> array_mixte57 + array_mixte57: imm_int 6, %46, --> array_mixte56 + array_mixte56: imm_int 4, %47, --> array_mixte55 + array_mixte55: mul %45, %46, %47 --> array_mixte54 + array_mixte54: store int32, add, %44, %45, %43 --> array_mixte53 + array_mixte53: emit c23 --> array_mixte52 + array_mixte52: imm_int 0, %38, --> array_mixte51 + array_mixte51: imm_addr 0($sp), %39, --> array_mixte50 + array_mixte50: imm_int 7, %41, --> array_mixte49 + array_mixte5: emit c17 --> array_mixte4 + array_mixte49: imm_int 4, %42, --> array_mixte48 + array_mixte48: mul %40, %41, %42 --> array_mixte47 + array_mixte47: store int32, add, %39, %40, %38 --> array_mixte46 + array_mixte46: emit c22 --> array_mixte45 + array_mixte45: imm_int 0, %33, --> array_mixte44 + array_mixte44: imm_addr 0($sp), %34, --> array_mixte43 + array_mixte43: imm_int 8, %36, --> array_mixte42 + array_mixte42: imm_int 4, %37, --> array_mixte41 + array_mixte41: mul %35, %36, %37 --> array_mixte40 + array_mixte40: store int32, add, %34, %35, %33 --> array_mixte39 + array_mixte4: imm_addr 0($sp), %4, --> array_mixte3 + array_mixte39: emit c21 --> array_mixte38 + array_mixte38: imm_int 0, %28, --> array_mixte37 + array_mixte37: imm_addr 0($sp), %29, --> array_mixte36 + array_mixte36: imm_int 9, %31, --> array_mixte35 + array_mixte35: imm_int 4, %32, --> array_mixte34 + array_mixte34: mul %30, %31, %32 --> array_mixte33 + array_mixte33: store int32, add, %29, %30, %28 --> array_mixte32 + array_mixte32: emit c20 --> array_mixte31 + array_mixte31: imm_int 4, %27, --> array_mixte30 + array_mixte30: mul %26, %2, %27 --> array_mixte29 + array_mixte3: imm_int 4, %6, --> array_mixte2 + array_mixte29: load int32, add, %0, %26, %24 --> array_mixte28 + array_mixte28: imm_int 1, %25, --> array_mixte27 + array_mixte27: add %20, %24, %25 --> array_mixte26 + array_mixte26: imm_addr 0($sp), %21, --> array_mixte25 + array_mixte25: imm_int 4, %23, --> array_mixte24 + array_mixte24: mul %22, %1, %23 --> array_mixte23 + array_mixte23: store int32, add, %21, %22, %20 --> array_mixte22 + array_mixte22: emit c19 --> array_mixte21 + array_mixte21: imm_addr 0($sp), %16, --> array_mixte20 + array_mixte20: imm_int 0, %18, --> array_mixte19 + array_mixte2: mul %5, %1, %6 --> array_mixte1 + array_mixte19: imm_int 4, %19, --> array_mixte18 + array_mixte18: mul %17, %18, %19 --> array_mixte17 + array_mixte17: load int32, add, %16, %17, %13 --> array_mixte16 + array_mixte16: imm_int 4, %15, --> array_mixte15 + array_mixte15: mul %14, %2, %15 --> array_mixte14 + array_mixte14: store int32, add, %0, %14, %13 --> array_mixte13 + array_mixte13: emit c18 --> array_mixte12 + array_mixte12: imm_int 1, %11, --> array_mixte11 + array_mixte11: imm_int 4, %12, --> array_mixte10 + array_mixte102: emit c30 --> array_mixte101 + array_mixte101: imm_int 0, %73, --> array_mixte100 + array_mixte100: imm_addr 0($sp), %74, --> array_mixte99 + array_mixte10: mul %10, %11, %12 --> array_mixte9 + array_mixte1: load int32, add, %4, %5, %3 --> array_mixte0 + array_mixte0: return %3 + + + "array_param"(%0, %1, %2): int -> int -> int -> int + locals: %7, %3, %4, %5, %6, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25 + result: %7 + stacksize: 0 + entry: array_param32 + exit: array_param0 + + array_param9: mul %11, %2, %12 --> array_param8 + array_param8: load int32, add, %0, %11, %6 --> array_param7 + array_param7: emit c32 --> array_param6 + array_param6: imm_int 0, %9, --> array_param5 + array_param5: imm_int 4, %10, --> array_param4 + array_param4: mul %8, %9, %10 --> array_param3 + array_param32: emit c37 --> array_param31 + array_param31: imm_int 1, %22, --> array_param30 + array_param30: imm_int 0, %24, --> array_param29 + array_param3: load int32, add, %0, %8, %5 --> array_param2 + array_param29: imm_int 4, %25, --> array_param28 + array_param28: mul %23, %24, %25 --> array_param27 + array_param27: store int32, add, %0, %23, %22 --> array_param26 + array_param26: emit c36 --> array_param25 + array_param25: imm_int 1, %20, --> array_param24 + array_param24: imm_int 4, %21, --> array_param23 + array_param23: mul %19, %20, %21 --> array_param22 + array_param22: store int32, add, %0, %19, %1 --> array_param21 + array_param21: emit c35 --> array_param20 + array_param20: imm_int 0, %17, --> array_param19 + array_param2: emit c31 --> array_param1 + array_param19: imm_int 4, %18, --> array_param18 + array_param18: mul %16, %17, %18 --> array_param17 + array_param17: load int32, add, %0, %16, %6 --> array_param16 + array_param16: emit c34 --> array_param15 + array_param15: imm_int 7, %13, --> array_param14 + array_param14: imm_int 4, %15, --> array_param13 + array_param13: mul %14, %2, %15 --> array_param12 + array_param12: store int32, add, %0, %14, %13 --> array_param11 + array_param11: emit c33 --> array_param10 + array_param10: imm_int 4, %12, --> array_param9 + array_param1: mov %7, %6 --> array_param0 + array_param0: return %7 + + + "main"(): int + locals: %3, %0, %1, %2, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60 + result: %3 + stacksize: 40 + entry: main85 + exit: main0 + + main9: call "array_mixte", %8, %9, %10, %1: int -> int -> int -> int --> main8 + main85: emit c51 --> main84 + main84: imm_int 1, %56, --> main83 + main83: imm_addr 0($sp), %57, --> main82 + main82: imm_int 0, %59, --> main81 + main81: imm_int 4, %60, --> main80 + main80: mul %58, %59, %60 --> main79 + main8: emit c39 --> main7 + main79: store int32, add, %57, %58, %56 --> main78 + main78: emit c50 --> main77 + main77: imm_int 2, %51, --> main76 + main76: imm_addr 0($sp), %52, --> main75 + main75: imm_int 1, %54, --> main74 + main74: imm_int 4, %55, --> main73 + main73: mul %53, %54, %55 --> main72 + main72: store int32, add, %52, %53, %51 --> main71 + main71: emit c49 --> main70 + main70: imm_int 3, %46, --> main69 + main7: imm_addr 0($sp), %5, --> main6 + main69: imm_addr 0($sp), %47, --> main68 + main68: imm_int 2, %49, --> main67 + main67: imm_int 4, %50, --> main66 + main66: mul %48, %49, %50 --> main65 + main65: store int32, add, %47, %48, %46 --> main64 + main64: emit c48 --> main63 + main63: imm_int 4, %41, --> main62 + main62: imm_addr 0($sp), %42, --> main61 + main61: imm_int 3, %44, --> main60 + main60: imm_int 4, %45, --> main59 + main6: imm_int 2, %6, --> main5 + main59: mul %43, %44, %45 --> main58 + main58: store int32, add, %42, %43, %41 --> main57 + main57: emit c47 --> main56 + main56: imm_int 5, %36, --> main55 + main55: imm_addr 0($sp), %37, --> main54 + main54: imm_int 4, %39, --> main53 + main53: imm_int 4, %40, --> main52 + main52: mul %38, %39, %40 --> main51 + main51: store int32, add, %37, %38, %36 --> main50 + main50: emit c46 --> main49 + main5: imm_int 3, %7, --> main4 + main49: imm_int 6, %31, --> main48 + main48: imm_addr 0($sp), %32, --> main47 + main47: imm_int 5, %34, --> main46 + main46: imm_int 4, %35, --> main45 + main45: mul %33, %34, %35 --> main44 + main44: store int32, add, %32, %33, %31 --> main43 + main43: emit c45 --> main42 + main42: imm_int 7, %26, --> main41 + main41: imm_addr 0($sp), %27, --> main40 + main40: imm_int 6, %29, --> main39 + main4: call "array_param", %5, %6, %7, %0: int -> int -> int -> int --> main3 + main39: imm_int 4, %30, --> main38 + main38: mul %28, %29, %30 --> main37 + main37: store int32, add, %27, %28, %26 --> main36 + main36: emit c44 --> main35 + main35: imm_int 8, %21, --> main34 + main34: imm_addr 0($sp), %22, --> main33 + main33: imm_int 7, %24, --> main32 + main32: imm_int 4, %25, --> main31 + main31: mul %23, %24, %25 --> main30 + main30: store int32, add, %22, %23, %21 --> main29 + main3: emit c38 --> main2 + main29: emit c43 --> main28 + main28: imm_int 9, %16, --> main27 + main27: imm_addr 0($sp), %17, --> main26 + main26: imm_int 8, %19, --> main25 + main25: imm_int 4, %20, --> main24 + main24: mul %18, %19, %20 --> main23 + main23: store int32, add, %17, %18, %16 --> main22 + main22: emit c42 --> main21 + main21: imm_int 0, %11, --> main20 + main20: imm_addr 0($sp), %12, --> main19 + main2: add %4, %2, %1 --> main1 + main19: imm_int 9, %14, --> main18 + main18: imm_int 4, %15, --> main17 + main17: mul %13, %14, %15 --> main16 + main16: store int32, add, %12, %13, %11 --> main15 + main15: emit c41 --> main14 + main14: call "array_local", , %2: int --> main13 + main13: emit c40 --> main12 + main12: imm_addr 0($sp), %8, --> main11 + main11: imm_int 2, %9, --> main10 + main10: imm_int 3, %10, --> main9 + main1: add %3, %4, %0 --> main0 + main0: return %3 + + diff --git a/tests/clight/array.c b/tests/clight/array.c new file mode 100644 index 0000000..896991b --- /dev/null +++ b/tests/clight/array.c @@ -0,0 +1,48 @@ +int array_local () { + int i,j,a,b; + int tab[10] = {0,0,0,0,0,0,0,0,0,0}; + + tab[0]=1; //Ecriture + tab[1]=5; + + a=tab[0]; //Lecture & Ecriture + tab[1]=7; + + a=tab[1]; //Lecture + b=tab[0]; + + return a;//7 +} + +int array_mixte (int tab1[], int a, int b) { + int tab2[10] = {0,0,0,0,0,0,0,0,0,0}; + + tab2[a] = tab1[b]+1; + tab1[b] = tab2[0]; + tab1[a] = tab1[1]; + return tab2[a];//5 +} + +int array_param (int tab[], int c, int d) { + int i,j,a,b; + + tab[0]=1; //Ecriture + tab[1]=c; + + a=tab[0]; //Lecture & Ecriture + tab[d]=7; + + a=tab[d]; //Lecture + b=tab[0]; + + return a;//7 +} + +int main(){ + int t[10] = {1,2,3,4,5,6,7,8,9,0}; + int a = array_local(); + int b = array_mixte(t,2,3); + int c = array_param(t,2,3); + return a+b+c; //19 + // return b; +} diff --git a/tests/clight/array.c.expected b/tests/clight/array.c.expected new file mode 100644 index 0000000..0df5e53 --- /dev/null +++ b/tests/clight/array.c.expected @@ -0,0 +1,48 @@ +int array_local () { + int i,j,a,b; + int tab[10] = {0,0,0,0,0,0,0,0,0,0}; + + tab[0]=1; //Ecriture + tab[1]=5; + + a=tab[0]; //Lecture & Ecriture + tab[1]=7; + + a=tab[1]; //Lecture + b=tab[0]; + + return a;//7 +} + +int array_mixte (int tab1[], int a, int b) { + int tab2[10] = {0,0,0,0,0,0,0,0,0,0}; + + tab2[a] = tab1[b]+1; + tab1[b] = tab2[0]; + tab1[a] = tab1[1]; + return tab2[a];//5 +} + +int array_param (int tab[], int c, int d) { + int i,j,a,b; + + tab[0]=1; //Ecriture + tab[1]=c; + + a=tab[0]; //Lecture & Ecriture + tab[d]=7; + + a=tab[d]; //Lecture + b=tab[0]; + + return a;//7 +} + +main(){ + int t[10] = {1,2,3,4,5,6,7,8,9,0}; + int a = array_local(); + int b = array_mixte(t,2,3); + int c = array_param(t,2,3); + return a+b+c; //19 + //return b; +} diff --git a/tests/clight/array.log.expected b/tests/clight/array.log.expected new file mode 100644 index 0000000..ba50dc8 --- /dev/null +++ b/tests/clight/array.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Constant not supported. diff --git a/tests/clight/binop.ASM.expected b/tests/clight/binop.ASM.expected new file mode 100644 index 0000000..81536ee --- /dev/null +++ b/tests/clight/binop.ASM.expected @@ -0,0 +1,353 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main57 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin _main +main57: +addi $sp, $sp, -12 +sw $ra, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +c20: +li $s0, 4 +c19: +li $s1, 5 +c18: +c17: +c16: +c15: +c14: +c13: +c12: +la $v0, mod +move $a0, $s0 +move $a1, $s1 +jalr $v0 +c11: +c10: +c9: +c8: +c7: +c6: +c5: +c4: +c3: +c2: +c1: +sge $v0, $s0, $s1 +c0: +lw $ra, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +addi $sp, $sp, 12 +jr $ra +# end _main diff --git a/tests/clight/binop.Clight.expected b/tests/clight/binop.Clight.expected new file mode 100644 index 0000000..d4668ad --- /dev/null +++ b/tests/clight/binop.Clight.expected @@ -0,0 +1,314 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int main(void) +{ + int a; + int b; + int c; + c20: + a = 4; + c19: + b = 5; + c18: + c = a; + c17: + c = 10; + c16: + c = a + b; + c15: + c = a - b; + c14: + c = a * b; + c13: + c = a / b; + c12: + c = a % b; + c11: + c = a & b; + c10: + c = a | b; + c9: + c = a << b; + c8: + c = a >> b; + c7: + c = a ^ b; + c6: + c = a < b; + c5: + c = a > b; + c4: + c = a == b; + c3: + c = a != b; + c2: + c = a <= b; + c1: + c = a >= b; + c0: + return c; +} + + diff --git a/tests/clight/binop.Cminor.expected b/tests/clight/binop.Cminor.expected new file mode 100644 index 0000000..6093629 --- /dev/null +++ b/tests/clight/binop.Cminor.expected @@ -0,0 +1,451 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"main" () : int { + + stack 0; + + var c, b, a; + + c20: + a = 4; + c19: + b = 5; + c18: + c = a; + c17: + c = 10; + c16: + c = a + b; + c15: + c = a - b; + c14: + c = a * b; + c13: + c = a / b; + c12: + c = a % b; + c11: + c = a && b; + c10: + c = a || b; + c9: + c = a << b; + c8: + c = a >> b; + c7: + c = a ^ b; + c6: + c = a < b; + c5: + c = a > b; + c4: + c = a == b; + c3: + c = a != b; + c2: + c = a <= b; + c1: + c = a >= b; + c0: + return c; + +} + + diff --git a/tests/clight/binop.ERTL.expected b/tests/clight/binop.ERTL.expected new file mode 100644 index 0000000..88c63af --- /dev/null +++ b/tests/clight/binop.ERTL.expected @@ -0,0 +1,480 @@ +program + +globals 0 + +procedure _main(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13 +entry main57 +main57: newframe --> main56 +main56: move %13, $ra --> main55 +main55: move %12, $s7 --> main54 +main54: move %11, $s6 --> main53 +main53: move %10, $s5 --> main52 +main52: move %9, $s4 --> main51 +main51: move %8, $s3 --> main50 +main50: move %7, $s2 --> main49 +main49: move %6, $s1 --> main48 +main48: move %5, $s0 --> main47 +main47: li %0, 0 --> main46 +main46: li %1, 0 --> main45 +main45: li %2, 0 --> main44 +main44: li %4, 0 --> main42 +main42: emit c20 --> main41 +main41: li %2, 4 --> main40 +main40: emit c19 --> main39 +main39: li %1, 5 --> main38 +main38: emit c18 --> main37 +main37: move %0, %2 --> main36 +main36: emit c17 --> main35 +main35: li %0, 10 --> main34 +main34: emit c16 --> main33 +main33: add %0, %2, %1 --> main32 +main32: emit c15 --> main31 +main31: sub %0, %2, %1 --> main30 +main30: emit c14 --> main29 +main29: mulo %0, %2, %1 --> main28 +main28: emit c13 --> main27 +main27: div %0, %2, %1 --> main26 +main26: emit c12 --> main25 +main25: la %4, mod --> main43 +main43: j --> main73 +main73: move $a0, %2 --> main72 +main72: move $a1, %1 --> main71 +main71: call %4(2) --> main70 +main70: move %0, $v0 --> main24 +main24: emit c11 --> main23 +main23: and %0, %2, %1 --> main22 +main22: emit c10 --> main21 +main21: or %0, %2, %1 --> main20 +main20: emit c9 --> main19 +main19: sllv %0, %2, %1 --> main18 +main18: emit c8 --> main17 +main17: srav %0, %2, %1 --> main16 +main16: emit c7 --> main15 +main15: xor %0, %2, %1 --> main14 +main14: emit c6 --> main13 +main13: slt %0, %2, %1 --> main12 +main12: emit c5 --> main11 +main11: sgt %0, %2, %1 --> main10 +main10: emit c4 --> main9 +main9 : seq %0, %2, %1 --> main8 +main8 : emit c3 --> main7 +main7 : sne %0, %2, %1 --> main6 +main6 : emit c2 --> main5 +main5 : sle %0, %2, %1 --> main4 +main4 : emit c1 --> main3 +main3 : sge %0, %2, %1 --> main2 +main2 : emit c0 --> main1 +main1 : move %3, %0 --> main0 +main0 : j --> main69 +main69: move $v0, %3 --> main68 +main68: move $ra, %13 --> main67 +main67: move $s7, %12 --> main66 +main66: move $s6, %11 --> main65 +main65: move $s5, %10 --> main64 +main64: move $s4, %9 --> main63 +main63: move $s3, %8 --> main62 +main62: move $s2, %7 --> main61 +main61: move $s1, %6 --> main60 +main60: move $s0, %5 --> main59 +main59: delframe --> main58 +main58: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/binop.LIN.expected b/tests/clight/binop.LIN.expected new file mode 100644 index 0000000..029cadb --- /dev/null +++ b/tests/clight/binop.LIN.expected @@ -0,0 +1,441 @@ +program + +globals 0 + +procedure _main(0) +var 12 +main57: +newframe +sw $ra, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +c20: +li $s0, 4 +c19: +li $s1, 5 +c18: +c17: +c16: +c15: +c14: +c13: +c12: +la $v0, mod +move $a0, $s0 +move $a1, $s1 +call $v0 +c11: +c10: +c9: +c8: +c7: +c6: +c5: +c4: +c3: +c2: +c1: +sge $v0, $s0, $s1 +c0: +lw $ra, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/binop.LTL.expected b/tests/clight/binop.LTL.expected new file mode 100644 index 0000000..e808e97 --- /dev/null +++ b/tests/clight/binop.LTL.expected @@ -0,0 +1,478 @@ +program + +globals 0 + +procedure _main(0) +var 12 +entry main57 +main57: newframe --> main56 +main56: lw $ra, 8($sp) --> main55 +main55: j --> main54 +main54: j --> main53 +main53: j --> main52 +main52: j --> main51 +main51: j --> main50 +main50: j --> main49 +main49: lw $s1, 4($sp) --> main48 +main48: lw $s0, 0($sp) --> main47 +main47: j --> main46 +main46: j --> main45 +main45: j --> main44 +main44: j --> main42 +main42: emit c20 --> main41 +main41: li $s0, 4 --> main40 +main40: emit c19 --> main39 +main39: li $s1, 5 --> main38 +main38: emit c18 --> main37 +main37: j --> main36 +main36: emit c17 --> main35 +main35: j --> main34 +main34: emit c16 --> main33 +main33: j --> main32 +main32: emit c15 --> main31 +main31: j --> main30 +main30: emit c14 --> main29 +main29: j --> main28 +main28: emit c13 --> main27 +main27: j --> main26 +main26: emit c12 --> main25 +main25: la $v0, mod --> main43 +main43: j --> main73 +main73: move $a0, $s0 --> main72 +main72: move $a1, $s1 --> main71 +main71: call $v0 --> main70 +main70: j --> main24 +main24: emit c11 --> main23 +main23: j --> main22 +main22: emit c10 --> main21 +main21: j --> main20 +main20: emit c9 --> main19 +main19: j --> main18 +main18: emit c8 --> main17 +main17: j --> main16 +main16: emit c7 --> main15 +main15: j --> main14 +main14: emit c6 --> main13 +main13: j --> main12 +main12: emit c5 --> main11 +main11: j --> main10 +main10: emit c4 --> main9 +main9 : j --> main8 +main8 : emit c3 --> main7 +main7 : j --> main6 +main6 : emit c2 --> main5 +main5 : j --> main4 +main4 : emit c1 --> main3 +main3 : sge $v0, $s0, $s1 --> main2 +main2 : emit c0 --> main1 +main1 : j --> main0 +main0 : j --> main69 +main69: j --> main68 +main68: lw $ra, 8($sp) --> main67 +main67: j --> main66 +main66: j --> main65 +main65: j --> main64 +main64: j --> main63 +main63: j --> main62 +main62: j --> main61 +main61: lw $s1, 4($sp) --> main60 +main60: lw $s0, 0($sp) --> main59 +main59: delframe --> main58 +main58: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/binop.RTL.expected b/tests/clight/binop.RTL.expected new file mode 100644 index 0000000..1712f71 --- /dev/null +++ b/tests/clight/binop.RTL.expected @@ -0,0 +1,453 @@ +program + +globals 0 + +function _main() : %3 +stacksize 0 +var %0, %1, %2, %3, %4 +entry main47 +main47: li %0, 0 --> main46 +main46: li %1, 0 --> main45 +main45: li %2, 0 --> main44 +main44: li %4, 0 --> main42 +main42: emit c20 --> main41 +main41: li %2, 4 --> main40 +main40: emit c19 --> main39 +main39: li %1, 5 --> main38 +main38: emit c18 --> main37 +main37: move %0, %2 --> main36 +main36: emit c17 --> main35 +main35: li %0, 10 --> main34 +main34: emit c16 --> main33 +main33: add %0, %2, %1 --> main32 +main32: emit c15 --> main31 +main31: sub %0, %2, %1 --> main30 +main30: emit c14 --> main29 +main29: mulo %0, %2, %1 --> main28 +main28: emit c13 --> main27 +main27: div %0, %2, %1 --> main26 +main26: emit c12 --> main25 +main25: la %4, mod --> main43 +main43: call %0, %4(%2, %1) --> main24 +main24: emit c11 --> main23 +main23: and %0, %2, %1 --> main22 +main22: emit c10 --> main21 +main21: or %0, %2, %1 --> main20 +main20: emit c9 --> main19 +main19: sllv %0, %2, %1 --> main18 +main18: emit c8 --> main17 +main17: srav %0, %2, %1 --> main16 +main16: emit c7 --> main15 +main15: xor %0, %2, %1 --> main14 +main14: emit c6 --> main13 +main13: slt %0, %2, %1 --> main12 +main12: emit c5 --> main11 +main11: sgt %0, %2, %1 --> main10 +main10: emit c4 --> main9 +main9 : seq %0, %2, %1 --> main8 +main8 : emit c3 --> main7 +main7 : sne %0, %2, %1 --> main6 +main6 : emit c2 --> main5 +main5 : sle %0, %2, %1 --> main4 +main4 : emit c1 --> main3 +main3 : sge %0, %2, %1 --> main2 +main2 : emit c0 --> main1 +main1 : move %3, %0 --> main0 +main0 : return %3 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/binop.RTLabs.expected b/tests/clight/binop.RTLabs.expected new file mode 100644 index 0000000..515ee34 --- /dev/null +++ b/tests/clight/binop.RTLabs.expected @@ -0,0 +1,454 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "main"(): int + locals: %3, %0, %1, %2 + result: %3 + stacksize: 0 + entry: main42 + exit: main0 + + main9: eq %0, %2, %1 --> main8 + main8: emit c3 --> main7 + main7: ne %0, %2, %1 --> main6 + main6: emit c2 --> main5 + main5: le %0, %2, %1 --> main4 + main42: emit c20 --> main41 + main41: imm_int 4, %2, --> main40 + main40: emit c19 --> main39 + main4: emit c1 --> main3 + main39: imm_int 5, %1, --> main38 + main38: emit c18 --> main37 + main37: mov %0, %2 --> main36 + main36: emit c17 --> main35 + main35: imm_int 10, %0, --> main34 + main34: emit c16 --> main33 + main33: add %0, %2, %1 --> main32 + main32: emit c15 --> main31 + main31: sub %0, %2, %1 --> main30 + main30: emit c14 --> main29 + main3: ge %0, %2, %1 --> main2 + main29: mul %0, %2, %1 --> main28 + main28: emit c13 --> main27 + main27: div %0, %2, %1 --> main26 + main26: emit c12 --> main25 + main25: mod %0, %2, %1 --> main24 + main24: emit c11 --> main23 + main23: and %0, %2, %1 --> main22 + main22: emit c10 --> main21 + main21: or %0, %2, %1 --> main20 + main20: emit c9 --> main19 + main2: emit c0 --> main1 + main19: shl %0, %2, %1 --> main18 + main18: emit c8 --> main17 + main17: shr %0, %2, %1 --> main16 + main16: emit c7 --> main15 + main15: xor %0, %2, %1 --> main14 + main14: emit c6 --> main13 + main13: lt %0, %2, %1 --> main12 + main12: emit c5 --> main11 + main11: gt %0, %2, %1 --> main10 + main10: emit c4 --> main9 + main1: mov %3, %0 --> main0 + main0: return %3 + + diff --git a/tests/clight/binop.c b/tests/clight/binop.c new file mode 100644 index 0000000..800cfe9 --- /dev/null +++ b/tests/clight/binop.c @@ -0,0 +1,40 @@ +int main(){ + int a=4,b=5,c; +// double d=3.5,e=0.1,f; + + c = a; + c = 10; + c = a+b; + c = a-b; + c = a*b; + c = a/b; + c = a%b; + c = a&b; + c = a|b; + c = a<>b; + c = a^b; + c = ab; + c = a==b; + c = a!=b; + c = a<=b; + c = a>=b; + +// f = d; +// f = 1.0; +// f = d+e; +// f = d-e; +// f = d*e; +// f = d/e; +// c = de; +// c = d==e; +// c = d!=e; +// c = d<=e; +// c = d>=e; + + return c; +} + + diff --git a/tests/clight/binop.c.expected b/tests/clight/binop.c.expected new file mode 100644 index 0000000..7f56782 --- /dev/null +++ b/tests/clight/binop.c.expected @@ -0,0 +1,40 @@ +int main(){ + int a=4,b=5,c; + double d=3.5,e=0.1,f; + + c = a; + c = 10; + c = a+b; + c = a-b; + c = a*b; + c = a/b; + c = a%b; + c = a&b; + c = a|b; + c = a<>b; + c = a^b; + c = ab; + c = a==b; + c = a!=b; + c = a<=b; + c = a>=b; + + f = d; + f = 1.0; + f = d+e; + f = d-e; + f = d*e; + f = d/e; + c = de; + c = d==e; + c = d!=e; + c = d<=e; + c = d>=e; + + return c; +} + + diff --git a/tests/clight/binop.log.expected b/tests/clight/binop.log.expected new file mode 100644 index 0000000..962e977 --- /dev/null +++ b/tests/clight/binop.log.expected @@ -0,0 +1 @@ +Fatal error: exception Assert_failure("src/RTLabs/RTLabsToRTL.ml", 23, 9) diff --git a/tests/clight/complets.ASM.expected b/tests/clight/complets.ASM.expected new file mode 100644 index 0000000..39ee23b --- /dev/null +++ b/tests/clight/complets.ASM.expected @@ -0,0 +1,1300 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main307 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin comp_tri +comp_tri123: +c108: +li $v0, 0 +c107: +c106: +li $t1, 0 +comp_tri55: +li $a3, 0 +c105: +slt $a2, $t1, $a1 +seq $a2, $a2, $zero +beq $a2, $a3, comp_tri50 +c95: +jr $ra +comp_tri50: +c103: +c102: +li $t2, 1 +comp_tri47: +li $a3, 0 +c101: +sub $a2, $a1, $t1 +slt $a2, $t2, $a2 +seq $a2, $a2, $zero +beq $a2, $a3, comp_tri41 +c104: +li $a2, 1 +add $t1, $t1, $a2 +j comp_tri55 +comp_tri41: +c99: +li $a2, 4 +mulo $a2, $t2, $a2 +add $a2, $a0, $a2 +lw $t0, 0($a2) +li $a2, 1 +sub $a3, $t2, $a2 +li $a2, 4 +mulo $a2, $a3, $a2 +add $a2, $a0, $a2 +lw $a2, 0($a2) +slt $a2, $t0, $a2 +beq $a2, $zero, comp_tri10 +c98: +li $v0, 1 +sub $a2, $t2, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +c97: +li $a2, 4 +mulo $a2, $t2, $a2 +add $a2, $a0, $a2 +lw $t0, 0($a2) +li $a2, 1 +sub $a3, $t2, $a2 +li $a2, 4 +mulo $a2, $a3, $a2 +add $a2, $a0, $a2 +sw $t0, 0($a2) +c96: +li $a2, 4 +mulo $a2, $t2, $a2 +add $a2, $a0, $a2 +sw $v0, 0($a2) +comp_tri10: +c100: +li $a2, 1 +add $t2, $t2, $a2 +j comp_tri47 +# end comp_tri + + +# begin comp_total +comp_total410: +addi $sp, $sp, -80 +c94: +li $t0, 0 +move $a3, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c93: +move $t0, $sp +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c92: +move $t0, $sp +li $a3, 2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c91: +move $t0, $sp +li $a3, 3 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c90: +move $t0, $sp +li $a3, 4 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c89: +move $t0, $sp +li $a3, 5 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c88: +move $t0, $sp +li $a3, 6 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c87: +move $t0, $sp +li $a3, 7 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c86: +move $t0, $sp +li $a3, 8 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c85: +move $t0, $sp +li $a3, 9 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c84: +li $t0, 0 +move $a3, $sp +addi $a3, $a3, 40 +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c83: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c82: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c81: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 3 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c80: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 4 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c79: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 5 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c78: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 6 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c77: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 7 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c76: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 8 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c75: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 9 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c74: +slt $v0, $a1, $a2 +beq $v0, $zero, comp_total40 +c73: +c72: +li $t0, 0 +comp_total58: +li $a2, 0 +c71: +sle $v0, $t0, $a1 +seq $v0, $v0, $zero +beq $v0, $a2, comp_total53 +comp_total2: +c59: +li $v0, 0 +addi $sp, $sp, 80 +jr $ra +comp_total53: +c69: +sub $a2, $a1, $t0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +move $a2, $sp +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a2, $v0 +sw $a3, 0($v0) +c70: +li $v0, 1 +add $t0, $t0, $v0 +j comp_total58 +comp_total40: +c68: +c67: +li $t2, 0 +comp_total37: +li $a3, 0 +c66: +slt $v0, $t2, $a1 +seq $v0, $v0, $zero +bne $v0, $a3, comp_total2 +c64: +c63: +move $t1, $a2 +comp_total29: +li $a3, 0 +c62: +sgt $v0, $t1, $zero +seq $v0, $v0, $zero +beq $v0, $a3, comp_total23 +c65: +li $v0, 1 +add $t2, $t2, $v0 +j comp_total37 +comp_total23: +c60: +move $a3, $sp +li $v0, 4 +mulo $v0, $t2, $v0 +add $v0, $a3, $v0 +lw $t0, 0($v0) +move $a3, $sp +addi $a3, $a3, 40 +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a3, $v0 +lw $v0, 0($v0) +add $a3, $t0, $v0 +li $v0, 4 +mulo $v0, $t2, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c61: +li $v0, 1 +sub $t1, $t1, $v0 +j comp_total29 +# end comp_total + + +# begin comp_ifFor +comp_ifFor45: +c58: +li $v0, 0 +c57: +c56: +li $t0, 0 +comp_ifFor18: +li $t1, 0 +c55: +slt $a3, $t0, $a0 +seq $a3, $a3, $zero +beq $a3, $t1, comp_ifFor13 +c50: +jr $ra +comp_ifFor13: +c53: +sne $a3, $t0, $a1 +beq $a3, $zero, comp_ifFor7 +c52: +add $v0, $v0, $t0 +comp_ifFor5: +c54: +add $t0, $t0, $a2 +j comp_ifFor18 +comp_ifFor7: +c51: +li $v0, 0 +j comp_ifFor5 +# end comp_ifFor + + +# begin comp_forif2 +comp_forif2153: +addi $sp, $sp, -16 +sw $ra, 12($sp) +sw $s2, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +c130: +li $s0, 0 +c129: +li $s1, 0 +c128: +c127: +li $t0, 0 +comp_forif275: +li $t1, 0 +c126: +slt $v0, $t0, $a2 +seq $v0, $v0, $zero +beq $v0, $t1, comp_forif270 +c123: +c122: +li $a0, 0 +comp_forif258: +li $a2, 0 +c121: +slt $v0, $a0, $a3 +seq $v0, $v0, $zero +beq $v0, $a2, comp_forif253 +c118: +li $s2, 0 +c117: +li $a1, 2 +la $v0, mod +move $a0, $s0 +jalr $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif226 +c116: +li $a1, 2 +la $v0, mod +move $a0, $s1 +jalr $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif227 +li $v0, 1 +comp_forif225: +beq $v0, $s2, comp_forif222 +c115: +comp_forif22: +c109: +li $v0, 0 +lw $ra, 12($sp) +lw $s2, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +addi $sp, $sp, 16 +jr $ra +comp_forif222: +c114: +li $a1, 2 +la $v0, mod +move $a0, $s0 +jalr $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif213 +c113: +j comp_forif22 +comp_forif213: +c112: +li $a1, 2 +la $v0, mod +move $a0, $s1 +jalr $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif24 +c111: +j comp_forif22 +comp_forif24: +c110: +j comp_forif22 +comp_forif227: +li $v0, 0 +j comp_forif225 +comp_forif226: +li $v0, 0 +j comp_forif225 +comp_forif253: +c119: +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +lw $v0, 0($v0) +add $s1, $s1, $v0 +c120: +li $v0, 1 +add $a0, $a0, $v0 +j comp_forif258 +comp_forif270: +c124: +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +add $s0, $s0, $v0 +c125: +li $v0, 1 +add $t0, $t0, $v0 +j comp_forif275 +# end comp_forif2 + + +# begin comp_forif +comp_forif65: +addi $sp, $sp, -12 +sw $ra, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +c141: +li $s1, 0 +c140: +c139: +c138: +li $s0, 0 +comp_forif28: +li $a0, 0 +c137: +li $v0, 10 +slt $v0, $s0, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, comp_forif22 +c131: +move $v0, $s1 +lw $ra, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +addi $sp, $sp, 12 +jr $ra +comp_forif22: +c135: +li $v0, 1 +add $s1, $s1, $v0 +c134: +li $v0, 1 +add $s1, $s1, $v0 +c133: +li $a1, 2 +la $v0, mod +move $a0, $s0 +jalr $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif6 +c132: +comp_forif6: +c136: +li $v0, 1 +add $s0, $s0, $v0 +j comp_forif28 +# end comp_forif + + +# begin comp_fir_basic +comp_fir_basic141: +addi $sp, $sp, -4 +c16: +li $v0, 0 +c15: +c14: +li $t3, 0 +comp_fir_basic64: +li $t0, 0 +c13: +li $a3, 3 +slt $a3, $t3, $a3 +seq $a3, $a3, $zero +beq $a3, $t0, comp_fir_basic58 +c0: +addi $sp, $sp, 4 +jr $ra +comp_fir_basic58: +c11: +li $a3, 4 +mulo $a3, $t3, $a3 +add $a3, $a0, $a3 +lw $t0, 0($a3) +li $a3, 4 +mulo $a3, $zero, $a3 +add $a3, $a2, $a3 +sw $t0, 0($a3) +c10: +c9: +li $t0, 0 +comp_fir_basic47: +li $t1, 0 +c8: +li $a3, 3 +slt $a3, $t0, $a3 +seq $a3, $a3, $zero +beq $a3, $t1, comp_fir_basic41 +c5: +c4: +li $t2, 2 +comp_fir_basic25: +li $t0, 0 +c3: +sge $a3, $t2, $zero +seq $a3, $a3, $zero +beq $a3, $t0, comp_fir_basic19 +c12: +li $a3, 1 +add $t3, $t3, $a3 +j comp_fir_basic64 +comp_fir_basic19: +c1: +li $a3, 4 +mulo $a3, $t2, $a3 +add $a3, $a2, $a3 +lw $t1, 0($a3) +li $a3, 1 +add $t0, $t2, $a3 +li $a3, 4 +mulo $a3, $t0, $a3 +add $a3, $a2, $a3 +sw $t1, 0($a3) +c2: +li $a3, 1 +sub $t2, $t2, $a3 +j comp_fir_basic25 +comp_fir_basic41: +c6: +li $a3, 4 +mulo $a3, $t0, $a3 +add $a3, $a1, $a3 +lw $t1, 0($a3) +li $a3, 4 +mulo $a3, $t0, $a3 +add $a3, $a2, $a3 +lw $a3, 0($a3) +mulo $a3, $t1, $a3 +add $v0, $v0, $a3 +c7: +li $a3, 1 +add $t0, $t0, $a3 +j comp_fir_basic47 +# end comp_fir_basic + + +# begin comp_fir16 +comp_fir16373: +addi $sp, $sp, -96 +sw $ra, 92($sp) +sw $s6, 88($sp) +sw $s5, 84($sp) +sw $s4, 80($sp) +sw $s3, 76($sp) +sw $s2, 72($sp) +sw $s1, 68($sp) +sw $s0, 64($sp) +move $s6, $a0 +move $s5, $a1 +move $s4, $a2 +move $s3, $a3 +c49: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c48: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c47: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c46: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c45: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c44: +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c43: +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c42: +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c41: +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c40: +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c39: +move $a1, $sp +li $a0, 10 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c38: +move $a1, $sp +li $a0, 11 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c37: +move $a1, $sp +li $a0, 12 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c36: +move $a1, $sp +li $a0, 13 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c35: +move $a1, $sp +li $a0, 14 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c34: +move $a1, $sp +li $a0, 15 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c33: +li $v0, 0 +c32: +li $s2, 0 +c31: +c30: +li $s1, 0 +comp_fir1665: +li $a1, 0 +c29: +slt $a0, $s1, $s3 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir1660 +c17: +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +lw $ra, 92($sp) +lw $s6, 88($sp) +lw $s5, 84($sp) +lw $s4, 80($sp) +lw $s3, 76($sp) +lw $s2, 72($sp) +lw $s1, 68($sp) +lw $s0, 64($sp) +addi $sp, $sp, 96 +jr $ra +comp_fir1660: +c27: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s6, $a0 +lw $a2, 0($a0) +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +sw $a2, 0($a0) +c26: +c25: +li $s0, 0 +comp_fir1649: +li $a1, 0 +c24: +li $a0, 16 +slt $a0, $s0, $a0 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir1643 +c19: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +jalr $v0 +c18: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s4, $a0 +sw $s2, 0($a0) +c28: +li $a0, 1 +add $s1, $s1, $a0 +j comp_fir1665 +comp_fir1643: +c22: +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +lw $a1, 0($a0) +li $a0, 4 +mulo $a0, $s0, $a0 +add $a0, $s5, $a0 +lw $a0, 0($a0) +mulo $a2, $a1, $a0 +li $a1, 2 +li $a0, 16 +xor $a0, $a1, $a0 +mulo $a0, $a2, $a0 +c21: +add $s2, $s2, $a0 +c20: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +jalr $v0 +c23: +li $a0, 1 +add $s0, $s0, $a0 +j comp_fir1649 +# end comp_fir16 + + +# begin _main +main307: +addi $sp, $sp, -68 +sw $ra, 64($sp) +c165: +li $a1, 10 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c164: +li $a2, 9 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c163: +li $a2, 8 +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c162: +li $a2, 7 +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c161: +li $a2, 6 +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c160: +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c159: +li $a2, 5 +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c158: +li $a2, 4 +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c157: +li $a2, 3 +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c156: +li $a2, 2 +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c155: +move $a1, $sp +li $a0, 10 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c154: +move $a1, $sp +li $a0, 11 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c153: +move $a1, $sp +li $a0, 12 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c152: +move $a1, $sp +li $a0, 13 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c151: +move $a1, $sp +li $a0, 14 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c150: +move $a1, $sp +li $a0, 15 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c149: +move $a0, $sp +move $a1, $sp +move $a2, $sp +li $a3, 10 +li $t0, 10 +la $v0, comp_fir_basic141 +sw $t0, -4($sp) +jalr $v0 +c148: +move $a0, $sp +move $a1, $sp +move $a2, $sp +li $a3, 16 +la $v0, comp_fir16373 +jalr $v0 +c147: +li $a0, 4 +li $a1, 1 +li $a2, 1 +la $v0, comp_ifFor45 +jalr $v0 +c146: +move $a0, $sp +li $a1, 9 +li $a2, 3 +la $v0, comp_total410 +jalr $v0 +c145: +move $a0, $sp +li $a1, 10 +la $v0, comp_tri123 +jalr $v0 +c144: +move $a0, $sp +move $a1, $sp +li $a2, 10 +li $a3, 10 +la $v0, comp_forif2153 +jalr $v0 +c143: +la $v0, comp_forif65 +jalr $v0 +c142: +lw $ra, 64($sp) +addi $sp, $sp, 68 +jr $ra +# end _main diff --git a/tests/clight/complets.Clight.expected b/tests/clight/complets.Clight.expected new file mode 100644 index 0000000..8a80289 --- /dev/null +++ b/tests/clight/complets.Clight.expected @@ -0,0 +1,602 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int comp_fir_basic(int *input, int *h, int *z, int N, int n) +{ + int i; + int j; + int k; + int y; + c16: + y = 0; + c15: + for (({ c14: k = 0; }); (/* c13 */ k < 3); ({ c12: k = k + 1; })) { + c11: + z[0] = input[k]; + c10: + for (({ c9: i = 0; }); (/* c8 */ i < 3); ({ c7: i = i + 1; })) { + c6: + y = y + h[i] * z[i]; + } + c5: + for (({ c4: j = 2; }); (/* c3 */ j >= 0); ({ c2: j = j - 1; })) { + c1: + z[(j + 1)] = z[j]; + } + } + c0: + return y; +} + +int comp_fir16(int *in, int *c, int *out, int size) +{ + int i; + int j; + int res; + int tmp; + int x[16]; + int adx; + c49: + x[0] = 0; + c48: + x[1] = 0; + c47: + x[2] = 0; + c46: + x[3] = 0; + c45: + x[4] = 0; + c44: + x[5] = 0; + c43: + x[6] = 0; + c42: + x[7] = 0; + c41: + x[8] = 0; + c40: + x[9] = 0; + c39: + x[10] = 0; + c38: + x[11] = 0; + c37: + x[12] = 0; + c36: + x[13] = 0; + c35: + x[14] = 0; + c34: + x[15] = 0; + c33: + adx = 0; + c32: + res = 0; + c31: + for (({ c30: j = 0; }); (/* c29 */ j < size); ({ c28: j = j + 1; })) { + c27: + x[adx] = in[j]; + c26: + for (({ c25: i = 0; }); (/* c24 */ i < 16); ({ c23: i = i + 1; })) { + c22: + tmp = (x[adx] * c[i]) * (2 ^ 16); + c21: + res = res + tmp; + c20: + adx = (adx + 1) % 16; + } + c19: + adx = (adx + 1) % 16; + c18: + out[j] = res; + } + c17: + return x[0]; +} + +int comp_ifFor(int a, int b, int pas) +{ + int i; + int result; + c58: + result = 0; + c57: + for (({ c56: i = 0; }); (/* c55 */ i < a); ({ c54: i = i + pas; })) { + c53: + if (i != b) { + c52: + result = result + i; + } else { + c51: + result = 0; + } + } + c50: + return result; +} + +int comp_total(int *tabParam, int a, int b) +{ + int i; + int j; + int k; + int tabLocal1[10]; + int tabLocal2[10]; + c94: + tabLocal1[0] = 0; + c93: + tabLocal1[1] = 0; + c92: + tabLocal1[2] = 0; + c91: + tabLocal1[3] = 0; + c90: + tabLocal1[4] = 0; + c89: + tabLocal1[5] = 0; + c88: + tabLocal1[6] = 0; + c87: + tabLocal1[7] = 0; + c86: + tabLocal1[8] = 0; + c85: + tabLocal1[9] = 0; + c84: + tabLocal2[0] = 0; + c83: + tabLocal2[1] = 0; + c82: + tabLocal2[2] = 0; + c81: + tabLocal2[3] = 0; + c80: + tabLocal2[4] = 0; + c79: + tabLocal2[5] = 0; + c78: + tabLocal2[6] = 0; + c77: + tabLocal2[7] = 0; + c76: + tabLocal2[8] = 0; + c75: + tabLocal2[9] = 0; + c74: + if (a < b) { + c73: + for (({ c72: i = 0; }); (/* c71 */ i <= a); ({ c70: i = i + 1; })) { + c69: + tabLocal1[i] = tabParam[(a - i)]; + } + } else { + c68: + for (({ c67: k = 0; }); (/* c66 */ k < a); ({ c65: k = k + 1; })) { + c64: + for (({ c63: j = b; }); (/* c62 */ j > 0); ({ c61: j = j - 1; })) { + c60: + tabParam[k] = tabLocal1[k] + tabLocal2[j]; + } + } + } + c59: + return 0; +} + +int comp_tri(int *t, int n) +{ + int i; + int j; + int tmp; + c108: + tmp = 0; + c107: + for (({ c106: i = 0; }); (/* c105 */ i < n); ({ c104: i = i + 1; })) { + c103: + for (({ c102: + j = 1; }); + (/* c101 */ + j < n - i); + ({ c100: + j = j + 1; })) { + c99: + if (t[j] < t[(j - 1)]) { + c98: + tmp = t[(j - 1)]; + c97: + t[(j - 1)] = t[j]; + c96: + t[j] = tmp; + } + } + } + c95: + return tmp; +} + +int comp_forif2(int *u, int *v, int a, int b) +{ + int i; + int j; + int k; + int l; + int res; + c130: + k = 0; + c129: + l = 0; + c128: + for (({ c127: i = 0; }); (/* c126 */ i < a); ({ c125: i = i + 1; })) { + c124: + k = k + u[i]; + } + c123: + for (({ c122: j = 0; }); (/* c121 */ j < b); ({ c120: j = j + 1; })) { + c119: + l = l + v[j]; + } + c118: + if ((/* c117 */ k % 2 == 0) && (/* c116 */ l % 2 == 0)) { + c115: + res = 0; + } else { + c114: + if (k % 2 == 0) { + c113: + res = 1; + } else { + c112: + if (l % 2 == 0) { + c111: + res = 2; + } else { + c110: + res = 3; + } + } + } + c109: + return 0; +} + +int comp_forif(void) +{ + int i; + int j; + int k; + c141: + j = 0; + c140: + k = 0; + c139: + for (({ c138: i = 0; }); (/* c137 */ i < 10); ({ c136: i = i + 1; })) { + c135: + j = j + 1; + c134: + j = j + 1; + c133: + if (i % 2 == 0) { + c132: + k = k + 1; + } + } + c131: + return j; +} + +int main(void) +{ + int a; + int t[16]; + c165: + t[0] = 10; + c164: + t[1] = 9; + c163: + t[2] = 8; + c162: + t[3] = 7; + c161: + t[4] = 6; + c160: + t[5] = 0; + c159: + t[6] = 5; + c158: + t[7] = 4; + c157: + t[8] = 3; + c156: + t[9] = 2; + c155: + t[10] = 0; + c154: + t[11] = 0; + c153: + t[12] = 0; + c152: + t[13] = 0; + c151: + t[14] = 0; + c150: + t[15] = 0; + c149: + a = comp_fir_basic(t, t, t, 10, 10); + c148: + a = comp_fir16(t, t, t, 16); + c147: + a = comp_ifFor(4, 1, 1); + c146: + a = comp_total(t, 9, 3); + c145: + a = comp_tri(t, 10); + c144: + a = comp_forif2(t, t, 10, 10); + c143: + a = comp_forif(); + c142: + return a; +} + + diff --git a/tests/clight/complets.Cminor.expected b/tests/clight/complets.Cminor.expected new file mode 100644 index 0000000..3fe731c --- /dev/null +++ b/tests/clight/complets.Cminor.expected @@ -0,0 +1,940 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"comp_fir_basic" (input, h, z, N, n) : int -> int -> int -> int -> int -> int { + + stack 0; + + var y, k, j, i; + + c16: + y = 0; + c15: + c14: + k = 0; + block { + loop { + if (!(/* c13 */ k < 3)) { + exit 0; + } + else { + } + block { + c11: + int32[z + (0 * 4)] = int32[input + (k * 4)]; + c10: + c9: + i = 0; + block { + loop { + if (!(/* c8 */ i < 3)) { + exit 0; + } + else { + } + block { + c6: + y = y + (int32[h + (i * 4)] * int32[z + (i * 4)]); + } + c7: + i = i + 1; + } + } + c5: + c4: + j = 2; + block { + loop { + if (!(/* c3 */ j >= 0)) { + exit 0; + } + else { + } + block { + c1: + int32[z + ((j + 1) * 4)] = int32[z + (j * 4)]; + } + c2: + j = j - 1; + } + } + } + c12: + k = k + 1; + } + } + c0: + return y; + +} + + +"comp_fir16" (in, c, out, size) : int -> int -> int -> int -> int { + + stack 64; + + var res, tmp, j, i, adx; + + c49: + int32[&0 + (0 * 4)] = 0; + c48: + int32[&0 + (1 * 4)] = 0; + c47: + int32[&0 + (2 * 4)] = 0; + c46: + int32[&0 + (3 * 4)] = 0; + c45: + int32[&0 + (4 * 4)] = 0; + c44: + int32[&0 + (5 * 4)] = 0; + c43: + int32[&0 + (6 * 4)] = 0; + c42: + int32[&0 + (7 * 4)] = 0; + c41: + int32[&0 + (8 * 4)] = 0; + c40: + int32[&0 + (9 * 4)] = 0; + c39: + int32[&0 + (10 * 4)] = 0; + c38: + int32[&0 + (11 * 4)] = 0; + c37: + int32[&0 + (12 * 4)] = 0; + c36: + int32[&0 + (13 * 4)] = 0; + c35: + int32[&0 + (14 * 4)] = 0; + c34: + int32[&0 + (15 * 4)] = 0; + c33: + adx = 0; + c32: + res = 0; + c31: + c30: + j = 0; + block { + loop { + if (!(/* c29 */ j < size)) { + exit 0; + } + else { + } + block { + c27: + int32[&0 + (adx * 4)] = int32[in + (j * 4)]; + c26: + c25: + i = 0; + block { + loop { + if (!(/* c24 */ i < 16)) { + exit 0; + } + else { + } + block { + c22: + tmp = (int32[&0 + (adx * 4)] * int32[c + (i * 4)]) * (2 ^ 16); + c21: + res = res + tmp; + c20: + adx = (adx + 1) % 16; + } + c23: + i = i + 1; + } + } + c19: + adx = (adx + 1) % 16; + c18: + int32[out + (j * 4)] = res; + } + c28: + j = j + 1; + } + } + c17: + return int32[&0 + (0 * 4)]; + +} + + +"comp_ifFor" (a, b, pas) : int -> int -> int -> int { + + stack 0; + + var i, result; + + c58: + result = 0; + c57: + c56: + i = 0; + block { + loop { + if (!(/* c55 */ i < a)) { + exit 0; + } + else { + } + block { + c53: + if (i != b) { + c52: + result = result + i; + } + else { + c51: + result = 0; + } + } + c54: + i = i + pas; + } + } + c50: + return result; + +} + + +"comp_total" (tabParam, a, b) : int -> int -> int -> int { + + stack 80; + + var k, j, i; + + c94: + int32[&0 + (0 * 4)] = 0; + c93: + int32[&0 + (1 * 4)] = 0; + c92: + int32[&0 + (2 * 4)] = 0; + c91: + int32[&0 + (3 * 4)] = 0; + c90: + int32[&0 + (4 * 4)] = 0; + c89: + int32[&0 + (5 * 4)] = 0; + c88: + int32[&0 + (6 * 4)] = 0; + c87: + int32[&0 + (7 * 4)] = 0; + c86: + int32[&0 + (8 * 4)] = 0; + c85: + int32[&0 + (9 * 4)] = 0; + c84: + int32[&40 + (0 * 4)] = 0; + c83: + int32[&40 + (1 * 4)] = 0; + c82: + int32[&40 + (2 * 4)] = 0; + c81: + int32[&40 + (3 * 4)] = 0; + c80: + int32[&40 + (4 * 4)] = 0; + c79: + int32[&40 + (5 * 4)] = 0; + c78: + int32[&40 + (6 * 4)] = 0; + c77: + int32[&40 + (7 * 4)] = 0; + c76: + int32[&40 + (8 * 4)] = 0; + c75: + int32[&40 + (9 * 4)] = 0; + c74: + if (a < b) { + c73: + c72: + i = 0; + block { + loop { + if (!(/* c71 */ i <= a)) { + exit 0; + } + else { + } + block { + c69: + int32[&0 + (i * 4)] = int32[tabParam + ((a - i) * 4)]; + } + c70: + i = i + 1; + } + } + } + else { + c68: + c67: + k = 0; + block { + loop { + if (!(/* c66 */ k < a)) { + exit 0; + } + else { + } + block { + c64: + c63: + j = b; + block { + loop { + if (!(/* c62 */ j > 0)) { + exit 0; + } + else { + } + block { + c60: + int32[tabParam + (k * 4)] = int32[&0 + (k * 4)] + int32[&40 + (j * 4)]; + } + c61: + j = j - 1; + } + } + } + c65: + k = k + 1; + } + } + } + c59: + return 0; + +} + + +"comp_tri" (t, n) : int -> int -> int { + + stack 0; + + var tmp, j, i; + + c108: + tmp = 0; + c107: + c106: + i = 0; + block { + loop { + if (!(/* c105 */ i < n)) { + exit 0; + } + else { + } + block { + c103: + c102: + j = 1; + block { + loop { + if (!(/* c101 */ j < (n - i))) { + exit 0; + } + else { + } + block { + c99: + if (int32[t + (j * 4)] < int32[t + ((j - 1) * 4)]) { + c98: + tmp = int32[t + ((j - 1) * 4)]; + c97: + int32[t + ((j - 1) * 4)] = int32[t + (j * 4)]; + c96: + int32[t + (j * 4)] = tmp; + } + else { + } + } + c100: + j = j + 1; + } + } + } + c104: + i = i + 1; + } + } + c95: + return tmp; + +} + + +"comp_forif2" (u, v, a, b) : int -> int -> int -> int -> int { + + stack 0; + + var res, l, k, j, i; + + c130: + k = 0; + c129: + l = 0; + c128: + c127: + i = 0; + block { + loop { + if (!(/* c126 */ i < a)) { + exit 0; + } + else { + } + block { + c124: + k = k + int32[u + (i * 4)]; + } + c125: + i = i + 1; + } + } + c123: + c122: + j = 0; + block { + loop { + if (!(/* c121 */ j < b)) { + exit 0; + } + else { + } + block { + c119: + l = l + int32[v + (j * 4)]; + } + c120: + j = j + 1; + } + } + c118: + if ((/* c117 */ (k % 2) == 0) ? ((/* c116 */ (l % 2) == 0) ? 1 : 0) : 0) { + c115: + res = 0; + } + else { + c114: + if ((k % 2) == 0) { + c113: + res = 1; + } + else { + c112: + if ((l % 2) == 0) { + c111: + res = 2; + } + else { + c110: + res = 3; + } + } + } + c109: + return 0; + +} + + +"comp_forif" () : int { + + stack 0; + + var k, j, i; + + c141: + j = 0; + c140: + k = 0; + c139: + c138: + i = 0; + block { + loop { + if (!(/* c137 */ i < 10)) { + exit 0; + } + else { + } + block { + c135: + j = j + 1; + c134: + j = j + 1; + c133: + if ((i % 2) == 0) { + c132: + k = k + 1; + } + else { + } + } + c136: + i = i + 1; + } + } + c131: + return j; + +} + + +"main" () : int { + + stack 64; + + var a; + + c165: + int32[&0 + (0 * 4)] = 10; + c164: + int32[&0 + (1 * 4)] = 9; + c163: + int32[&0 + (2 * 4)] = 8; + c162: + int32[&0 + (3 * 4)] = 7; + c161: + int32[&0 + (4 * 4)] = 6; + c160: + int32[&0 + (5 * 4)] = 0; + c159: + int32[&0 + (6 * 4)] = 5; + c158: + int32[&0 + (7 * 4)] = 4; + c157: + int32[&0 + (8 * 4)] = 3; + c156: + int32[&0 + (9 * 4)] = 2; + c155: + int32[&0 + (10 * 4)] = 0; + c154: + int32[&0 + (11 * 4)] = 0; + c153: + int32[&0 + (12 * 4)] = 0; + c152: + int32[&0 + (13 * 4)] = 0; + c151: + int32[&0 + (14 * 4)] = 0; + c150: + int32[&0 + (15 * 4)] = 0; + c149: + a = "comp_fir_basic"(&0, &0, &0, 10, 10) : int -> int -> int -> int -> int -> int; + c148: + a = "comp_fir16"(&0, &0, &0, 16) : int -> int -> int -> int -> int; + c147: + a = "comp_ifFor"(4, 1, 1) : int -> int -> int -> int; + c146: + a = "comp_total"(&0, 9, 3) : int -> int -> int -> int; + c145: + a = "comp_tri"(&0, 10) : int -> int -> int; + c144: + a = "comp_forif2"(&0, &0, 10, 10) : int -> int -> int -> int -> int; + c143: + a = "comp_forif"() : int; + c142: + return a; + +} + + diff --git a/tests/clight/complets.ERTL.expected b/tests/clight/complets.ERTL.expected new file mode 100644 index 0000000..1456c06 --- /dev/null +++ b/tests/clight/complets.ERTL.expected @@ -0,0 +1,2387 @@ +program + +globals 0 + +procedure comp_tri(2) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54 +entry comp_tri123 +comp_tri123: newframe --> comp_tri122 +comp_tri122: move %54, $ra --> comp_tri121 +comp_tri121: move %53, $s7 --> comp_tri120 +comp_tri120: move %52, $s6 --> comp_tri119 +comp_tri119: move %51, $s5 --> comp_tri118 +comp_tri118: move %50, $s4 --> comp_tri117 +comp_tri117: move %49, $s3 --> comp_tri116 +comp_tri116: move %48, $s2 --> comp_tri115 +comp_tri115: move %47, $s1 --> comp_tri114 +comp_tri114: move %46, $s0 --> comp_tri113 +comp_tri113: move %0, $a0 --> comp_tri112 +comp_tri112: move %1, $a1 --> comp_tri111 +comp_tri111: li %2, 0 --> comp_tri110 +comp_tri110: li %3, 0 --> comp_tri109 +comp_tri109: li %4, 0 --> comp_tri108 +comp_tri108: li %6, 0 --> comp_tri107 +comp_tri107: li %7, 0 --> comp_tri106 +comp_tri106: li %8, 0 --> comp_tri105 +comp_tri105: li %9, 0 --> comp_tri104 +comp_tri104: li %10, 0 --> comp_tri103 +comp_tri103: li %11, 0 --> comp_tri102 +comp_tri102: li %12, 0 --> comp_tri101 +comp_tri101: li %13, 0 --> comp_tri100 +comp_tri100: li %14, 0 --> comp_tri99 +comp_tri99 : li %15, 0 --> comp_tri98 +comp_tri98 : li %16, 0 --> comp_tri97 +comp_tri97 : li %17, 0 --> comp_tri96 +comp_tri96 : li %18, 0 --> comp_tri95 +comp_tri95 : li %19, 0 --> comp_tri94 +comp_tri94 : li %20, 0 --> comp_tri93 +comp_tri93 : li %21, 0 --> comp_tri92 +comp_tri92 : li %22, 0 --> comp_tri91 +comp_tri91 : li %23, 0 --> comp_tri90 +comp_tri90 : li %24, 0 --> comp_tri89 +comp_tri89 : li %25, 0 --> comp_tri88 +comp_tri88 : li %26, 0 --> comp_tri87 +comp_tri87 : li %27, 0 --> comp_tri86 +comp_tri86 : li %28, 0 --> comp_tri85 +comp_tri85 : li %29, 0 --> comp_tri84 +comp_tri84 : li %30, 0 --> comp_tri83 +comp_tri83 : li %31, 0 --> comp_tri82 +comp_tri82 : li %32, 0 --> comp_tri81 +comp_tri81 : li %33, 0 --> comp_tri80 +comp_tri80 : li %34, 0 --> comp_tri79 +comp_tri79 : li %35, 0 --> comp_tri78 +comp_tri78 : li %36, 0 --> comp_tri77 +comp_tri77 : li %37, 0 --> comp_tri76 +comp_tri76 : li %38, 0 --> comp_tri75 +comp_tri75 : li %39, 0 --> comp_tri74 +comp_tri74 : li %40, 0 --> comp_tri73 +comp_tri73 : li %41, 0 --> comp_tri72 +comp_tri72 : li %42, 0 --> comp_tri71 +comp_tri71 : li %43, 0 --> comp_tri70 +comp_tri70 : li %44, 0 --> comp_tri69 +comp_tri69 : li %45, 0 --> comp_tri60 +comp_tri60 : emit c108 --> comp_tri59 +comp_tri59 : li %2, 0 --> comp_tri58 +comp_tri58 : emit c107 --> comp_tri57 +comp_tri57 : emit c106 --> comp_tri56 +comp_tri56 : li %4, 0 --> comp_tri3 +comp_tri3 : j --> comp_tri55 +comp_tri55 : li %36, 0 --> comp_tri54 +comp_tri54 : emit c105 --> comp_tri53 +comp_tri53 : slt %37, %4, %1 --> comp_tri52 +comp_tri52 : li %45, 0 --> comp_tri68 +comp_tri68 : seq %35, %37, %45 --> comp_tri51 +comp_tri51 : beq %35, %36 --> comp_tri50, comp_tri2 +comp_tri2 : emit c95 --> comp_tri1 +comp_tri1 : move %5, %2 --> comp_tri0 +comp_tri0 : j --> comp_tri135 +comp_tri135: move $v0, %5 --> comp_tri134 +comp_tri134: move $ra, %54 --> comp_tri133 +comp_tri133: move $s7, %53 --> comp_tri132 +comp_tri132: move $s6, %52 --> comp_tri131 +comp_tri131: move $s5, %51 --> comp_tri130 +comp_tri130: move $s4, %50 --> comp_tri129 +comp_tri129: move $s3, %49 --> comp_tri128 +comp_tri128: move $s2, %48 --> comp_tri127 +comp_tri127: move $s1, %47 --> comp_tri126 +comp_tri126: move $s0, %46 --> comp_tri125 +comp_tri125: delframe --> comp_tri124 +comp_tri124: jr $ra (xmits $v0) +comp_tri50 : emit c103 --> comp_tri49 +comp_tri49 : emit c102 --> comp_tri48 +comp_tri48 : li %3, 1 --> comp_tri7 +comp_tri7 : j --> comp_tri47 +comp_tri47 : li %32, 0 --> comp_tri46 +comp_tri46 : emit c101 --> comp_tri45 +comp_tri45 : sub %34, %1, %4 --> comp_tri44 +comp_tri44 : slt %33, %3, %34 --> comp_tri43 +comp_tri43 : li %44, 0 --> comp_tri67 +comp_tri67 : seq %31, %33, %44 --> comp_tri42 +comp_tri42 : beq %31, %32 --> comp_tri41, comp_tri6 +comp_tri6 : emit c104 --> comp_tri5 +comp_tri5 : li %6, 1 --> comp_tri4 +comp_tri4 : add %4, %4, %6 --> comp_tri3 +comp_tri41 : emit c99 --> comp_tri40 +comp_tri40 : li %22, 0 --> comp_tri39 +comp_tri39 : li %30, 4 --> comp_tri38 +comp_tri38 : mulo %29, %3, %30 --> comp_tri37 +comp_tri37 : add %43, %0, %29 --> comp_tri66 +comp_tri66 : lw %23, 0(%43) --> comp_tri36 +comp_tri36 : li %28, 1 --> comp_tri35 +comp_tri35 : sub %26, %3, %28 --> comp_tri34 +comp_tri34 : li %27, 4 --> comp_tri33 +comp_tri33 : mulo %25, %26, %27 --> comp_tri32 +comp_tri32 : add %42, %0, %25 --> comp_tri65 +comp_tri65 : lw %24, 0(%42) --> comp_tri31 +comp_tri31 : slt %21, %23, %24 --> comp_tri30 +comp_tri30 : beq %21, %22 --> comp_tri10, comp_tri29 +comp_tri29 : emit c98 --> comp_tri28 +comp_tri28 : li %20, 1 --> comp_tri27 +comp_tri27 : sub %18, %3, %20 --> comp_tri26 +comp_tri26 : li %19, 4 --> comp_tri25 +comp_tri25 : mulo %17, %18, %19 --> comp_tri24 +comp_tri24 : add %41, %0, %17 --> comp_tri64 +comp_tri64 : lw %2, 0(%41) --> comp_tri23 +comp_tri23 : emit c97 --> comp_tri22 +comp_tri22 : li %16, 4 --> comp_tri21 +comp_tri21 : mulo %15, %3, %16 --> comp_tri20 +comp_tri20 : add %40, %0, %15 --> comp_tri63 +comp_tri63 : lw %10, 0(%40) --> comp_tri19 +comp_tri19 : li %14, 1 --> comp_tri18 +comp_tri18 : sub %12, %3, %14 --> comp_tri17 +comp_tri17 : li %13, 4 --> comp_tri16 +comp_tri16 : mulo %11, %12, %13 --> comp_tri15 +comp_tri15 : add %39, %0, %11 --> comp_tri62 +comp_tri62 : sw %10, 0(%39) --> comp_tri14 +comp_tri14 : emit c96 --> comp_tri13 +comp_tri13 : li %9, 4 --> comp_tri12 +comp_tri12 : mulo %8, %3, %9 --> comp_tri11 +comp_tri11 : add %38, %0, %8 --> comp_tri61 +comp_tri61 : sw %2, 0(%38) --> comp_tri10 +comp_tri10 : emit c100 --> comp_tri9 +comp_tri9 : li %7, 1 --> comp_tri8 +comp_tri8 : add %3, %3, %7 --> comp_tri7 + +procedure comp_total(3) +stacksize 80 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134, %135, %136, %137, %138, %139, + %140, %141, %142, %143, %144, %145, %146, + %147, %148, %149, %150, %151, %152, %153, + %154, %155, %156, %157, %158, %159, %160, + %161, %162, %163, %164, %165, %166, %167, + %168, %169, %170, %171, %172, %173, %174, + %175, %176 +entry comp_total410 +comp_total410: newframe --> comp_total409 +comp_total409: move %176, $ra --> comp_total408 +comp_total408: move %175, $s7 --> comp_total407 +comp_total407: move %174, $s6 --> comp_total406 +comp_total406: move %173, $s5 --> comp_total405 +comp_total405: move %172, $s4 --> comp_total404 +comp_total404: move %171, $s3 --> comp_total403 +comp_total403: move %170, $s2 --> comp_total402 +comp_total402: move %169, $s1 --> comp_total401 +comp_total401: move %168, $s0 --> comp_total400 +comp_total400: move %0, $a0 --> comp_total399 +comp_total399: move %1, $a1 --> comp_total398 +comp_total398: move %2, $a2 --> comp_total397 +comp_total397: li %3, 0 --> comp_total396 +comp_total396: li %4, 0 --> comp_total395 +comp_total395: li %5, 0 --> comp_total394 +comp_total394: li %7, 0 --> comp_total393 +comp_total393: li %8, 0 --> comp_total392 +comp_total392: li %9, 0 --> comp_total391 +comp_total391: li %10, 0 --> comp_total390 +comp_total390: li %11, 0 --> comp_total389 +comp_total389: li %12, 0 --> comp_total388 +comp_total388: li %13, 0 --> comp_total387 +comp_total387: li %14, 0 --> comp_total386 +comp_total386: li %15, 0 --> comp_total385 +comp_total385: li %16, 0 --> comp_total384 +comp_total384: li %17, 0 --> comp_total383 +comp_total383: li %18, 0 --> comp_total382 +comp_total382: li %19, 0 --> comp_total381 +comp_total381: li %20, 0 --> comp_total380 +comp_total380: li %21, 0 --> comp_total379 +comp_total379: li %22, 0 --> comp_total378 +comp_total378: li %23, 0 --> comp_total377 +comp_total377: li %24, 0 --> comp_total376 +comp_total376: li %25, 0 --> comp_total375 +comp_total375: li %26, 0 --> comp_total374 +comp_total374: li %27, 0 --> comp_total373 +comp_total373: li %28, 0 --> comp_total372 +comp_total372: li %29, 0 --> comp_total371 +comp_total371: li %30, 0 --> comp_total370 +comp_total370: li %31, 0 --> comp_total369 +comp_total369: li %32, 0 --> comp_total368 +comp_total368: li %33, 0 --> comp_total367 +comp_total367: li %34, 0 --> comp_total366 +comp_total366: li %35, 0 --> comp_total365 +comp_total365: li %36, 0 --> comp_total364 +comp_total364: li %37, 0 --> comp_total363 +comp_total363: li %38, 0 --> comp_total362 +comp_total362: li %39, 0 --> comp_total361 +comp_total361: li %40, 0 --> comp_total360 +comp_total360: li %41, 0 --> comp_total359 +comp_total359: li %42, 0 --> comp_total358 +comp_total358: li %43, 0 --> comp_total357 +comp_total357: li %44, 0 --> comp_total356 +comp_total356: li %45, 0 --> comp_total355 +comp_total355: li %46, 0 --> comp_total354 +comp_total354: li %47, 0 --> comp_total353 +comp_total353: li %48, 0 --> comp_total352 +comp_total352: li %49, 0 --> comp_total351 +comp_total351: li %50, 0 --> comp_total350 +comp_total350: li %51, 0 --> comp_total349 +comp_total349: li %52, 0 --> comp_total348 +comp_total348: li %53, 0 --> comp_total347 +comp_total347: li %54, 0 --> comp_total346 +comp_total346: li %55, 0 --> comp_total345 +comp_total345: li %56, 0 --> comp_total344 +comp_total344: li %57, 0 --> comp_total343 +comp_total343: li %58, 0 --> comp_total342 +comp_total342: li %59, 0 --> comp_total341 +comp_total341: li %60, 0 --> comp_total340 +comp_total340: li %61, 0 --> comp_total339 +comp_total339: li %62, 0 --> comp_total338 +comp_total338: li %63, 0 --> comp_total337 +comp_total337: li %64, 0 --> comp_total336 +comp_total336: li %65, 0 --> comp_total335 +comp_total335: li %66, 0 --> comp_total334 +comp_total334: li %67, 0 --> comp_total333 +comp_total333: li %68, 0 --> comp_total332 +comp_total332: li %69, 0 --> comp_total331 +comp_total331: li %70, 0 --> comp_total330 +comp_total330: li %71, 0 --> comp_total329 +comp_total329: li %72, 0 --> comp_total328 +comp_total328: li %73, 0 --> comp_total327 +comp_total327: li %74, 0 --> comp_total326 +comp_total326: li %75, 0 --> comp_total325 +comp_total325: li %76, 0 --> comp_total324 +comp_total324: li %77, 0 --> comp_total323 +comp_total323: li %78, 0 --> comp_total322 +comp_total322: li %79, 0 --> comp_total321 +comp_total321: li %80, 0 --> comp_total320 +comp_total320: li %81, 0 --> comp_total319 +comp_total319: li %82, 0 --> comp_total318 +comp_total318: li %83, 0 --> comp_total317 +comp_total317: li %84, 0 --> comp_total316 +comp_total316: li %85, 0 --> comp_total315 +comp_total315: li %86, 0 --> comp_total314 +comp_total314: li %87, 0 --> comp_total313 +comp_total313: li %88, 0 --> comp_total312 +comp_total312: li %89, 0 --> comp_total311 +comp_total311: li %90, 0 --> comp_total310 +comp_total310: li %91, 0 --> comp_total309 +comp_total309: li %92, 0 --> comp_total308 +comp_total308: li %93, 0 --> comp_total307 +comp_total307: li %94, 0 --> comp_total306 +comp_total306: li %95, 0 --> comp_total305 +comp_total305: li %96, 0 --> comp_total304 +comp_total304: li %97, 0 --> comp_total303 +comp_total303: li %98, 0 --> comp_total302 +comp_total302: li %99, 0 --> comp_total301 +comp_total301: li %100, 0 --> comp_total300 +comp_total300: li %101, 0 --> comp_total299 +comp_total299: li %102, 0 --> comp_total298 +comp_total298: li %103, 0 --> comp_total297 +comp_total297: li %104, 0 --> comp_total296 +comp_total296: li %105, 0 --> comp_total295 +comp_total295: li %106, 0 --> comp_total294 +comp_total294: li %107, 0 --> comp_total293 +comp_total293: li %108, 0 --> comp_total292 +comp_total292: li %109, 0 --> comp_total291 +comp_total291: li %110, 0 --> comp_total290 +comp_total290: li %111, 0 --> comp_total289 +comp_total289: li %112, 0 --> comp_total288 +comp_total288: li %113, 0 --> comp_total287 +comp_total287: li %114, 0 --> comp_total286 +comp_total286: li %115, 0 --> comp_total285 +comp_total285: li %116, 0 --> comp_total284 +comp_total284: li %117, 0 --> comp_total283 +comp_total283: li %118, 0 --> comp_total282 +comp_total282: li %119, 0 --> comp_total281 +comp_total281: li %120, 0 --> comp_total280 +comp_total280: li %121, 0 --> comp_total279 +comp_total279: li %122, 0 --> comp_total278 +comp_total278: li %123, 0 --> comp_total277 +comp_total277: li %124, 0 --> comp_total276 +comp_total276: li %125, 0 --> comp_total275 +comp_total275: li %126, 0 --> comp_total274 +comp_total274: li %127, 0 --> comp_total273 +comp_total273: li %128, 0 --> comp_total272 +comp_total272: li %129, 0 --> comp_total271 +comp_total271: li %130, 0 --> comp_total270 +comp_total270: li %131, 0 --> comp_total269 +comp_total269: li %132, 0 --> comp_total268 +comp_total268: li %133, 0 --> comp_total267 +comp_total267: li %134, 0 --> comp_total266 +comp_total266: li %135, 0 --> comp_total265 +comp_total265: li %136, 0 --> comp_total264 +comp_total264: li %137, 0 --> comp_total263 +comp_total263: li %138, 0 --> comp_total262 +comp_total262: li %139, 0 --> comp_total261 +comp_total261: li %140, 0 --> comp_total260 +comp_total260: li %141, 0 --> comp_total259 +comp_total259: li %142, 0 --> comp_total258 +comp_total258: li %143, 0 --> comp_total257 +comp_total257: li %144, 0 --> comp_total256 +comp_total256: li %145, 0 --> comp_total255 +comp_total255: li %146, 0 --> comp_total254 +comp_total254: li %147, 0 --> comp_total253 +comp_total253: li %148, 0 --> comp_total252 +comp_total252: li %149, 0 --> comp_total251 +comp_total251: li %150, 0 --> comp_total250 +comp_total250: li %151, 0 --> comp_total249 +comp_total249: li %152, 0 --> comp_total248 +comp_total248: li %153, 0 --> comp_total247 +comp_total247: li %154, 0 --> comp_total246 +comp_total246: li %155, 0 --> comp_total245 +comp_total245: li %156, 0 --> comp_total244 +comp_total244: li %157, 0 --> comp_total243 +comp_total243: li %158, 0 --> comp_total242 +comp_total242: li %159, 0 --> comp_total241 +comp_total241: li %160, 0 --> comp_total240 +comp_total240: li %161, 0 --> comp_total239 +comp_total239: li %162, 0 --> comp_total238 +comp_total238: li %163, 0 --> comp_total237 +comp_total237: li %164, 0 --> comp_total236 +comp_total236: li %165, 0 --> comp_total235 +comp_total235: li %166, 0 --> comp_total234 +comp_total234: li %167, 0 --> comp_total205 +comp_total205: emit c94 --> comp_total204 +comp_total204: li %135, 0 --> comp_total203 +comp_total203: move %136, $sp --> comp_total438 +comp_total438: move %136, %136 --> comp_total202 +comp_total202: li %138, 0 --> comp_total201 +comp_total201: li %139, 4 --> comp_total200 +comp_total200: mulo %137, %138, %139 --> comp_total199 +comp_total199: add %157, %136, %137 --> comp_total223 +comp_total223: sw %135, 0(%157) --> comp_total198 +comp_total198: emit c93 --> comp_total197 +comp_total197: li %130, 0 --> comp_total196 +comp_total196: move %131, $sp --> comp_total437 +comp_total437: move %131, %131 --> comp_total195 +comp_total195: li %133, 1 --> comp_total194 +comp_total194: li %134, 4 --> comp_total193 +comp_total193: mulo %132, %133, %134 --> comp_total192 +comp_total192: add %156, %131, %132 --> comp_total222 +comp_total222: sw %130, 0(%156) --> comp_total191 +comp_total191: emit c92 --> comp_total190 +comp_total190: li %125, 0 --> comp_total189 +comp_total189: move %126, $sp --> comp_total436 +comp_total436: move %126, %126 --> comp_total188 +comp_total188: li %128, 2 --> comp_total187 +comp_total187: li %129, 4 --> comp_total186 +comp_total186: mulo %127, %128, %129 --> comp_total185 +comp_total185: add %154, %126, %127 --> comp_total220 +comp_total220: sw %125, 0(%154) --> comp_total184 +comp_total184: emit c91 --> comp_total183 +comp_total183: li %120, 0 --> comp_total182 +comp_total182: move %121, $sp --> comp_total435 +comp_total435: move %121, %121 --> comp_total181 +comp_total181: li %123, 3 --> comp_total180 +comp_total180: li %124, 4 --> comp_total179 +comp_total179: mulo %122, %123, %124 --> comp_total178 +comp_total178: add %153, %121, %122 --> comp_total219 +comp_total219: sw %120, 0(%153) --> comp_total177 +comp_total177: emit c90 --> comp_total176 +comp_total176: li %115, 0 --> comp_total175 +comp_total175: move %116, $sp --> comp_total433 +comp_total433: move %116, %116 --> comp_total174 +comp_total174: li %118, 4 --> comp_total173 +comp_total173: li %119, 4 --> comp_total172 +comp_total172: mulo %117, %118, %119 --> comp_total171 +comp_total171: add %152, %116, %117 --> comp_total218 +comp_total218: sw %115, 0(%152) --> comp_total170 +comp_total170: emit c89 --> comp_total169 +comp_total169: li %110, 0 --> comp_total168 +comp_total168: move %111, $sp --> comp_total432 +comp_total432: move %111, %111 --> comp_total167 +comp_total167: li %113, 5 --> comp_total166 +comp_total166: li %114, 4 --> comp_total165 +comp_total165: mulo %112, %113, %114 --> comp_total164 +comp_total164: add %151, %111, %112 --> comp_total217 +comp_total217: sw %110, 0(%151) --> comp_total163 +comp_total163: emit c88 --> comp_total162 +comp_total162: li %105, 0 --> comp_total161 +comp_total161: move %106, $sp --> comp_total431 +comp_total431: move %106, %106 --> comp_total160 +comp_total160: li %108, 6 --> comp_total159 +comp_total159: li %109, 4 --> comp_total158 +comp_total158: mulo %107, %108, %109 --> comp_total157 +comp_total157: add %150, %106, %107 --> comp_total216 +comp_total216: sw %105, 0(%150) --> comp_total156 +comp_total156: emit c87 --> comp_total155 +comp_total155: li %100, 0 --> comp_total154 +comp_total154: move %101, $sp --> comp_total430 +comp_total430: move %101, %101 --> comp_total153 +comp_total153: li %103, 7 --> comp_total152 +comp_total152: li %104, 4 --> comp_total151 +comp_total151: mulo %102, %103, %104 --> comp_total150 +comp_total150: add %149, %101, %102 --> comp_total215 +comp_total215: sw %100, 0(%149) --> comp_total149 +comp_total149: emit c86 --> comp_total148 +comp_total148: li %95, 0 --> comp_total147 +comp_total147: move %96, $sp --> comp_total429 +comp_total429: move %96, %96 --> comp_total146 +comp_total146: li %98, 8 --> comp_total145 +comp_total145: li %99, 4 --> comp_total144 +comp_total144: mulo %97, %98, %99 --> comp_total143 +comp_total143: add %147, %96, %97 --> comp_total213 +comp_total213: sw %95, 0(%147) --> comp_total142 +comp_total142: emit c85 --> comp_total141 +comp_total141: li %90, 0 --> comp_total140 +comp_total140: move %91, $sp --> comp_total428 +comp_total428: move %91, %91 --> comp_total139 +comp_total139: li %93, 9 --> comp_total138 +comp_total138: li %94, 4 --> comp_total137 +comp_total137: mulo %92, %93, %94 --> comp_total136 +comp_total136: add %146, %91, %92 --> comp_total212 +comp_total212: sw %90, 0(%146) --> comp_total135 +comp_total135: emit c84 --> comp_total134 +comp_total134: li %85, 0 --> comp_total133 +comp_total133: move %86, $sp --> comp_total427 +comp_total427: addi %86, %86, 40 --> comp_total132 +comp_total132: li %88, 0 --> comp_total131 +comp_total131: li %89, 4 --> comp_total130 +comp_total130: mulo %87, %88, %89 --> comp_total129 +comp_total129: add %145, %86, %87 --> comp_total211 +comp_total211: sw %85, 0(%145) --> comp_total128 +comp_total128: emit c83 --> comp_total127 +comp_total127: li %80, 0 --> comp_total126 +comp_total126: move %81, $sp --> comp_total426 +comp_total426: addi %81, %81, 40 --> comp_total125 +comp_total125: li %83, 1 --> comp_total124 +comp_total124: li %84, 4 --> comp_total123 +comp_total123: mulo %82, %83, %84 --> comp_total122 +comp_total122: add %144, %81, %82 --> comp_total210 +comp_total210: sw %80, 0(%144) --> comp_total121 +comp_total121: emit c82 --> comp_total120 +comp_total120: li %75, 0 --> comp_total119 +comp_total119: move %76, $sp --> comp_total425 +comp_total425: addi %76, %76, 40 --> comp_total118 +comp_total118: li %78, 2 --> comp_total117 +comp_total117: li %79, 4 --> comp_total116 +comp_total116: mulo %77, %78, %79 --> comp_total115 +comp_total115: add %143, %76, %77 --> comp_total209 +comp_total209: sw %75, 0(%143) --> comp_total114 +comp_total114: emit c81 --> comp_total113 +comp_total113: li %70, 0 --> comp_total112 +comp_total112: move %71, $sp --> comp_total424 +comp_total424: addi %71, %71, 40 --> comp_total111 +comp_total111: li %73, 3 --> comp_total110 +comp_total110: li %74, 4 --> comp_total109 +comp_total109: mulo %72, %73, %74 --> comp_total108 +comp_total108: add %141, %71, %72 --> comp_total207 +comp_total207: sw %70, 0(%141) --> comp_total107 +comp_total107: emit c80 --> comp_total106 +comp_total106: li %65, 0 --> comp_total105 +comp_total105: move %66, $sp --> comp_total423 +comp_total423: addi %66, %66, 40 --> comp_total104 +comp_total104: li %68, 4 --> comp_total103 +comp_total103: li %69, 4 --> comp_total102 +comp_total102: mulo %67, %68, %69 --> comp_total101 +comp_total101: add %140, %66, %67 --> comp_total206 +comp_total206: sw %65, 0(%140) --> comp_total100 +comp_total100: emit c79 --> comp_total99 +comp_total99 : li %60, 0 --> comp_total98 +comp_total98 : move %61, $sp --> comp_total445 +comp_total445: addi %61, %61, 40 --> comp_total97 +comp_total97 : li %63, 5 --> comp_total96 +comp_total96 : li %64, 4 --> comp_total95 +comp_total95 : mulo %62, %63, %64 --> comp_total94 +comp_total94 : add %167, %61, %62 --> comp_total233 +comp_total233: sw %60, 0(%167) --> comp_total93 +comp_total93 : emit c78 --> comp_total92 +comp_total92 : li %55, 0 --> comp_total91 +comp_total91 : move %56, $sp --> comp_total444 +comp_total444: addi %56, %56, 40 --> comp_total90 +comp_total90 : li %58, 6 --> comp_total89 +comp_total89 : li %59, 4 --> comp_total88 +comp_total88 : mulo %57, %58, %59 --> comp_total87 +comp_total87 : add %166, %56, %57 --> comp_total232 +comp_total232: sw %55, 0(%166) --> comp_total86 +comp_total86 : emit c77 --> comp_total85 +comp_total85 : li %50, 0 --> comp_total84 +comp_total84 : move %51, $sp --> comp_total443 +comp_total443: addi %51, %51, 40 --> comp_total83 +comp_total83 : li %53, 7 --> comp_total82 +comp_total82 : li %54, 4 --> comp_total81 +comp_total81 : mulo %52, %53, %54 --> comp_total80 +comp_total80 : add %165, %51, %52 --> comp_total231 +comp_total231: sw %50, 0(%165) --> comp_total79 +comp_total79 : emit c76 --> comp_total78 +comp_total78 : li %45, 0 --> comp_total77 +comp_total77 : move %46, $sp --> comp_total442 +comp_total442: addi %46, %46, 40 --> comp_total76 +comp_total76 : li %48, 8 --> comp_total75 +comp_total75 : li %49, 4 --> comp_total74 +comp_total74 : mulo %47, %48, %49 --> comp_total73 +comp_total73 : add %164, %46, %47 --> comp_total230 +comp_total230: sw %45, 0(%164) --> comp_total72 +comp_total72 : emit c75 --> comp_total71 +comp_total71 : li %40, 0 --> comp_total70 +comp_total70 : move %41, $sp --> comp_total441 +comp_total441: addi %41, %41, 40 --> comp_total69 +comp_total69 : li %43, 9 --> comp_total68 +comp_total68 : li %44, 4 --> comp_total67 +comp_total67 : mulo %42, %43, %44 --> comp_total66 +comp_total66 : add %163, %41, %42 --> comp_total229 +comp_total229: sw %40, 0(%163) --> comp_total65 +comp_total65 : emit c74 --> comp_total64 +comp_total64 : li %39, 0 --> comp_total63 +comp_total63 : slt %38, %1, %2 --> comp_total62 +comp_total62 : beq %38, %39 --> comp_total40, comp_total61 +comp_total61 : emit c73 --> comp_total60 +comp_total60 : emit c72 --> comp_total59 +comp_total59 : li %5, 0 --> comp_total41 +comp_total41 : j --> comp_total58 +comp_total58 : li %36, 0 --> comp_total57 +comp_total57 : emit c71 --> comp_total56 +comp_total56 : sle %37, %5, %1 --> comp_total55 +comp_total55 : li %162, 0 --> comp_total228 +comp_total228: seq %35, %37, %162 --> comp_total54 +comp_total54 : beq %35, %36 --> comp_total53, comp_total2 +comp_total2 : emit c59 --> comp_total1 +comp_total1 : li %6, 0 --> comp_total0 +comp_total0 : j --> comp_total422 +comp_total422: move $v0, %6 --> comp_total421 +comp_total421: move $ra, %176 --> comp_total420 +comp_total420: move $s7, %175 --> comp_total419 +comp_total419: move $s6, %174 --> comp_total418 +comp_total418: move $s5, %173 --> comp_total417 +comp_total417: move $s4, %172 --> comp_total416 +comp_total416: move $s3, %171 --> comp_total415 +comp_total415: move $s2, %170 --> comp_total414 +comp_total414: move $s1, %169 --> comp_total413 +comp_total413: move $s0, %168 --> comp_total412 +comp_total412: delframe --> comp_total411 +comp_total411: jr $ra (xmits $v0) +comp_total53 : emit c69 --> comp_total52 +comp_total52 : sub %33, %1, %5 --> comp_total51 +comp_total51 : li %34, 4 --> comp_total50 +comp_total50 : mulo %32, %33, %34 --> comp_total49 +comp_total49 : add %161, %0, %32 --> comp_total227 +comp_total227: lw %28, 0(%161) --> comp_total48 +comp_total48 : move %29, $sp --> comp_total440 +comp_total440: move %29, %29 --> comp_total47 +comp_total47 : li %31, 4 --> comp_total46 +comp_total46 : mulo %30, %5, %31 --> comp_total45 +comp_total45 : add %160, %29, %30 --> comp_total226 +comp_total226: sw %28, 0(%160) --> comp_total44 +comp_total44 : emit c70 --> comp_total43 +comp_total43 : li %27, 1 --> comp_total42 +comp_total42 : add %5, %5, %27 --> comp_total41 +comp_total40 : emit c68 --> comp_total39 +comp_total39 : emit c67 --> comp_total38 +comp_total38 : li %3, 0 --> comp_total3 +comp_total3 : j --> comp_total37 +comp_total37 : li %25, 0 --> comp_total36 +comp_total36 : emit c66 --> comp_total35 +comp_total35 : slt %26, %3, %1 --> comp_total34 +comp_total34 : li %159, 0 --> comp_total225 +comp_total225: seq %24, %26, %159 --> comp_total33 +comp_total33 : beq %24, %25 --> comp_total32, comp_total2 +comp_total32 : emit c64 --> comp_total31 +comp_total31 : emit c63 --> comp_total30 +comp_total30 : move %4, %2 --> comp_total7 +comp_total7 : j --> comp_total29 +comp_total29 : li %21, 0 --> comp_total28 +comp_total28 : emit c62 --> comp_total27 +comp_total27 : li %23, 0 --> comp_total26 +comp_total26 : sgt %22, %4, %23 --> comp_total25 +comp_total25 : li %158, 0 --> comp_total224 +comp_total224: seq %20, %22, %158 --> comp_total24 +comp_total24 : beq %20, %21 --> comp_total23, comp_total6 +comp_total6 : emit c65 --> comp_total5 +comp_total5 : li %7, 1 --> comp_total4 +comp_total4 : add %3, %3, %7 --> comp_total3 +comp_total23 : emit c60 --> comp_total22 +comp_total22 : move %17, $sp --> comp_total439 +comp_total439: move %17, %17 --> comp_total21 +comp_total21 : li %19, 4 --> comp_total20 +comp_total20 : mulo %18, %3, %19 --> comp_total19 +comp_total19 : add %155, %17, %18 --> comp_total221 +comp_total221: lw %12, 0(%155) --> comp_total18 +comp_total18 : move %14, $sp --> comp_total434 +comp_total434: addi %14, %14, 40 --> comp_total17 +comp_total17 : li %16, 4 --> comp_total16 +comp_total16 : mulo %15, %4, %16 --> comp_total15 +comp_total15 : add %148, %14, %15 --> comp_total214 +comp_total214: lw %13, 0(%148) --> comp_total14 +comp_total14 : add %9, %12, %13 --> comp_total13 +comp_total13 : li %11, 4 --> comp_total12 +comp_total12 : mulo %10, %3, %11 --> comp_total11 +comp_total11 : add %142, %0, %10 --> comp_total208 +comp_total208: sw %9, 0(%142) --> comp_total10 +comp_total10 : emit c61 --> comp_total9 +comp_total9 : li %8, 1 --> comp_total8 +comp_total8 : sub %4, %4, %8 --> comp_total7 + +procedure comp_ifFor(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20 +entry comp_ifFor45 +comp_ifFor45: newframe --> comp_ifFor44 +comp_ifFor44: move %20, $ra --> comp_ifFor43 +comp_ifFor43: move %19, $s7 --> comp_ifFor42 +comp_ifFor42: move %18, $s6 --> comp_ifFor41 +comp_ifFor41: move %17, $s5 --> comp_ifFor40 +comp_ifFor40: move %16, $s4 --> comp_ifFor39 +comp_ifFor39: move %15, $s3 --> comp_ifFor38 +comp_ifFor38: move %14, $s2 --> comp_ifFor37 +comp_ifFor37: move %13, $s1 --> comp_ifFor36 +comp_ifFor36: move %12, $s0 --> comp_ifFor35 +comp_ifFor35: move %0, $a0 --> comp_ifFor34 +comp_ifFor34: move %1, $a1 --> comp_ifFor33 +comp_ifFor33: move %2, $a2 --> comp_ifFor32 +comp_ifFor32: li %3, 0 --> comp_ifFor31 +comp_ifFor31: li %4, 0 --> comp_ifFor30 +comp_ifFor30: li %6, 0 --> comp_ifFor29 +comp_ifFor29: li %7, 0 --> comp_ifFor28 +comp_ifFor28: li %8, 0 --> comp_ifFor27 +comp_ifFor27: li %9, 0 --> comp_ifFor26 +comp_ifFor26: li %10, 0 --> comp_ifFor25 +comp_ifFor25: li %11, 0 --> comp_ifFor23 +comp_ifFor23: emit c58 --> comp_ifFor22 +comp_ifFor22: li %4, 0 --> comp_ifFor21 +comp_ifFor21: emit c57 --> comp_ifFor20 +comp_ifFor20: emit c56 --> comp_ifFor19 +comp_ifFor19: li %3, 0 --> comp_ifFor3 +comp_ifFor3 : j --> comp_ifFor18 +comp_ifFor18: li %9, 0 --> comp_ifFor17 +comp_ifFor17: emit c55 --> comp_ifFor16 +comp_ifFor16: slt %10, %3, %0 --> comp_ifFor15 +comp_ifFor15: li %11, 0 --> comp_ifFor24 +comp_ifFor24: seq %8, %10, %11 --> comp_ifFor14 +comp_ifFor14: beq %8, %9 --> comp_ifFor13, comp_ifFor2 +comp_ifFor2 : emit c50 --> comp_ifFor1 +comp_ifFor1 : move %5, %4 --> comp_ifFor0 +comp_ifFor0 : j --> comp_ifFor57 +comp_ifFor57: move $v0, %5 --> comp_ifFor56 +comp_ifFor56: move $ra, %20 --> comp_ifFor55 +comp_ifFor55: move $s7, %19 --> comp_ifFor54 +comp_ifFor54: move $s6, %18 --> comp_ifFor53 +comp_ifFor53: move $s5, %17 --> comp_ifFor52 +comp_ifFor52: move $s4, %16 --> comp_ifFor51 +comp_ifFor51: move $s3, %15 --> comp_ifFor50 +comp_ifFor50: move $s2, %14 --> comp_ifFor49 +comp_ifFor49: move $s1, %13 --> comp_ifFor48 +comp_ifFor48: move $s0, %12 --> comp_ifFor47 +comp_ifFor47: delframe --> comp_ifFor46 +comp_ifFor46: jr $ra (xmits $v0) +comp_ifFor13: emit c53 --> comp_ifFor12 +comp_ifFor12: li %7, 0 --> comp_ifFor11 +comp_ifFor11: sne %6, %3, %1 --> comp_ifFor10 +comp_ifFor10: beq %6, %7 --> comp_ifFor7, comp_ifFor9 +comp_ifFor9 : emit c52 --> comp_ifFor8 +comp_ifFor8 : add %4, %4, %3 --> comp_ifFor5 +comp_ifFor5 : emit c54 --> comp_ifFor4 +comp_ifFor4 : add %3, %3, %2 --> comp_ifFor3 +comp_ifFor7 : emit c51 --> comp_ifFor6 +comp_ifFor6 : li %4, 0 --> comp_ifFor5 + +procedure comp_forif2(4) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62 +entry comp_forif2153 +comp_forif2153: newframe --> comp_forif2152 +comp_forif2152: move %62, $ra --> comp_forif2151 +comp_forif2151: move %61, $s7 --> comp_forif2150 +comp_forif2150: move %60, $s6 --> comp_forif2149 +comp_forif2149: move %59, $s5 --> comp_forif2148 +comp_forif2148: move %58, $s4 --> comp_forif2147 +comp_forif2147: move %57, $s3 --> comp_forif2146 +comp_forif2146: move %56, $s2 --> comp_forif2145 +comp_forif2145: move %55, $s1 --> comp_forif2144 +comp_forif2144: move %54, $s0 --> comp_forif2143 +comp_forif2143: move %0, $a0 --> comp_forif2142 +comp_forif2142: move %1, $a1 --> comp_forif2141 +comp_forif2141: move %2, $a2 --> comp_forif2140 +comp_forif2140: move %3, $a3 --> comp_forif2139 +comp_forif2139: li %4, 0 --> comp_forif2138 +comp_forif2138: li %5, 0 --> comp_forif2137 +comp_forif2137: li %6, 0 --> comp_forif2136 +comp_forif2136: li %7, 0 --> comp_forif2135 +comp_forif2135: li %8, 0 --> comp_forif2134 +comp_forif2134: li %10, 0 --> comp_forif2133 +comp_forif2133: li %11, 0 --> comp_forif2132 +comp_forif2132: li %12, 0 --> comp_forif2131 +comp_forif2131: li %13, 0 --> comp_forif2130 +comp_forif2130: li %14, 0 --> comp_forif2129 +comp_forif2129: li %15, 0 --> comp_forif2128 +comp_forif2128: li %16, 0 --> comp_forif2127 +comp_forif2127: li %17, 0 --> comp_forif2126 +comp_forif2126: li %18, 0 --> comp_forif2125 +comp_forif2125: li %19, 0 --> comp_forif2124 +comp_forif2124: li %20, 0 --> comp_forif2123 +comp_forif2123: li %21, 0 --> comp_forif2122 +comp_forif2122: li %22, 0 --> comp_forif2121 +comp_forif2121: li %23, 0 --> comp_forif2120 +comp_forif2120: li %24, 0 --> comp_forif2119 +comp_forif2119: li %25, 0 --> comp_forif2118 +comp_forif2118: li %26, 0 --> comp_forif2117 +comp_forif2117: li %27, 0 --> comp_forif2116 +comp_forif2116: li %28, 0 --> comp_forif2115 +comp_forif2115: li %29, 0 --> comp_forif2114 +comp_forif2114: li %30, 0 --> comp_forif2113 +comp_forif2113: li %31, 0 --> comp_forif2112 +comp_forif2112: li %32, 0 --> comp_forif2111 +comp_forif2111: li %33, 0 --> comp_forif2110 +comp_forif2110: li %34, 0 --> comp_forif2109 +comp_forif2109: li %35, 0 --> comp_forif2108 +comp_forif2108: li %36, 0 --> comp_forif2107 +comp_forif2107: li %37, 0 --> comp_forif2106 +comp_forif2106: li %38, 0 --> comp_forif2105 +comp_forif2105: li %39, 0 --> comp_forif2104 +comp_forif2104: li %40, 0 --> comp_forif2103 +comp_forif2103: li %41, 0 --> comp_forif2102 +comp_forif2102: li %42, 0 --> comp_forif2101 +comp_forif2101: li %43, 0 --> comp_forif2100 +comp_forif2100: li %44, 0 --> comp_forif299 +comp_forif299 : li %45, 0 --> comp_forif298 +comp_forif298 : li %46, 0 --> comp_forif297 +comp_forif297 : li %47, 0 --> comp_forif296 +comp_forif296 : li %48, 0 --> comp_forif295 +comp_forif295 : li %49, 0 --> comp_forif294 +comp_forif294 : li %50, 0 --> comp_forif293 +comp_forif293 : li %51, 0 --> comp_forif292 +comp_forif292 : li %52, 0 --> comp_forif291 +comp_forif291 : li %53, 0 --> comp_forif282 +comp_forif282 : emit c130 --> comp_forif281 +comp_forif281 : li %6, 0 --> comp_forif280 +comp_forif280 : emit c129 --> comp_forif279 +comp_forif279 : li %5, 0 --> comp_forif278 +comp_forif278 : emit c128 --> comp_forif277 +comp_forif277 : emit c127 --> comp_forif276 +comp_forif276 : li %8, 0 --> comp_forif262 +comp_forif262 : j --> comp_forif275 +comp_forif275 : li %44, 0 --> comp_forif274 +comp_forif274 : emit c126 --> comp_forif273 +comp_forif273 : slt %45, %8, %2 --> comp_forif272 +comp_forif272 : li %53, 0 --> comp_forif290 +comp_forif290 : seq %43, %45, %53 --> comp_forif271 +comp_forif271 : beq %43, %44 --> comp_forif270, comp_forif261 +comp_forif261 : emit c123 --> comp_forif260 +comp_forif260 : emit c122 --> comp_forif259 +comp_forif259 : li %7, 0 --> comp_forif245 +comp_forif245 : j --> comp_forif258 +comp_forif258 : li %37, 0 --> comp_forif257 +comp_forif257 : emit c121 --> comp_forif256 +comp_forif256 : slt %38, %7, %3 --> comp_forif255 +comp_forif255 : li %51, 0 --> comp_forif288 +comp_forif288 : seq %36, %38, %51 --> comp_forif254 +comp_forif254 : beq %36, %37 --> comp_forif253, comp_forif244 +comp_forif244 : emit c118 --> comp_forif243 +comp_forif243 : li %21, 0 --> comp_forif242 +comp_forif242 : li %28, 0 --> comp_forif241 +comp_forif241 : emit c117 --> comp_forif240 +comp_forif240 : li %31, 2 --> comp_forif239 +comp_forif239 : la %49, mod --> comp_forif286 +comp_forif286 : j --> comp_forif2181 +comp_forif2181: move $a0, %6 --> comp_forif2180 +comp_forif2180: move $a1, %31 --> comp_forif2179 +comp_forif2179: call %49(2) --> comp_forif2178 +comp_forif2178: move %29, $v0 --> comp_forif238 +comp_forif238 : li %30, 0 --> comp_forif237 +comp_forif237 : seq %27, %29, %30 --> comp_forif236 +comp_forif236 : beq %27, %28 --> comp_forif226, comp_forif235 +comp_forif235 : li %23, 0 --> comp_forif234 +comp_forif234 : emit c116 --> comp_forif233 +comp_forif233 : li %26, 2 --> comp_forif232 +comp_forif232 : la %48, mod --> comp_forif285 +comp_forif285 : j --> comp_forif2177 +comp_forif2177: move $a0, %5 --> comp_forif2176 +comp_forif2176: move $a1, %26 --> comp_forif2175 +comp_forif2175: call %48(2) --> comp_forif2174 +comp_forif2174: move %24, $v0 --> comp_forif231 +comp_forif231 : li %25, 0 --> comp_forif230 +comp_forif230 : seq %22, %24, %25 --> comp_forif229 +comp_forif229 : beq %22, %23 --> comp_forif227, comp_forif228 +comp_forif228 : li %20, 1 --> comp_forif225 +comp_forif225 : beq %20, %21 --> comp_forif222, comp_forif224 +comp_forif224 : emit c115 --> comp_forif223 +comp_forif223 : li %4, 0 --> comp_forif22 +comp_forif22 : emit c109 --> comp_forif21 +comp_forif21 : li %9, 0 --> comp_forif20 +comp_forif20 : j --> comp_forif2165 +comp_forif2165: move $v0, %9 --> comp_forif2164 +comp_forif2164: move $ra, %62 --> comp_forif2163 +comp_forif2163: move $s7, %61 --> comp_forif2162 +comp_forif2162: move $s6, %60 --> comp_forif2161 +comp_forif2161: move $s5, %59 --> comp_forif2160 +comp_forif2160: move $s4, %58 --> comp_forif2159 +comp_forif2159: move $s3, %57 --> comp_forif2158 +comp_forif2158: move $s2, %56 --> comp_forif2157 +comp_forif2157: move $s1, %55 --> comp_forif2156 +comp_forif2156: move $s0, %54 --> comp_forif2155 +comp_forif2155: delframe --> comp_forif2154 +comp_forif2154: jr $ra (xmits $v0) +comp_forif222 : emit c114 --> comp_forif221 +comp_forif221 : li %16, 0 --> comp_forif220 +comp_forif220 : li %19, 2 --> comp_forif219 +comp_forif219 : la %47, mod --> comp_forif284 +comp_forif284 : j --> comp_forif2173 +comp_forif2173: move $a0, %6 --> comp_forif2172 +comp_forif2172: move $a1, %19 --> comp_forif2171 +comp_forif2171: call %47(2) --> comp_forif2170 +comp_forif2170: move %17, $v0 --> comp_forif218 +comp_forif218 : li %18, 0 --> comp_forif217 +comp_forif217 : seq %15, %17, %18 --> comp_forif216 +comp_forif216 : beq %15, %16 --> comp_forif213, comp_forif215 +comp_forif215 : emit c113 --> comp_forif214 +comp_forif214 : li %4, 1 --> comp_forif22 +comp_forif213 : emit c112 --> comp_forif212 +comp_forif212 : li %11, 0 --> comp_forif211 +comp_forif211 : li %14, 2 --> comp_forif210 +comp_forif210 : la %46, mod --> comp_forif283 +comp_forif283 : j --> comp_forif2169 +comp_forif2169: move $a0, %5 --> comp_forif2168 +comp_forif2168: move $a1, %14 --> comp_forif2167 +comp_forif2167: call %46(2) --> comp_forif2166 +comp_forif2166: move %12, $v0 --> comp_forif29 +comp_forif29 : li %13, 0 --> comp_forif28 +comp_forif28 : seq %10, %12, %13 --> comp_forif27 +comp_forif27 : beq %10, %11 --> comp_forif24, comp_forif26 +comp_forif26 : emit c111 --> comp_forif25 +comp_forif25 : li %4, 2 --> comp_forif22 +comp_forif24 : emit c110 --> comp_forif23 +comp_forif23 : li %4, 3 --> comp_forif22 +comp_forif227 : li %20, 0 --> comp_forif225 +comp_forif226 : li %20, 0 --> comp_forif225 +comp_forif253 : emit c119 --> comp_forif252 +comp_forif252 : li %35, 4 --> comp_forif251 +comp_forif251 : mulo %34, %7, %35 --> comp_forif250 +comp_forif250 : add %50, %1, %34 --> comp_forif287 +comp_forif287 : lw %33, 0(%50) --> comp_forif249 +comp_forif249 : add %5, %5, %33 --> comp_forif248 +comp_forif248 : emit c120 --> comp_forif247 +comp_forif247 : li %32, 1 --> comp_forif246 +comp_forif246 : add %7, %7, %32 --> comp_forif245 +comp_forif270 : emit c124 --> comp_forif269 +comp_forif269 : li %42, 4 --> comp_forif268 +comp_forif268 : mulo %41, %8, %42 --> comp_forif267 +comp_forif267 : add %52, %0, %41 --> comp_forif289 +comp_forif289 : lw %40, 0(%52) --> comp_forif266 +comp_forif266 : add %6, %6, %40 --> comp_forif265 +comp_forif265 : emit c125 --> comp_forif264 +comp_forif264 : li %39, 1 --> comp_forif263 +comp_forif263 : add %8, %8, %39 --> comp_forif262 + +procedure comp_forif(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27 +entry comp_forif65 +comp_forif65: newframe --> comp_forif64 +comp_forif64: move %27, $ra --> comp_forif63 +comp_forif63: move %26, $s7 --> comp_forif62 +comp_forif62: move %25, $s6 --> comp_forif61 +comp_forif61: move %24, $s5 --> comp_forif60 +comp_forif60: move %23, $s4 --> comp_forif59 +comp_forif59: move %22, $s3 --> comp_forif58 +comp_forif58: move %21, $s2 --> comp_forif57 +comp_forif57: move %20, $s1 --> comp_forif56 +comp_forif56: move %19, $s0 --> comp_forif55 +comp_forif55: li %0, 0 --> comp_forif54 +comp_forif54: li %1, 0 --> comp_forif53 +comp_forif53: li %2, 0 --> comp_forif52 +comp_forif52: li %4, 0 --> comp_forif51 +comp_forif51: li %5, 0 --> comp_forif50 +comp_forif50: li %6, 0 --> comp_forif49 +comp_forif49: li %7, 0 --> comp_forif48 +comp_forif48: li %8, 0 --> comp_forif47 +comp_forif47: li %9, 0 --> comp_forif46 +comp_forif46: li %10, 0 --> comp_forif45 +comp_forif45: li %11, 0 --> comp_forif44 +comp_forif44: li %12, 0 --> comp_forif43 +comp_forif43: li %13, 0 --> comp_forif42 +comp_forif42: li %14, 0 --> comp_forif41 +comp_forif41: li %15, 0 --> comp_forif40 +comp_forif40: li %16, 0 --> comp_forif39 +comp_forif39: li %17, 0 --> comp_forif38 +comp_forif38: li %18, 0 --> comp_forif35 +comp_forif35: emit c141 --> comp_forif34 +comp_forif34: li %1, 0 --> comp_forif33 +comp_forif33: emit c140 --> comp_forif32 +comp_forif32: li %0, 0 --> comp_forif31 +comp_forif31: emit c139 --> comp_forif30 +comp_forif30: emit c138 --> comp_forif29 +comp_forif29: li %2, 0 --> comp_forif3 +comp_forif3 : j --> comp_forif28 +comp_forif28: li %14, 0 --> comp_forif27 +comp_forif27: emit c137 --> comp_forif26 +comp_forif26: li %16, 10 --> comp_forif25 +comp_forif25: slt %15, %2, %16 --> comp_forif24 +comp_forif24: li %18, 0 --> comp_forif37 +comp_forif37: seq %13, %15, %18 --> comp_forif23 +comp_forif23: beq %13, %14 --> comp_forif22, comp_forif2 +comp_forif2 : emit c131 --> comp_forif1 +comp_forif1 : move %3, %1 --> comp_forif0 +comp_forif0 : j --> comp_forif77 +comp_forif77: move $v0, %3 --> comp_forif76 +comp_forif76: move $ra, %27 --> comp_forif75 +comp_forif75: move $s7, %26 --> comp_forif74 +comp_forif74: move $s6, %25 --> comp_forif73 +comp_forif73: move $s5, %24 --> comp_forif72 +comp_forif72: move $s4, %23 --> comp_forif71 +comp_forif71: move $s3, %22 --> comp_forif70 +comp_forif70: move $s2, %21 --> comp_forif69 +comp_forif69: move $s1, %20 --> comp_forif68 +comp_forif68: move $s0, %19 --> comp_forif67 +comp_forif67: delframe --> comp_forif66 +comp_forif66: jr $ra (xmits $v0) +comp_forif22: emit c135 --> comp_forif21 +comp_forif21: li %12, 1 --> comp_forif20 +comp_forif20: add %1, %1, %12 --> comp_forif19 +comp_forif19: emit c134 --> comp_forif18 +comp_forif18: li %11, 1 --> comp_forif17 +comp_forif17: add %1, %1, %11 --> comp_forif16 +comp_forif16: emit c133 --> comp_forif15 +comp_forif15: li %7, 0 --> comp_forif14 +comp_forif14: li %10, 2 --> comp_forif13 +comp_forif13: la %17, mod --> comp_forif36 +comp_forif36: j --> comp_forif81 +comp_forif81: move $a0, %2 --> comp_forif80 +comp_forif80: move $a1, %10 --> comp_forif79 +comp_forif79: call %17(2) --> comp_forif78 +comp_forif78: move %8, $v0 --> comp_forif12 +comp_forif12: li %9, 0 --> comp_forif11 +comp_forif11: seq %6, %8, %9 --> comp_forif10 +comp_forif10: beq %6, %7 --> comp_forif6, comp_forif9 +comp_forif9 : emit c132 --> comp_forif8 +comp_forif8 : li %5, 1 --> comp_forif7 +comp_forif7 : add %0, %0, %5 --> comp_forif6 +comp_forif6 : emit c136 --> comp_forif5 +comp_forif5 : li %4, 1 --> comp_forif4 +comp_forif4 : add %2, %2, %4 --> comp_forif3 + +procedure comp_fir_basic(5) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62 +entry comp_fir_basic141 +comp_fir_basic141: newframe --> comp_fir_basic140 +comp_fir_basic140: move %62, $ra --> comp_fir_basic139 +comp_fir_basic139: move %61, $s7 --> comp_fir_basic138 +comp_fir_basic138: move %60, $s6 --> comp_fir_basic137 +comp_fir_basic137: move %59, $s5 --> comp_fir_basic136 +comp_fir_basic136: move %58, $s4 --> comp_fir_basic135 +comp_fir_basic135: move %57, $s3 --> comp_fir_basic134 +comp_fir_basic134: move %56, $s2 --> comp_fir_basic133 +comp_fir_basic133: move %55, $s1 --> comp_fir_basic132 +comp_fir_basic132: move %54, $s0 --> comp_fir_basic131 +comp_fir_basic131: move %0, $a0 --> comp_fir_basic130 +comp_fir_basic130: move %1, $a1 --> comp_fir_basic129 +comp_fir_basic129: move %2, $a2 --> comp_fir_basic128 +comp_fir_basic128: move %3, $a3 --> comp_fir_basic127 +comp_fir_basic127: gets %4, in(0) --> comp_fir_basic126 +comp_fir_basic126: li %5, 0 --> comp_fir_basic125 +comp_fir_basic125: li %6, 0 --> comp_fir_basic124 +comp_fir_basic124: li %7, 0 --> comp_fir_basic123 +comp_fir_basic123: li %8, 0 --> comp_fir_basic122 +comp_fir_basic122: li %10, 0 --> comp_fir_basic121 +comp_fir_basic121: li %11, 0 --> comp_fir_basic120 +comp_fir_basic120: li %12, 0 --> comp_fir_basic119 +comp_fir_basic119: li %13, 0 --> comp_fir_basic118 +comp_fir_basic118: li %14, 0 --> comp_fir_basic117 +comp_fir_basic117: li %15, 0 --> comp_fir_basic116 +comp_fir_basic116: li %16, 0 --> comp_fir_basic115 +comp_fir_basic115: li %17, 0 --> comp_fir_basic114 +comp_fir_basic114: li %18, 0 --> comp_fir_basic113 +comp_fir_basic113: li %19, 0 --> comp_fir_basic112 +comp_fir_basic112: li %20, 0 --> comp_fir_basic111 +comp_fir_basic111: li %21, 0 --> comp_fir_basic110 +comp_fir_basic110: li %22, 0 --> comp_fir_basic109 +comp_fir_basic109: li %23, 0 --> comp_fir_basic108 +comp_fir_basic108: li %24, 0 --> comp_fir_basic107 +comp_fir_basic107: li %25, 0 --> comp_fir_basic106 +comp_fir_basic106: li %26, 0 --> comp_fir_basic105 +comp_fir_basic105: li %27, 0 --> comp_fir_basic104 +comp_fir_basic104: li %28, 0 --> comp_fir_basic103 +comp_fir_basic103: li %29, 0 --> comp_fir_basic102 +comp_fir_basic102: li %30, 0 --> comp_fir_basic101 +comp_fir_basic101: li %31, 0 --> comp_fir_basic100 +comp_fir_basic100: li %32, 0 --> comp_fir_basic99 +comp_fir_basic99 : li %33, 0 --> comp_fir_basic98 +comp_fir_basic98 : li %34, 0 --> comp_fir_basic97 +comp_fir_basic97 : li %35, 0 --> comp_fir_basic96 +comp_fir_basic96 : li %36, 0 --> comp_fir_basic95 +comp_fir_basic95 : li %37, 0 --> comp_fir_basic94 +comp_fir_basic94 : li %38, 0 --> comp_fir_basic93 +comp_fir_basic93 : li %39, 0 --> comp_fir_basic92 +comp_fir_basic92 : li %40, 0 --> comp_fir_basic91 +comp_fir_basic91 : li %41, 0 --> comp_fir_basic90 +comp_fir_basic90 : li %42, 0 --> comp_fir_basic89 +comp_fir_basic89 : li %43, 0 --> comp_fir_basic88 +comp_fir_basic88 : li %44, 0 --> comp_fir_basic87 +comp_fir_basic87 : li %45, 0 --> comp_fir_basic86 +comp_fir_basic86 : li %46, 0 --> comp_fir_basic85 +comp_fir_basic85 : li %47, 0 --> comp_fir_basic84 +comp_fir_basic84 : li %48, 0 --> comp_fir_basic83 +comp_fir_basic83 : li %49, 0 --> comp_fir_basic82 +comp_fir_basic82 : li %50, 0 --> comp_fir_basic81 +comp_fir_basic81 : li %51, 0 --> comp_fir_basic80 +comp_fir_basic80 : li %52, 0 --> comp_fir_basic79 +comp_fir_basic79 : li %53, 0 --> comp_fir_basic69 +comp_fir_basic69 : emit c16 --> comp_fir_basic68 +comp_fir_basic68 : li %5, 0 --> comp_fir_basic67 +comp_fir_basic67 : emit c15 --> comp_fir_basic66 +comp_fir_basic66 : emit c14 --> comp_fir_basic65 +comp_fir_basic65 : li %6, 0 --> comp_fir_basic3 +comp_fir_basic3 : j --> comp_fir_basic64 +comp_fir_basic64 : li %42, 0 --> comp_fir_basic63 +comp_fir_basic63 : emit c13 --> comp_fir_basic62 +comp_fir_basic62 : li %44, 3 --> comp_fir_basic61 +comp_fir_basic61 : slt %43, %6, %44 --> comp_fir_basic60 +comp_fir_basic60 : li %53, 0 --> comp_fir_basic78 +comp_fir_basic78 : seq %41, %43, %53 --> comp_fir_basic59 +comp_fir_basic59 : beq %41, %42 --> comp_fir_basic58, comp_fir_basic2 +comp_fir_basic2 : emit c0 --> comp_fir_basic1 +comp_fir_basic1 : move %9, %5 --> comp_fir_basic0 +comp_fir_basic0 : j --> comp_fir_basic153 +comp_fir_basic153: move $v0, %9 --> comp_fir_basic152 +comp_fir_basic152: move $ra, %62 --> comp_fir_basic151 +comp_fir_basic151: move $s7, %61 --> comp_fir_basic150 +comp_fir_basic150: move $s6, %60 --> comp_fir_basic149 +comp_fir_basic149: move $s5, %59 --> comp_fir_basic148 +comp_fir_basic148: move $s4, %58 --> comp_fir_basic147 +comp_fir_basic147: move $s3, %57 --> comp_fir_basic146 +comp_fir_basic146: move $s2, %56 --> comp_fir_basic145 +comp_fir_basic145: move $s1, %55 --> comp_fir_basic144 +comp_fir_basic144: move $s0, %54 --> comp_fir_basic143 +comp_fir_basic143: delframe --> comp_fir_basic142 +comp_fir_basic142: jr $ra (xmits $v0) +comp_fir_basic58 : emit c11 --> comp_fir_basic57 +comp_fir_basic57 : li %40, 4 --> comp_fir_basic56 +comp_fir_basic56 : mulo %39, %6, %40 --> comp_fir_basic55 +comp_fir_basic55 : add %52, %0, %39 --> comp_fir_basic77 +comp_fir_basic77 : lw %35, 0(%52) --> comp_fir_basic54 +comp_fir_basic54 : li %37, 0 --> comp_fir_basic53 +comp_fir_basic53 : li %38, 4 --> comp_fir_basic52 +comp_fir_basic52 : mulo %36, %37, %38 --> comp_fir_basic51 +comp_fir_basic51 : add %51, %2, %36 --> comp_fir_basic76 +comp_fir_basic76 : sw %35, 0(%51) --> comp_fir_basic50 +comp_fir_basic50 : emit c10 --> comp_fir_basic49 +comp_fir_basic49 : emit c9 --> comp_fir_basic48 +comp_fir_basic48 : li %8, 0 --> comp_fir_basic29 +comp_fir_basic29 : j --> comp_fir_basic47 +comp_fir_basic47 : li %32, 0 --> comp_fir_basic46 +comp_fir_basic46 : emit c8 --> comp_fir_basic45 +comp_fir_basic45 : li %34, 3 --> comp_fir_basic44 +comp_fir_basic44 : slt %33, %8, %34 --> comp_fir_basic43 +comp_fir_basic43 : li %50, 0 --> comp_fir_basic75 +comp_fir_basic75 : seq %31, %33, %50 --> comp_fir_basic42 +comp_fir_basic42 : beq %31, %32 --> comp_fir_basic41, comp_fir_basic28 +comp_fir_basic28 : emit c5 --> comp_fir_basic27 +comp_fir_basic27 : emit c4 --> comp_fir_basic26 +comp_fir_basic26 : li %7, 2 --> comp_fir_basic7 +comp_fir_basic7 : j --> comp_fir_basic25 +comp_fir_basic25 : li %20, 0 --> comp_fir_basic24 +comp_fir_basic24 : emit c3 --> comp_fir_basic23 +comp_fir_basic23 : li %22, 0 --> comp_fir_basic22 +comp_fir_basic22 : sge %21, %7, %22 --> comp_fir_basic21 +comp_fir_basic21 : li %47, 0 --> comp_fir_basic72 +comp_fir_basic72 : seq %19, %21, %47 --> comp_fir_basic20 +comp_fir_basic20 : beq %19, %20 --> comp_fir_basic19, comp_fir_basic6 +comp_fir_basic6 : emit c12 --> comp_fir_basic5 +comp_fir_basic5 : li %10, 1 --> comp_fir_basic4 +comp_fir_basic4 : add %6, %6, %10 --> comp_fir_basic3 +comp_fir_basic19 : emit c1 --> comp_fir_basic18 +comp_fir_basic18 : li %18, 4 --> comp_fir_basic17 +comp_fir_basic17 : mulo %17, %7, %18 --> comp_fir_basic16 +comp_fir_basic16 : add %46, %2, %17 --> comp_fir_basic71 +comp_fir_basic71 : lw %12, 0(%46) --> comp_fir_basic15 +comp_fir_basic15 : li %16, 1 --> comp_fir_basic14 +comp_fir_basic14 : add %14, %7, %16 --> comp_fir_basic13 +comp_fir_basic13 : li %15, 4 --> comp_fir_basic12 +comp_fir_basic12 : mulo %13, %14, %15 --> comp_fir_basic11 +comp_fir_basic11 : add %45, %2, %13 --> comp_fir_basic70 +comp_fir_basic70 : sw %12, 0(%45) --> comp_fir_basic10 +comp_fir_basic10 : emit c2 --> comp_fir_basic9 +comp_fir_basic9 : li %11, 1 --> comp_fir_basic8 +comp_fir_basic8 : sub %7, %7, %11 --> comp_fir_basic7 +comp_fir_basic41 : emit c6 --> comp_fir_basic40 +comp_fir_basic40 : li %30, 4 --> comp_fir_basic39 +comp_fir_basic39 : mulo %29, %8, %30 --> comp_fir_basic38 +comp_fir_basic38 : add %49, %1, %29 --> comp_fir_basic74 +comp_fir_basic74 : lw %25, 0(%49) --> comp_fir_basic37 +comp_fir_basic37 : li %28, 4 --> comp_fir_basic36 +comp_fir_basic36 : mulo %27, %8, %28 --> comp_fir_basic35 +comp_fir_basic35 : add %48, %2, %27 --> comp_fir_basic73 +comp_fir_basic73 : lw %26, 0(%48) --> comp_fir_basic34 +comp_fir_basic34 : mulo %24, %25, %26 --> comp_fir_basic33 +comp_fir_basic33 : add %5, %5, %24 --> comp_fir_basic32 +comp_fir_basic32 : emit c7 --> comp_fir_basic31 +comp_fir_basic31 : li %23, 1 --> comp_fir_basic30 +comp_fir_basic30 : add %8, %8, %23 --> comp_fir_basic29 + +procedure comp_fir16(4) +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134, %135, %136, %137, %138, %139, + %140, %141, %142, %143, %144, %145, %146, + %147, %148, %149, %150, %151, %152, %153, + %154, %155, %156, %157, %158, %159, %160, + %161, %162 +entry comp_fir16373 +comp_fir16373: newframe --> comp_fir16372 +comp_fir16372: move %162, $ra --> comp_fir16371 +comp_fir16371: move %161, $s7 --> comp_fir16370 +comp_fir16370: move %160, $s6 --> comp_fir16369 +comp_fir16369: move %159, $s5 --> comp_fir16368 +comp_fir16368: move %158, $s4 --> comp_fir16367 +comp_fir16367: move %157, $s3 --> comp_fir16366 +comp_fir16366: move %156, $s2 --> comp_fir16365 +comp_fir16365: move %155, $s1 --> comp_fir16364 +comp_fir16364: move %154, $s0 --> comp_fir16363 +comp_fir16363: move %0, $a0 --> comp_fir16362 +comp_fir16362: move %1, $a1 --> comp_fir16361 +comp_fir16361: move %2, $a2 --> comp_fir16360 +comp_fir16360: move %3, $a3 --> comp_fir16359 +comp_fir16359: li %4, 0 --> comp_fir16358 +comp_fir16358: li %5, 0 --> comp_fir16357 +comp_fir16357: li %6, 0 --> comp_fir16356 +comp_fir16356: li %7, 0 --> comp_fir16355 +comp_fir16355: li %8, 0 --> comp_fir16354 +comp_fir16354: li %10, 0 --> comp_fir16353 +comp_fir16353: li %11, 0 --> comp_fir16352 +comp_fir16352: li %12, 0 --> comp_fir16351 +comp_fir16351: li %13, 0 --> comp_fir16350 +comp_fir16350: li %14, 0 --> comp_fir16349 +comp_fir16349: li %15, 0 --> comp_fir16348 +comp_fir16348: li %16, 0 --> comp_fir16347 +comp_fir16347: li %17, 0 --> comp_fir16346 +comp_fir16346: li %18, 0 --> comp_fir16345 +comp_fir16345: li %19, 0 --> comp_fir16344 +comp_fir16344: li %20, 0 --> comp_fir16343 +comp_fir16343: li %21, 0 --> comp_fir16342 +comp_fir16342: li %22, 0 --> comp_fir16341 +comp_fir16341: li %23, 0 --> comp_fir16340 +comp_fir16340: li %24, 0 --> comp_fir16339 +comp_fir16339: li %25, 0 --> comp_fir16338 +comp_fir16338: li %26, 0 --> comp_fir16337 +comp_fir16337: li %27, 0 --> comp_fir16336 +comp_fir16336: li %28, 0 --> comp_fir16335 +comp_fir16335: li %29, 0 --> comp_fir16334 +comp_fir16334: li %30, 0 --> comp_fir16333 +comp_fir16333: li %31, 0 --> comp_fir16332 +comp_fir16332: li %32, 0 --> comp_fir16331 +comp_fir16331: li %33, 0 --> comp_fir16330 +comp_fir16330: li %34, 0 --> comp_fir16329 +comp_fir16329: li %35, 0 --> comp_fir16328 +comp_fir16328: li %36, 0 --> comp_fir16327 +comp_fir16327: li %37, 0 --> comp_fir16326 +comp_fir16326: li %38, 0 --> comp_fir16325 +comp_fir16325: li %39, 0 --> comp_fir16324 +comp_fir16324: li %40, 0 --> comp_fir16323 +comp_fir16323: li %41, 0 --> comp_fir16322 +comp_fir16322: li %42, 0 --> comp_fir16321 +comp_fir16321: li %43, 0 --> comp_fir16320 +comp_fir16320: li %44, 0 --> comp_fir16319 +comp_fir16319: li %45, 0 --> comp_fir16318 +comp_fir16318: li %46, 0 --> comp_fir16317 +comp_fir16317: li %47, 0 --> comp_fir16316 +comp_fir16316: li %48, 0 --> comp_fir16315 +comp_fir16315: li %49, 0 --> comp_fir16314 +comp_fir16314: li %50, 0 --> comp_fir16313 +comp_fir16313: li %51, 0 --> comp_fir16312 +comp_fir16312: li %52, 0 --> comp_fir16311 +comp_fir16311: li %53, 0 --> comp_fir16310 +comp_fir16310: li %54, 0 --> comp_fir16309 +comp_fir16309: li %55, 0 --> comp_fir16308 +comp_fir16308: li %56, 0 --> comp_fir16307 +comp_fir16307: li %57, 0 --> comp_fir16306 +comp_fir16306: li %58, 0 --> comp_fir16305 +comp_fir16305: li %59, 0 --> comp_fir16304 +comp_fir16304: li %60, 0 --> comp_fir16303 +comp_fir16303: li %61, 0 --> comp_fir16302 +comp_fir16302: li %62, 0 --> comp_fir16301 +comp_fir16301: li %63, 0 --> comp_fir16300 +comp_fir16300: li %64, 0 --> comp_fir16299 +comp_fir16299: li %65, 0 --> comp_fir16298 +comp_fir16298: li %66, 0 --> comp_fir16297 +comp_fir16297: li %67, 0 --> comp_fir16296 +comp_fir16296: li %68, 0 --> comp_fir16295 +comp_fir16295: li %69, 0 --> comp_fir16294 +comp_fir16294: li %70, 0 --> comp_fir16293 +comp_fir16293: li %71, 0 --> comp_fir16292 +comp_fir16292: li %72, 0 --> comp_fir16291 +comp_fir16291: li %73, 0 --> comp_fir16290 +comp_fir16290: li %74, 0 --> comp_fir16289 +comp_fir16289: li %75, 0 --> comp_fir16288 +comp_fir16288: li %76, 0 --> comp_fir16287 +comp_fir16287: li %77, 0 --> comp_fir16286 +comp_fir16286: li %78, 0 --> comp_fir16285 +comp_fir16285: li %79, 0 --> comp_fir16284 +comp_fir16284: li %80, 0 --> comp_fir16283 +comp_fir16283: li %81, 0 --> comp_fir16282 +comp_fir16282: li %82, 0 --> comp_fir16281 +comp_fir16281: li %83, 0 --> comp_fir16280 +comp_fir16280: li %84, 0 --> comp_fir16279 +comp_fir16279: li %85, 0 --> comp_fir16278 +comp_fir16278: li %86, 0 --> comp_fir16277 +comp_fir16277: li %87, 0 --> comp_fir16276 +comp_fir16276: li %88, 0 --> comp_fir16275 +comp_fir16275: li %89, 0 --> comp_fir16274 +comp_fir16274: li %90, 0 --> comp_fir16273 +comp_fir16273: li %91, 0 --> comp_fir16272 +comp_fir16272: li %92, 0 --> comp_fir16271 +comp_fir16271: li %93, 0 --> comp_fir16270 +comp_fir16270: li %94, 0 --> comp_fir16269 +comp_fir16269: li %95, 0 --> comp_fir16268 +comp_fir16268: li %96, 0 --> comp_fir16267 +comp_fir16267: li %97, 0 --> comp_fir16266 +comp_fir16266: li %98, 0 --> comp_fir16265 +comp_fir16265: li %99, 0 --> comp_fir16264 +comp_fir16264: li %100, 0 --> comp_fir16263 +comp_fir16263: li %101, 0 --> comp_fir16262 +comp_fir16262: li %102, 0 --> comp_fir16261 +comp_fir16261: li %103, 0 --> comp_fir16260 +comp_fir16260: li %104, 0 --> comp_fir16259 +comp_fir16259: li %105, 0 --> comp_fir16258 +comp_fir16258: li %106, 0 --> comp_fir16257 +comp_fir16257: li %107, 0 --> comp_fir16256 +comp_fir16256: li %108, 0 --> comp_fir16255 +comp_fir16255: li %109, 0 --> comp_fir16254 +comp_fir16254: li %110, 0 --> comp_fir16253 +comp_fir16253: li %111, 0 --> comp_fir16252 +comp_fir16252: li %112, 0 --> comp_fir16251 +comp_fir16251: li %113, 0 --> comp_fir16250 +comp_fir16250: li %114, 0 --> comp_fir16249 +comp_fir16249: li %115, 0 --> comp_fir16248 +comp_fir16248: li %116, 0 --> comp_fir16247 +comp_fir16247: li %117, 0 --> comp_fir16246 +comp_fir16246: li %118, 0 --> comp_fir16245 +comp_fir16245: li %119, 0 --> comp_fir16244 +comp_fir16244: li %120, 0 --> comp_fir16243 +comp_fir16243: li %121, 0 --> comp_fir16242 +comp_fir16242: li %122, 0 --> comp_fir16241 +comp_fir16241: li %123, 0 --> comp_fir16240 +comp_fir16240: li %124, 0 --> comp_fir16239 +comp_fir16239: li %125, 0 --> comp_fir16238 +comp_fir16238: li %126, 0 --> comp_fir16237 +comp_fir16237: li %127, 0 --> comp_fir16236 +comp_fir16236: li %128, 0 --> comp_fir16235 +comp_fir16235: li %129, 0 --> comp_fir16234 +comp_fir16234: li %130, 0 --> comp_fir16233 +comp_fir16233: li %131, 0 --> comp_fir16232 +comp_fir16232: li %132, 0 --> comp_fir16231 +comp_fir16231: li %133, 0 --> comp_fir16230 +comp_fir16230: li %134, 0 --> comp_fir16229 +comp_fir16229: li %135, 0 --> comp_fir16228 +comp_fir16228: li %136, 0 --> comp_fir16227 +comp_fir16227: li %137, 0 --> comp_fir16226 +comp_fir16226: li %138, 0 --> comp_fir16225 +comp_fir16225: li %139, 0 --> comp_fir16224 +comp_fir16224: li %140, 0 --> comp_fir16223 +comp_fir16223: li %141, 0 --> comp_fir16222 +comp_fir16222: li %142, 0 --> comp_fir16221 +comp_fir16221: li %143, 0 --> comp_fir16220 +comp_fir16220: li %144, 0 --> comp_fir16219 +comp_fir16219: li %145, 0 --> comp_fir16218 +comp_fir16218: li %146, 0 --> comp_fir16217 +comp_fir16217: li %147, 0 --> comp_fir16216 +comp_fir16216: li %148, 0 --> comp_fir16215 +comp_fir16215: li %149, 0 --> comp_fir16214 +comp_fir16214: li %150, 0 --> comp_fir16213 +comp_fir16213: li %151, 0 --> comp_fir16212 +comp_fir16212: li %152, 0 --> comp_fir16211 +comp_fir16211: li %153, 0 --> comp_fir16184 +comp_fir16184: emit c49 --> comp_fir16183 +comp_fir16183: li %123, 0 --> comp_fir16182 +comp_fir16182: move %124, $sp --> comp_fir16397 +comp_fir16397: move %124, %124 --> comp_fir16181 +comp_fir16181: li %126, 0 --> comp_fir16180 +comp_fir16180: li %127, 4 --> comp_fir16179 +comp_fir16179: mulo %125, %126, %127 --> comp_fir16178 +comp_fir16178: add %142, %124, %125 --> comp_fir16199 +comp_fir16199: sw %123, 0(%142) --> comp_fir16177 +comp_fir16177: emit c48 --> comp_fir16176 +comp_fir16176: li %118, 0 --> comp_fir16175 +comp_fir16175: move %119, $sp --> comp_fir16396 +comp_fir16396: move %119, %119 --> comp_fir16174 +comp_fir16174: li %121, 1 --> comp_fir16173 +comp_fir16173: li %122, 4 --> comp_fir16172 +comp_fir16172: mulo %120, %121, %122 --> comp_fir16171 +comp_fir16171: add %141, %119, %120 --> comp_fir16198 +comp_fir16198: sw %118, 0(%141) --> comp_fir16170 +comp_fir16170: emit c47 --> comp_fir16169 +comp_fir16169: li %113, 0 --> comp_fir16168 +comp_fir16168: move %114, $sp --> comp_fir16395 +comp_fir16395: move %114, %114 --> comp_fir16167 +comp_fir16167: li %116, 2 --> comp_fir16166 +comp_fir16166: li %117, 4 --> comp_fir16165 +comp_fir16165: mulo %115, %116, %117 --> comp_fir16164 +comp_fir16164: add %140, %114, %115 --> comp_fir16197 +comp_fir16197: sw %113, 0(%140) --> comp_fir16163 +comp_fir16163: emit c46 --> comp_fir16162 +comp_fir16162: li %108, 0 --> comp_fir16161 +comp_fir16161: move %109, $sp --> comp_fir16394 +comp_fir16394: move %109, %109 --> comp_fir16160 +comp_fir16160: li %111, 3 --> comp_fir16159 +comp_fir16159: li %112, 4 --> comp_fir16158 +comp_fir16158: mulo %110, %111, %112 --> comp_fir16157 +comp_fir16157: add %139, %109, %110 --> comp_fir16196 +comp_fir16196: sw %108, 0(%139) --> comp_fir16156 +comp_fir16156: emit c45 --> comp_fir16155 +comp_fir16155: li %103, 0 --> comp_fir16154 +comp_fir16154: move %104, $sp --> comp_fir16393 +comp_fir16393: move %104, %104 --> comp_fir16153 +comp_fir16153: li %106, 4 --> comp_fir16152 +comp_fir16152: li %107, 4 --> comp_fir16151 +comp_fir16151: mulo %105, %106, %107 --> comp_fir16150 +comp_fir16150: add %138, %104, %105 --> comp_fir16195 +comp_fir16195: sw %103, 0(%138) --> comp_fir16149 +comp_fir16149: emit c44 --> comp_fir16148 +comp_fir16148: li %98, 0 --> comp_fir16147 +comp_fir16147: move %99, $sp --> comp_fir16392 +comp_fir16392: move %99, %99 --> comp_fir16146 +comp_fir16146: li %101, 5 --> comp_fir16145 +comp_fir16145: li %102, 4 --> comp_fir16144 +comp_fir16144: mulo %100, %101, %102 --> comp_fir16143 +comp_fir16143: add %136, %99, %100 --> comp_fir16193 +comp_fir16193: sw %98, 0(%136) --> comp_fir16142 +comp_fir16142: emit c43 --> comp_fir16141 +comp_fir16141: li %93, 0 --> comp_fir16140 +comp_fir16140: move %94, $sp --> comp_fir16391 +comp_fir16391: move %94, %94 --> comp_fir16139 +comp_fir16139: li %96, 6 --> comp_fir16138 +comp_fir16138: li %97, 4 --> comp_fir16137 +comp_fir16137: mulo %95, %96, %97 --> comp_fir16136 +comp_fir16136: add %135, %94, %95 --> comp_fir16192 +comp_fir16192: sw %93, 0(%135) --> comp_fir16135 +comp_fir16135: emit c42 --> comp_fir16134 +comp_fir16134: li %88, 0 --> comp_fir16133 +comp_fir16133: move %89, $sp --> comp_fir16390 +comp_fir16390: move %89, %89 --> comp_fir16132 +comp_fir16132: li %91, 7 --> comp_fir16131 +comp_fir16131: li %92, 4 --> comp_fir16130 +comp_fir16130: mulo %90, %91, %92 --> comp_fir16129 +comp_fir16129: add %134, %89, %90 --> comp_fir16191 +comp_fir16191: sw %88, 0(%134) --> comp_fir16128 +comp_fir16128: emit c41 --> comp_fir16127 +comp_fir16127: li %83, 0 --> comp_fir16126 +comp_fir16126: move %84, $sp --> comp_fir16389 +comp_fir16389: move %84, %84 --> comp_fir16125 +comp_fir16125: li %86, 8 --> comp_fir16124 +comp_fir16124: li %87, 4 --> comp_fir16123 +comp_fir16123: mulo %85, %86, %87 --> comp_fir16122 +comp_fir16122: add %133, %84, %85 --> comp_fir16190 +comp_fir16190: sw %83, 0(%133) --> comp_fir16121 +comp_fir16121: emit c40 --> comp_fir16120 +comp_fir16120: li %78, 0 --> comp_fir16119 +comp_fir16119: move %79, $sp --> comp_fir16388 +comp_fir16388: move %79, %79 --> comp_fir16118 +comp_fir16118: li %81, 9 --> comp_fir16117 +comp_fir16117: li %82, 4 --> comp_fir16116 +comp_fir16116: mulo %80, %81, %82 --> comp_fir16115 +comp_fir16115: add %132, %79, %80 --> comp_fir16189 +comp_fir16189: sw %78, 0(%132) --> comp_fir16114 +comp_fir16114: emit c39 --> comp_fir16113 +comp_fir16113: li %73, 0 --> comp_fir16112 +comp_fir16112: move %74, $sp --> comp_fir16387 +comp_fir16387: move %74, %74 --> comp_fir16111 +comp_fir16111: li %76, 10 --> comp_fir16110 +comp_fir16110: li %77, 4 --> comp_fir16109 +comp_fir16109: mulo %75, %76, %77 --> comp_fir16108 +comp_fir16108: add %130, %74, %75 --> comp_fir16187 +comp_fir16187: sw %73, 0(%130) --> comp_fir16107 +comp_fir16107: emit c38 --> comp_fir16106 +comp_fir16106: li %68, 0 --> comp_fir16105 +comp_fir16105: move %69, $sp --> comp_fir16386 +comp_fir16386: move %69, %69 --> comp_fir16104 +comp_fir16104: li %71, 11 --> comp_fir16103 +comp_fir16103: li %72, 4 --> comp_fir16102 +comp_fir16102: mulo %70, %71, %72 --> comp_fir16101 +comp_fir16101: add %129, %69, %70 --> comp_fir16186 +comp_fir16186: sw %68, 0(%129) --> comp_fir16100 +comp_fir16100: emit c37 --> comp_fir1699 +comp_fir1699 : li %63, 0 --> comp_fir1698 +comp_fir1698 : move %64, $sp --> comp_fir16412 +comp_fir16412: move %64, %64 --> comp_fir1697 +comp_fir1697 : li %66, 12 --> comp_fir1696 +comp_fir1696 : li %67, 4 --> comp_fir1695 +comp_fir1695 : mulo %65, %66, %67 --> comp_fir1694 +comp_fir1694 : add %153, %64, %65 --> comp_fir16210 +comp_fir16210: sw %63, 0(%153) --> comp_fir1693 +comp_fir1693 : emit c36 --> comp_fir1692 +comp_fir1692 : li %58, 0 --> comp_fir1691 +comp_fir1691 : move %59, $sp --> comp_fir16411 +comp_fir16411: move %59, %59 --> comp_fir1690 +comp_fir1690 : li %61, 13 --> comp_fir1689 +comp_fir1689 : li %62, 4 --> comp_fir1688 +comp_fir1688 : mulo %60, %61, %62 --> comp_fir1687 +comp_fir1687 : add %152, %59, %60 --> comp_fir16209 +comp_fir16209: sw %58, 0(%152) --> comp_fir1686 +comp_fir1686 : emit c35 --> comp_fir1685 +comp_fir1685 : li %53, 0 --> comp_fir1684 +comp_fir1684 : move %54, $sp --> comp_fir16410 +comp_fir16410: move %54, %54 --> comp_fir1683 +comp_fir1683 : li %56, 14 --> comp_fir1682 +comp_fir1682 : li %57, 4 --> comp_fir1681 +comp_fir1681 : mulo %55, %56, %57 --> comp_fir1680 +comp_fir1680 : add %151, %54, %55 --> comp_fir16208 +comp_fir16208: sw %53, 0(%151) --> comp_fir1679 +comp_fir1679 : emit c34 --> comp_fir1678 +comp_fir1678 : li %48, 0 --> comp_fir1677 +comp_fir1677 : move %49, $sp --> comp_fir16409 +comp_fir16409: move %49, %49 --> comp_fir1676 +comp_fir1676 : li %51, 15 --> comp_fir1675 +comp_fir1675 : li %52, 4 --> comp_fir1674 +comp_fir1674 : mulo %50, %51, %52 --> comp_fir1673 +comp_fir1673 : add %150, %49, %50 --> comp_fir16207 +comp_fir16207: sw %48, 0(%150) --> comp_fir1672 +comp_fir1672 : emit c33 --> comp_fir1671 +comp_fir1671 : li %8, 0 --> comp_fir1670 +comp_fir1670 : emit c32 --> comp_fir1669 +comp_fir1669 : li %4, 0 --> comp_fir1668 +comp_fir1668 : emit c31 --> comp_fir1667 +comp_fir1667 : emit c30 --> comp_fir1666 +comp_fir1666 : li %6, 0 --> comp_fir167 +comp_fir167 : j --> comp_fir1665 +comp_fir1665 : li %46, 0 --> comp_fir1664 +comp_fir1664 : emit c29 --> comp_fir1663 +comp_fir1663 : slt %47, %6, %3 --> comp_fir1662 +comp_fir1662 : li %149, 0 --> comp_fir16206 +comp_fir16206: seq %45, %47, %149 --> comp_fir1661 +comp_fir1661 : beq %45, %46 --> comp_fir1660, comp_fir166 +comp_fir166 : emit c17 --> comp_fir165 +comp_fir165 : move %10, $sp --> comp_fir16407 +comp_fir16407: move %10, %10 --> comp_fir164 +comp_fir164 : li %12, 0 --> comp_fir163 +comp_fir163 : li %13, 4 --> comp_fir162 +comp_fir162 : mulo %11, %12, %13 --> comp_fir161 +comp_fir161 : add %128, %10, %11 --> comp_fir16185 +comp_fir16185: lw %9, 0(%128) --> comp_fir160 +comp_fir160 : j --> comp_fir16385 +comp_fir16385: move $v0, %9 --> comp_fir16384 +comp_fir16384: move $ra, %162 --> comp_fir16383 +comp_fir16383: move $s7, %161 --> comp_fir16382 +comp_fir16382: move $s6, %160 --> comp_fir16381 +comp_fir16381: move $s5, %159 --> comp_fir16380 +comp_fir16380: move $s4, %158 --> comp_fir16379 +comp_fir16379: move $s3, %157 --> comp_fir16378 +comp_fir16378: move $s2, %156 --> comp_fir16377 +comp_fir16377: move $s1, %155 --> comp_fir16376 +comp_fir16376: move $s0, %154 --> comp_fir16375 +comp_fir16375: delframe --> comp_fir16374 +comp_fir16374: jr $ra (xmits $v0) +comp_fir1660 : emit c27 --> comp_fir1659 +comp_fir1659 : li %44, 4 --> comp_fir1658 +comp_fir1658 : mulo %43, %6, %44 --> comp_fir1657 +comp_fir1657 : add %148, %0, %43 --> comp_fir16205 +comp_fir16205: lw %39, 0(%148) --> comp_fir1656 +comp_fir1656 : move %40, $sp --> comp_fir16408 +comp_fir16408: move %40, %40 --> comp_fir1655 +comp_fir1655 : li %42, 4 --> comp_fir1654 +comp_fir1654 : mulo %41, %8, %42 --> comp_fir1653 +comp_fir1653 : add %147, %40, %41 --> comp_fir16204 +comp_fir16204: sw %39, 0(%147) --> comp_fir1652 +comp_fir1652 : emit c26 --> comp_fir1651 +comp_fir1651 : emit c25 --> comp_fir1650 +comp_fir1650 : li %7, 0 --> comp_fir1620 +comp_fir1620 : j --> comp_fir1649 +comp_fir1649 : li %36, 0 --> comp_fir1648 +comp_fir1648 : emit c24 --> comp_fir1647 +comp_fir1647 : li %38, 16 --> comp_fir1646 +comp_fir1646 : slt %37, %7, %38 --> comp_fir1645 +comp_fir1645 : li %146, 0 --> comp_fir16203 +comp_fir16203: seq %35, %37, %146 --> comp_fir1644 +comp_fir1644 : beq %35, %36 --> comp_fir1643, comp_fir1619 +comp_fir1619 : emit c19 --> comp_fir1618 +comp_fir1618 : li %19, 1 --> comp_fir1617 +comp_fir1617 : add %17, %8, %19 --> comp_fir1616 +comp_fir1616 : li %18, 16 --> comp_fir1615 +comp_fir1615 : la %137, mod --> comp_fir16194 +comp_fir16194: j --> comp_fir16401 +comp_fir16401: move $a0, %17 --> comp_fir16400 +comp_fir16400: move $a1, %18 --> comp_fir16399 +comp_fir16399: call %137(2) --> comp_fir16398 +comp_fir16398: move %8, $v0 --> comp_fir1614 +comp_fir1614 : emit c18 --> comp_fir1613 +comp_fir1613 : li %16, 4 --> comp_fir1612 +comp_fir1612 : mulo %15, %6, %16 --> comp_fir1611 +comp_fir1611 : add %131, %2, %15 --> comp_fir16188 +comp_fir16188: sw %4, 0(%131) --> comp_fir1610 +comp_fir1610 : emit c28 --> comp_fir169 +comp_fir169 : li %14, 1 --> comp_fir168 +comp_fir168 : add %6, %6, %14 --> comp_fir167 +comp_fir1643 : emit c22 --> comp_fir1642 +comp_fir1642 : move %32, $sp --> comp_fir16406 +comp_fir16406: move %32, %32 --> comp_fir1641 +comp_fir1641 : li %34, 4 --> comp_fir1640 +comp_fir1640 : mulo %33, %8, %34 --> comp_fir1639 +comp_fir1639 : add %145, %32, %33 --> comp_fir16202 +comp_fir16202: lw %28, 0(%145) --> comp_fir1638 +comp_fir1638 : li %31, 4 --> comp_fir1637 +comp_fir1637 : mulo %30, %7, %31 --> comp_fir1636 +comp_fir1636 : add %144, %1, %30 --> comp_fir16201 +comp_fir16201: lw %29, 0(%144) --> comp_fir1635 +comp_fir1635 : mulo %24, %28, %29 --> comp_fir1634 +comp_fir1634 : li %26, 2 --> comp_fir1633 +comp_fir1633 : li %27, 16 --> comp_fir1632 +comp_fir1632 : xor %25, %26, %27 --> comp_fir1631 +comp_fir1631 : mulo %5, %24, %25 --> comp_fir1630 +comp_fir1630 : emit c21 --> comp_fir1629 +comp_fir1629 : add %4, %4, %5 --> comp_fir1628 +comp_fir1628 : emit c20 --> comp_fir1627 +comp_fir1627 : li %23, 1 --> comp_fir1626 +comp_fir1626 : add %21, %8, %23 --> comp_fir1625 +comp_fir1625 : li %22, 16 --> comp_fir1624 +comp_fir1624 : la %143, mod --> comp_fir16200 +comp_fir16200: j --> comp_fir16405 +comp_fir16405: move $a0, %21 --> comp_fir16404 +comp_fir16404: move $a1, %22 --> comp_fir16403 +comp_fir16403: call %143(2) --> comp_fir16402 +comp_fir16402: move %8, $v0 --> comp_fir1623 +comp_fir1623 : emit c23 --> comp_fir1622 +comp_fir1622 : li %20, 1 --> comp_fir1621 +comp_fir1621 : add %7, %7, %20 --> comp_fir1620 + +procedure _main(0) +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134 +entry main307 +main307: newframe --> main306 +main306: move %134, $ra --> main305 +main305: move %133, $s7 --> main304 +main304: move %132, $s6 --> main303 +main303: move %131, $s5 --> main302 +main302: move %130, $s4 --> main301 +main301: move %129, $s3 --> main300 +main300: move %128, $s2 --> main299 +main299: move %127, $s1 --> main298 +main298: move %126, $s0 --> main297 +main297: li %0, 0 --> main296 +main296: li %2, 0 --> main295 +main295: li %3, 0 --> main294 +main294: li %4, 0 --> main293 +main293: li %5, 0 --> main292 +main292: li %6, 0 --> main291 +main291: li %7, 0 --> main290 +main290: li %8, 0 --> main289 +main289: li %9, 0 --> main288 +main288: li %10, 0 --> main287 +main287: li %11, 0 --> main286 +main286: li %12, 0 --> main285 +main285: li %13, 0 --> main284 +main284: li %14, 0 --> main283 +main283: li %15, 0 --> main282 +main282: li %16, 0 --> main281 +main281: li %17, 0 --> main280 +main280: li %18, 0 --> main279 +main279: li %19, 0 --> main278 +main278: li %20, 0 --> main277 +main277: li %21, 0 --> main276 +main276: li %22, 0 --> main275 +main275: li %23, 0 --> main274 +main274: li %24, 0 --> main273 +main273: li %25, 0 --> main272 +main272: li %26, 0 --> main271 +main271: li %27, 0 --> main270 +main270: li %28, 0 --> main269 +main269: li %29, 0 --> main268 +main268: li %30, 0 --> main267 +main267: li %31, 0 --> main266 +main266: li %32, 0 --> main265 +main265: li %33, 0 --> main264 +main264: li %34, 0 --> main263 +main263: li %35, 0 --> main262 +main262: li %36, 0 --> main261 +main261: li %37, 0 --> main260 +main260: li %38, 0 --> main259 +main259: li %39, 0 --> main258 +main258: li %40, 0 --> main257 +main257: li %41, 0 --> main256 +main256: li %42, 0 --> main255 +main255: li %43, 0 --> main254 +main254: li %44, 0 --> main253 +main253: li %45, 0 --> main252 +main252: li %46, 0 --> main251 +main251: li %47, 0 --> main250 +main250: li %48, 0 --> main249 +main249: li %49, 0 --> main248 +main248: li %50, 0 --> main247 +main247: li %51, 0 --> main246 +main246: li %52, 0 --> main245 +main245: li %53, 0 --> main244 +main244: li %54, 0 --> main243 +main243: li %55, 0 --> main242 +main242: li %56, 0 --> main241 +main241: li %57, 0 --> main240 +main240: li %58, 0 --> main239 +main239: li %59, 0 --> main238 +main238: li %60, 0 --> main237 +main237: li %61, 0 --> main236 +main236: li %62, 0 --> main235 +main235: li %63, 0 --> main234 +main234: li %64, 0 --> main233 +main233: li %65, 0 --> main232 +main232: li %66, 0 --> main231 +main231: li %67, 0 --> main230 +main230: li %68, 0 --> main229 +main229: li %69, 0 --> main228 +main228: li %70, 0 --> main227 +main227: li %71, 0 --> main226 +main226: li %72, 0 --> main225 +main225: li %73, 0 --> main224 +main224: li %74, 0 --> main223 +main223: li %75, 0 --> main222 +main222: li %76, 0 --> main221 +main221: li %77, 0 --> main220 +main220: li %78, 0 --> main219 +main219: li %79, 0 --> main218 +main218: li %80, 0 --> main217 +main217: li %81, 0 --> main216 +main216: li %82, 0 --> main215 +main215: li %83, 0 --> main214 +main214: li %84, 0 --> main213 +main213: li %85, 0 --> main212 +main212: li %86, 0 --> main211 +main211: li %87, 0 --> main210 +main210: li %88, 0 --> main209 +main209: li %89, 0 --> main208 +main208: li %90, 0 --> main207 +main207: li %91, 0 --> main206 +main206: li %92, 0 --> main205 +main205: li %93, 0 --> main204 +main204: li %94, 0 --> main203 +main203: li %95, 0 --> main202 +main202: li %96, 0 --> main201 +main201: li %97, 0 --> main200 +main200: li %98, 0 --> main199 +main199: li %99, 0 --> main198 +main198: li %100, 0 --> main197 +main197: li %101, 0 --> main196 +main196: li %102, 0 --> main195 +main195: li %103, 0 --> main194 +main194: li %104, 0 --> main193 +main193: li %105, 0 --> main192 +main192: li %106, 0 --> main191 +main191: li %107, 0 --> main190 +main190: li %108, 0 --> main189 +main189: li %109, 0 --> main188 +main188: li %110, 0 --> main187 +main187: li %111, 0 --> main186 +main186: li %112, 0 --> main185 +main185: li %113, 0 --> main184 +main184: li %114, 0 --> main183 +main183: li %115, 0 --> main182 +main182: li %116, 0 --> main181 +main181: li %117, 0 --> main180 +main180: li %118, 0 --> main179 +main179: li %119, 0 --> main178 +main178: li %120, 0 --> main177 +main177: li %121, 0 --> main176 +main176: li %122, 0 --> main175 +main175: li %123, 0 --> main174 +main174: li %124, 0 --> main173 +main173: li %125, 0 --> main149 +main149: emit c165 --> main148 +main148: li %98, 10 --> main147 +main147: move %99, $sp --> main327 +main327: move %99, %99 --> main146 +main146: li %101, 0 --> main145 +main145: li %102, 4 --> main144 +main144: mulo %100, %101, %102 --> main143 +main143: add %110, %99, %100 --> main157 +main157: sw %98, 0(%110) --> main142 +main142: emit c164 --> main141 +main141: li %93, 9 --> main140 +main140: move %94, $sp --> main326 +main326: move %94, %94 --> main139 +main139: li %96, 1 --> main138 +main138: li %97, 4 --> main137 +main137: mulo %95, %96, %97 --> main136 +main136: add %109, %94, %95 --> main156 +main156: sw %93, 0(%109) --> main135 +main135: emit c163 --> main134 +main134: li %88, 8 --> main133 +main133: move %89, $sp --> main325 +main325: move %89, %89 --> main132 +main132: li %91, 2 --> main131 +main131: li %92, 4 --> main130 +main130: mulo %90, %91, %92 --> main129 +main129: add %108, %89, %90 --> main155 +main155: sw %88, 0(%108) --> main128 +main128: emit c162 --> main127 +main127: li %83, 7 --> main126 +main126: move %84, $sp --> main323 +main323: move %84, %84 --> main125 +main125: li %86, 3 --> main124 +main124: li %87, 4 --> main123 +main123: mulo %85, %86, %87 --> main122 +main122: add %107, %84, %85 --> main154 +main154: sw %83, 0(%107) --> main121 +main121: emit c161 --> main120 +main120: li %78, 6 --> main119 +main119: move %79, $sp --> main322 +main322: move %79, %79 --> main118 +main118: li %81, 4 --> main117 +main117: li %82, 4 --> main116 +main116: mulo %80, %81, %82 --> main115 +main115: add %106, %79, %80 --> main153 +main153: sw %78, 0(%106) --> main114 +main114: emit c160 --> main113 +main113: li %73, 0 --> main112 +main112: move %74, $sp --> main321 +main321: move %74, %74 --> main111 +main111: li %76, 5 --> main110 +main110: li %77, 4 --> main109 +main109: mulo %75, %76, %77 --> main108 +main108: add %104, %74, %75 --> main151 +main151: sw %73, 0(%104) --> main107 +main107: emit c159 --> main106 +main106: li %68, 5 --> main105 +main105: move %69, $sp --> main320 +main320: move %69, %69 --> main104 +main104: li %71, 6 --> main103 +main103: li %72, 4 --> main102 +main102: mulo %70, %71, %72 --> main101 +main101: add %103, %69, %70 --> main150 +main150: sw %68, 0(%103) --> main100 +main100: emit c158 --> main99 +main99 : li %63, 4 --> main98 +main98 : move %64, $sp --> main380 +main380: move %64, %64 --> main97 +main97 : li %66, 7 --> main96 +main96 : li %67, 4 --> main95 +main95 : mulo %65, %66, %67 --> main94 +main94 : add %125, %64, %65 --> main172 +main172: sw %63, 0(%125) --> main93 +main93 : emit c157 --> main92 +main92 : li %58, 3 --> main91 +main91 : move %59, $sp --> main379 +main379: move %59, %59 --> main90 +main90 : li %61, 8 --> main89 +main89 : li %62, 4 --> main88 +main88 : mulo %60, %61, %62 --> main87 +main87 : add %124, %59, %60 --> main171 +main171: sw %58, 0(%124) --> main86 +main86 : emit c156 --> main85 +main85 : li %53, 2 --> main84 +main84 : move %54, $sp --> main377 +main377: move %54, %54 --> main83 +main83 : li %56, 9 --> main82 +main82 : li %57, 4 --> main81 +main81 : mulo %55, %56, %57 --> main80 +main80 : add %123, %54, %55 --> main170 +main170: sw %53, 0(%123) --> main79 +main79 : emit c155 --> main78 +main78 : li %48, 0 --> main77 +main77 : move %49, $sp --> main375 +main375: move %49, %49 --> main76 +main76 : li %51, 10 --> main75 +main75 : li %52, 4 --> main74 +main74 : mulo %50, %51, %52 --> main73 +main73 : add %122, %49, %50 --> main169 +main169: sw %48, 0(%122) --> main72 +main72 : emit c154 --> main71 +main71 : li %43, 0 --> main70 +main70 : move %44, $sp --> main374 +main374: move %44, %44 --> main69 +main69 : li %46, 11 --> main68 +main68 : li %47, 4 --> main67 +main67 : mulo %45, %46, %47 --> main66 +main66 : add %121, %44, %45 --> main168 +main168: sw %43, 0(%121) --> main65 +main65 : emit c153 --> main64 +main64 : li %38, 0 --> main63 +main63 : move %39, $sp --> main373 +main373: move %39, %39 --> main62 +main62 : li %41, 12 --> main61 +main61 : li %42, 4 --> main60 +main60 : mulo %40, %41, %42 --> main59 +main59 : add %120, %39, %40 --> main167 +main167: sw %38, 0(%120) --> main58 +main58 : emit c152 --> main57 +main57 : li %33, 0 --> main56 +main56 : move %34, $sp --> main372 +main372: move %34, %34 --> main55 +main55 : li %36, 13 --> main54 +main54 : li %37, 4 --> main53 +main53 : mulo %35, %36, %37 --> main52 +main52 : add %119, %34, %35 --> main166 +main166: sw %33, 0(%119) --> main51 +main51 : emit c151 --> main50 +main50 : li %28, 0 --> main49 +main49 : move %29, $sp --> main371 +main371: move %29, %29 --> main48 +main48 : li %31, 14 --> main47 +main47 : li %32, 4 --> main46 +main46 : mulo %30, %31, %32 --> main45 +main45 : add %117, %29, %30 --> main164 +main164: sw %28, 0(%117) --> main44 +main44 : emit c150 --> main43 +main43 : li %23, 0 --> main42 +main42 : move %24, $sp --> main370 +main370: move %24, %24 --> main41 +main41 : li %26, 15 --> main40 +main40 : li %27, 4 --> main39 +main39 : mulo %25, %26, %27 --> main38 +main38 : add %116, %24, %25 --> main163 +main163: sw %23, 0(%116) --> main37 +main37 : emit c149 --> main36 +main36 : move %18, $sp --> main369 +main369: move %18, %18 --> main35 +main35 : move %19, $sp --> main368 +main368: move %19, %19 --> main34 +main34 : move %20, $sp --> main367 +main367: move %20, %20 --> main33 +main33 : li %21, 10 --> main32 +main32 : li %22, 10 --> main31 +main31 : la %115, comp_fir_basic --> main162 +main162: j --> main356 +main356: move $a0, %18 --> main355 +main355: move $a1, %19 --> main354 +main354: move $a2, %20 --> main353 +main353: move $a3, %21 --> main352 +main352: sets out(0), %22 --> main351 +main351: call %115(5) --> main350 +main350: move %0, $v0 --> main30 +main30 : emit c148 --> main29 +main29 : move %14, $sp --> main366 +main366: move %14, %14 --> main28 +main28 : move %15, $sp --> main365 +main365: move %15, %15 --> main27 +main27 : move %16, $sp --> main364 +main364: move %16, %16 --> main26 +main26 : li %17, 16 --> main25 +main25 : la %113, comp_fir16 --> main160 +main160: j --> main347 +main347: move $a0, %14 --> main346 +main346: move $a1, %15 --> main345 +main345: move $a2, %16 --> main344 +main344: move $a3, %17 --> main343 +main343: call %113(4) --> main342 +main342: move %0, $v0 --> main24 +main24 : emit c147 --> main23 +main23 : li %11, 4 --> main22 +main22 : li %12, 1 --> main21 +main21 : li %13, 1 --> main20 +main20 : la %112, comp_ifFor --> main159 +main159: j --> main341 +main341: move $a0, %11 --> main340 +main340: move $a1, %12 --> main339 +main339: move $a2, %13 --> main338 +main338: call %112(3) --> main337 +main337: move %0, $v0 --> main19 +main19 : emit c146 --> main18 +main18 : move %8, $sp --> main363 +main363: move %8, %8 --> main17 +main17 : li %9, 9 --> main16 +main16 : li %10, 3 --> main15 +main15 : la %111, comp_total --> main158 +main158: j --> main336 +main336: move $a0, %8 --> main335 +main335: move $a1, %9 --> main334 +main334: move $a2, %10 --> main333 +main333: call %111(3) --> main332 +main332: move %0, $v0 --> main14 +main14 : emit c145 --> main13 +main13 : move %6, $sp --> main324 +main324: move %6, %6 --> main12 +main12 : li %7, 10 --> main11 +main11 : la %105, comp_tri --> main152 +main152: j --> main331 +main331: move $a0, %6 --> main330 +main330: move $a1, %7 --> main329 +main329: call %105(2) --> main328 +main328: move %0, $v0 --> main10 +main10 : emit c144 --> main9 +main9 : move %2, $sp --> main378 +main378: move %2, %2 --> main8 +main8 : move %3, $sp --> main376 +main376: move %3, %3 --> main7 +main7 : li %4, 10 --> main6 +main6 : li %5, 10 --> main5 +main5 : la %118, comp_forif2 --> main165 +main165: j --> main362 +main362: move $a0, %2 --> main361 +main361: move $a1, %3 --> main360 +main360: move $a2, %4 --> main359 +main359: move $a3, %5 --> main358 +main358: call %118(4) --> main357 +main357: move %0, $v0 --> main4 +main4 : emit c143 --> main3 +main3 : la %114, comp_forif --> main161 +main161: j --> main349 +main349: call %114(0) --> main348 +main348: move %0, $v0 --> main2 +main2 : emit c142 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main319 +main319: move $v0, %1 --> main318 +main318: move $ra, %134 --> main317 +main317: move $s7, %133 --> main316 +main316: move $s6, %132 --> main315 +main315: move $s5, %131 --> main314 +main314: move $s4, %130 --> main313 +main313: move $s3, %129 --> main312 +main312: move $s2, %128 --> main311 +main311: move $s1, %127 --> main310 +main310: move $s0, %126 --> main309 +main309: delframe --> main308 +main308: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/complets.LIN.expected b/tests/clight/complets.LIN.expected new file mode 100644 index 0000000..dd59104 --- /dev/null +++ b/tests/clight/complets.LIN.expected @@ -0,0 +1,1385 @@ +program + +globals 0 + +procedure comp_tri(2) +var 0 +comp_tri123: +newframe +c108: +li $v0, 0 +c107: +c106: +li $t1, 0 +comp_tri55: +li $a3, 0 +c105: +slt $a2, $t1, $a1 +seq $a2, $a2, $zero +beq $a2, $a3, comp_tri50 +c95: +delframe +jr $ra +comp_tri50: +c103: +c102: +li $t2, 1 +comp_tri47: +li $a3, 0 +c101: +sub $a2, $a1, $t1 +slt $a2, $t2, $a2 +seq $a2, $a2, $zero +beq $a2, $a3, comp_tri41 +c104: +li $a2, 1 +add $t1, $t1, $a2 +j comp_tri55 +comp_tri41: +c99: +li $a2, 4 +mulo $a2, $t2, $a2 +add $a2, $a0, $a2 +lw $t0, 0($a2) +li $a2, 1 +sub $a3, $t2, $a2 +li $a2, 4 +mulo $a2, $a3, $a2 +add $a2, $a0, $a2 +lw $a2, 0($a2) +slt $a2, $t0, $a2 +beq $a2, $zero, comp_tri10 +c98: +li $v0, 1 +sub $a2, $t2, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +c97: +li $a2, 4 +mulo $a2, $t2, $a2 +add $a2, $a0, $a2 +lw $t0, 0($a2) +li $a2, 1 +sub $a3, $t2, $a2 +li $a2, 4 +mulo $a2, $a3, $a2 +add $a2, $a0, $a2 +sw $t0, 0($a2) +c96: +li $a2, 4 +mulo $a2, $t2, $a2 +add $a2, $a0, $a2 +sw $v0, 0($a2) +comp_tri10: +c100: +li $a2, 1 +add $t2, $t2, $a2 +j comp_tri47 + +procedure comp_total(3) +var 80 +comp_total410: +newframe +c94: +li $t0, 0 +move $a3, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c93: +move $t0, $sp +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c92: +move $t0, $sp +li $a3, 2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c91: +move $t0, $sp +li $a3, 3 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c90: +move $t0, $sp +li $a3, 4 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c89: +move $t0, $sp +li $a3, 5 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c88: +move $t0, $sp +li $a3, 6 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c87: +move $t0, $sp +li $a3, 7 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c86: +move $t0, $sp +li $a3, 8 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c85: +move $t0, $sp +li $a3, 9 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c84: +li $t0, 0 +move $a3, $sp +addi $a3, $a3, 40 +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a3, $v0 +sw $t0, 0($v0) +c83: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 1 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c82: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c81: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 3 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c80: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 4 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c79: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 5 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c78: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 6 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c77: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 7 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c76: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 8 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c75: +move $t0, $sp +addi $t0, $t0, 40 +li $a3, 9 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $t0, $v0 +sw $zero, 0($v0) +c74: +slt $v0, $a1, $a2 +beq $v0, $zero, comp_total40 +c73: +c72: +li $t0, 0 +comp_total58: +li $a2, 0 +c71: +sle $v0, $t0, $a1 +seq $v0, $v0, $zero +beq $v0, $a2, comp_total53 +comp_total2: +c59: +li $v0, 0 +delframe +jr $ra +comp_total53: +c69: +sub $a2, $a1, $t0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +move $a2, $sp +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a2, $v0 +sw $a3, 0($v0) +c70: +li $v0, 1 +add $t0, $t0, $v0 +j comp_total58 +comp_total40: +c68: +c67: +li $t2, 0 +comp_total37: +li $a3, 0 +c66: +slt $v0, $t2, $a1 +seq $v0, $v0, $zero +bne $v0, $a3, comp_total2 +c64: +c63: +move $t1, $a2 +comp_total29: +li $a3, 0 +c62: +sgt $v0, $t1, $zero +seq $v0, $v0, $zero +beq $v0, $a3, comp_total23 +c65: +li $v0, 1 +add $t2, $t2, $v0 +j comp_total37 +comp_total23: +c60: +move $a3, $sp +li $v0, 4 +mulo $v0, $t2, $v0 +add $v0, $a3, $v0 +lw $t0, 0($v0) +move $a3, $sp +addi $a3, $a3, 40 +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a3, $v0 +lw $v0, 0($v0) +add $a3, $t0, $v0 +li $v0, 4 +mulo $v0, $t2, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c61: +li $v0, 1 +sub $t1, $t1, $v0 +j comp_total29 + +procedure comp_ifFor(3) +var 0 +comp_ifFor45: +newframe +c58: +li $v0, 0 +c57: +c56: +li $t0, 0 +comp_ifFor18: +li $t1, 0 +c55: +slt $a3, $t0, $a0 +seq $a3, $a3, $zero +beq $a3, $t1, comp_ifFor13 +c50: +delframe +jr $ra +comp_ifFor13: +c53: +sne $a3, $t0, $a1 +beq $a3, $zero, comp_ifFor7 +c52: +add $v0, $v0, $t0 +comp_ifFor5: +c54: +add $t0, $t0, $a2 +j comp_ifFor18 +comp_ifFor7: +c51: +li $v0, 0 +j comp_ifFor5 + +procedure comp_forif2(4) +var 16 +comp_forif2153: +newframe +sw $ra, 12($sp) +sw $s2, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +c130: +li $s0, 0 +c129: +li $s1, 0 +c128: +c127: +li $t0, 0 +comp_forif275: +li $t1, 0 +c126: +slt $v0, $t0, $a2 +seq $v0, $v0, $zero +beq $v0, $t1, comp_forif270 +c123: +c122: +li $a0, 0 +comp_forif258: +li $a2, 0 +c121: +slt $v0, $a0, $a3 +seq $v0, $v0, $zero +beq $v0, $a2, comp_forif253 +c118: +li $s2, 0 +c117: +li $a1, 2 +la $v0, mod +move $a0, $s0 +call $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif226 +c116: +li $a1, 2 +la $v0, mod +move $a0, $s1 +call $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif227 +li $v0, 1 +comp_forif225: +beq $v0, $s2, comp_forif222 +c115: +comp_forif22: +c109: +li $v0, 0 +lw $ra, 12($sp) +lw $s2, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +delframe +jr $ra +comp_forif222: +c114: +li $a1, 2 +la $v0, mod +move $a0, $s0 +call $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif213 +c113: +j comp_forif22 +comp_forif213: +c112: +li $a1, 2 +la $v0, mod +move $a0, $s1 +call $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif24 +c111: +j comp_forif22 +comp_forif24: +c110: +j comp_forif22 +comp_forif227: +li $v0, 0 +j comp_forif225 +comp_forif226: +li $v0, 0 +j comp_forif225 +comp_forif253: +c119: +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +lw $v0, 0($v0) +add $s1, $s1, $v0 +c120: +li $v0, 1 +add $a0, $a0, $v0 +j comp_forif258 +comp_forif270: +c124: +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +add $s0, $s0, $v0 +c125: +li $v0, 1 +add $t0, $t0, $v0 +j comp_forif275 + +procedure comp_forif(0) +var 12 +comp_forif65: +newframe +sw $ra, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +c141: +li $s1, 0 +c140: +c139: +c138: +li $s0, 0 +comp_forif28: +li $a0, 0 +c137: +li $v0, 10 +slt $v0, $s0, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, comp_forif22 +c131: +move $v0, $s1 +lw $ra, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +delframe +jr $ra +comp_forif22: +c135: +li $v0, 1 +add $s1, $s1, $v0 +c134: +li $v0, 1 +add $s1, $s1, $v0 +c133: +li $a1, 2 +la $v0, mod +move $a0, $s0 +call $v0 +li $a0, 0 +seq $v0, $v0, $a0 +beq $v0, $zero, comp_forif6 +c132: +comp_forif6: +c136: +li $v0, 1 +add $s0, $s0, $v0 +j comp_forif28 + +procedure comp_fir_basic(5) +var 4 +comp_fir_basic141: +newframe +c16: +li $v0, 0 +c15: +c14: +li $t3, 0 +comp_fir_basic64: +li $t0, 0 +c13: +li $a3, 3 +slt $a3, $t3, $a3 +seq $a3, $a3, $zero +beq $a3, $t0, comp_fir_basic58 +c0: +delframe +jr $ra +comp_fir_basic58: +c11: +li $a3, 4 +mulo $a3, $t3, $a3 +add $a3, $a0, $a3 +lw $t0, 0($a3) +li $a3, 4 +mulo $a3, $zero, $a3 +add $a3, $a2, $a3 +sw $t0, 0($a3) +c10: +c9: +li $t0, 0 +comp_fir_basic47: +li $t1, 0 +c8: +li $a3, 3 +slt $a3, $t0, $a3 +seq $a3, $a3, $zero +beq $a3, $t1, comp_fir_basic41 +c5: +c4: +li $t2, 2 +comp_fir_basic25: +li $t0, 0 +c3: +sge $a3, $t2, $zero +seq $a3, $a3, $zero +beq $a3, $t0, comp_fir_basic19 +c12: +li $a3, 1 +add $t3, $t3, $a3 +j comp_fir_basic64 +comp_fir_basic19: +c1: +li $a3, 4 +mulo $a3, $t2, $a3 +add $a3, $a2, $a3 +lw $t1, 0($a3) +li $a3, 1 +add $t0, $t2, $a3 +li $a3, 4 +mulo $a3, $t0, $a3 +add $a3, $a2, $a3 +sw $t1, 0($a3) +c2: +li $a3, 1 +sub $t2, $t2, $a3 +j comp_fir_basic25 +comp_fir_basic41: +c6: +li $a3, 4 +mulo $a3, $t0, $a3 +add $a3, $a1, $a3 +lw $t1, 0($a3) +li $a3, 4 +mulo $a3, $t0, $a3 +add $a3, $a2, $a3 +lw $a3, 0($a3) +mulo $a3, $t1, $a3 +add $v0, $v0, $a3 +c7: +li $a3, 1 +add $t0, $t0, $a3 +j comp_fir_basic47 + +procedure comp_fir16(4) +var 96 +comp_fir16373: +newframe +sw $ra, 92($sp) +sw $s6, 88($sp) +sw $s5, 84($sp) +sw $s4, 80($sp) +sw $s3, 76($sp) +sw $s2, 72($sp) +sw $s1, 68($sp) +sw $s0, 64($sp) +move $s6, $a0 +move $s5, $a1 +move $s4, $a2 +move $s3, $a3 +c49: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c48: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c47: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c46: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c45: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c44: +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c43: +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c42: +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c41: +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c40: +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c39: +move $a1, $sp +li $a0, 10 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c38: +move $a1, $sp +li $a0, 11 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c37: +move $a1, $sp +li $a0, 12 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c36: +move $a1, $sp +li $a0, 13 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c35: +move $a1, $sp +li $a0, 14 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c34: +move $a1, $sp +li $a0, 15 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c33: +li $v0, 0 +c32: +li $s2, 0 +c31: +c30: +li $s1, 0 +comp_fir1665: +li $a1, 0 +c29: +slt $a0, $s1, $s3 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir1660 +c17: +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +lw $ra, 92($sp) +lw $s6, 88($sp) +lw $s5, 84($sp) +lw $s4, 80($sp) +lw $s3, 76($sp) +lw $s2, 72($sp) +lw $s1, 68($sp) +lw $s0, 64($sp) +delframe +jr $ra +comp_fir1660: +c27: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s6, $a0 +lw $a2, 0($a0) +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +sw $a2, 0($a0) +c26: +c25: +li $s0, 0 +comp_fir1649: +li $a1, 0 +c24: +li $a0, 16 +slt $a0, $s0, $a0 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir1643 +c19: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +call $v0 +c18: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s4, $a0 +sw $s2, 0($a0) +c28: +li $a0, 1 +add $s1, $s1, $a0 +j comp_fir1665 +comp_fir1643: +c22: +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +lw $a1, 0($a0) +li $a0, 4 +mulo $a0, $s0, $a0 +add $a0, $s5, $a0 +lw $a0, 0($a0) +mulo $a2, $a1, $a0 +li $a1, 2 +li $a0, 16 +xor $a0, $a1, $a0 +mulo $a0, $a2, $a0 +c21: +add $s2, $s2, $a0 +c20: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +call $v0 +c23: +li $a0, 1 +add $s0, $s0, $a0 +j comp_fir1649 + +procedure _main(0) +var 68 +main307: +newframe +sw $ra, 64($sp) +c165: +li $a1, 10 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c164: +li $a2, 9 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c163: +li $a2, 8 +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c162: +li $a2, 7 +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c161: +li $a2, 6 +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c160: +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c159: +li $a2, 5 +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c158: +li $a2, 4 +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c157: +li $a2, 3 +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c156: +li $a2, 2 +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c155: +move $a1, $sp +li $a0, 10 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c154: +move $a1, $sp +li $a0, 11 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c153: +move $a1, $sp +li $a0, 12 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c152: +move $a1, $sp +li $a0, 13 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c151: +move $a1, $sp +li $a0, 14 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c150: +move $a1, $sp +li $a0, 15 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c149: +move $a0, $sp +move $a1, $sp +move $a2, $sp +li $a3, 10 +li $t0, 10 +la $v0, comp_fir_basic +sw $t0, -4($sp) +call $v0 +c148: +move $a0, $sp +move $a1, $sp +move $a2, $sp +li $a3, 16 +la $v0, comp_fir16 +call $v0 +c147: +li $a0, 4 +li $a1, 1 +li $a2, 1 +la $v0, comp_ifFor +call $v0 +c146: +move $a0, $sp +li $a1, 9 +li $a2, 3 +la $v0, comp_total +call $v0 +c145: +move $a0, $sp +li $a1, 10 +la $v0, comp_tri +call $v0 +c144: +move $a0, $sp +move $a1, $sp +li $a2, 10 +li $a3, 10 +la $v0, comp_forif2 +call $v0 +c143: +la $v0, comp_forif +call $v0 +c142: +lw $ra, 64($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/complets.LTL.expected b/tests/clight/complets.LTL.expected new file mode 100644 index 0000000..65b43cd --- /dev/null +++ b/tests/clight/complets.LTL.expected @@ -0,0 +1,2284 @@ +program + +globals 0 + +procedure comp_tri(2) +var 0 +entry comp_tri123 +comp_tri123: newframe --> comp_tri122 +comp_tri122: j --> comp_tri121 +comp_tri121: j --> comp_tri120 +comp_tri120: j --> comp_tri119 +comp_tri119: j --> comp_tri118 +comp_tri118: j --> comp_tri117 +comp_tri117: j --> comp_tri116 +comp_tri116: j --> comp_tri115 +comp_tri115: j --> comp_tri114 +comp_tri114: j --> comp_tri113 +comp_tri113: j --> comp_tri112 +comp_tri112: j --> comp_tri111 +comp_tri111: j --> comp_tri110 +comp_tri110: j --> comp_tri109 +comp_tri109: j --> comp_tri108 +comp_tri108: j --> comp_tri107 +comp_tri107: j --> comp_tri106 +comp_tri106: j --> comp_tri105 +comp_tri105: j --> comp_tri104 +comp_tri104: j --> comp_tri103 +comp_tri103: j --> comp_tri102 +comp_tri102: j --> comp_tri101 +comp_tri101: j --> comp_tri100 +comp_tri100: j --> comp_tri99 +comp_tri99 : j --> comp_tri98 +comp_tri98 : j --> comp_tri97 +comp_tri97 : j --> comp_tri96 +comp_tri96 : j --> comp_tri95 +comp_tri95 : j --> comp_tri94 +comp_tri94 : j --> comp_tri93 +comp_tri93 : j --> comp_tri92 +comp_tri92 : j --> comp_tri91 +comp_tri91 : j --> comp_tri90 +comp_tri90 : j --> comp_tri89 +comp_tri89 : j --> comp_tri88 +comp_tri88 : j --> comp_tri87 +comp_tri87 : j --> comp_tri86 +comp_tri86 : j --> comp_tri85 +comp_tri85 : j --> comp_tri84 +comp_tri84 : j --> comp_tri83 +comp_tri83 : j --> comp_tri82 +comp_tri82 : j --> comp_tri81 +comp_tri81 : j --> comp_tri80 +comp_tri80 : j --> comp_tri79 +comp_tri79 : j --> comp_tri78 +comp_tri78 : j --> comp_tri77 +comp_tri77 : j --> comp_tri76 +comp_tri76 : j --> comp_tri75 +comp_tri75 : j --> comp_tri74 +comp_tri74 : j --> comp_tri73 +comp_tri73 : j --> comp_tri72 +comp_tri72 : j --> comp_tri71 +comp_tri71 : j --> comp_tri70 +comp_tri70 : j --> comp_tri69 +comp_tri69 : j --> comp_tri60 +comp_tri60 : emit c108 --> comp_tri59 +comp_tri59 : li $v0, 0 --> comp_tri58 +comp_tri58 : emit c107 --> comp_tri57 +comp_tri57 : emit c106 --> comp_tri56 +comp_tri56 : li $t1, 0 --> comp_tri3 +comp_tri3 : j --> comp_tri55 +comp_tri55 : li $a3, 0 --> comp_tri54 +comp_tri54 : emit c105 --> comp_tri53 +comp_tri53 : slt $a2, $t1, $a1 --> comp_tri52 +comp_tri52 : j --> comp_tri68 +comp_tri68 : seq $a2, $a2, $zero --> comp_tri51 +comp_tri51 : beq $a2, $a3 --> comp_tri50, comp_tri2 +comp_tri2 : emit c95 --> comp_tri1 +comp_tri1 : j --> comp_tri0 +comp_tri0 : j --> comp_tri135 +comp_tri135: j --> comp_tri134 +comp_tri134: j --> comp_tri133 +comp_tri133: j --> comp_tri132 +comp_tri132: j --> comp_tri131 +comp_tri131: j --> comp_tri130 +comp_tri130: j --> comp_tri129 +comp_tri129: j --> comp_tri128 +comp_tri128: j --> comp_tri127 +comp_tri127: j --> comp_tri126 +comp_tri126: j --> comp_tri125 +comp_tri125: delframe --> comp_tri124 +comp_tri124: jr $ra +comp_tri50 : emit c103 --> comp_tri49 +comp_tri49 : emit c102 --> comp_tri48 +comp_tri48 : li $t2, 1 --> comp_tri7 +comp_tri7 : j --> comp_tri47 +comp_tri47 : li $a3, 0 --> comp_tri46 +comp_tri46 : emit c101 --> comp_tri45 +comp_tri45 : sub $a2, $a1, $t1 --> comp_tri44 +comp_tri44 : slt $a2, $t2, $a2 --> comp_tri43 +comp_tri43 : j --> comp_tri67 +comp_tri67 : seq $a2, $a2, $zero --> comp_tri42 +comp_tri42 : beq $a2, $a3 --> comp_tri41, comp_tri6 +comp_tri6 : emit c104 --> comp_tri5 +comp_tri5 : li $a2, 1 --> comp_tri4 +comp_tri4 : add $t1, $t1, $a2 --> comp_tri3 +comp_tri41 : emit c99 --> comp_tri40 +comp_tri40 : j --> comp_tri39 +comp_tri39 : li $a2, 4 --> comp_tri38 +comp_tri38 : mulo $a2, $t2, $a2 --> comp_tri37 +comp_tri37 : add $a2, $a0, $a2 --> comp_tri66 +comp_tri66 : lw $t0, 0($a2) --> comp_tri36 +comp_tri36 : li $a2, 1 --> comp_tri35 +comp_tri35 : sub $a3, $t2, $a2 --> comp_tri34 +comp_tri34 : li $a2, 4 --> comp_tri33 +comp_tri33 : mulo $a2, $a3, $a2 --> comp_tri32 +comp_tri32 : add $a2, $a0, $a2 --> comp_tri65 +comp_tri65 : lw $a2, 0($a2) --> comp_tri31 +comp_tri31 : slt $a2, $t0, $a2 --> comp_tri30 +comp_tri30 : beq $a2, $zero --> comp_tri10, comp_tri29 +comp_tri29 : emit c98 --> comp_tri28 +comp_tri28 : li $v0, 1 --> comp_tri27 +comp_tri27 : sub $a2, $t2, $v0 --> comp_tri26 +comp_tri26 : li $v0, 4 --> comp_tri25 +comp_tri25 : mulo $v0, $a2, $v0 --> comp_tri24 +comp_tri24 : add $v0, $a0, $v0 --> comp_tri64 +comp_tri64 : lw $v0, 0($v0) --> comp_tri23 +comp_tri23 : emit c97 --> comp_tri22 +comp_tri22 : li $a2, 4 --> comp_tri21 +comp_tri21 : mulo $a2, $t2, $a2 --> comp_tri20 +comp_tri20 : add $a2, $a0, $a2 --> comp_tri63 +comp_tri63 : lw $t0, 0($a2) --> comp_tri19 +comp_tri19 : li $a2, 1 --> comp_tri18 +comp_tri18 : sub $a3, $t2, $a2 --> comp_tri17 +comp_tri17 : li $a2, 4 --> comp_tri16 +comp_tri16 : mulo $a2, $a3, $a2 --> comp_tri15 +comp_tri15 : add $a2, $a0, $a2 --> comp_tri62 +comp_tri62 : lw $t0, 0($a2) --> comp_tri14 +comp_tri14 : emit c96 --> comp_tri13 +comp_tri13 : li $a2, 4 --> comp_tri12 +comp_tri12 : mulo $a2, $t2, $a2 --> comp_tri11 +comp_tri11 : add $a2, $a0, $a2 --> comp_tri61 +comp_tri61 : lw $v0, 0($a2) --> comp_tri10 +comp_tri10 : emit c100 --> comp_tri9 +comp_tri9 : li $a2, 1 --> comp_tri8 +comp_tri8 : add $t2, $t2, $a2 --> comp_tri7 + +procedure comp_total(3) +var 80 +entry comp_total410 +comp_total410: newframe --> comp_total409 +comp_total409: j --> comp_total408 +comp_total408: j --> comp_total407 +comp_total407: j --> comp_total406 +comp_total406: j --> comp_total405 +comp_total405: j --> comp_total404 +comp_total404: j --> comp_total403 +comp_total403: j --> comp_total402 +comp_total402: j --> comp_total401 +comp_total401: j --> comp_total400 +comp_total400: j --> comp_total399 +comp_total399: j --> comp_total398 +comp_total398: j --> comp_total397 +comp_total397: j --> comp_total396 +comp_total396: j --> comp_total395 +comp_total395: j --> comp_total394 +comp_total394: j --> comp_total393 +comp_total393: j --> comp_total392 +comp_total392: j --> comp_total391 +comp_total391: j --> comp_total390 +comp_total390: j --> comp_total389 +comp_total389: j --> comp_total388 +comp_total388: j --> comp_total387 +comp_total387: j --> comp_total386 +comp_total386: j --> comp_total385 +comp_total385: j --> comp_total384 +comp_total384: j --> comp_total383 +comp_total383: j --> comp_total382 +comp_total382: j --> comp_total381 +comp_total381: j --> comp_total380 +comp_total380: j --> comp_total379 +comp_total379: j --> comp_total378 +comp_total378: j --> comp_total377 +comp_total377: j --> comp_total376 +comp_total376: j --> comp_total375 +comp_total375: j --> comp_total374 +comp_total374: j --> comp_total373 +comp_total373: j --> comp_total372 +comp_total372: j --> comp_total371 +comp_total371: j --> comp_total370 +comp_total370: j --> comp_total369 +comp_total369: j --> comp_total368 +comp_total368: j --> comp_total367 +comp_total367: j --> comp_total366 +comp_total366: j --> comp_total365 +comp_total365: j --> comp_total364 +comp_total364: j --> comp_total363 +comp_total363: j --> comp_total362 +comp_total362: j --> comp_total361 +comp_total361: j --> comp_total360 +comp_total360: j --> comp_total359 +comp_total359: j --> comp_total358 +comp_total358: j --> comp_total357 +comp_total357: j --> comp_total356 +comp_total356: j --> comp_total355 +comp_total355: j --> comp_total354 +comp_total354: j --> comp_total353 +comp_total353: j --> comp_total352 +comp_total352: j --> comp_total351 +comp_total351: j --> comp_total350 +comp_total350: j --> comp_total349 +comp_total349: j --> comp_total348 +comp_total348: j --> comp_total347 +comp_total347: j --> comp_total346 +comp_total346: j --> comp_total345 +comp_total345: j --> comp_total344 +comp_total344: j --> comp_total343 +comp_total343: j --> comp_total342 +comp_total342: j --> comp_total341 +comp_total341: j --> comp_total340 +comp_total340: j --> comp_total339 +comp_total339: j --> comp_total338 +comp_total338: j --> comp_total337 +comp_total337: j --> comp_total336 +comp_total336: j --> comp_total335 +comp_total335: j --> comp_total334 +comp_total334: j --> comp_total333 +comp_total333: j --> comp_total332 +comp_total332: j --> comp_total331 +comp_total331: j --> comp_total330 +comp_total330: j --> comp_total329 +comp_total329: j --> comp_total328 +comp_total328: j --> comp_total327 +comp_total327: j --> comp_total326 +comp_total326: j --> comp_total325 +comp_total325: j --> comp_total324 +comp_total324: j --> comp_total323 +comp_total323: j --> comp_total322 +comp_total322: j --> comp_total321 +comp_total321: j --> comp_total320 +comp_total320: j --> comp_total319 +comp_total319: j --> comp_total318 +comp_total318: j --> comp_total317 +comp_total317: j --> comp_total316 +comp_total316: j --> comp_total315 +comp_total315: j --> comp_total314 +comp_total314: j --> comp_total313 +comp_total313: j --> comp_total312 +comp_total312: j --> comp_total311 +comp_total311: j --> comp_total310 +comp_total310: j --> comp_total309 +comp_total309: j --> comp_total308 +comp_total308: j --> comp_total307 +comp_total307: j --> comp_total306 +comp_total306: j --> comp_total305 +comp_total305: j --> comp_total304 +comp_total304: j --> comp_total303 +comp_total303: j --> comp_total302 +comp_total302: j --> comp_total301 +comp_total301: j --> comp_total300 +comp_total300: j --> comp_total299 +comp_total299: j --> comp_total298 +comp_total298: j --> comp_total297 +comp_total297: j --> comp_total296 +comp_total296: j --> comp_total295 +comp_total295: j --> comp_total294 +comp_total294: j --> comp_total293 +comp_total293: j --> comp_total292 +comp_total292: j --> comp_total291 +comp_total291: j --> comp_total290 +comp_total290: j --> comp_total289 +comp_total289: j --> comp_total288 +comp_total288: j --> comp_total287 +comp_total287: j --> comp_total286 +comp_total286: j --> comp_total285 +comp_total285: j --> comp_total284 +comp_total284: j --> comp_total283 +comp_total283: j --> comp_total282 +comp_total282: j --> comp_total281 +comp_total281: j --> comp_total280 +comp_total280: j --> comp_total279 +comp_total279: j --> comp_total278 +comp_total278: j --> comp_total277 +comp_total277: j --> comp_total276 +comp_total276: j --> comp_total275 +comp_total275: j --> comp_total274 +comp_total274: j --> comp_total273 +comp_total273: j --> comp_total272 +comp_total272: j --> comp_total271 +comp_total271: j --> comp_total270 +comp_total270: j --> comp_total269 +comp_total269: j --> comp_total268 +comp_total268: j --> comp_total267 +comp_total267: j --> comp_total266 +comp_total266: j --> comp_total265 +comp_total265: j --> comp_total264 +comp_total264: j --> comp_total263 +comp_total263: j --> comp_total262 +comp_total262: j --> comp_total261 +comp_total261: j --> comp_total260 +comp_total260: j --> comp_total259 +comp_total259: j --> comp_total258 +comp_total258: j --> comp_total257 +comp_total257: j --> comp_total256 +comp_total256: j --> comp_total255 +comp_total255: j --> comp_total254 +comp_total254: j --> comp_total253 +comp_total253: j --> comp_total252 +comp_total252: j --> comp_total251 +comp_total251: j --> comp_total250 +comp_total250: j --> comp_total249 +comp_total249: j --> comp_total248 +comp_total248: j --> comp_total247 +comp_total247: j --> comp_total246 +comp_total246: j --> comp_total245 +comp_total245: j --> comp_total244 +comp_total244: j --> comp_total243 +comp_total243: j --> comp_total242 +comp_total242: j --> comp_total241 +comp_total241: j --> comp_total240 +comp_total240: j --> comp_total239 +comp_total239: j --> comp_total238 +comp_total238: j --> comp_total237 +comp_total237: j --> comp_total236 +comp_total236: j --> comp_total235 +comp_total235: j --> comp_total234 +comp_total234: j --> comp_total205 +comp_total205: emit c94 --> comp_total204 +comp_total204: li $t0, 0 --> comp_total203 +comp_total203: move $a3, $sp --> comp_total438 +comp_total438: j --> comp_total202 +comp_total202: j --> comp_total201 +comp_total201: li $v0, 4 --> comp_total200 +comp_total200: mulo $v0, $zero, $v0 --> comp_total199 +comp_total199: add $v0, $a3, $v0 --> comp_total223 +comp_total223: lw $t0, 0($v0) --> comp_total198 +comp_total198: emit c93 --> comp_total197 +comp_total197: j --> comp_total196 +comp_total196: move $t0, $sp --> comp_total437 +comp_total437: j --> comp_total195 +comp_total195: li $a3, 1 --> comp_total194 +comp_total194: li $v0, 4 --> comp_total193 +comp_total193: mulo $v0, $a3, $v0 --> comp_total192 +comp_total192: add $v0, $t0, $v0 --> comp_total222 +comp_total222: lw $zero, 0($v0) --> comp_total191 +comp_total191: emit c92 --> comp_total190 +comp_total190: j --> comp_total189 +comp_total189: move $t0, $sp --> comp_total436 +comp_total436: j --> comp_total188 +comp_total188: li $a3, 2 --> comp_total187 +comp_total187: li $v0, 4 --> comp_total186 +comp_total186: mulo $v0, $a3, $v0 --> comp_total185 +comp_total185: add $v0, $t0, $v0 --> comp_total220 +comp_total220: lw $zero, 0($v0) --> comp_total184 +comp_total184: emit c91 --> comp_total183 +comp_total183: j --> comp_total182 +comp_total182: move $t0, $sp --> comp_total435 +comp_total435: j --> comp_total181 +comp_total181: li $a3, 3 --> comp_total180 +comp_total180: li $v0, 4 --> comp_total179 +comp_total179: mulo $v0, $a3, $v0 --> comp_total178 +comp_total178: add $v0, $t0, $v0 --> comp_total219 +comp_total219: lw $zero, 0($v0) --> comp_total177 +comp_total177: emit c90 --> comp_total176 +comp_total176: j --> comp_total175 +comp_total175: move $t0, $sp --> comp_total433 +comp_total433: j --> comp_total174 +comp_total174: li $a3, 4 --> comp_total173 +comp_total173: li $v0, 4 --> comp_total172 +comp_total172: mulo $v0, $a3, $v0 --> comp_total171 +comp_total171: add $v0, $t0, $v0 --> comp_total218 +comp_total218: lw $zero, 0($v0) --> comp_total170 +comp_total170: emit c89 --> comp_total169 +comp_total169: j --> comp_total168 +comp_total168: move $t0, $sp --> comp_total432 +comp_total432: j --> comp_total167 +comp_total167: li $a3, 5 --> comp_total166 +comp_total166: li $v0, 4 --> comp_total165 +comp_total165: mulo $v0, $a3, $v0 --> comp_total164 +comp_total164: add $v0, $t0, $v0 --> comp_total217 +comp_total217: lw $zero, 0($v0) --> comp_total163 +comp_total163: emit c88 --> comp_total162 +comp_total162: j --> comp_total161 +comp_total161: move $t0, $sp --> comp_total431 +comp_total431: j --> comp_total160 +comp_total160: li $a3, 6 --> comp_total159 +comp_total159: li $v0, 4 --> comp_total158 +comp_total158: mulo $v0, $a3, $v0 --> comp_total157 +comp_total157: add $v0, $t0, $v0 --> comp_total216 +comp_total216: lw $zero, 0($v0) --> comp_total156 +comp_total156: emit c87 --> comp_total155 +comp_total155: j --> comp_total154 +comp_total154: move $t0, $sp --> comp_total430 +comp_total430: j --> comp_total153 +comp_total153: li $a3, 7 --> comp_total152 +comp_total152: li $v0, 4 --> comp_total151 +comp_total151: mulo $v0, $a3, $v0 --> comp_total150 +comp_total150: add $v0, $t0, $v0 --> comp_total215 +comp_total215: lw $zero, 0($v0) --> comp_total149 +comp_total149: emit c86 --> comp_total148 +comp_total148: j --> comp_total147 +comp_total147: move $t0, $sp --> comp_total429 +comp_total429: j --> comp_total146 +comp_total146: li $a3, 8 --> comp_total145 +comp_total145: li $v0, 4 --> comp_total144 +comp_total144: mulo $v0, $a3, $v0 --> comp_total143 +comp_total143: add $v0, $t0, $v0 --> comp_total213 +comp_total213: lw $zero, 0($v0) --> comp_total142 +comp_total142: emit c85 --> comp_total141 +comp_total141: j --> comp_total140 +comp_total140: move $t0, $sp --> comp_total428 +comp_total428: j --> comp_total139 +comp_total139: li $a3, 9 --> comp_total138 +comp_total138: li $v0, 4 --> comp_total137 +comp_total137: mulo $v0, $a3, $v0 --> comp_total136 +comp_total136: add $v0, $t0, $v0 --> comp_total212 +comp_total212: lw $zero, 0($v0) --> comp_total135 +comp_total135: emit c84 --> comp_total134 +comp_total134: li $t0, 0 --> comp_total133 +comp_total133: move $a3, $sp --> comp_total427 +comp_total427: addi $a3, $a3, 40 --> comp_total132 +comp_total132: j --> comp_total131 +comp_total131: li $v0, 4 --> comp_total130 +comp_total130: mulo $v0, $zero, $v0 --> comp_total129 +comp_total129: add $v0, $a3, $v0 --> comp_total211 +comp_total211: lw $t0, 0($v0) --> comp_total128 +comp_total128: emit c83 --> comp_total127 +comp_total127: j --> comp_total126 +comp_total126: move $t0, $sp --> comp_total426 +comp_total426: addi $t0, $t0, 40 --> comp_total125 +comp_total125: li $a3, 1 --> comp_total124 +comp_total124: li $v0, 4 --> comp_total123 +comp_total123: mulo $v0, $a3, $v0 --> comp_total122 +comp_total122: add $v0, $t0, $v0 --> comp_total210 +comp_total210: lw $zero, 0($v0) --> comp_total121 +comp_total121: emit c82 --> comp_total120 +comp_total120: j --> comp_total119 +comp_total119: move $t0, $sp --> comp_total425 +comp_total425: addi $t0, $t0, 40 --> comp_total118 +comp_total118: li $a3, 2 --> comp_total117 +comp_total117: li $v0, 4 --> comp_total116 +comp_total116: mulo $v0, $a3, $v0 --> comp_total115 +comp_total115: add $v0, $t0, $v0 --> comp_total209 +comp_total209: lw $zero, 0($v0) --> comp_total114 +comp_total114: emit c81 --> comp_total113 +comp_total113: j --> comp_total112 +comp_total112: move $t0, $sp --> comp_total424 +comp_total424: addi $t0, $t0, 40 --> comp_total111 +comp_total111: li $a3, 3 --> comp_total110 +comp_total110: li $v0, 4 --> comp_total109 +comp_total109: mulo $v0, $a3, $v0 --> comp_total108 +comp_total108: add $v0, $t0, $v0 --> comp_total207 +comp_total207: lw $zero, 0($v0) --> comp_total107 +comp_total107: emit c80 --> comp_total106 +comp_total106: j --> comp_total105 +comp_total105: move $t0, $sp --> comp_total423 +comp_total423: addi $t0, $t0, 40 --> comp_total104 +comp_total104: li $a3, 4 --> comp_total103 +comp_total103: li $v0, 4 --> comp_total102 +comp_total102: mulo $v0, $a3, $v0 --> comp_total101 +comp_total101: add $v0, $t0, $v0 --> comp_total206 +comp_total206: lw $zero, 0($v0) --> comp_total100 +comp_total100: emit c79 --> comp_total99 +comp_total99 : j --> comp_total98 +comp_total98 : move $t0, $sp --> comp_total445 +comp_total445: addi $t0, $t0, 40 --> comp_total97 +comp_total97 : li $a3, 5 --> comp_total96 +comp_total96 : li $v0, 4 --> comp_total95 +comp_total95 : mulo $v0, $a3, $v0 --> comp_total94 +comp_total94 : add $v0, $t0, $v0 --> comp_total233 +comp_total233: lw $zero, 0($v0) --> comp_total93 +comp_total93 : emit c78 --> comp_total92 +comp_total92 : j --> comp_total91 +comp_total91 : move $t0, $sp --> comp_total444 +comp_total444: addi $t0, $t0, 40 --> comp_total90 +comp_total90 : li $a3, 6 --> comp_total89 +comp_total89 : li $v0, 4 --> comp_total88 +comp_total88 : mulo $v0, $a3, $v0 --> comp_total87 +comp_total87 : add $v0, $t0, $v0 --> comp_total232 +comp_total232: lw $zero, 0($v0) --> comp_total86 +comp_total86 : emit c77 --> comp_total85 +comp_total85 : j --> comp_total84 +comp_total84 : move $t0, $sp --> comp_total443 +comp_total443: addi $t0, $t0, 40 --> comp_total83 +comp_total83 : li $a3, 7 --> comp_total82 +comp_total82 : li $v0, 4 --> comp_total81 +comp_total81 : mulo $v0, $a3, $v0 --> comp_total80 +comp_total80 : add $v0, $t0, $v0 --> comp_total231 +comp_total231: lw $zero, 0($v0) --> comp_total79 +comp_total79 : emit c76 --> comp_total78 +comp_total78 : j --> comp_total77 +comp_total77 : move $t0, $sp --> comp_total442 +comp_total442: addi $t0, $t0, 40 --> comp_total76 +comp_total76 : li $a3, 8 --> comp_total75 +comp_total75 : li $v0, 4 --> comp_total74 +comp_total74 : mulo $v0, $a3, $v0 --> comp_total73 +comp_total73 : add $v0, $t0, $v0 --> comp_total230 +comp_total230: lw $zero, 0($v0) --> comp_total72 +comp_total72 : emit c75 --> comp_total71 +comp_total71 : j --> comp_total70 +comp_total70 : move $t0, $sp --> comp_total441 +comp_total441: addi $t0, $t0, 40 --> comp_total69 +comp_total69 : li $a3, 9 --> comp_total68 +comp_total68 : li $v0, 4 --> comp_total67 +comp_total67 : mulo $v0, $a3, $v0 --> comp_total66 +comp_total66 : add $v0, $t0, $v0 --> comp_total229 +comp_total229: lw $zero, 0($v0) --> comp_total65 +comp_total65 : emit c74 --> comp_total64 +comp_total64 : j --> comp_total63 +comp_total63 : slt $v0, $a1, $a2 --> comp_total62 +comp_total62 : beq $v0, $zero --> comp_total40, comp_total61 +comp_total61 : emit c73 --> comp_total60 +comp_total60 : emit c72 --> comp_total59 +comp_total59 : li $t0, 0 --> comp_total41 +comp_total41 : j --> comp_total58 +comp_total58 : li $a2, 0 --> comp_total57 +comp_total57 : emit c71 --> comp_total56 +comp_total56 : sle $v0, $t0, $a1 --> comp_total55 +comp_total55 : j --> comp_total228 +comp_total228: seq $v0, $v0, $zero --> comp_total54 +comp_total54 : beq $v0, $a2 --> comp_total53, comp_total2 +comp_total2 : emit c59 --> comp_total1 +comp_total1 : li $v0, 0 --> comp_total0 +comp_total0 : j --> comp_total422 +comp_total422: j --> comp_total421 +comp_total421: j --> comp_total420 +comp_total420: j --> comp_total419 +comp_total419: j --> comp_total418 +comp_total418: j --> comp_total417 +comp_total417: j --> comp_total416 +comp_total416: j --> comp_total415 +comp_total415: j --> comp_total414 +comp_total414: j --> comp_total413 +comp_total413: j --> comp_total412 +comp_total412: delframe --> comp_total411 +comp_total411: jr $ra +comp_total53 : emit c69 --> comp_total52 +comp_total52 : sub $a2, $a1, $t0 --> comp_total51 +comp_total51 : li $v0, 4 --> comp_total50 +comp_total50 : mulo $v0, $a2, $v0 --> comp_total49 +comp_total49 : add $v0, $a0, $v0 --> comp_total227 +comp_total227: lw $a3, 0($v0) --> comp_total48 +comp_total48 : move $a2, $sp --> comp_total440 +comp_total440: j --> comp_total47 +comp_total47 : li $v0, 4 --> comp_total46 +comp_total46 : mulo $v0, $t0, $v0 --> comp_total45 +comp_total45 : add $v0, $a2, $v0 --> comp_total226 +comp_total226: lw $a3, 0($v0) --> comp_total44 +comp_total44 : emit c70 --> comp_total43 +comp_total43 : li $v0, 1 --> comp_total42 +comp_total42 : add $t0, $t0, $v0 --> comp_total41 +comp_total40 : emit c68 --> comp_total39 +comp_total39 : emit c67 --> comp_total38 +comp_total38 : li $t2, 0 --> comp_total3 +comp_total3 : j --> comp_total37 +comp_total37 : li $a3, 0 --> comp_total36 +comp_total36 : emit c66 --> comp_total35 +comp_total35 : slt $v0, $t2, $a1 --> comp_total34 +comp_total34 : j --> comp_total225 +comp_total225: seq $v0, $v0, $zero --> comp_total33 +comp_total33 : beq $v0, $a3 --> comp_total32, comp_total2 +comp_total32 : emit c64 --> comp_total31 +comp_total31 : emit c63 --> comp_total30 +comp_total30 : move $t1, $a2 --> comp_total7 +comp_total7 : j --> comp_total29 +comp_total29 : li $a3, 0 --> comp_total28 +comp_total28 : emit c62 --> comp_total27 +comp_total27 : j --> comp_total26 +comp_total26 : sgt $v0, $t1, $zero --> comp_total25 +comp_total25 : j --> comp_total224 +comp_total224: seq $v0, $v0, $zero --> comp_total24 +comp_total24 : beq $v0, $a3 --> comp_total23, comp_total6 +comp_total6 : emit c65 --> comp_total5 +comp_total5 : li $v0, 1 --> comp_total4 +comp_total4 : add $t2, $t2, $v0 --> comp_total3 +comp_total23 : emit c60 --> comp_total22 +comp_total22 : move $a3, $sp --> comp_total439 +comp_total439: j --> comp_total21 +comp_total21 : li $v0, 4 --> comp_total20 +comp_total20 : mulo $v0, $t2, $v0 --> comp_total19 +comp_total19 : add $v0, $a3, $v0 --> comp_total221 +comp_total221: lw $t0, 0($v0) --> comp_total18 +comp_total18 : move $a3, $sp --> comp_total434 +comp_total434: addi $a3, $a3, 40 --> comp_total17 +comp_total17 : li $v0, 4 --> comp_total16 +comp_total16 : mulo $v0, $t1, $v0 --> comp_total15 +comp_total15 : add $v0, $a3, $v0 --> comp_total214 +comp_total214: lw $v0, 0($v0) --> comp_total14 +comp_total14 : add $a3, $t0, $v0 --> comp_total13 +comp_total13 : li $v0, 4 --> comp_total12 +comp_total12 : mulo $v0, $t2, $v0 --> comp_total11 +comp_total11 : add $v0, $a0, $v0 --> comp_total208 +comp_total208: lw $a3, 0($v0) --> comp_total10 +comp_total10 : emit c61 --> comp_total9 +comp_total9 : li $v0, 1 --> comp_total8 +comp_total8 : sub $t1, $t1, $v0 --> comp_total7 + +procedure comp_ifFor(3) +var 0 +entry comp_ifFor45 +comp_ifFor45: newframe --> comp_ifFor44 +comp_ifFor44: j --> comp_ifFor43 +comp_ifFor43: j --> comp_ifFor42 +comp_ifFor42: j --> comp_ifFor41 +comp_ifFor41: j --> comp_ifFor40 +comp_ifFor40: j --> comp_ifFor39 +comp_ifFor39: j --> comp_ifFor38 +comp_ifFor38: j --> comp_ifFor37 +comp_ifFor37: j --> comp_ifFor36 +comp_ifFor36: j --> comp_ifFor35 +comp_ifFor35: j --> comp_ifFor34 +comp_ifFor34: j --> comp_ifFor33 +comp_ifFor33: j --> comp_ifFor32 +comp_ifFor32: j --> comp_ifFor31 +comp_ifFor31: j --> comp_ifFor30 +comp_ifFor30: j --> comp_ifFor29 +comp_ifFor29: j --> comp_ifFor28 +comp_ifFor28: j --> comp_ifFor27 +comp_ifFor27: j --> comp_ifFor26 +comp_ifFor26: j --> comp_ifFor25 +comp_ifFor25: j --> comp_ifFor23 +comp_ifFor23: emit c58 --> comp_ifFor22 +comp_ifFor22: li $v0, 0 --> comp_ifFor21 +comp_ifFor21: emit c57 --> comp_ifFor20 +comp_ifFor20: emit c56 --> comp_ifFor19 +comp_ifFor19: li $t0, 0 --> comp_ifFor3 +comp_ifFor3 : j --> comp_ifFor18 +comp_ifFor18: li $t1, 0 --> comp_ifFor17 +comp_ifFor17: emit c55 --> comp_ifFor16 +comp_ifFor16: slt $a3, $t0, $a0 --> comp_ifFor15 +comp_ifFor15: j --> comp_ifFor24 +comp_ifFor24: seq $a3, $a3, $zero --> comp_ifFor14 +comp_ifFor14: beq $a3, $t1 --> comp_ifFor13, comp_ifFor2 +comp_ifFor2 : emit c50 --> comp_ifFor1 +comp_ifFor1 : j --> comp_ifFor0 +comp_ifFor0 : j --> comp_ifFor57 +comp_ifFor57: j --> comp_ifFor56 +comp_ifFor56: j --> comp_ifFor55 +comp_ifFor55: j --> comp_ifFor54 +comp_ifFor54: j --> comp_ifFor53 +comp_ifFor53: j --> comp_ifFor52 +comp_ifFor52: j --> comp_ifFor51 +comp_ifFor51: j --> comp_ifFor50 +comp_ifFor50: j --> comp_ifFor49 +comp_ifFor49: j --> comp_ifFor48 +comp_ifFor48: j --> comp_ifFor47 +comp_ifFor47: delframe --> comp_ifFor46 +comp_ifFor46: jr $ra +comp_ifFor13: emit c53 --> comp_ifFor12 +comp_ifFor12: j --> comp_ifFor11 +comp_ifFor11: sne $a3, $t0, $a1 --> comp_ifFor10 +comp_ifFor10: beq $a3, $zero --> comp_ifFor7, comp_ifFor9 +comp_ifFor9 : emit c52 --> comp_ifFor8 +comp_ifFor8 : add $v0, $v0, $t0 --> comp_ifFor5 +comp_ifFor5 : emit c54 --> comp_ifFor4 +comp_ifFor4 : add $t0, $t0, $a2 --> comp_ifFor3 +comp_ifFor7 : emit c51 --> comp_ifFor6 +comp_ifFor6 : li $v0, 0 --> comp_ifFor5 + +procedure comp_forif2(4) +var 16 +entry comp_forif2153 +comp_forif2153: newframe --> comp_forif2152 +comp_forif2152: lw $ra, 12($sp) --> comp_forif2151 +comp_forif2151: j --> comp_forif2150 +comp_forif2150: j --> comp_forif2149 +comp_forif2149: j --> comp_forif2148 +comp_forif2148: j --> comp_forif2147 +comp_forif2147: j --> comp_forif2146 +comp_forif2146: lw $s2, 8($sp) --> comp_forif2145 +comp_forif2145: lw $s1, 4($sp) --> comp_forif2144 +comp_forif2144: lw $s0, 0($sp) --> comp_forif2143 +comp_forif2143: j --> comp_forif2142 +comp_forif2142: j --> comp_forif2141 +comp_forif2141: j --> comp_forif2140 +comp_forif2140: j --> comp_forif2139 +comp_forif2139: j --> comp_forif2138 +comp_forif2138: j --> comp_forif2137 +comp_forif2137: j --> comp_forif2136 +comp_forif2136: j --> comp_forif2135 +comp_forif2135: j --> comp_forif2134 +comp_forif2134: j --> comp_forif2133 +comp_forif2133: j --> comp_forif2132 +comp_forif2132: j --> comp_forif2131 +comp_forif2131: j --> comp_forif2130 +comp_forif2130: j --> comp_forif2129 +comp_forif2129: j --> comp_forif2128 +comp_forif2128: j --> comp_forif2127 +comp_forif2127: j --> comp_forif2126 +comp_forif2126: j --> comp_forif2125 +comp_forif2125: j --> comp_forif2124 +comp_forif2124: j --> comp_forif2123 +comp_forif2123: j --> comp_forif2122 +comp_forif2122: j --> comp_forif2121 +comp_forif2121: j --> comp_forif2120 +comp_forif2120: j --> comp_forif2119 +comp_forif2119: j --> comp_forif2118 +comp_forif2118: j --> comp_forif2117 +comp_forif2117: j --> comp_forif2116 +comp_forif2116: j --> comp_forif2115 +comp_forif2115: j --> comp_forif2114 +comp_forif2114: j --> comp_forif2113 +comp_forif2113: j --> comp_forif2112 +comp_forif2112: j --> comp_forif2111 +comp_forif2111: j --> comp_forif2110 +comp_forif2110: j --> comp_forif2109 +comp_forif2109: j --> comp_forif2108 +comp_forif2108: j --> comp_forif2107 +comp_forif2107: j --> comp_forif2106 +comp_forif2106: j --> comp_forif2105 +comp_forif2105: j --> comp_forif2104 +comp_forif2104: j --> comp_forif2103 +comp_forif2103: j --> comp_forif2102 +comp_forif2102: j --> comp_forif2101 +comp_forif2101: j --> comp_forif2100 +comp_forif2100: j --> comp_forif299 +comp_forif299 : j --> comp_forif298 +comp_forif298 : j --> comp_forif297 +comp_forif297 : j --> comp_forif296 +comp_forif296 : j --> comp_forif295 +comp_forif295 : j --> comp_forif294 +comp_forif294 : j --> comp_forif293 +comp_forif293 : j --> comp_forif292 +comp_forif292 : j --> comp_forif291 +comp_forif291 : j --> comp_forif282 +comp_forif282 : emit c130 --> comp_forif281 +comp_forif281 : li $s0, 0 --> comp_forif280 +comp_forif280 : emit c129 --> comp_forif279 +comp_forif279 : li $s1, 0 --> comp_forif278 +comp_forif278 : emit c128 --> comp_forif277 +comp_forif277 : emit c127 --> comp_forif276 +comp_forif276 : li $t0, 0 --> comp_forif262 +comp_forif262 : j --> comp_forif275 +comp_forif275 : li $t1, 0 --> comp_forif274 +comp_forif274 : emit c126 --> comp_forif273 +comp_forif273 : slt $v0, $t0, $a2 --> comp_forif272 +comp_forif272 : j --> comp_forif290 +comp_forif290 : seq $v0, $v0, $zero --> comp_forif271 +comp_forif271 : beq $v0, $t1 --> comp_forif270, comp_forif261 +comp_forif261 : emit c123 --> comp_forif260 +comp_forif260 : emit c122 --> comp_forif259 +comp_forif259 : li $a0, 0 --> comp_forif245 +comp_forif245 : j --> comp_forif258 +comp_forif258 : li $a2, 0 --> comp_forif257 +comp_forif257 : emit c121 --> comp_forif256 +comp_forif256 : slt $v0, $a0, $a3 --> comp_forif255 +comp_forif255 : j --> comp_forif288 +comp_forif288 : seq $v0, $v0, $zero --> comp_forif254 +comp_forif254 : beq $v0, $a2 --> comp_forif253, comp_forif244 +comp_forif244 : emit c118 --> comp_forif243 +comp_forif243 : li $s2, 0 --> comp_forif242 +comp_forif242 : j --> comp_forif241 +comp_forif241 : emit c117 --> comp_forif240 +comp_forif240 : li $a1, 2 --> comp_forif239 +comp_forif239 : la $v0, mod --> comp_forif286 +comp_forif286 : j --> comp_forif2181 +comp_forif2181: move $a0, $s0 --> comp_forif2180 +comp_forif2180: j --> comp_forif2179 +comp_forif2179: call $v0 --> comp_forif2178 +comp_forif2178: j --> comp_forif238 +comp_forif238 : li $a0, 0 --> comp_forif237 +comp_forif237 : seq $v0, $v0, $a0 --> comp_forif236 +comp_forif236 : beq $v0, $zero --> comp_forif226, comp_forif235 +comp_forif235 : j --> comp_forif234 +comp_forif234 : emit c116 --> comp_forif233 +comp_forif233 : li $a1, 2 --> comp_forif232 +comp_forif232 : la $v0, mod --> comp_forif285 +comp_forif285 : j --> comp_forif2177 +comp_forif2177: move $a0, $s1 --> comp_forif2176 +comp_forif2176: j --> comp_forif2175 +comp_forif2175: call $v0 --> comp_forif2174 +comp_forif2174: j --> comp_forif231 +comp_forif231 : li $a0, 0 --> comp_forif230 +comp_forif230 : seq $v0, $v0, $a0 --> comp_forif229 +comp_forif229 : beq $v0, $zero --> comp_forif227, comp_forif228 +comp_forif228 : li $v0, 1 --> comp_forif225 +comp_forif225 : beq $v0, $s2 --> comp_forif222, comp_forif224 +comp_forif224 : emit c115 --> comp_forif223 +comp_forif223 : j --> comp_forif22 +comp_forif22 : emit c109 --> comp_forif21 +comp_forif21 : li $v0, 0 --> comp_forif20 +comp_forif20 : j --> comp_forif2165 +comp_forif2165: j --> comp_forif2164 +comp_forif2164: lw $ra, 12($sp) --> comp_forif2163 +comp_forif2163: j --> comp_forif2162 +comp_forif2162: j --> comp_forif2161 +comp_forif2161: j --> comp_forif2160 +comp_forif2160: j --> comp_forif2159 +comp_forif2159: j --> comp_forif2158 +comp_forif2158: lw $s2, 8($sp) --> comp_forif2157 +comp_forif2157: lw $s1, 4($sp) --> comp_forif2156 +comp_forif2156: lw $s0, 0($sp) --> comp_forif2155 +comp_forif2155: delframe --> comp_forif2154 +comp_forif2154: jr $ra +comp_forif222 : emit c114 --> comp_forif221 +comp_forif221 : j --> comp_forif220 +comp_forif220 : li $a1, 2 --> comp_forif219 +comp_forif219 : la $v0, mod --> comp_forif284 +comp_forif284 : j --> comp_forif2173 +comp_forif2173: move $a0, $s0 --> comp_forif2172 +comp_forif2172: j --> comp_forif2171 +comp_forif2171: call $v0 --> comp_forif2170 +comp_forif2170: j --> comp_forif218 +comp_forif218 : li $a0, 0 --> comp_forif217 +comp_forif217 : seq $v0, $v0, $a0 --> comp_forif216 +comp_forif216 : beq $v0, $zero --> comp_forif213, comp_forif215 +comp_forif215 : emit c113 --> comp_forif214 +comp_forif214 : j --> comp_forif22 +comp_forif213 : emit c112 --> comp_forif212 +comp_forif212 : j --> comp_forif211 +comp_forif211 : li $a1, 2 --> comp_forif210 +comp_forif210 : la $v0, mod --> comp_forif283 +comp_forif283 : j --> comp_forif2169 +comp_forif2169: move $a0, $s1 --> comp_forif2168 +comp_forif2168: j --> comp_forif2167 +comp_forif2167: call $v0 --> comp_forif2166 +comp_forif2166: j --> comp_forif29 +comp_forif29 : li $a0, 0 --> comp_forif28 +comp_forif28 : seq $v0, $v0, $a0 --> comp_forif27 +comp_forif27 : beq $v0, $zero --> comp_forif24, comp_forif26 +comp_forif26 : emit c111 --> comp_forif25 +comp_forif25 : j --> comp_forif22 +comp_forif24 : emit c110 --> comp_forif23 +comp_forif23 : j --> comp_forif22 +comp_forif227 : li $v0, 0 --> comp_forif225 +comp_forif226 : li $v0, 0 --> comp_forif225 +comp_forif253 : emit c119 --> comp_forif252 +comp_forif252 : li $v0, 4 --> comp_forif251 +comp_forif251 : mulo $v0, $a0, $v0 --> comp_forif250 +comp_forif250 : add $v0, $a1, $v0 --> comp_forif287 +comp_forif287 : lw $v0, 0($v0) --> comp_forif249 +comp_forif249 : add $s1, $s1, $v0 --> comp_forif248 +comp_forif248 : emit c120 --> comp_forif247 +comp_forif247 : li $v0, 1 --> comp_forif246 +comp_forif246 : add $a0, $a0, $v0 --> comp_forif245 +comp_forif270 : emit c124 --> comp_forif269 +comp_forif269 : li $v0, 4 --> comp_forif268 +comp_forif268 : mulo $v0, $t0, $v0 --> comp_forif267 +comp_forif267 : add $v0, $a0, $v0 --> comp_forif289 +comp_forif289 : lw $v0, 0($v0) --> comp_forif266 +comp_forif266 : add $s0, $s0, $v0 --> comp_forif265 +comp_forif265 : emit c125 --> comp_forif264 +comp_forif264 : li $v0, 1 --> comp_forif263 +comp_forif263 : add $t0, $t0, $v0 --> comp_forif262 + +procedure comp_forif(0) +var 12 +entry comp_forif65 +comp_forif65: newframe --> comp_forif64 +comp_forif64: lw $ra, 8($sp) --> comp_forif63 +comp_forif63: j --> comp_forif62 +comp_forif62: j --> comp_forif61 +comp_forif61: j --> comp_forif60 +comp_forif60: j --> comp_forif59 +comp_forif59: j --> comp_forif58 +comp_forif58: j --> comp_forif57 +comp_forif57: lw $s1, 4($sp) --> comp_forif56 +comp_forif56: lw $s0, 0($sp) --> comp_forif55 +comp_forif55: j --> comp_forif54 +comp_forif54: j --> comp_forif53 +comp_forif53: j --> comp_forif52 +comp_forif52: j --> comp_forif51 +comp_forif51: j --> comp_forif50 +comp_forif50: j --> comp_forif49 +comp_forif49: j --> comp_forif48 +comp_forif48: j --> comp_forif47 +comp_forif47: j --> comp_forif46 +comp_forif46: j --> comp_forif45 +comp_forif45: j --> comp_forif44 +comp_forif44: j --> comp_forif43 +comp_forif43: j --> comp_forif42 +comp_forif42: j --> comp_forif41 +comp_forif41: j --> comp_forif40 +comp_forif40: j --> comp_forif39 +comp_forif39: j --> comp_forif38 +comp_forif38: j --> comp_forif35 +comp_forif35: emit c141 --> comp_forif34 +comp_forif34: li $s1, 0 --> comp_forif33 +comp_forif33: emit c140 --> comp_forif32 +comp_forif32: j --> comp_forif31 +comp_forif31: emit c139 --> comp_forif30 +comp_forif30: emit c138 --> comp_forif29 +comp_forif29: li $s0, 0 --> comp_forif3 +comp_forif3 : j --> comp_forif28 +comp_forif28: li $a0, 0 --> comp_forif27 +comp_forif27: emit c137 --> comp_forif26 +comp_forif26: li $v0, 10 --> comp_forif25 +comp_forif25: slt $v0, $s0, $v0 --> comp_forif24 +comp_forif24: j --> comp_forif37 +comp_forif37: seq $v0, $v0, $zero --> comp_forif23 +comp_forif23: beq $v0, $a0 --> comp_forif22, comp_forif2 +comp_forif2 : emit c131 --> comp_forif1 +comp_forif1 : j --> comp_forif0 +comp_forif0 : j --> comp_forif77 +comp_forif77: move $v0, $s1 --> comp_forif76 +comp_forif76: lw $ra, 8($sp) --> comp_forif75 +comp_forif75: j --> comp_forif74 +comp_forif74: j --> comp_forif73 +comp_forif73: j --> comp_forif72 +comp_forif72: j --> comp_forif71 +comp_forif71: j --> comp_forif70 +comp_forif70: j --> comp_forif69 +comp_forif69: lw $s1, 4($sp) --> comp_forif68 +comp_forif68: lw $s0, 0($sp) --> comp_forif67 +comp_forif67: delframe --> comp_forif66 +comp_forif66: jr $ra +comp_forif22: emit c135 --> comp_forif21 +comp_forif21: li $v0, 1 --> comp_forif20 +comp_forif20: add $s1, $s1, $v0 --> comp_forif19 +comp_forif19: emit c134 --> comp_forif18 +comp_forif18: li $v0, 1 --> comp_forif17 +comp_forif17: add $s1, $s1, $v0 --> comp_forif16 +comp_forif16: emit c133 --> comp_forif15 +comp_forif15: j --> comp_forif14 +comp_forif14: li $a1, 2 --> comp_forif13 +comp_forif13: la $v0, mod --> comp_forif36 +comp_forif36: j --> comp_forif81 +comp_forif81: move $a0, $s0 --> comp_forif80 +comp_forif80: j --> comp_forif79 +comp_forif79: call $v0 --> comp_forif78 +comp_forif78: j --> comp_forif12 +comp_forif12: li $a0, 0 --> comp_forif11 +comp_forif11: seq $v0, $v0, $a0 --> comp_forif10 +comp_forif10: beq $v0, $zero --> comp_forif6, comp_forif9 +comp_forif9 : emit c132 --> comp_forif8 +comp_forif8 : j --> comp_forif7 +comp_forif7 : j --> comp_forif6 +comp_forif6 : emit c136 --> comp_forif5 +comp_forif5 : li $v0, 1 --> comp_forif4 +comp_forif4 : add $s0, $s0, $v0 --> comp_forif3 + +procedure comp_fir_basic(5) +var 4 +entry comp_fir_basic141 +comp_fir_basic141: newframe --> comp_fir_basic140 +comp_fir_basic140: j --> comp_fir_basic139 +comp_fir_basic139: j --> comp_fir_basic138 +comp_fir_basic138: j --> comp_fir_basic137 +comp_fir_basic137: j --> comp_fir_basic136 +comp_fir_basic136: j --> comp_fir_basic135 +comp_fir_basic135: j --> comp_fir_basic134 +comp_fir_basic134: j --> comp_fir_basic133 +comp_fir_basic133: j --> comp_fir_basic132 +comp_fir_basic132: j --> comp_fir_basic131 +comp_fir_basic131: j --> comp_fir_basic130 +comp_fir_basic130: j --> comp_fir_basic129 +comp_fir_basic129: j --> comp_fir_basic128 +comp_fir_basic128: j --> comp_fir_basic127 +comp_fir_basic127: j --> comp_fir_basic126 +comp_fir_basic126: j --> comp_fir_basic125 +comp_fir_basic125: j --> comp_fir_basic124 +comp_fir_basic124: j --> comp_fir_basic123 +comp_fir_basic123: j --> comp_fir_basic122 +comp_fir_basic122: j --> comp_fir_basic121 +comp_fir_basic121: j --> comp_fir_basic120 +comp_fir_basic120: j --> comp_fir_basic119 +comp_fir_basic119: j --> comp_fir_basic118 +comp_fir_basic118: j --> comp_fir_basic117 +comp_fir_basic117: j --> comp_fir_basic116 +comp_fir_basic116: j --> comp_fir_basic115 +comp_fir_basic115: j --> comp_fir_basic114 +comp_fir_basic114: j --> comp_fir_basic113 +comp_fir_basic113: j --> comp_fir_basic112 +comp_fir_basic112: j --> comp_fir_basic111 +comp_fir_basic111: j --> comp_fir_basic110 +comp_fir_basic110: j --> comp_fir_basic109 +comp_fir_basic109: j --> comp_fir_basic108 +comp_fir_basic108: j --> comp_fir_basic107 +comp_fir_basic107: j --> comp_fir_basic106 +comp_fir_basic106: j --> comp_fir_basic105 +comp_fir_basic105: j --> comp_fir_basic104 +comp_fir_basic104: j --> comp_fir_basic103 +comp_fir_basic103: j --> comp_fir_basic102 +comp_fir_basic102: j --> comp_fir_basic101 +comp_fir_basic101: j --> comp_fir_basic100 +comp_fir_basic100: j --> comp_fir_basic99 +comp_fir_basic99 : j --> comp_fir_basic98 +comp_fir_basic98 : j --> comp_fir_basic97 +comp_fir_basic97 : j --> comp_fir_basic96 +comp_fir_basic96 : j --> comp_fir_basic95 +comp_fir_basic95 : j --> comp_fir_basic94 +comp_fir_basic94 : j --> comp_fir_basic93 +comp_fir_basic93 : j --> comp_fir_basic92 +comp_fir_basic92 : j --> comp_fir_basic91 +comp_fir_basic91 : j --> comp_fir_basic90 +comp_fir_basic90 : j --> comp_fir_basic89 +comp_fir_basic89 : j --> comp_fir_basic88 +comp_fir_basic88 : j --> comp_fir_basic87 +comp_fir_basic87 : j --> comp_fir_basic86 +comp_fir_basic86 : j --> comp_fir_basic85 +comp_fir_basic85 : j --> comp_fir_basic84 +comp_fir_basic84 : j --> comp_fir_basic83 +comp_fir_basic83 : j --> comp_fir_basic82 +comp_fir_basic82 : j --> comp_fir_basic81 +comp_fir_basic81 : j --> comp_fir_basic80 +comp_fir_basic80 : j --> comp_fir_basic79 +comp_fir_basic79 : j --> comp_fir_basic69 +comp_fir_basic69 : emit c16 --> comp_fir_basic68 +comp_fir_basic68 : li $v0, 0 --> comp_fir_basic67 +comp_fir_basic67 : emit c15 --> comp_fir_basic66 +comp_fir_basic66 : emit c14 --> comp_fir_basic65 +comp_fir_basic65 : li $t3, 0 --> comp_fir_basic3 +comp_fir_basic3 : j --> comp_fir_basic64 +comp_fir_basic64 : li $t0, 0 --> comp_fir_basic63 +comp_fir_basic63 : emit c13 --> comp_fir_basic62 +comp_fir_basic62 : li $a3, 3 --> comp_fir_basic61 +comp_fir_basic61 : slt $a3, $t3, $a3 --> comp_fir_basic60 +comp_fir_basic60 : j --> comp_fir_basic78 +comp_fir_basic78 : seq $a3, $a3, $zero --> comp_fir_basic59 +comp_fir_basic59 : beq $a3, $t0 --> comp_fir_basic58, comp_fir_basic2 +comp_fir_basic2 : emit c0 --> comp_fir_basic1 +comp_fir_basic1 : j --> comp_fir_basic0 +comp_fir_basic0 : j --> comp_fir_basic153 +comp_fir_basic153: j --> comp_fir_basic152 +comp_fir_basic152: j --> comp_fir_basic151 +comp_fir_basic151: j --> comp_fir_basic150 +comp_fir_basic150: j --> comp_fir_basic149 +comp_fir_basic149: j --> comp_fir_basic148 +comp_fir_basic148: j --> comp_fir_basic147 +comp_fir_basic147: j --> comp_fir_basic146 +comp_fir_basic146: j --> comp_fir_basic145 +comp_fir_basic145: j --> comp_fir_basic144 +comp_fir_basic144: j --> comp_fir_basic143 +comp_fir_basic143: delframe --> comp_fir_basic142 +comp_fir_basic142: jr $ra +comp_fir_basic58 : emit c11 --> comp_fir_basic57 +comp_fir_basic57 : li $a3, 4 --> comp_fir_basic56 +comp_fir_basic56 : mulo $a3, $t3, $a3 --> comp_fir_basic55 +comp_fir_basic55 : add $a3, $a0, $a3 --> comp_fir_basic77 +comp_fir_basic77 : lw $t0, 0($a3) --> comp_fir_basic54 +comp_fir_basic54 : j --> comp_fir_basic53 +comp_fir_basic53 : li $a3, 4 --> comp_fir_basic52 +comp_fir_basic52 : mulo $a3, $zero, $a3 --> comp_fir_basic51 +comp_fir_basic51 : add $a3, $a2, $a3 --> comp_fir_basic76 +comp_fir_basic76 : lw $t0, 0($a3) --> comp_fir_basic50 +comp_fir_basic50 : emit c10 --> comp_fir_basic49 +comp_fir_basic49 : emit c9 --> comp_fir_basic48 +comp_fir_basic48 : li $t0, 0 --> comp_fir_basic29 +comp_fir_basic29 : j --> comp_fir_basic47 +comp_fir_basic47 : li $t1, 0 --> comp_fir_basic46 +comp_fir_basic46 : emit c8 --> comp_fir_basic45 +comp_fir_basic45 : li $a3, 3 --> comp_fir_basic44 +comp_fir_basic44 : slt $a3, $t0, $a3 --> comp_fir_basic43 +comp_fir_basic43 : j --> comp_fir_basic75 +comp_fir_basic75 : seq $a3, $a3, $zero --> comp_fir_basic42 +comp_fir_basic42 : beq $a3, $t1 --> comp_fir_basic41, comp_fir_basic28 +comp_fir_basic28 : emit c5 --> comp_fir_basic27 +comp_fir_basic27 : emit c4 --> comp_fir_basic26 +comp_fir_basic26 : li $t2, 2 --> comp_fir_basic7 +comp_fir_basic7 : j --> comp_fir_basic25 +comp_fir_basic25 : li $t0, 0 --> comp_fir_basic24 +comp_fir_basic24 : emit c3 --> comp_fir_basic23 +comp_fir_basic23 : j --> comp_fir_basic22 +comp_fir_basic22 : sge $a3, $t2, $zero --> comp_fir_basic21 +comp_fir_basic21 : j --> comp_fir_basic72 +comp_fir_basic72 : seq $a3, $a3, $zero --> comp_fir_basic20 +comp_fir_basic20 : beq $a3, $t0 --> comp_fir_basic19, comp_fir_basic6 +comp_fir_basic6 : emit c12 --> comp_fir_basic5 +comp_fir_basic5 : li $a3, 1 --> comp_fir_basic4 +comp_fir_basic4 : add $t3, $t3, $a3 --> comp_fir_basic3 +comp_fir_basic19 : emit c1 --> comp_fir_basic18 +comp_fir_basic18 : li $a3, 4 --> comp_fir_basic17 +comp_fir_basic17 : mulo $a3, $t2, $a3 --> comp_fir_basic16 +comp_fir_basic16 : add $a3, $a2, $a3 --> comp_fir_basic71 +comp_fir_basic71 : lw $t1, 0($a3) --> comp_fir_basic15 +comp_fir_basic15 : li $a3, 1 --> comp_fir_basic14 +comp_fir_basic14 : add $t0, $t2, $a3 --> comp_fir_basic13 +comp_fir_basic13 : li $a3, 4 --> comp_fir_basic12 +comp_fir_basic12 : mulo $a3, $t0, $a3 --> comp_fir_basic11 +comp_fir_basic11 : add $a3, $a2, $a3 --> comp_fir_basic70 +comp_fir_basic70 : lw $t1, 0($a3) --> comp_fir_basic10 +comp_fir_basic10 : emit c2 --> comp_fir_basic9 +comp_fir_basic9 : li $a3, 1 --> comp_fir_basic8 +comp_fir_basic8 : sub $t2, $t2, $a3 --> comp_fir_basic7 +comp_fir_basic41 : emit c6 --> comp_fir_basic40 +comp_fir_basic40 : li $a3, 4 --> comp_fir_basic39 +comp_fir_basic39 : mulo $a3, $t0, $a3 --> comp_fir_basic38 +comp_fir_basic38 : add $a3, $a1, $a3 --> comp_fir_basic74 +comp_fir_basic74 : lw $t1, 0($a3) --> comp_fir_basic37 +comp_fir_basic37 : li $a3, 4 --> comp_fir_basic36 +comp_fir_basic36 : mulo $a3, $t0, $a3 --> comp_fir_basic35 +comp_fir_basic35 : add $a3, $a2, $a3 --> comp_fir_basic73 +comp_fir_basic73 : lw $a3, 0($a3) --> comp_fir_basic34 +comp_fir_basic34 : mulo $a3, $t1, $a3 --> comp_fir_basic33 +comp_fir_basic33 : add $v0, $v0, $a3 --> comp_fir_basic32 +comp_fir_basic32 : emit c7 --> comp_fir_basic31 +comp_fir_basic31 : li $a3, 1 --> comp_fir_basic30 +comp_fir_basic30 : add $t0, $t0, $a3 --> comp_fir_basic29 + +procedure comp_fir16(4) +var 96 +entry comp_fir16373 +comp_fir16373: newframe --> comp_fir16372 +comp_fir16372: lw $ra, 92($sp) --> comp_fir16371 +comp_fir16371: j --> comp_fir16370 +comp_fir16370: lw $s6, 88($sp) --> comp_fir16369 +comp_fir16369: lw $s5, 84($sp) --> comp_fir16368 +comp_fir16368: lw $s4, 80($sp) --> comp_fir16367 +comp_fir16367: lw $s3, 76($sp) --> comp_fir16366 +comp_fir16366: lw $s2, 72($sp) --> comp_fir16365 +comp_fir16365: lw $s1, 68($sp) --> comp_fir16364 +comp_fir16364: lw $s0, 64($sp) --> comp_fir16363 +comp_fir16363: move $s6, $a0 --> comp_fir16362 +comp_fir16362: move $s5, $a1 --> comp_fir16361 +comp_fir16361: move $s4, $a2 --> comp_fir16360 +comp_fir16360: move $s3, $a3 --> comp_fir16359 +comp_fir16359: j --> comp_fir16358 +comp_fir16358: j --> comp_fir16357 +comp_fir16357: j --> comp_fir16356 +comp_fir16356: j --> comp_fir16355 +comp_fir16355: j --> comp_fir16354 +comp_fir16354: j --> comp_fir16353 +comp_fir16353: j --> comp_fir16352 +comp_fir16352: j --> comp_fir16351 +comp_fir16351: j --> comp_fir16350 +comp_fir16350: j --> comp_fir16349 +comp_fir16349: j --> comp_fir16348 +comp_fir16348: j --> comp_fir16347 +comp_fir16347: j --> comp_fir16346 +comp_fir16346: j --> comp_fir16345 +comp_fir16345: j --> comp_fir16344 +comp_fir16344: j --> comp_fir16343 +comp_fir16343: j --> comp_fir16342 +comp_fir16342: j --> comp_fir16341 +comp_fir16341: j --> comp_fir16340 +comp_fir16340: j --> comp_fir16339 +comp_fir16339: j --> comp_fir16338 +comp_fir16338: j --> comp_fir16337 +comp_fir16337: j --> comp_fir16336 +comp_fir16336: j --> comp_fir16335 +comp_fir16335: j --> comp_fir16334 +comp_fir16334: j --> comp_fir16333 +comp_fir16333: j --> comp_fir16332 +comp_fir16332: j --> comp_fir16331 +comp_fir16331: j --> comp_fir16330 +comp_fir16330: j --> comp_fir16329 +comp_fir16329: j --> comp_fir16328 +comp_fir16328: j --> comp_fir16327 +comp_fir16327: j --> comp_fir16326 +comp_fir16326: j --> comp_fir16325 +comp_fir16325: j --> comp_fir16324 +comp_fir16324: j --> comp_fir16323 +comp_fir16323: j --> comp_fir16322 +comp_fir16322: j --> comp_fir16321 +comp_fir16321: j --> comp_fir16320 +comp_fir16320: j --> comp_fir16319 +comp_fir16319: j --> comp_fir16318 +comp_fir16318: j --> comp_fir16317 +comp_fir16317: j --> comp_fir16316 +comp_fir16316: j --> comp_fir16315 +comp_fir16315: j --> comp_fir16314 +comp_fir16314: j --> comp_fir16313 +comp_fir16313: j --> comp_fir16312 +comp_fir16312: j --> comp_fir16311 +comp_fir16311: j --> comp_fir16310 +comp_fir16310: j --> comp_fir16309 +comp_fir16309: j --> comp_fir16308 +comp_fir16308: j --> comp_fir16307 +comp_fir16307: j --> comp_fir16306 +comp_fir16306: j --> comp_fir16305 +comp_fir16305: j --> comp_fir16304 +comp_fir16304: j --> comp_fir16303 +comp_fir16303: j --> comp_fir16302 +comp_fir16302: j --> comp_fir16301 +comp_fir16301: j --> comp_fir16300 +comp_fir16300: j --> comp_fir16299 +comp_fir16299: j --> comp_fir16298 +comp_fir16298: j --> comp_fir16297 +comp_fir16297: j --> comp_fir16296 +comp_fir16296: j --> comp_fir16295 +comp_fir16295: j --> comp_fir16294 +comp_fir16294: j --> comp_fir16293 +comp_fir16293: j --> comp_fir16292 +comp_fir16292: j --> comp_fir16291 +comp_fir16291: j --> comp_fir16290 +comp_fir16290: j --> comp_fir16289 +comp_fir16289: j --> comp_fir16288 +comp_fir16288: j --> comp_fir16287 +comp_fir16287: j --> comp_fir16286 +comp_fir16286: j --> comp_fir16285 +comp_fir16285: j --> comp_fir16284 +comp_fir16284: j --> comp_fir16283 +comp_fir16283: j --> comp_fir16282 +comp_fir16282: j --> comp_fir16281 +comp_fir16281: j --> comp_fir16280 +comp_fir16280: j --> comp_fir16279 +comp_fir16279: j --> comp_fir16278 +comp_fir16278: j --> comp_fir16277 +comp_fir16277: j --> comp_fir16276 +comp_fir16276: j --> comp_fir16275 +comp_fir16275: j --> comp_fir16274 +comp_fir16274: j --> comp_fir16273 +comp_fir16273: j --> comp_fir16272 +comp_fir16272: j --> comp_fir16271 +comp_fir16271: j --> comp_fir16270 +comp_fir16270: j --> comp_fir16269 +comp_fir16269: j --> comp_fir16268 +comp_fir16268: j --> comp_fir16267 +comp_fir16267: j --> comp_fir16266 +comp_fir16266: j --> comp_fir16265 +comp_fir16265: j --> comp_fir16264 +comp_fir16264: j --> comp_fir16263 +comp_fir16263: j --> comp_fir16262 +comp_fir16262: j --> comp_fir16261 +comp_fir16261: j --> comp_fir16260 +comp_fir16260: j --> comp_fir16259 +comp_fir16259: j --> comp_fir16258 +comp_fir16258: j --> comp_fir16257 +comp_fir16257: j --> comp_fir16256 +comp_fir16256: j --> comp_fir16255 +comp_fir16255: j --> comp_fir16254 +comp_fir16254: j --> comp_fir16253 +comp_fir16253: j --> comp_fir16252 +comp_fir16252: j --> comp_fir16251 +comp_fir16251: j --> comp_fir16250 +comp_fir16250: j --> comp_fir16249 +comp_fir16249: j --> comp_fir16248 +comp_fir16248: j --> comp_fir16247 +comp_fir16247: j --> comp_fir16246 +comp_fir16246: j --> comp_fir16245 +comp_fir16245: j --> comp_fir16244 +comp_fir16244: j --> comp_fir16243 +comp_fir16243: j --> comp_fir16242 +comp_fir16242: j --> comp_fir16241 +comp_fir16241: j --> comp_fir16240 +comp_fir16240: j --> comp_fir16239 +comp_fir16239: j --> comp_fir16238 +comp_fir16238: j --> comp_fir16237 +comp_fir16237: j --> comp_fir16236 +comp_fir16236: j --> comp_fir16235 +comp_fir16235: j --> comp_fir16234 +comp_fir16234: j --> comp_fir16233 +comp_fir16233: j --> comp_fir16232 +comp_fir16232: j --> comp_fir16231 +comp_fir16231: j --> comp_fir16230 +comp_fir16230: j --> comp_fir16229 +comp_fir16229: j --> comp_fir16228 +comp_fir16228: j --> comp_fir16227 +comp_fir16227: j --> comp_fir16226 +comp_fir16226: j --> comp_fir16225 +comp_fir16225: j --> comp_fir16224 +comp_fir16224: j --> comp_fir16223 +comp_fir16223: j --> comp_fir16222 +comp_fir16222: j --> comp_fir16221 +comp_fir16221: j --> comp_fir16220 +comp_fir16220: j --> comp_fir16219 +comp_fir16219: j --> comp_fir16218 +comp_fir16218: j --> comp_fir16217 +comp_fir16217: j --> comp_fir16216 +comp_fir16216: j --> comp_fir16215 +comp_fir16215: j --> comp_fir16214 +comp_fir16214: j --> comp_fir16213 +comp_fir16213: j --> comp_fir16212 +comp_fir16212: j --> comp_fir16211 +comp_fir16211: j --> comp_fir16184 +comp_fir16184: emit c49 --> comp_fir16183 +comp_fir16183: li $a1, 0 --> comp_fir16182 +comp_fir16182: move $a0, $sp --> comp_fir16397 +comp_fir16397: j --> comp_fir16181 +comp_fir16181: j --> comp_fir16180 +comp_fir16180: li $v0, 4 --> comp_fir16179 +comp_fir16179: mulo $v0, $zero, $v0 --> comp_fir16178 +comp_fir16178: add $v0, $a0, $v0 --> comp_fir16199 +comp_fir16199: lw $a1, 0($v0) --> comp_fir16177 +comp_fir16177: emit c48 --> comp_fir16176 +comp_fir16176: j --> comp_fir16175 +comp_fir16175: move $a1, $sp --> comp_fir16396 +comp_fir16396: j --> comp_fir16174 +comp_fir16174: li $a0, 1 --> comp_fir16173 +comp_fir16173: li $v0, 4 --> comp_fir16172 +comp_fir16172: mulo $v0, $a0, $v0 --> comp_fir16171 +comp_fir16171: add $v0, $a1, $v0 --> comp_fir16198 +comp_fir16198: lw $zero, 0($v0) --> comp_fir16170 +comp_fir16170: emit c47 --> comp_fir16169 +comp_fir16169: j --> comp_fir16168 +comp_fir16168: move $a1, $sp --> comp_fir16395 +comp_fir16395: j --> comp_fir16167 +comp_fir16167: li $a0, 2 --> comp_fir16166 +comp_fir16166: li $v0, 4 --> comp_fir16165 +comp_fir16165: mulo $v0, $a0, $v0 --> comp_fir16164 +comp_fir16164: add $v0, $a1, $v0 --> comp_fir16197 +comp_fir16197: lw $zero, 0($v0) --> comp_fir16163 +comp_fir16163: emit c46 --> comp_fir16162 +comp_fir16162: j --> comp_fir16161 +comp_fir16161: move $a1, $sp --> comp_fir16394 +comp_fir16394: j --> comp_fir16160 +comp_fir16160: li $a0, 3 --> comp_fir16159 +comp_fir16159: li $v0, 4 --> comp_fir16158 +comp_fir16158: mulo $v0, $a0, $v0 --> comp_fir16157 +comp_fir16157: add $v0, $a1, $v0 --> comp_fir16196 +comp_fir16196: lw $zero, 0($v0) --> comp_fir16156 +comp_fir16156: emit c45 --> comp_fir16155 +comp_fir16155: j --> comp_fir16154 +comp_fir16154: move $a1, $sp --> comp_fir16393 +comp_fir16393: j --> comp_fir16153 +comp_fir16153: li $a0, 4 --> comp_fir16152 +comp_fir16152: li $v0, 4 --> comp_fir16151 +comp_fir16151: mulo $v0, $a0, $v0 --> comp_fir16150 +comp_fir16150: add $v0, $a1, $v0 --> comp_fir16195 +comp_fir16195: lw $zero, 0($v0) --> comp_fir16149 +comp_fir16149: emit c44 --> comp_fir16148 +comp_fir16148: j --> comp_fir16147 +comp_fir16147: move $a1, $sp --> comp_fir16392 +comp_fir16392: j --> comp_fir16146 +comp_fir16146: li $a0, 5 --> comp_fir16145 +comp_fir16145: li $v0, 4 --> comp_fir16144 +comp_fir16144: mulo $v0, $a0, $v0 --> comp_fir16143 +comp_fir16143: add $v0, $a1, $v0 --> comp_fir16193 +comp_fir16193: lw $zero, 0($v0) --> comp_fir16142 +comp_fir16142: emit c43 --> comp_fir16141 +comp_fir16141: j --> comp_fir16140 +comp_fir16140: move $a1, $sp --> comp_fir16391 +comp_fir16391: j --> comp_fir16139 +comp_fir16139: li $a0, 6 --> comp_fir16138 +comp_fir16138: li $v0, 4 --> comp_fir16137 +comp_fir16137: mulo $v0, $a0, $v0 --> comp_fir16136 +comp_fir16136: add $v0, $a1, $v0 --> comp_fir16192 +comp_fir16192: lw $zero, 0($v0) --> comp_fir16135 +comp_fir16135: emit c42 --> comp_fir16134 +comp_fir16134: j --> comp_fir16133 +comp_fir16133: move $a1, $sp --> comp_fir16390 +comp_fir16390: j --> comp_fir16132 +comp_fir16132: li $a0, 7 --> comp_fir16131 +comp_fir16131: li $v0, 4 --> comp_fir16130 +comp_fir16130: mulo $v0, $a0, $v0 --> comp_fir16129 +comp_fir16129: add $v0, $a1, $v0 --> comp_fir16191 +comp_fir16191: lw $zero, 0($v0) --> comp_fir16128 +comp_fir16128: emit c41 --> comp_fir16127 +comp_fir16127: j --> comp_fir16126 +comp_fir16126: move $a1, $sp --> comp_fir16389 +comp_fir16389: j --> comp_fir16125 +comp_fir16125: li $a0, 8 --> comp_fir16124 +comp_fir16124: li $v0, 4 --> comp_fir16123 +comp_fir16123: mulo $v0, $a0, $v0 --> comp_fir16122 +comp_fir16122: add $v0, $a1, $v0 --> comp_fir16190 +comp_fir16190: lw $zero, 0($v0) --> comp_fir16121 +comp_fir16121: emit c40 --> comp_fir16120 +comp_fir16120: j --> comp_fir16119 +comp_fir16119: move $a1, $sp --> comp_fir16388 +comp_fir16388: j --> comp_fir16118 +comp_fir16118: li $a0, 9 --> comp_fir16117 +comp_fir16117: li $v0, 4 --> comp_fir16116 +comp_fir16116: mulo $v0, $a0, $v0 --> comp_fir16115 +comp_fir16115: add $v0, $a1, $v0 --> comp_fir16189 +comp_fir16189: lw $zero, 0($v0) --> comp_fir16114 +comp_fir16114: emit c39 --> comp_fir16113 +comp_fir16113: j --> comp_fir16112 +comp_fir16112: move $a1, $sp --> comp_fir16387 +comp_fir16387: j --> comp_fir16111 +comp_fir16111: li $a0, 10 --> comp_fir16110 +comp_fir16110: li $v0, 4 --> comp_fir16109 +comp_fir16109: mulo $v0, $a0, $v0 --> comp_fir16108 +comp_fir16108: add $v0, $a1, $v0 --> comp_fir16187 +comp_fir16187: lw $zero, 0($v0) --> comp_fir16107 +comp_fir16107: emit c38 --> comp_fir16106 +comp_fir16106: j --> comp_fir16105 +comp_fir16105: move $a1, $sp --> comp_fir16386 +comp_fir16386: j --> comp_fir16104 +comp_fir16104: li $a0, 11 --> comp_fir16103 +comp_fir16103: li $v0, 4 --> comp_fir16102 +comp_fir16102: mulo $v0, $a0, $v0 --> comp_fir16101 +comp_fir16101: add $v0, $a1, $v0 --> comp_fir16186 +comp_fir16186: lw $zero, 0($v0) --> comp_fir16100 +comp_fir16100: emit c37 --> comp_fir1699 +comp_fir1699 : j --> comp_fir1698 +comp_fir1698 : move $a1, $sp --> comp_fir16412 +comp_fir16412: j --> comp_fir1697 +comp_fir1697 : li $a0, 12 --> comp_fir1696 +comp_fir1696 : li $v0, 4 --> comp_fir1695 +comp_fir1695 : mulo $v0, $a0, $v0 --> comp_fir1694 +comp_fir1694 : add $v0, $a1, $v0 --> comp_fir16210 +comp_fir16210: lw $zero, 0($v0) --> comp_fir1693 +comp_fir1693 : emit c36 --> comp_fir1692 +comp_fir1692 : j --> comp_fir1691 +comp_fir1691 : move $a1, $sp --> comp_fir16411 +comp_fir16411: j --> comp_fir1690 +comp_fir1690 : li $a0, 13 --> comp_fir1689 +comp_fir1689 : li $v0, 4 --> comp_fir1688 +comp_fir1688 : mulo $v0, $a0, $v0 --> comp_fir1687 +comp_fir1687 : add $v0, $a1, $v0 --> comp_fir16209 +comp_fir16209: lw $zero, 0($v0) --> comp_fir1686 +comp_fir1686 : emit c35 --> comp_fir1685 +comp_fir1685 : j --> comp_fir1684 +comp_fir1684 : move $a1, $sp --> comp_fir16410 +comp_fir16410: j --> comp_fir1683 +comp_fir1683 : li $a0, 14 --> comp_fir1682 +comp_fir1682 : li $v0, 4 --> comp_fir1681 +comp_fir1681 : mulo $v0, $a0, $v0 --> comp_fir1680 +comp_fir1680 : add $v0, $a1, $v0 --> comp_fir16208 +comp_fir16208: lw $zero, 0($v0) --> comp_fir1679 +comp_fir1679 : emit c34 --> comp_fir1678 +comp_fir1678 : j --> comp_fir1677 +comp_fir1677 : move $a1, $sp --> comp_fir16409 +comp_fir16409: j --> comp_fir1676 +comp_fir1676 : li $a0, 15 --> comp_fir1675 +comp_fir1675 : li $v0, 4 --> comp_fir1674 +comp_fir1674 : mulo $v0, $a0, $v0 --> comp_fir1673 +comp_fir1673 : add $v0, $a1, $v0 --> comp_fir16207 +comp_fir16207: lw $zero, 0($v0) --> comp_fir1672 +comp_fir1672 : emit c33 --> comp_fir1671 +comp_fir1671 : li $v0, 0 --> comp_fir1670 +comp_fir1670 : emit c32 --> comp_fir1669 +comp_fir1669 : li $s2, 0 --> comp_fir1668 +comp_fir1668 : emit c31 --> comp_fir1667 +comp_fir1667 : emit c30 --> comp_fir1666 +comp_fir1666 : li $s1, 0 --> comp_fir167 +comp_fir167 : j --> comp_fir1665 +comp_fir1665 : li $a1, 0 --> comp_fir1664 +comp_fir1664 : emit c29 --> comp_fir1663 +comp_fir1663 : slt $a0, $s1, $s3 --> comp_fir1662 +comp_fir1662 : j --> comp_fir16206 +comp_fir16206: seq $a0, $a0, $zero --> comp_fir1661 +comp_fir1661 : beq $a0, $a1 --> comp_fir1660, comp_fir166 +comp_fir166 : emit c17 --> comp_fir165 +comp_fir165 : j --> comp_fir16407 +comp_fir16407: j --> comp_fir164 +comp_fir164 : j --> comp_fir163 +comp_fir163 : li $v0, 4 --> comp_fir162 +comp_fir162 : mulo $v0, $zero, $v0 --> comp_fir161 +comp_fir161 : add $v0, $sp, $v0 --> comp_fir16185 +comp_fir16185: lw $v0, 0($v0) --> comp_fir160 +comp_fir160 : j --> comp_fir16385 +comp_fir16385: j --> comp_fir16384 +comp_fir16384: lw $ra, 92($sp) --> comp_fir16383 +comp_fir16383: j --> comp_fir16382 +comp_fir16382: lw $s6, 88($sp) --> comp_fir16381 +comp_fir16381: lw $s5, 84($sp) --> comp_fir16380 +comp_fir16380: lw $s4, 80($sp) --> comp_fir16379 +comp_fir16379: lw $s3, 76($sp) --> comp_fir16378 +comp_fir16378: lw $s2, 72($sp) --> comp_fir16377 +comp_fir16377: lw $s1, 68($sp) --> comp_fir16376 +comp_fir16376: lw $s0, 64($sp) --> comp_fir16375 +comp_fir16375: delframe --> comp_fir16374 +comp_fir16374: jr $ra +comp_fir1660 : emit c27 --> comp_fir1659 +comp_fir1659 : li $a0, 4 --> comp_fir1658 +comp_fir1658 : mulo $a0, $s1, $a0 --> comp_fir1657 +comp_fir1657 : add $a0, $s6, $a0 --> comp_fir16205 +comp_fir16205: lw $a2, 0($a0) --> comp_fir1656 +comp_fir1656 : move $a1, $sp --> comp_fir16408 +comp_fir16408: j --> comp_fir1655 +comp_fir1655 : li $a0, 4 --> comp_fir1654 +comp_fir1654 : mulo $a0, $v0, $a0 --> comp_fir1653 +comp_fir1653 : add $a0, $a1, $a0 --> comp_fir16204 +comp_fir16204: lw $a2, 0($a0) --> comp_fir1652 +comp_fir1652 : emit c26 --> comp_fir1651 +comp_fir1651 : emit c25 --> comp_fir1650 +comp_fir1650 : li $s0, 0 --> comp_fir1620 +comp_fir1620 : j --> comp_fir1649 +comp_fir1649 : li $a1, 0 --> comp_fir1648 +comp_fir1648 : emit c24 --> comp_fir1647 +comp_fir1647 : li $a0, 16 --> comp_fir1646 +comp_fir1646 : slt $a0, $s0, $a0 --> comp_fir1645 +comp_fir1645 : j --> comp_fir16203 +comp_fir16203: seq $a0, $a0, $zero --> comp_fir1644 +comp_fir1644 : beq $a0, $a1 --> comp_fir1643, comp_fir1619 +comp_fir1619 : emit c19 --> comp_fir1618 +comp_fir1618 : li $a0, 1 --> comp_fir1617 +comp_fir1617 : add $a0, $v0, $a0 --> comp_fir1616 +comp_fir1616 : li $a1, 16 --> comp_fir1615 +comp_fir1615 : la $v0, mod --> comp_fir16194 +comp_fir16194: j --> comp_fir16401 +comp_fir16401: j --> comp_fir16400 +comp_fir16400: j --> comp_fir16399 +comp_fir16399: call $v0 --> comp_fir16398 +comp_fir16398: j --> comp_fir1614 +comp_fir1614 : emit c18 --> comp_fir1613 +comp_fir1613 : li $a0, 4 --> comp_fir1612 +comp_fir1612 : mulo $a0, $s1, $a0 --> comp_fir1611 +comp_fir1611 : add $a0, $s4, $a0 --> comp_fir16188 +comp_fir16188: lw $s2, 0($a0) --> comp_fir1610 +comp_fir1610 : emit c28 --> comp_fir169 +comp_fir169 : li $a0, 1 --> comp_fir168 +comp_fir168 : add $s1, $s1, $a0 --> comp_fir167 +comp_fir1643 : emit c22 --> comp_fir1642 +comp_fir1642 : move $a1, $sp --> comp_fir16406 +comp_fir16406: j --> comp_fir1641 +comp_fir1641 : li $a0, 4 --> comp_fir1640 +comp_fir1640 : mulo $a0, $v0, $a0 --> comp_fir1639 +comp_fir1639 : add $a0, $a1, $a0 --> comp_fir16202 +comp_fir16202: lw $a1, 0($a0) --> comp_fir1638 +comp_fir1638 : li $a0, 4 --> comp_fir1637 +comp_fir1637 : mulo $a0, $s0, $a0 --> comp_fir1636 +comp_fir1636 : add $a0, $s5, $a0 --> comp_fir16201 +comp_fir16201: lw $a0, 0($a0) --> comp_fir1635 +comp_fir1635 : mulo $a2, $a1, $a0 --> comp_fir1634 +comp_fir1634 : li $a1, 2 --> comp_fir1633 +comp_fir1633 : li $a0, 16 --> comp_fir1632 +comp_fir1632 : xor $a0, $a1, $a0 --> comp_fir1631 +comp_fir1631 : mulo $a0, $a2, $a0 --> comp_fir1630 +comp_fir1630 : emit c21 --> comp_fir1629 +comp_fir1629 : add $s2, $s2, $a0 --> comp_fir1628 +comp_fir1628 : emit c20 --> comp_fir1627 +comp_fir1627 : li $a0, 1 --> comp_fir1626 +comp_fir1626 : add $a0, $v0, $a0 --> comp_fir1625 +comp_fir1625 : li $a1, 16 --> comp_fir1624 +comp_fir1624 : la $v0, mod --> comp_fir16200 +comp_fir16200: j --> comp_fir16405 +comp_fir16405: j --> comp_fir16404 +comp_fir16404: j --> comp_fir16403 +comp_fir16403: call $v0 --> comp_fir16402 +comp_fir16402: j --> comp_fir1623 +comp_fir1623 : emit c23 --> comp_fir1622 +comp_fir1622 : li $a0, 1 --> comp_fir1621 +comp_fir1621 : add $s0, $s0, $a0 --> comp_fir1620 + +procedure _main(0) +var 68 +entry main307 +main307: newframe --> main306 +main306: lw $ra, 64($sp) --> main305 +main305: j --> main304 +main304: j --> main303 +main303: j --> main302 +main302: j --> main301 +main301: j --> main300 +main300: j --> main299 +main299: j --> main298 +main298: j --> main297 +main297: j --> main296 +main296: j --> main295 +main295: j --> main294 +main294: j --> main293 +main293: j --> main292 +main292: j --> main291 +main291: j --> main290 +main290: j --> main289 +main289: j --> main288 +main288: j --> main287 +main287: j --> main286 +main286: j --> main285 +main285: j --> main284 +main284: j --> main283 +main283: j --> main282 +main282: j --> main281 +main281: j --> main280 +main280: j --> main279 +main279: j --> main278 +main278: j --> main277 +main277: j --> main276 +main276: j --> main275 +main275: j --> main274 +main274: j --> main273 +main273: j --> main272 +main272: j --> main271 +main271: j --> main270 +main270: j --> main269 +main269: j --> main268 +main268: j --> main267 +main267: j --> main266 +main266: j --> main265 +main265: j --> main264 +main264: j --> main263 +main263: j --> main262 +main262: j --> main261 +main261: j --> main260 +main260: j --> main259 +main259: j --> main258 +main258: j --> main257 +main257: j --> main256 +main256: j --> main255 +main255: j --> main254 +main254: j --> main253 +main253: j --> main252 +main252: j --> main251 +main251: j --> main250 +main250: j --> main249 +main249: j --> main248 +main248: j --> main247 +main247: j --> main246 +main246: j --> main245 +main245: j --> main244 +main244: j --> main243 +main243: j --> main242 +main242: j --> main241 +main241: j --> main240 +main240: j --> main239 +main239: j --> main238 +main238: j --> main237 +main237: j --> main236 +main236: j --> main235 +main235: j --> main234 +main234: j --> main233 +main233: j --> main232 +main232: j --> main231 +main231: j --> main230 +main230: j --> main229 +main229: j --> main228 +main228: j --> main227 +main227: j --> main226 +main226: j --> main225 +main225: j --> main224 +main224: j --> main223 +main223: j --> main222 +main222: j --> main221 +main221: j --> main220 +main220: j --> main219 +main219: j --> main218 +main218: j --> main217 +main217: j --> main216 +main216: j --> main215 +main215: j --> main214 +main214: j --> main213 +main213: j --> main212 +main212: j --> main211 +main211: j --> main210 +main210: j --> main209 +main209: j --> main208 +main208: j --> main207 +main207: j --> main206 +main206: j --> main205 +main205: j --> main204 +main204: j --> main203 +main203: j --> main202 +main202: j --> main201 +main201: j --> main200 +main200: j --> main199 +main199: j --> main198 +main198: j --> main197 +main197: j --> main196 +main196: j --> main195 +main195: j --> main194 +main194: j --> main193 +main193: j --> main192 +main192: j --> main191 +main191: j --> main190 +main190: j --> main189 +main189: j --> main188 +main188: j --> main187 +main187: j --> main186 +main186: j --> main185 +main185: j --> main184 +main184: j --> main183 +main183: j --> main182 +main182: j --> main181 +main181: j --> main180 +main180: j --> main179 +main179: j --> main178 +main178: j --> main177 +main177: j --> main176 +main176: j --> main175 +main175: j --> main174 +main174: j --> main173 +main173: j --> main149 +main149: emit c165 --> main148 +main148: li $a1, 10 --> main147 +main147: move $a0, $sp --> main327 +main327: j --> main146 +main146: j --> main145 +main145: li $v0, 4 --> main144 +main144: mulo $v0, $zero, $v0 --> main143 +main143: add $v0, $a0, $v0 --> main157 +main157: lw $a1, 0($v0) --> main142 +main142: emit c164 --> main141 +main141: li $a2, 9 --> main140 +main140: move $a1, $sp --> main326 +main326: j --> main139 +main139: li $a0, 1 --> main138 +main138: li $v0, 4 --> main137 +main137: mulo $v0, $a0, $v0 --> main136 +main136: add $v0, $a1, $v0 --> main156 +main156: lw $a2, 0($v0) --> main135 +main135: emit c163 --> main134 +main134: li $a2, 8 --> main133 +main133: move $a1, $sp --> main325 +main325: j --> main132 +main132: li $a0, 2 --> main131 +main131: li $v0, 4 --> main130 +main130: mulo $v0, $a0, $v0 --> main129 +main129: add $v0, $a1, $v0 --> main155 +main155: lw $a2, 0($v0) --> main128 +main128: emit c162 --> main127 +main127: li $a2, 7 --> main126 +main126: move $a1, $sp --> main323 +main323: j --> main125 +main125: li $a0, 3 --> main124 +main124: li $v0, 4 --> main123 +main123: mulo $v0, $a0, $v0 --> main122 +main122: add $v0, $a1, $v0 --> main154 +main154: lw $a2, 0($v0) --> main121 +main121: emit c161 --> main120 +main120: li $a2, 6 --> main119 +main119: move $a1, $sp --> main322 +main322: j --> main118 +main118: li $a0, 4 --> main117 +main117: li $v0, 4 --> main116 +main116: mulo $v0, $a0, $v0 --> main115 +main115: add $v0, $a1, $v0 --> main153 +main153: lw $a2, 0($v0) --> main114 +main114: emit c160 --> main113 +main113: j --> main112 +main112: move $a1, $sp --> main321 +main321: j --> main111 +main111: li $a0, 5 --> main110 +main110: li $v0, 4 --> main109 +main109: mulo $v0, $a0, $v0 --> main108 +main108: add $v0, $a1, $v0 --> main151 +main151: lw $zero, 0($v0) --> main107 +main107: emit c159 --> main106 +main106: li $a2, 5 --> main105 +main105: move $a1, $sp --> main320 +main320: j --> main104 +main104: li $a0, 6 --> main103 +main103: li $v0, 4 --> main102 +main102: mulo $v0, $a0, $v0 --> main101 +main101: add $v0, $a1, $v0 --> main150 +main150: lw $a2, 0($v0) --> main100 +main100: emit c158 --> main99 +main99 : li $a2, 4 --> main98 +main98 : move $a1, $sp --> main380 +main380: j --> main97 +main97 : li $a0, 7 --> main96 +main96 : li $v0, 4 --> main95 +main95 : mulo $v0, $a0, $v0 --> main94 +main94 : add $v0, $a1, $v0 --> main172 +main172: lw $a2, 0($v0) --> main93 +main93 : emit c157 --> main92 +main92 : li $a2, 3 --> main91 +main91 : move $a1, $sp --> main379 +main379: j --> main90 +main90 : li $a0, 8 --> main89 +main89 : li $v0, 4 --> main88 +main88 : mulo $v0, $a0, $v0 --> main87 +main87 : add $v0, $a1, $v0 --> main171 +main171: lw $a2, 0($v0) --> main86 +main86 : emit c156 --> main85 +main85 : li $a2, 2 --> main84 +main84 : move $a1, $sp --> main377 +main377: j --> main83 +main83 : li $a0, 9 --> main82 +main82 : li $v0, 4 --> main81 +main81 : mulo $v0, $a0, $v0 --> main80 +main80 : add $v0, $a1, $v0 --> main170 +main170: lw $a2, 0($v0) --> main79 +main79 : emit c155 --> main78 +main78 : j --> main77 +main77 : move $a1, $sp --> main375 +main375: j --> main76 +main76 : li $a0, 10 --> main75 +main75 : li $v0, 4 --> main74 +main74 : mulo $v0, $a0, $v0 --> main73 +main73 : add $v0, $a1, $v0 --> main169 +main169: lw $zero, 0($v0) --> main72 +main72 : emit c154 --> main71 +main71 : j --> main70 +main70 : move $a1, $sp --> main374 +main374: j --> main69 +main69 : li $a0, 11 --> main68 +main68 : li $v0, 4 --> main67 +main67 : mulo $v0, $a0, $v0 --> main66 +main66 : add $v0, $a1, $v0 --> main168 +main168: lw $zero, 0($v0) --> main65 +main65 : emit c153 --> main64 +main64 : j --> main63 +main63 : move $a1, $sp --> main373 +main373: j --> main62 +main62 : li $a0, 12 --> main61 +main61 : li $v0, 4 --> main60 +main60 : mulo $v0, $a0, $v0 --> main59 +main59 : add $v0, $a1, $v0 --> main167 +main167: lw $zero, 0($v0) --> main58 +main58 : emit c152 --> main57 +main57 : j --> main56 +main56 : move $a1, $sp --> main372 +main372: j --> main55 +main55 : li $a0, 13 --> main54 +main54 : li $v0, 4 --> main53 +main53 : mulo $v0, $a0, $v0 --> main52 +main52 : add $v0, $a1, $v0 --> main166 +main166: lw $zero, 0($v0) --> main51 +main51 : emit c151 --> main50 +main50 : j --> main49 +main49 : move $a1, $sp --> main371 +main371: j --> main48 +main48 : li $a0, 14 --> main47 +main47 : li $v0, 4 --> main46 +main46 : mulo $v0, $a0, $v0 --> main45 +main45 : add $v0, $a1, $v0 --> main164 +main164: lw $zero, 0($v0) --> main44 +main44 : emit c150 --> main43 +main43 : j --> main42 +main42 : move $a1, $sp --> main370 +main370: j --> main41 +main41 : li $a0, 15 --> main40 +main40 : li $v0, 4 --> main39 +main39 : mulo $v0, $a0, $v0 --> main38 +main38 : add $v0, $a1, $v0 --> main163 +main163: lw $zero, 0($v0) --> main37 +main37 : emit c149 --> main36 +main36 : move $a0, $sp --> main369 +main369: j --> main35 +main35 : move $a1, $sp --> main368 +main368: j --> main34 +main34 : move $a2, $sp --> main367 +main367: j --> main33 +main33 : li $a3, 10 --> main32 +main32 : li $t0, 10 --> main31 +main31 : la $v0, comp_fir_basic --> main162 +main162: j --> main356 +main356: j --> main355 +main355: j --> main354 +main354: j --> main353 +main353: j --> main352 +main352: lw $t0, -4($sp) --> main351 +main351: call $v0 --> main350 +main350: j --> main30 +main30 : emit c148 --> main29 +main29 : move $a0, $sp --> main366 +main366: j --> main28 +main28 : move $a1, $sp --> main365 +main365: j --> main27 +main27 : move $a2, $sp --> main364 +main364: j --> main26 +main26 : li $a3, 16 --> main25 +main25 : la $v0, comp_fir16 --> main160 +main160: j --> main347 +main347: j --> main346 +main346: j --> main345 +main345: j --> main344 +main344: j --> main343 +main343: call $v0 --> main342 +main342: j --> main24 +main24 : emit c147 --> main23 +main23 : li $a0, 4 --> main22 +main22 : li $a1, 1 --> main21 +main21 : li $a2, 1 --> main20 +main20 : la $v0, comp_ifFor --> main159 +main159: j --> main341 +main341: j --> main340 +main340: j --> main339 +main339: j --> main338 +main338: call $v0 --> main337 +main337: j --> main19 +main19 : emit c146 --> main18 +main18 : move $a0, $sp --> main363 +main363: j --> main17 +main17 : li $a1, 9 --> main16 +main16 : li $a2, 3 --> main15 +main15 : la $v0, comp_total --> main158 +main158: j --> main336 +main336: j --> main335 +main335: j --> main334 +main334: j --> main333 +main333: call $v0 --> main332 +main332: j --> main14 +main14 : emit c145 --> main13 +main13 : move $a0, $sp --> main324 +main324: j --> main12 +main12 : li $a1, 10 --> main11 +main11 : la $v0, comp_tri --> main152 +main152: j --> main331 +main331: j --> main330 +main330: j --> main329 +main329: call $v0 --> main328 +main328: j --> main10 +main10 : emit c144 --> main9 +main9 : move $a0, $sp --> main378 +main378: j --> main8 +main8 : move $a1, $sp --> main376 +main376: j --> main7 +main7 : li $a2, 10 --> main6 +main6 : li $a3, 10 --> main5 +main5 : la $v0, comp_forif2 --> main165 +main165: j --> main362 +main362: j --> main361 +main361: j --> main360 +main360: j --> main359 +main359: j --> main358 +main358: call $v0 --> main357 +main357: j --> main4 +main4 : emit c143 --> main3 +main3 : la $v0, comp_forif --> main161 +main161: j --> main349 +main349: call $v0 --> main348 +main348: j --> main2 +main2 : emit c142 --> main1 +main1 : j --> main0 +main0 : j --> main319 +main319: j --> main318 +main318: lw $ra, 64($sp) --> main317 +main317: j --> main316 +main316: j --> main315 +main315: j --> main314 +main314: j --> main313 +main313: j --> main312 +main312: j --> main311 +main311: j --> main310 +main310: j --> main309 +main309: delframe --> main308 +main308: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/complets.RTL.expected b/tests/clight/complets.RTL.expected new file mode 100644 index 0000000..1c3f3e7 --- /dev/null +++ b/tests/clight/complets.RTL.expected @@ -0,0 +1,2048 @@ +program + +globals 0 + +function comp_tri(%0; %1) : %5 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45 +entry comp_tri111 +comp_tri111: li %2, 0 --> comp_tri110 +comp_tri110: li %3, 0 --> comp_tri109 +comp_tri109: li %4, 0 --> comp_tri108 +comp_tri108: li %6, 0 --> comp_tri107 +comp_tri107: li %7, 0 --> comp_tri106 +comp_tri106: li %8, 0 --> comp_tri105 +comp_tri105: li %9, 0 --> comp_tri104 +comp_tri104: li %10, 0 --> comp_tri103 +comp_tri103: li %11, 0 --> comp_tri102 +comp_tri102: li %12, 0 --> comp_tri101 +comp_tri101: li %13, 0 --> comp_tri100 +comp_tri100: li %14, 0 --> comp_tri99 +comp_tri99 : li %15, 0 --> comp_tri98 +comp_tri98 : li %16, 0 --> comp_tri97 +comp_tri97 : li %17, 0 --> comp_tri96 +comp_tri96 : li %18, 0 --> comp_tri95 +comp_tri95 : li %19, 0 --> comp_tri94 +comp_tri94 : li %20, 0 --> comp_tri93 +comp_tri93 : li %21, 0 --> comp_tri92 +comp_tri92 : li %22, 0 --> comp_tri91 +comp_tri91 : li %23, 0 --> comp_tri90 +comp_tri90 : li %24, 0 --> comp_tri89 +comp_tri89 : li %25, 0 --> comp_tri88 +comp_tri88 : li %26, 0 --> comp_tri87 +comp_tri87 : li %27, 0 --> comp_tri86 +comp_tri86 : li %28, 0 --> comp_tri85 +comp_tri85 : li %29, 0 --> comp_tri84 +comp_tri84 : li %30, 0 --> comp_tri83 +comp_tri83 : li %31, 0 --> comp_tri82 +comp_tri82 : li %32, 0 --> comp_tri81 +comp_tri81 : li %33, 0 --> comp_tri80 +comp_tri80 : li %34, 0 --> comp_tri79 +comp_tri79 : li %35, 0 --> comp_tri78 +comp_tri78 : li %36, 0 --> comp_tri77 +comp_tri77 : li %37, 0 --> comp_tri76 +comp_tri76 : li %38, 0 --> comp_tri75 +comp_tri75 : li %39, 0 --> comp_tri74 +comp_tri74 : li %40, 0 --> comp_tri73 +comp_tri73 : li %41, 0 --> comp_tri72 +comp_tri72 : li %42, 0 --> comp_tri71 +comp_tri71 : li %43, 0 --> comp_tri70 +comp_tri70 : li %44, 0 --> comp_tri69 +comp_tri69 : li %45, 0 --> comp_tri60 +comp_tri60 : emit c108 --> comp_tri59 +comp_tri59 : li %2, 0 --> comp_tri58 +comp_tri58 : emit c107 --> comp_tri57 +comp_tri57 : emit c106 --> comp_tri56 +comp_tri56 : li %4, 0 --> comp_tri3 +comp_tri3 : j --> comp_tri55 +comp_tri55 : li %36, 0 --> comp_tri54 +comp_tri54 : emit c105 --> comp_tri53 +comp_tri53 : slt %37, %4, %1 --> comp_tri52 +comp_tri52 : li %45, 0 --> comp_tri68 +comp_tri68 : seq %35, %37, %45 --> comp_tri51 +comp_tri51 : beq %35, %36 --> comp_tri50, comp_tri2 +comp_tri2 : emit c95 --> comp_tri1 +comp_tri1 : move %5, %2 --> comp_tri0 +comp_tri0 : return %5 +comp_tri50 : emit c103 --> comp_tri49 +comp_tri49 : emit c102 --> comp_tri48 +comp_tri48 : li %3, 1 --> comp_tri7 +comp_tri7 : j --> comp_tri47 +comp_tri47 : li %32, 0 --> comp_tri46 +comp_tri46 : emit c101 --> comp_tri45 +comp_tri45 : sub %34, %1, %4 --> comp_tri44 +comp_tri44 : slt %33, %3, %34 --> comp_tri43 +comp_tri43 : li %44, 0 --> comp_tri67 +comp_tri67 : seq %31, %33, %44 --> comp_tri42 +comp_tri42 : beq %31, %32 --> comp_tri41, comp_tri6 +comp_tri6 : emit c104 --> comp_tri5 +comp_tri5 : li %6, 1 --> comp_tri4 +comp_tri4 : add %4, %4, %6 --> comp_tri3 +comp_tri41 : emit c99 --> comp_tri40 +comp_tri40 : li %22, 0 --> comp_tri39 +comp_tri39 : li %30, 4 --> comp_tri38 +comp_tri38 : mulo %29, %3, %30 --> comp_tri37 +comp_tri37 : add %43, %0, %29 --> comp_tri66 +comp_tri66 : lw %23, 0(%43) --> comp_tri36 +comp_tri36 : li %28, 1 --> comp_tri35 +comp_tri35 : sub %26, %3, %28 --> comp_tri34 +comp_tri34 : li %27, 4 --> comp_tri33 +comp_tri33 : mulo %25, %26, %27 --> comp_tri32 +comp_tri32 : add %42, %0, %25 --> comp_tri65 +comp_tri65 : lw %24, 0(%42) --> comp_tri31 +comp_tri31 : slt %21, %23, %24 --> comp_tri30 +comp_tri30 : beq %21, %22 --> comp_tri10, comp_tri29 +comp_tri29 : emit c98 --> comp_tri28 +comp_tri28 : li %20, 1 --> comp_tri27 +comp_tri27 : sub %18, %3, %20 --> comp_tri26 +comp_tri26 : li %19, 4 --> comp_tri25 +comp_tri25 : mulo %17, %18, %19 --> comp_tri24 +comp_tri24 : add %41, %0, %17 --> comp_tri64 +comp_tri64 : lw %2, 0(%41) --> comp_tri23 +comp_tri23 : emit c97 --> comp_tri22 +comp_tri22 : li %16, 4 --> comp_tri21 +comp_tri21 : mulo %15, %3, %16 --> comp_tri20 +comp_tri20 : add %40, %0, %15 --> comp_tri63 +comp_tri63 : lw %10, 0(%40) --> comp_tri19 +comp_tri19 : li %14, 1 --> comp_tri18 +comp_tri18 : sub %12, %3, %14 --> comp_tri17 +comp_tri17 : li %13, 4 --> comp_tri16 +comp_tri16 : mulo %11, %12, %13 --> comp_tri15 +comp_tri15 : add %39, %0, %11 --> comp_tri62 +comp_tri62 : sw %10, 0(%39) --> comp_tri14 +comp_tri14 : emit c96 --> comp_tri13 +comp_tri13 : li %9, 4 --> comp_tri12 +comp_tri12 : mulo %8, %3, %9 --> comp_tri11 +comp_tri11 : add %38, %0, %8 --> comp_tri61 +comp_tri61 : sw %2, 0(%38) --> comp_tri10 +comp_tri10 : emit c100 --> comp_tri9 +comp_tri9 : li %7, 1 --> comp_tri8 +comp_tri8 : add %3, %3, %7 --> comp_tri7 + +function comp_total(%0; %1; %2) : %6 +stacksize 80 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134, %135, %136, %137, %138, %139, + %140, %141, %142, %143, %144, %145, %146, + %147, %148, %149, %150, %151, %152, %153, + %154, %155, %156, %157, %158, %159, %160, + %161, %162, %163, %164, %165, %166, %167 +entry comp_total397 +comp_total397: li %3, 0 --> comp_total396 +comp_total396: li %4, 0 --> comp_total395 +comp_total395: li %5, 0 --> comp_total394 +comp_total394: li %7, 0 --> comp_total393 +comp_total393: li %8, 0 --> comp_total392 +comp_total392: li %9, 0 --> comp_total391 +comp_total391: li %10, 0 --> comp_total390 +comp_total390: li %11, 0 --> comp_total389 +comp_total389: li %12, 0 --> comp_total388 +comp_total388: li %13, 0 --> comp_total387 +comp_total387: li %14, 0 --> comp_total386 +comp_total386: li %15, 0 --> comp_total385 +comp_total385: li %16, 0 --> comp_total384 +comp_total384: li %17, 0 --> comp_total383 +comp_total383: li %18, 0 --> comp_total382 +comp_total382: li %19, 0 --> comp_total381 +comp_total381: li %20, 0 --> comp_total380 +comp_total380: li %21, 0 --> comp_total379 +comp_total379: li %22, 0 --> comp_total378 +comp_total378: li %23, 0 --> comp_total377 +comp_total377: li %24, 0 --> comp_total376 +comp_total376: li %25, 0 --> comp_total375 +comp_total375: li %26, 0 --> comp_total374 +comp_total374: li %27, 0 --> comp_total373 +comp_total373: li %28, 0 --> comp_total372 +comp_total372: li %29, 0 --> comp_total371 +comp_total371: li %30, 0 --> comp_total370 +comp_total370: li %31, 0 --> comp_total369 +comp_total369: li %32, 0 --> comp_total368 +comp_total368: li %33, 0 --> comp_total367 +comp_total367: li %34, 0 --> comp_total366 +comp_total366: li %35, 0 --> comp_total365 +comp_total365: li %36, 0 --> comp_total364 +comp_total364: li %37, 0 --> comp_total363 +comp_total363: li %38, 0 --> comp_total362 +comp_total362: li %39, 0 --> comp_total361 +comp_total361: li %40, 0 --> comp_total360 +comp_total360: li %41, 0 --> comp_total359 +comp_total359: li %42, 0 --> comp_total358 +comp_total358: li %43, 0 --> comp_total357 +comp_total357: li %44, 0 --> comp_total356 +comp_total356: li %45, 0 --> comp_total355 +comp_total355: li %46, 0 --> comp_total354 +comp_total354: li %47, 0 --> comp_total353 +comp_total353: li %48, 0 --> comp_total352 +comp_total352: li %49, 0 --> comp_total351 +comp_total351: li %50, 0 --> comp_total350 +comp_total350: li %51, 0 --> comp_total349 +comp_total349: li %52, 0 --> comp_total348 +comp_total348: li %53, 0 --> comp_total347 +comp_total347: li %54, 0 --> comp_total346 +comp_total346: li %55, 0 --> comp_total345 +comp_total345: li %56, 0 --> comp_total344 +comp_total344: li %57, 0 --> comp_total343 +comp_total343: li %58, 0 --> comp_total342 +comp_total342: li %59, 0 --> comp_total341 +comp_total341: li %60, 0 --> comp_total340 +comp_total340: li %61, 0 --> comp_total339 +comp_total339: li %62, 0 --> comp_total338 +comp_total338: li %63, 0 --> comp_total337 +comp_total337: li %64, 0 --> comp_total336 +comp_total336: li %65, 0 --> comp_total335 +comp_total335: li %66, 0 --> comp_total334 +comp_total334: li %67, 0 --> comp_total333 +comp_total333: li %68, 0 --> comp_total332 +comp_total332: li %69, 0 --> comp_total331 +comp_total331: li %70, 0 --> comp_total330 +comp_total330: li %71, 0 --> comp_total329 +comp_total329: li %72, 0 --> comp_total328 +comp_total328: li %73, 0 --> comp_total327 +comp_total327: li %74, 0 --> comp_total326 +comp_total326: li %75, 0 --> comp_total325 +comp_total325: li %76, 0 --> comp_total324 +comp_total324: li %77, 0 --> comp_total323 +comp_total323: li %78, 0 --> comp_total322 +comp_total322: li %79, 0 --> comp_total321 +comp_total321: li %80, 0 --> comp_total320 +comp_total320: li %81, 0 --> comp_total319 +comp_total319: li %82, 0 --> comp_total318 +comp_total318: li %83, 0 --> comp_total317 +comp_total317: li %84, 0 --> comp_total316 +comp_total316: li %85, 0 --> comp_total315 +comp_total315: li %86, 0 --> comp_total314 +comp_total314: li %87, 0 --> comp_total313 +comp_total313: li %88, 0 --> comp_total312 +comp_total312: li %89, 0 --> comp_total311 +comp_total311: li %90, 0 --> comp_total310 +comp_total310: li %91, 0 --> comp_total309 +comp_total309: li %92, 0 --> comp_total308 +comp_total308: li %93, 0 --> comp_total307 +comp_total307: li %94, 0 --> comp_total306 +comp_total306: li %95, 0 --> comp_total305 +comp_total305: li %96, 0 --> comp_total304 +comp_total304: li %97, 0 --> comp_total303 +comp_total303: li %98, 0 --> comp_total302 +comp_total302: li %99, 0 --> comp_total301 +comp_total301: li %100, 0 --> comp_total300 +comp_total300: li %101, 0 --> comp_total299 +comp_total299: li %102, 0 --> comp_total298 +comp_total298: li %103, 0 --> comp_total297 +comp_total297: li %104, 0 --> comp_total296 +comp_total296: li %105, 0 --> comp_total295 +comp_total295: li %106, 0 --> comp_total294 +comp_total294: li %107, 0 --> comp_total293 +comp_total293: li %108, 0 --> comp_total292 +comp_total292: li %109, 0 --> comp_total291 +comp_total291: li %110, 0 --> comp_total290 +comp_total290: li %111, 0 --> comp_total289 +comp_total289: li %112, 0 --> comp_total288 +comp_total288: li %113, 0 --> comp_total287 +comp_total287: li %114, 0 --> comp_total286 +comp_total286: li %115, 0 --> comp_total285 +comp_total285: li %116, 0 --> comp_total284 +comp_total284: li %117, 0 --> comp_total283 +comp_total283: li %118, 0 --> comp_total282 +comp_total282: li %119, 0 --> comp_total281 +comp_total281: li %120, 0 --> comp_total280 +comp_total280: li %121, 0 --> comp_total279 +comp_total279: li %122, 0 --> comp_total278 +comp_total278: li %123, 0 --> comp_total277 +comp_total277: li %124, 0 --> comp_total276 +comp_total276: li %125, 0 --> comp_total275 +comp_total275: li %126, 0 --> comp_total274 +comp_total274: li %127, 0 --> comp_total273 +comp_total273: li %128, 0 --> comp_total272 +comp_total272: li %129, 0 --> comp_total271 +comp_total271: li %130, 0 --> comp_total270 +comp_total270: li %131, 0 --> comp_total269 +comp_total269: li %132, 0 --> comp_total268 +comp_total268: li %133, 0 --> comp_total267 +comp_total267: li %134, 0 --> comp_total266 +comp_total266: li %135, 0 --> comp_total265 +comp_total265: li %136, 0 --> comp_total264 +comp_total264: li %137, 0 --> comp_total263 +comp_total263: li %138, 0 --> comp_total262 +comp_total262: li %139, 0 --> comp_total261 +comp_total261: li %140, 0 --> comp_total260 +comp_total260: li %141, 0 --> comp_total259 +comp_total259: li %142, 0 --> comp_total258 +comp_total258: li %143, 0 --> comp_total257 +comp_total257: li %144, 0 --> comp_total256 +comp_total256: li %145, 0 --> comp_total255 +comp_total255: li %146, 0 --> comp_total254 +comp_total254: li %147, 0 --> comp_total253 +comp_total253: li %148, 0 --> comp_total252 +comp_total252: li %149, 0 --> comp_total251 +comp_total251: li %150, 0 --> comp_total250 +comp_total250: li %151, 0 --> comp_total249 +comp_total249: li %152, 0 --> comp_total248 +comp_total248: li %153, 0 --> comp_total247 +comp_total247: li %154, 0 --> comp_total246 +comp_total246: li %155, 0 --> comp_total245 +comp_total245: li %156, 0 --> comp_total244 +comp_total244: li %157, 0 --> comp_total243 +comp_total243: li %158, 0 --> comp_total242 +comp_total242: li %159, 0 --> comp_total241 +comp_total241: li %160, 0 --> comp_total240 +comp_total240: li %161, 0 --> comp_total239 +comp_total239: li %162, 0 --> comp_total238 +comp_total238: li %163, 0 --> comp_total237 +comp_total237: li %164, 0 --> comp_total236 +comp_total236: li %165, 0 --> comp_total235 +comp_total235: li %166, 0 --> comp_total234 +comp_total234: li %167, 0 --> comp_total205 +comp_total205: emit c94 --> comp_total204 +comp_total204: li %135, 0 --> comp_total203 +comp_total203: addi %136, STACK, 0 --> comp_total202 +comp_total202: li %138, 0 --> comp_total201 +comp_total201: li %139, 4 --> comp_total200 +comp_total200: mulo %137, %138, %139 --> comp_total199 +comp_total199: add %157, %136, %137 --> comp_total223 +comp_total223: sw %135, 0(%157) --> comp_total198 +comp_total198: emit c93 --> comp_total197 +comp_total197: li %130, 0 --> comp_total196 +comp_total196: addi %131, STACK, 0 --> comp_total195 +comp_total195: li %133, 1 --> comp_total194 +comp_total194: li %134, 4 --> comp_total193 +comp_total193: mulo %132, %133, %134 --> comp_total192 +comp_total192: add %156, %131, %132 --> comp_total222 +comp_total222: sw %130, 0(%156) --> comp_total191 +comp_total191: emit c92 --> comp_total190 +comp_total190: li %125, 0 --> comp_total189 +comp_total189: addi %126, STACK, 0 --> comp_total188 +comp_total188: li %128, 2 --> comp_total187 +comp_total187: li %129, 4 --> comp_total186 +comp_total186: mulo %127, %128, %129 --> comp_total185 +comp_total185: add %154, %126, %127 --> comp_total220 +comp_total220: sw %125, 0(%154) --> comp_total184 +comp_total184: emit c91 --> comp_total183 +comp_total183: li %120, 0 --> comp_total182 +comp_total182: addi %121, STACK, 0 --> comp_total181 +comp_total181: li %123, 3 --> comp_total180 +comp_total180: li %124, 4 --> comp_total179 +comp_total179: mulo %122, %123, %124 --> comp_total178 +comp_total178: add %153, %121, %122 --> comp_total219 +comp_total219: sw %120, 0(%153) --> comp_total177 +comp_total177: emit c90 --> comp_total176 +comp_total176: li %115, 0 --> comp_total175 +comp_total175: addi %116, STACK, 0 --> comp_total174 +comp_total174: li %118, 4 --> comp_total173 +comp_total173: li %119, 4 --> comp_total172 +comp_total172: mulo %117, %118, %119 --> comp_total171 +comp_total171: add %152, %116, %117 --> comp_total218 +comp_total218: sw %115, 0(%152) --> comp_total170 +comp_total170: emit c89 --> comp_total169 +comp_total169: li %110, 0 --> comp_total168 +comp_total168: addi %111, STACK, 0 --> comp_total167 +comp_total167: li %113, 5 --> comp_total166 +comp_total166: li %114, 4 --> comp_total165 +comp_total165: mulo %112, %113, %114 --> comp_total164 +comp_total164: add %151, %111, %112 --> comp_total217 +comp_total217: sw %110, 0(%151) --> comp_total163 +comp_total163: emit c88 --> comp_total162 +comp_total162: li %105, 0 --> comp_total161 +comp_total161: addi %106, STACK, 0 --> comp_total160 +comp_total160: li %108, 6 --> comp_total159 +comp_total159: li %109, 4 --> comp_total158 +comp_total158: mulo %107, %108, %109 --> comp_total157 +comp_total157: add %150, %106, %107 --> comp_total216 +comp_total216: sw %105, 0(%150) --> comp_total156 +comp_total156: emit c87 --> comp_total155 +comp_total155: li %100, 0 --> comp_total154 +comp_total154: addi %101, STACK, 0 --> comp_total153 +comp_total153: li %103, 7 --> comp_total152 +comp_total152: li %104, 4 --> comp_total151 +comp_total151: mulo %102, %103, %104 --> comp_total150 +comp_total150: add %149, %101, %102 --> comp_total215 +comp_total215: sw %100, 0(%149) --> comp_total149 +comp_total149: emit c86 --> comp_total148 +comp_total148: li %95, 0 --> comp_total147 +comp_total147: addi %96, STACK, 0 --> comp_total146 +comp_total146: li %98, 8 --> comp_total145 +comp_total145: li %99, 4 --> comp_total144 +comp_total144: mulo %97, %98, %99 --> comp_total143 +comp_total143: add %147, %96, %97 --> comp_total213 +comp_total213: sw %95, 0(%147) --> comp_total142 +comp_total142: emit c85 --> comp_total141 +comp_total141: li %90, 0 --> comp_total140 +comp_total140: addi %91, STACK, 0 --> comp_total139 +comp_total139: li %93, 9 --> comp_total138 +comp_total138: li %94, 4 --> comp_total137 +comp_total137: mulo %92, %93, %94 --> comp_total136 +comp_total136: add %146, %91, %92 --> comp_total212 +comp_total212: sw %90, 0(%146) --> comp_total135 +comp_total135: emit c84 --> comp_total134 +comp_total134: li %85, 0 --> comp_total133 +comp_total133: addi %86, STACK, 40 --> comp_total132 +comp_total132: li %88, 0 --> comp_total131 +comp_total131: li %89, 4 --> comp_total130 +comp_total130: mulo %87, %88, %89 --> comp_total129 +comp_total129: add %145, %86, %87 --> comp_total211 +comp_total211: sw %85, 0(%145) --> comp_total128 +comp_total128: emit c83 --> comp_total127 +comp_total127: li %80, 0 --> comp_total126 +comp_total126: addi %81, STACK, 40 --> comp_total125 +comp_total125: li %83, 1 --> comp_total124 +comp_total124: li %84, 4 --> comp_total123 +comp_total123: mulo %82, %83, %84 --> comp_total122 +comp_total122: add %144, %81, %82 --> comp_total210 +comp_total210: sw %80, 0(%144) --> comp_total121 +comp_total121: emit c82 --> comp_total120 +comp_total120: li %75, 0 --> comp_total119 +comp_total119: addi %76, STACK, 40 --> comp_total118 +comp_total118: li %78, 2 --> comp_total117 +comp_total117: li %79, 4 --> comp_total116 +comp_total116: mulo %77, %78, %79 --> comp_total115 +comp_total115: add %143, %76, %77 --> comp_total209 +comp_total209: sw %75, 0(%143) --> comp_total114 +comp_total114: emit c81 --> comp_total113 +comp_total113: li %70, 0 --> comp_total112 +comp_total112: addi %71, STACK, 40 --> comp_total111 +comp_total111: li %73, 3 --> comp_total110 +comp_total110: li %74, 4 --> comp_total109 +comp_total109: mulo %72, %73, %74 --> comp_total108 +comp_total108: add %141, %71, %72 --> comp_total207 +comp_total207: sw %70, 0(%141) --> comp_total107 +comp_total107: emit c80 --> comp_total106 +comp_total106: li %65, 0 --> comp_total105 +comp_total105: addi %66, STACK, 40 --> comp_total104 +comp_total104: li %68, 4 --> comp_total103 +comp_total103: li %69, 4 --> comp_total102 +comp_total102: mulo %67, %68, %69 --> comp_total101 +comp_total101: add %140, %66, %67 --> comp_total206 +comp_total206: sw %65, 0(%140) --> comp_total100 +comp_total100: emit c79 --> comp_total99 +comp_total99 : li %60, 0 --> comp_total98 +comp_total98 : addi %61, STACK, 40 --> comp_total97 +comp_total97 : li %63, 5 --> comp_total96 +comp_total96 : li %64, 4 --> comp_total95 +comp_total95 : mulo %62, %63, %64 --> comp_total94 +comp_total94 : add %167, %61, %62 --> comp_total233 +comp_total233: sw %60, 0(%167) --> comp_total93 +comp_total93 : emit c78 --> comp_total92 +comp_total92 : li %55, 0 --> comp_total91 +comp_total91 : addi %56, STACK, 40 --> comp_total90 +comp_total90 : li %58, 6 --> comp_total89 +comp_total89 : li %59, 4 --> comp_total88 +comp_total88 : mulo %57, %58, %59 --> comp_total87 +comp_total87 : add %166, %56, %57 --> comp_total232 +comp_total232: sw %55, 0(%166) --> comp_total86 +comp_total86 : emit c77 --> comp_total85 +comp_total85 : li %50, 0 --> comp_total84 +comp_total84 : addi %51, STACK, 40 --> comp_total83 +comp_total83 : li %53, 7 --> comp_total82 +comp_total82 : li %54, 4 --> comp_total81 +comp_total81 : mulo %52, %53, %54 --> comp_total80 +comp_total80 : add %165, %51, %52 --> comp_total231 +comp_total231: sw %50, 0(%165) --> comp_total79 +comp_total79 : emit c76 --> comp_total78 +comp_total78 : li %45, 0 --> comp_total77 +comp_total77 : addi %46, STACK, 40 --> comp_total76 +comp_total76 : li %48, 8 --> comp_total75 +comp_total75 : li %49, 4 --> comp_total74 +comp_total74 : mulo %47, %48, %49 --> comp_total73 +comp_total73 : add %164, %46, %47 --> comp_total230 +comp_total230: sw %45, 0(%164) --> comp_total72 +comp_total72 : emit c75 --> comp_total71 +comp_total71 : li %40, 0 --> comp_total70 +comp_total70 : addi %41, STACK, 40 --> comp_total69 +comp_total69 : li %43, 9 --> comp_total68 +comp_total68 : li %44, 4 --> comp_total67 +comp_total67 : mulo %42, %43, %44 --> comp_total66 +comp_total66 : add %163, %41, %42 --> comp_total229 +comp_total229: sw %40, 0(%163) --> comp_total65 +comp_total65 : emit c74 --> comp_total64 +comp_total64 : li %39, 0 --> comp_total63 +comp_total63 : slt %38, %1, %2 --> comp_total62 +comp_total62 : beq %38, %39 --> comp_total40, comp_total61 +comp_total61 : emit c73 --> comp_total60 +comp_total60 : emit c72 --> comp_total59 +comp_total59 : li %5, 0 --> comp_total41 +comp_total41 : j --> comp_total58 +comp_total58 : li %36, 0 --> comp_total57 +comp_total57 : emit c71 --> comp_total56 +comp_total56 : sle %37, %5, %1 --> comp_total55 +comp_total55 : li %162, 0 --> comp_total228 +comp_total228: seq %35, %37, %162 --> comp_total54 +comp_total54 : beq %35, %36 --> comp_total53, comp_total2 +comp_total2 : emit c59 --> comp_total1 +comp_total1 : li %6, 0 --> comp_total0 +comp_total0 : return %6 +comp_total53 : emit c69 --> comp_total52 +comp_total52 : sub %33, %1, %5 --> comp_total51 +comp_total51 : li %34, 4 --> comp_total50 +comp_total50 : mulo %32, %33, %34 --> comp_total49 +comp_total49 : add %161, %0, %32 --> comp_total227 +comp_total227: lw %28, 0(%161) --> comp_total48 +comp_total48 : addi %29, STACK, 0 --> comp_total47 +comp_total47 : li %31, 4 --> comp_total46 +comp_total46 : mulo %30, %5, %31 --> comp_total45 +comp_total45 : add %160, %29, %30 --> comp_total226 +comp_total226: sw %28, 0(%160) --> comp_total44 +comp_total44 : emit c70 --> comp_total43 +comp_total43 : li %27, 1 --> comp_total42 +comp_total42 : add %5, %5, %27 --> comp_total41 +comp_total40 : emit c68 --> comp_total39 +comp_total39 : emit c67 --> comp_total38 +comp_total38 : li %3, 0 --> comp_total3 +comp_total3 : j --> comp_total37 +comp_total37 : li %25, 0 --> comp_total36 +comp_total36 : emit c66 --> comp_total35 +comp_total35 : slt %26, %3, %1 --> comp_total34 +comp_total34 : li %159, 0 --> comp_total225 +comp_total225: seq %24, %26, %159 --> comp_total33 +comp_total33 : beq %24, %25 --> comp_total32, comp_total2 +comp_total32 : emit c64 --> comp_total31 +comp_total31 : emit c63 --> comp_total30 +comp_total30 : move %4, %2 --> comp_total7 +comp_total7 : j --> comp_total29 +comp_total29 : li %21, 0 --> comp_total28 +comp_total28 : emit c62 --> comp_total27 +comp_total27 : li %23, 0 --> comp_total26 +comp_total26 : sgt %22, %4, %23 --> comp_total25 +comp_total25 : li %158, 0 --> comp_total224 +comp_total224: seq %20, %22, %158 --> comp_total24 +comp_total24 : beq %20, %21 --> comp_total23, comp_total6 +comp_total6 : emit c65 --> comp_total5 +comp_total5 : li %7, 1 --> comp_total4 +comp_total4 : add %3, %3, %7 --> comp_total3 +comp_total23 : emit c60 --> comp_total22 +comp_total22 : addi %17, STACK, 0 --> comp_total21 +comp_total21 : li %19, 4 --> comp_total20 +comp_total20 : mulo %18, %3, %19 --> comp_total19 +comp_total19 : add %155, %17, %18 --> comp_total221 +comp_total221: lw %12, 0(%155) --> comp_total18 +comp_total18 : addi %14, STACK, 40 --> comp_total17 +comp_total17 : li %16, 4 --> comp_total16 +comp_total16 : mulo %15, %4, %16 --> comp_total15 +comp_total15 : add %148, %14, %15 --> comp_total214 +comp_total214: lw %13, 0(%148) --> comp_total14 +comp_total14 : add %9, %12, %13 --> comp_total13 +comp_total13 : li %11, 4 --> comp_total12 +comp_total12 : mulo %10, %3, %11 --> comp_total11 +comp_total11 : add %142, %0, %10 --> comp_total208 +comp_total208: sw %9, 0(%142) --> comp_total10 +comp_total10 : emit c61 --> comp_total9 +comp_total9 : li %8, 1 --> comp_total8 +comp_total8 : sub %4, %4, %8 --> comp_total7 + +function comp_ifFor(%0; %1; %2) : %5 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11 +entry comp_ifFor32 +comp_ifFor32: li %3, 0 --> comp_ifFor31 +comp_ifFor31: li %4, 0 --> comp_ifFor30 +comp_ifFor30: li %6, 0 --> comp_ifFor29 +comp_ifFor29: li %7, 0 --> comp_ifFor28 +comp_ifFor28: li %8, 0 --> comp_ifFor27 +comp_ifFor27: li %9, 0 --> comp_ifFor26 +comp_ifFor26: li %10, 0 --> comp_ifFor25 +comp_ifFor25: li %11, 0 --> comp_ifFor23 +comp_ifFor23: emit c58 --> comp_ifFor22 +comp_ifFor22: li %4, 0 --> comp_ifFor21 +comp_ifFor21: emit c57 --> comp_ifFor20 +comp_ifFor20: emit c56 --> comp_ifFor19 +comp_ifFor19: li %3, 0 --> comp_ifFor3 +comp_ifFor3 : j --> comp_ifFor18 +comp_ifFor18: li %9, 0 --> comp_ifFor17 +comp_ifFor17: emit c55 --> comp_ifFor16 +comp_ifFor16: slt %10, %3, %0 --> comp_ifFor15 +comp_ifFor15: li %11, 0 --> comp_ifFor24 +comp_ifFor24: seq %8, %10, %11 --> comp_ifFor14 +comp_ifFor14: beq %8, %9 --> comp_ifFor13, comp_ifFor2 +comp_ifFor2 : emit c50 --> comp_ifFor1 +comp_ifFor1 : move %5, %4 --> comp_ifFor0 +comp_ifFor0 : return %5 +comp_ifFor13: emit c53 --> comp_ifFor12 +comp_ifFor12: li %7, 0 --> comp_ifFor11 +comp_ifFor11: sne %6, %3, %1 --> comp_ifFor10 +comp_ifFor10: beq %6, %7 --> comp_ifFor7, comp_ifFor9 +comp_ifFor9 : emit c52 --> comp_ifFor8 +comp_ifFor8 : add %4, %4, %3 --> comp_ifFor5 +comp_ifFor5 : emit c54 --> comp_ifFor4 +comp_ifFor4 : add %3, %3, %2 --> comp_ifFor3 +comp_ifFor7 : emit c51 --> comp_ifFor6 +comp_ifFor6 : li %4, 0 --> comp_ifFor5 + +function comp_forif2(%0; %1; %2; %3) : %9 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53 +entry comp_forif2139 +comp_forif2139: li %4, 0 --> comp_forif2138 +comp_forif2138: li %5, 0 --> comp_forif2137 +comp_forif2137: li %6, 0 --> comp_forif2136 +comp_forif2136: li %7, 0 --> comp_forif2135 +comp_forif2135: li %8, 0 --> comp_forif2134 +comp_forif2134: li %10, 0 --> comp_forif2133 +comp_forif2133: li %11, 0 --> comp_forif2132 +comp_forif2132: li %12, 0 --> comp_forif2131 +comp_forif2131: li %13, 0 --> comp_forif2130 +comp_forif2130: li %14, 0 --> comp_forif2129 +comp_forif2129: li %15, 0 --> comp_forif2128 +comp_forif2128: li %16, 0 --> comp_forif2127 +comp_forif2127: li %17, 0 --> comp_forif2126 +comp_forif2126: li %18, 0 --> comp_forif2125 +comp_forif2125: li %19, 0 --> comp_forif2124 +comp_forif2124: li %20, 0 --> comp_forif2123 +comp_forif2123: li %21, 0 --> comp_forif2122 +comp_forif2122: li %22, 0 --> comp_forif2121 +comp_forif2121: li %23, 0 --> comp_forif2120 +comp_forif2120: li %24, 0 --> comp_forif2119 +comp_forif2119: li %25, 0 --> comp_forif2118 +comp_forif2118: li %26, 0 --> comp_forif2117 +comp_forif2117: li %27, 0 --> comp_forif2116 +comp_forif2116: li %28, 0 --> comp_forif2115 +comp_forif2115: li %29, 0 --> comp_forif2114 +comp_forif2114: li %30, 0 --> comp_forif2113 +comp_forif2113: li %31, 0 --> comp_forif2112 +comp_forif2112: li %32, 0 --> comp_forif2111 +comp_forif2111: li %33, 0 --> comp_forif2110 +comp_forif2110: li %34, 0 --> comp_forif2109 +comp_forif2109: li %35, 0 --> comp_forif2108 +comp_forif2108: li %36, 0 --> comp_forif2107 +comp_forif2107: li %37, 0 --> comp_forif2106 +comp_forif2106: li %38, 0 --> comp_forif2105 +comp_forif2105: li %39, 0 --> comp_forif2104 +comp_forif2104: li %40, 0 --> comp_forif2103 +comp_forif2103: li %41, 0 --> comp_forif2102 +comp_forif2102: li %42, 0 --> comp_forif2101 +comp_forif2101: li %43, 0 --> comp_forif2100 +comp_forif2100: li %44, 0 --> comp_forif299 +comp_forif299 : li %45, 0 --> comp_forif298 +comp_forif298 : li %46, 0 --> comp_forif297 +comp_forif297 : li %47, 0 --> comp_forif296 +comp_forif296 : li %48, 0 --> comp_forif295 +comp_forif295 : li %49, 0 --> comp_forif294 +comp_forif294 : li %50, 0 --> comp_forif293 +comp_forif293 : li %51, 0 --> comp_forif292 +comp_forif292 : li %52, 0 --> comp_forif291 +comp_forif291 : li %53, 0 --> comp_forif282 +comp_forif282 : emit c130 --> comp_forif281 +comp_forif281 : li %6, 0 --> comp_forif280 +comp_forif280 : emit c129 --> comp_forif279 +comp_forif279 : li %5, 0 --> comp_forif278 +comp_forif278 : emit c128 --> comp_forif277 +comp_forif277 : emit c127 --> comp_forif276 +comp_forif276 : li %8, 0 --> comp_forif262 +comp_forif262 : j --> comp_forif275 +comp_forif275 : li %44, 0 --> comp_forif274 +comp_forif274 : emit c126 --> comp_forif273 +comp_forif273 : slt %45, %8, %2 --> comp_forif272 +comp_forif272 : li %53, 0 --> comp_forif290 +comp_forif290 : seq %43, %45, %53 --> comp_forif271 +comp_forif271 : beq %43, %44 --> comp_forif270, comp_forif261 +comp_forif261 : emit c123 --> comp_forif260 +comp_forif260 : emit c122 --> comp_forif259 +comp_forif259 : li %7, 0 --> comp_forif245 +comp_forif245 : j --> comp_forif258 +comp_forif258 : li %37, 0 --> comp_forif257 +comp_forif257 : emit c121 --> comp_forif256 +comp_forif256 : slt %38, %7, %3 --> comp_forif255 +comp_forif255 : li %51, 0 --> comp_forif288 +comp_forif288 : seq %36, %38, %51 --> comp_forif254 +comp_forif254 : beq %36, %37 --> comp_forif253, comp_forif244 +comp_forif244 : emit c118 --> comp_forif243 +comp_forif243 : li %21, 0 --> comp_forif242 +comp_forif242 : li %28, 0 --> comp_forif241 +comp_forif241 : emit c117 --> comp_forif240 +comp_forif240 : li %31, 2 --> comp_forif239 +comp_forif239 : la %49, mod --> comp_forif286 +comp_forif286 : call %29, %49(%6, %31) --> comp_forif238 +comp_forif238 : li %30, 0 --> comp_forif237 +comp_forif237 : seq %27, %29, %30 --> comp_forif236 +comp_forif236 : beq %27, %28 --> comp_forif226, comp_forif235 +comp_forif235 : li %23, 0 --> comp_forif234 +comp_forif234 : emit c116 --> comp_forif233 +comp_forif233 : li %26, 2 --> comp_forif232 +comp_forif232 : la %48, mod --> comp_forif285 +comp_forif285 : call %24, %48(%5, %26) --> comp_forif231 +comp_forif231 : li %25, 0 --> comp_forif230 +comp_forif230 : seq %22, %24, %25 --> comp_forif229 +comp_forif229 : beq %22, %23 --> comp_forif227, comp_forif228 +comp_forif228 : li %20, 1 --> comp_forif225 +comp_forif225 : beq %20, %21 --> comp_forif222, comp_forif224 +comp_forif224 : emit c115 --> comp_forif223 +comp_forif223 : li %4, 0 --> comp_forif22 +comp_forif22 : emit c109 --> comp_forif21 +comp_forif21 : li %9, 0 --> comp_forif20 +comp_forif20 : return %9 +comp_forif222 : emit c114 --> comp_forif221 +comp_forif221 : li %16, 0 --> comp_forif220 +comp_forif220 : li %19, 2 --> comp_forif219 +comp_forif219 : la %47, mod --> comp_forif284 +comp_forif284 : call %17, %47(%6, %19) --> comp_forif218 +comp_forif218 : li %18, 0 --> comp_forif217 +comp_forif217 : seq %15, %17, %18 --> comp_forif216 +comp_forif216 : beq %15, %16 --> comp_forif213, comp_forif215 +comp_forif215 : emit c113 --> comp_forif214 +comp_forif214 : li %4, 1 --> comp_forif22 +comp_forif213 : emit c112 --> comp_forif212 +comp_forif212 : li %11, 0 --> comp_forif211 +comp_forif211 : li %14, 2 --> comp_forif210 +comp_forif210 : la %46, mod --> comp_forif283 +comp_forif283 : call %12, %46(%5, %14) --> comp_forif29 +comp_forif29 : li %13, 0 --> comp_forif28 +comp_forif28 : seq %10, %12, %13 --> comp_forif27 +comp_forif27 : beq %10, %11 --> comp_forif24, comp_forif26 +comp_forif26 : emit c111 --> comp_forif25 +comp_forif25 : li %4, 2 --> comp_forif22 +comp_forif24 : emit c110 --> comp_forif23 +comp_forif23 : li %4, 3 --> comp_forif22 +comp_forif227 : li %20, 0 --> comp_forif225 +comp_forif226 : li %20, 0 --> comp_forif225 +comp_forif253 : emit c119 --> comp_forif252 +comp_forif252 : li %35, 4 --> comp_forif251 +comp_forif251 : mulo %34, %7, %35 --> comp_forif250 +comp_forif250 : add %50, %1, %34 --> comp_forif287 +comp_forif287 : lw %33, 0(%50) --> comp_forif249 +comp_forif249 : add %5, %5, %33 --> comp_forif248 +comp_forif248 : emit c120 --> comp_forif247 +comp_forif247 : li %32, 1 --> comp_forif246 +comp_forif246 : add %7, %7, %32 --> comp_forif245 +comp_forif270 : emit c124 --> comp_forif269 +comp_forif269 : li %42, 4 --> comp_forif268 +comp_forif268 : mulo %41, %8, %42 --> comp_forif267 +comp_forif267 : add %52, %0, %41 --> comp_forif289 +comp_forif289 : lw %40, 0(%52) --> comp_forif266 +comp_forif266 : add %6, %6, %40 --> comp_forif265 +comp_forif265 : emit c125 --> comp_forif264 +comp_forif264 : li %39, 1 --> comp_forif263 +comp_forif263 : add %8, %8, %39 --> comp_forif262 + +function comp_forif() : %3 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18 +entry comp_forif55 +comp_forif55: li %0, 0 --> comp_forif54 +comp_forif54: li %1, 0 --> comp_forif53 +comp_forif53: li %2, 0 --> comp_forif52 +comp_forif52: li %4, 0 --> comp_forif51 +comp_forif51: li %5, 0 --> comp_forif50 +comp_forif50: li %6, 0 --> comp_forif49 +comp_forif49: li %7, 0 --> comp_forif48 +comp_forif48: li %8, 0 --> comp_forif47 +comp_forif47: li %9, 0 --> comp_forif46 +comp_forif46: li %10, 0 --> comp_forif45 +comp_forif45: li %11, 0 --> comp_forif44 +comp_forif44: li %12, 0 --> comp_forif43 +comp_forif43: li %13, 0 --> comp_forif42 +comp_forif42: li %14, 0 --> comp_forif41 +comp_forif41: li %15, 0 --> comp_forif40 +comp_forif40: li %16, 0 --> comp_forif39 +comp_forif39: li %17, 0 --> comp_forif38 +comp_forif38: li %18, 0 --> comp_forif35 +comp_forif35: emit c141 --> comp_forif34 +comp_forif34: li %1, 0 --> comp_forif33 +comp_forif33: emit c140 --> comp_forif32 +comp_forif32: li %0, 0 --> comp_forif31 +comp_forif31: emit c139 --> comp_forif30 +comp_forif30: emit c138 --> comp_forif29 +comp_forif29: li %2, 0 --> comp_forif3 +comp_forif3 : j --> comp_forif28 +comp_forif28: li %14, 0 --> comp_forif27 +comp_forif27: emit c137 --> comp_forif26 +comp_forif26: li %16, 10 --> comp_forif25 +comp_forif25: slt %15, %2, %16 --> comp_forif24 +comp_forif24: li %18, 0 --> comp_forif37 +comp_forif37: seq %13, %15, %18 --> comp_forif23 +comp_forif23: beq %13, %14 --> comp_forif22, comp_forif2 +comp_forif2 : emit c131 --> comp_forif1 +comp_forif1 : move %3, %1 --> comp_forif0 +comp_forif0 : return %3 +comp_forif22: emit c135 --> comp_forif21 +comp_forif21: li %12, 1 --> comp_forif20 +comp_forif20: add %1, %1, %12 --> comp_forif19 +comp_forif19: emit c134 --> comp_forif18 +comp_forif18: li %11, 1 --> comp_forif17 +comp_forif17: add %1, %1, %11 --> comp_forif16 +comp_forif16: emit c133 --> comp_forif15 +comp_forif15: li %7, 0 --> comp_forif14 +comp_forif14: li %10, 2 --> comp_forif13 +comp_forif13: la %17, mod --> comp_forif36 +comp_forif36: call %8, %17(%2, %10) --> comp_forif12 +comp_forif12: li %9, 0 --> comp_forif11 +comp_forif11: seq %6, %8, %9 --> comp_forif10 +comp_forif10: beq %6, %7 --> comp_forif6, comp_forif9 +comp_forif9 : emit c132 --> comp_forif8 +comp_forif8 : li %5, 1 --> comp_forif7 +comp_forif7 : add %0, %0, %5 --> comp_forif6 +comp_forif6 : emit c136 --> comp_forif5 +comp_forif5 : li %4, 1 --> comp_forif4 +comp_forif4 : add %2, %2, %4 --> comp_forif3 + +function comp_fir_basic(%0; %1; %2; %3; %4) : %9 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53 +entry comp_fir_basic126 +comp_fir_basic126: li %5, 0 --> comp_fir_basic125 +comp_fir_basic125: li %6, 0 --> comp_fir_basic124 +comp_fir_basic124: li %7, 0 --> comp_fir_basic123 +comp_fir_basic123: li %8, 0 --> comp_fir_basic122 +comp_fir_basic122: li %10, 0 --> comp_fir_basic121 +comp_fir_basic121: li %11, 0 --> comp_fir_basic120 +comp_fir_basic120: li %12, 0 --> comp_fir_basic119 +comp_fir_basic119: li %13, 0 --> comp_fir_basic118 +comp_fir_basic118: li %14, 0 --> comp_fir_basic117 +comp_fir_basic117: li %15, 0 --> comp_fir_basic116 +comp_fir_basic116: li %16, 0 --> comp_fir_basic115 +comp_fir_basic115: li %17, 0 --> comp_fir_basic114 +comp_fir_basic114: li %18, 0 --> comp_fir_basic113 +comp_fir_basic113: li %19, 0 --> comp_fir_basic112 +comp_fir_basic112: li %20, 0 --> comp_fir_basic111 +comp_fir_basic111: li %21, 0 --> comp_fir_basic110 +comp_fir_basic110: li %22, 0 --> comp_fir_basic109 +comp_fir_basic109: li %23, 0 --> comp_fir_basic108 +comp_fir_basic108: li %24, 0 --> comp_fir_basic107 +comp_fir_basic107: li %25, 0 --> comp_fir_basic106 +comp_fir_basic106: li %26, 0 --> comp_fir_basic105 +comp_fir_basic105: li %27, 0 --> comp_fir_basic104 +comp_fir_basic104: li %28, 0 --> comp_fir_basic103 +comp_fir_basic103: li %29, 0 --> comp_fir_basic102 +comp_fir_basic102: li %30, 0 --> comp_fir_basic101 +comp_fir_basic101: li %31, 0 --> comp_fir_basic100 +comp_fir_basic100: li %32, 0 --> comp_fir_basic99 +comp_fir_basic99 : li %33, 0 --> comp_fir_basic98 +comp_fir_basic98 : li %34, 0 --> comp_fir_basic97 +comp_fir_basic97 : li %35, 0 --> comp_fir_basic96 +comp_fir_basic96 : li %36, 0 --> comp_fir_basic95 +comp_fir_basic95 : li %37, 0 --> comp_fir_basic94 +comp_fir_basic94 : li %38, 0 --> comp_fir_basic93 +comp_fir_basic93 : li %39, 0 --> comp_fir_basic92 +comp_fir_basic92 : li %40, 0 --> comp_fir_basic91 +comp_fir_basic91 : li %41, 0 --> comp_fir_basic90 +comp_fir_basic90 : li %42, 0 --> comp_fir_basic89 +comp_fir_basic89 : li %43, 0 --> comp_fir_basic88 +comp_fir_basic88 : li %44, 0 --> comp_fir_basic87 +comp_fir_basic87 : li %45, 0 --> comp_fir_basic86 +comp_fir_basic86 : li %46, 0 --> comp_fir_basic85 +comp_fir_basic85 : li %47, 0 --> comp_fir_basic84 +comp_fir_basic84 : li %48, 0 --> comp_fir_basic83 +comp_fir_basic83 : li %49, 0 --> comp_fir_basic82 +comp_fir_basic82 : li %50, 0 --> comp_fir_basic81 +comp_fir_basic81 : li %51, 0 --> comp_fir_basic80 +comp_fir_basic80 : li %52, 0 --> comp_fir_basic79 +comp_fir_basic79 : li %53, 0 --> comp_fir_basic69 +comp_fir_basic69 : emit c16 --> comp_fir_basic68 +comp_fir_basic68 : li %5, 0 --> comp_fir_basic67 +comp_fir_basic67 : emit c15 --> comp_fir_basic66 +comp_fir_basic66 : emit c14 --> comp_fir_basic65 +comp_fir_basic65 : li %6, 0 --> comp_fir_basic3 +comp_fir_basic3 : j --> comp_fir_basic64 +comp_fir_basic64 : li %42, 0 --> comp_fir_basic63 +comp_fir_basic63 : emit c13 --> comp_fir_basic62 +comp_fir_basic62 : li %44, 3 --> comp_fir_basic61 +comp_fir_basic61 : slt %43, %6, %44 --> comp_fir_basic60 +comp_fir_basic60 : li %53, 0 --> comp_fir_basic78 +comp_fir_basic78 : seq %41, %43, %53 --> comp_fir_basic59 +comp_fir_basic59 : beq %41, %42 --> comp_fir_basic58, comp_fir_basic2 +comp_fir_basic2 : emit c0 --> comp_fir_basic1 +comp_fir_basic1 : move %9, %5 --> comp_fir_basic0 +comp_fir_basic0 : return %9 +comp_fir_basic58 : emit c11 --> comp_fir_basic57 +comp_fir_basic57 : li %40, 4 --> comp_fir_basic56 +comp_fir_basic56 : mulo %39, %6, %40 --> comp_fir_basic55 +comp_fir_basic55 : add %52, %0, %39 --> comp_fir_basic77 +comp_fir_basic77 : lw %35, 0(%52) --> comp_fir_basic54 +comp_fir_basic54 : li %37, 0 --> comp_fir_basic53 +comp_fir_basic53 : li %38, 4 --> comp_fir_basic52 +comp_fir_basic52 : mulo %36, %37, %38 --> comp_fir_basic51 +comp_fir_basic51 : add %51, %2, %36 --> comp_fir_basic76 +comp_fir_basic76 : sw %35, 0(%51) --> comp_fir_basic50 +comp_fir_basic50 : emit c10 --> comp_fir_basic49 +comp_fir_basic49 : emit c9 --> comp_fir_basic48 +comp_fir_basic48 : li %8, 0 --> comp_fir_basic29 +comp_fir_basic29 : j --> comp_fir_basic47 +comp_fir_basic47 : li %32, 0 --> comp_fir_basic46 +comp_fir_basic46 : emit c8 --> comp_fir_basic45 +comp_fir_basic45 : li %34, 3 --> comp_fir_basic44 +comp_fir_basic44 : slt %33, %8, %34 --> comp_fir_basic43 +comp_fir_basic43 : li %50, 0 --> comp_fir_basic75 +comp_fir_basic75 : seq %31, %33, %50 --> comp_fir_basic42 +comp_fir_basic42 : beq %31, %32 --> comp_fir_basic41, comp_fir_basic28 +comp_fir_basic28 : emit c5 --> comp_fir_basic27 +comp_fir_basic27 : emit c4 --> comp_fir_basic26 +comp_fir_basic26 : li %7, 2 --> comp_fir_basic7 +comp_fir_basic7 : j --> comp_fir_basic25 +comp_fir_basic25 : li %20, 0 --> comp_fir_basic24 +comp_fir_basic24 : emit c3 --> comp_fir_basic23 +comp_fir_basic23 : li %22, 0 --> comp_fir_basic22 +comp_fir_basic22 : sge %21, %7, %22 --> comp_fir_basic21 +comp_fir_basic21 : li %47, 0 --> comp_fir_basic72 +comp_fir_basic72 : seq %19, %21, %47 --> comp_fir_basic20 +comp_fir_basic20 : beq %19, %20 --> comp_fir_basic19, comp_fir_basic6 +comp_fir_basic6 : emit c12 --> comp_fir_basic5 +comp_fir_basic5 : li %10, 1 --> comp_fir_basic4 +comp_fir_basic4 : add %6, %6, %10 --> comp_fir_basic3 +comp_fir_basic19 : emit c1 --> comp_fir_basic18 +comp_fir_basic18 : li %18, 4 --> comp_fir_basic17 +comp_fir_basic17 : mulo %17, %7, %18 --> comp_fir_basic16 +comp_fir_basic16 : add %46, %2, %17 --> comp_fir_basic71 +comp_fir_basic71 : lw %12, 0(%46) --> comp_fir_basic15 +comp_fir_basic15 : li %16, 1 --> comp_fir_basic14 +comp_fir_basic14 : add %14, %7, %16 --> comp_fir_basic13 +comp_fir_basic13 : li %15, 4 --> comp_fir_basic12 +comp_fir_basic12 : mulo %13, %14, %15 --> comp_fir_basic11 +comp_fir_basic11 : add %45, %2, %13 --> comp_fir_basic70 +comp_fir_basic70 : sw %12, 0(%45) --> comp_fir_basic10 +comp_fir_basic10 : emit c2 --> comp_fir_basic9 +comp_fir_basic9 : li %11, 1 --> comp_fir_basic8 +comp_fir_basic8 : sub %7, %7, %11 --> comp_fir_basic7 +comp_fir_basic41 : emit c6 --> comp_fir_basic40 +comp_fir_basic40 : li %30, 4 --> comp_fir_basic39 +comp_fir_basic39 : mulo %29, %8, %30 --> comp_fir_basic38 +comp_fir_basic38 : add %49, %1, %29 --> comp_fir_basic74 +comp_fir_basic74 : lw %25, 0(%49) --> comp_fir_basic37 +comp_fir_basic37 : li %28, 4 --> comp_fir_basic36 +comp_fir_basic36 : mulo %27, %8, %28 --> comp_fir_basic35 +comp_fir_basic35 : add %48, %2, %27 --> comp_fir_basic73 +comp_fir_basic73 : lw %26, 0(%48) --> comp_fir_basic34 +comp_fir_basic34 : mulo %24, %25, %26 --> comp_fir_basic33 +comp_fir_basic33 : add %5, %5, %24 --> comp_fir_basic32 +comp_fir_basic32 : emit c7 --> comp_fir_basic31 +comp_fir_basic31 : li %23, 1 --> comp_fir_basic30 +comp_fir_basic30 : add %8, %8, %23 --> comp_fir_basic29 + +function comp_fir16(%0; %1; %2; %3) : %9 +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134, %135, %136, %137, %138, %139, + %140, %141, %142, %143, %144, %145, %146, + %147, %148, %149, %150, %151, %152, %153 +entry comp_fir16359 +comp_fir16359: li %4, 0 --> comp_fir16358 +comp_fir16358: li %5, 0 --> comp_fir16357 +comp_fir16357: li %6, 0 --> comp_fir16356 +comp_fir16356: li %7, 0 --> comp_fir16355 +comp_fir16355: li %8, 0 --> comp_fir16354 +comp_fir16354: li %10, 0 --> comp_fir16353 +comp_fir16353: li %11, 0 --> comp_fir16352 +comp_fir16352: li %12, 0 --> comp_fir16351 +comp_fir16351: li %13, 0 --> comp_fir16350 +comp_fir16350: li %14, 0 --> comp_fir16349 +comp_fir16349: li %15, 0 --> comp_fir16348 +comp_fir16348: li %16, 0 --> comp_fir16347 +comp_fir16347: li %17, 0 --> comp_fir16346 +comp_fir16346: li %18, 0 --> comp_fir16345 +comp_fir16345: li %19, 0 --> comp_fir16344 +comp_fir16344: li %20, 0 --> comp_fir16343 +comp_fir16343: li %21, 0 --> comp_fir16342 +comp_fir16342: li %22, 0 --> comp_fir16341 +comp_fir16341: li %23, 0 --> comp_fir16340 +comp_fir16340: li %24, 0 --> comp_fir16339 +comp_fir16339: li %25, 0 --> comp_fir16338 +comp_fir16338: li %26, 0 --> comp_fir16337 +comp_fir16337: li %27, 0 --> comp_fir16336 +comp_fir16336: li %28, 0 --> comp_fir16335 +comp_fir16335: li %29, 0 --> comp_fir16334 +comp_fir16334: li %30, 0 --> comp_fir16333 +comp_fir16333: li %31, 0 --> comp_fir16332 +comp_fir16332: li %32, 0 --> comp_fir16331 +comp_fir16331: li %33, 0 --> comp_fir16330 +comp_fir16330: li %34, 0 --> comp_fir16329 +comp_fir16329: li %35, 0 --> comp_fir16328 +comp_fir16328: li %36, 0 --> comp_fir16327 +comp_fir16327: li %37, 0 --> comp_fir16326 +comp_fir16326: li %38, 0 --> comp_fir16325 +comp_fir16325: li %39, 0 --> comp_fir16324 +comp_fir16324: li %40, 0 --> comp_fir16323 +comp_fir16323: li %41, 0 --> comp_fir16322 +comp_fir16322: li %42, 0 --> comp_fir16321 +comp_fir16321: li %43, 0 --> comp_fir16320 +comp_fir16320: li %44, 0 --> comp_fir16319 +comp_fir16319: li %45, 0 --> comp_fir16318 +comp_fir16318: li %46, 0 --> comp_fir16317 +comp_fir16317: li %47, 0 --> comp_fir16316 +comp_fir16316: li %48, 0 --> comp_fir16315 +comp_fir16315: li %49, 0 --> comp_fir16314 +comp_fir16314: li %50, 0 --> comp_fir16313 +comp_fir16313: li %51, 0 --> comp_fir16312 +comp_fir16312: li %52, 0 --> comp_fir16311 +comp_fir16311: li %53, 0 --> comp_fir16310 +comp_fir16310: li %54, 0 --> comp_fir16309 +comp_fir16309: li %55, 0 --> comp_fir16308 +comp_fir16308: li %56, 0 --> comp_fir16307 +comp_fir16307: li %57, 0 --> comp_fir16306 +comp_fir16306: li %58, 0 --> comp_fir16305 +comp_fir16305: li %59, 0 --> comp_fir16304 +comp_fir16304: li %60, 0 --> comp_fir16303 +comp_fir16303: li %61, 0 --> comp_fir16302 +comp_fir16302: li %62, 0 --> comp_fir16301 +comp_fir16301: li %63, 0 --> comp_fir16300 +comp_fir16300: li %64, 0 --> comp_fir16299 +comp_fir16299: li %65, 0 --> comp_fir16298 +comp_fir16298: li %66, 0 --> comp_fir16297 +comp_fir16297: li %67, 0 --> comp_fir16296 +comp_fir16296: li %68, 0 --> comp_fir16295 +comp_fir16295: li %69, 0 --> comp_fir16294 +comp_fir16294: li %70, 0 --> comp_fir16293 +comp_fir16293: li %71, 0 --> comp_fir16292 +comp_fir16292: li %72, 0 --> comp_fir16291 +comp_fir16291: li %73, 0 --> comp_fir16290 +comp_fir16290: li %74, 0 --> comp_fir16289 +comp_fir16289: li %75, 0 --> comp_fir16288 +comp_fir16288: li %76, 0 --> comp_fir16287 +comp_fir16287: li %77, 0 --> comp_fir16286 +comp_fir16286: li %78, 0 --> comp_fir16285 +comp_fir16285: li %79, 0 --> comp_fir16284 +comp_fir16284: li %80, 0 --> comp_fir16283 +comp_fir16283: li %81, 0 --> comp_fir16282 +comp_fir16282: li %82, 0 --> comp_fir16281 +comp_fir16281: li %83, 0 --> comp_fir16280 +comp_fir16280: li %84, 0 --> comp_fir16279 +comp_fir16279: li %85, 0 --> comp_fir16278 +comp_fir16278: li %86, 0 --> comp_fir16277 +comp_fir16277: li %87, 0 --> comp_fir16276 +comp_fir16276: li %88, 0 --> comp_fir16275 +comp_fir16275: li %89, 0 --> comp_fir16274 +comp_fir16274: li %90, 0 --> comp_fir16273 +comp_fir16273: li %91, 0 --> comp_fir16272 +comp_fir16272: li %92, 0 --> comp_fir16271 +comp_fir16271: li %93, 0 --> comp_fir16270 +comp_fir16270: li %94, 0 --> comp_fir16269 +comp_fir16269: li %95, 0 --> comp_fir16268 +comp_fir16268: li %96, 0 --> comp_fir16267 +comp_fir16267: li %97, 0 --> comp_fir16266 +comp_fir16266: li %98, 0 --> comp_fir16265 +comp_fir16265: li %99, 0 --> comp_fir16264 +comp_fir16264: li %100, 0 --> comp_fir16263 +comp_fir16263: li %101, 0 --> comp_fir16262 +comp_fir16262: li %102, 0 --> comp_fir16261 +comp_fir16261: li %103, 0 --> comp_fir16260 +comp_fir16260: li %104, 0 --> comp_fir16259 +comp_fir16259: li %105, 0 --> comp_fir16258 +comp_fir16258: li %106, 0 --> comp_fir16257 +comp_fir16257: li %107, 0 --> comp_fir16256 +comp_fir16256: li %108, 0 --> comp_fir16255 +comp_fir16255: li %109, 0 --> comp_fir16254 +comp_fir16254: li %110, 0 --> comp_fir16253 +comp_fir16253: li %111, 0 --> comp_fir16252 +comp_fir16252: li %112, 0 --> comp_fir16251 +comp_fir16251: li %113, 0 --> comp_fir16250 +comp_fir16250: li %114, 0 --> comp_fir16249 +comp_fir16249: li %115, 0 --> comp_fir16248 +comp_fir16248: li %116, 0 --> comp_fir16247 +comp_fir16247: li %117, 0 --> comp_fir16246 +comp_fir16246: li %118, 0 --> comp_fir16245 +comp_fir16245: li %119, 0 --> comp_fir16244 +comp_fir16244: li %120, 0 --> comp_fir16243 +comp_fir16243: li %121, 0 --> comp_fir16242 +comp_fir16242: li %122, 0 --> comp_fir16241 +comp_fir16241: li %123, 0 --> comp_fir16240 +comp_fir16240: li %124, 0 --> comp_fir16239 +comp_fir16239: li %125, 0 --> comp_fir16238 +comp_fir16238: li %126, 0 --> comp_fir16237 +comp_fir16237: li %127, 0 --> comp_fir16236 +comp_fir16236: li %128, 0 --> comp_fir16235 +comp_fir16235: li %129, 0 --> comp_fir16234 +comp_fir16234: li %130, 0 --> comp_fir16233 +comp_fir16233: li %131, 0 --> comp_fir16232 +comp_fir16232: li %132, 0 --> comp_fir16231 +comp_fir16231: li %133, 0 --> comp_fir16230 +comp_fir16230: li %134, 0 --> comp_fir16229 +comp_fir16229: li %135, 0 --> comp_fir16228 +comp_fir16228: li %136, 0 --> comp_fir16227 +comp_fir16227: li %137, 0 --> comp_fir16226 +comp_fir16226: li %138, 0 --> comp_fir16225 +comp_fir16225: li %139, 0 --> comp_fir16224 +comp_fir16224: li %140, 0 --> comp_fir16223 +comp_fir16223: li %141, 0 --> comp_fir16222 +comp_fir16222: li %142, 0 --> comp_fir16221 +comp_fir16221: li %143, 0 --> comp_fir16220 +comp_fir16220: li %144, 0 --> comp_fir16219 +comp_fir16219: li %145, 0 --> comp_fir16218 +comp_fir16218: li %146, 0 --> comp_fir16217 +comp_fir16217: li %147, 0 --> comp_fir16216 +comp_fir16216: li %148, 0 --> comp_fir16215 +comp_fir16215: li %149, 0 --> comp_fir16214 +comp_fir16214: li %150, 0 --> comp_fir16213 +comp_fir16213: li %151, 0 --> comp_fir16212 +comp_fir16212: li %152, 0 --> comp_fir16211 +comp_fir16211: li %153, 0 --> comp_fir16184 +comp_fir16184: emit c49 --> comp_fir16183 +comp_fir16183: li %123, 0 --> comp_fir16182 +comp_fir16182: addi %124, STACK, 0 --> comp_fir16181 +comp_fir16181: li %126, 0 --> comp_fir16180 +comp_fir16180: li %127, 4 --> comp_fir16179 +comp_fir16179: mulo %125, %126, %127 --> comp_fir16178 +comp_fir16178: add %142, %124, %125 --> comp_fir16199 +comp_fir16199: sw %123, 0(%142) --> comp_fir16177 +comp_fir16177: emit c48 --> comp_fir16176 +comp_fir16176: li %118, 0 --> comp_fir16175 +comp_fir16175: addi %119, STACK, 0 --> comp_fir16174 +comp_fir16174: li %121, 1 --> comp_fir16173 +comp_fir16173: li %122, 4 --> comp_fir16172 +comp_fir16172: mulo %120, %121, %122 --> comp_fir16171 +comp_fir16171: add %141, %119, %120 --> comp_fir16198 +comp_fir16198: sw %118, 0(%141) --> comp_fir16170 +comp_fir16170: emit c47 --> comp_fir16169 +comp_fir16169: li %113, 0 --> comp_fir16168 +comp_fir16168: addi %114, STACK, 0 --> comp_fir16167 +comp_fir16167: li %116, 2 --> comp_fir16166 +comp_fir16166: li %117, 4 --> comp_fir16165 +comp_fir16165: mulo %115, %116, %117 --> comp_fir16164 +comp_fir16164: add %140, %114, %115 --> comp_fir16197 +comp_fir16197: sw %113, 0(%140) --> comp_fir16163 +comp_fir16163: emit c46 --> comp_fir16162 +comp_fir16162: li %108, 0 --> comp_fir16161 +comp_fir16161: addi %109, STACK, 0 --> comp_fir16160 +comp_fir16160: li %111, 3 --> comp_fir16159 +comp_fir16159: li %112, 4 --> comp_fir16158 +comp_fir16158: mulo %110, %111, %112 --> comp_fir16157 +comp_fir16157: add %139, %109, %110 --> comp_fir16196 +comp_fir16196: sw %108, 0(%139) --> comp_fir16156 +comp_fir16156: emit c45 --> comp_fir16155 +comp_fir16155: li %103, 0 --> comp_fir16154 +comp_fir16154: addi %104, STACK, 0 --> comp_fir16153 +comp_fir16153: li %106, 4 --> comp_fir16152 +comp_fir16152: li %107, 4 --> comp_fir16151 +comp_fir16151: mulo %105, %106, %107 --> comp_fir16150 +comp_fir16150: add %138, %104, %105 --> comp_fir16195 +comp_fir16195: sw %103, 0(%138) --> comp_fir16149 +comp_fir16149: emit c44 --> comp_fir16148 +comp_fir16148: li %98, 0 --> comp_fir16147 +comp_fir16147: addi %99, STACK, 0 --> comp_fir16146 +comp_fir16146: li %101, 5 --> comp_fir16145 +comp_fir16145: li %102, 4 --> comp_fir16144 +comp_fir16144: mulo %100, %101, %102 --> comp_fir16143 +comp_fir16143: add %136, %99, %100 --> comp_fir16193 +comp_fir16193: sw %98, 0(%136) --> comp_fir16142 +comp_fir16142: emit c43 --> comp_fir16141 +comp_fir16141: li %93, 0 --> comp_fir16140 +comp_fir16140: addi %94, STACK, 0 --> comp_fir16139 +comp_fir16139: li %96, 6 --> comp_fir16138 +comp_fir16138: li %97, 4 --> comp_fir16137 +comp_fir16137: mulo %95, %96, %97 --> comp_fir16136 +comp_fir16136: add %135, %94, %95 --> comp_fir16192 +comp_fir16192: sw %93, 0(%135) --> comp_fir16135 +comp_fir16135: emit c42 --> comp_fir16134 +comp_fir16134: li %88, 0 --> comp_fir16133 +comp_fir16133: addi %89, STACK, 0 --> comp_fir16132 +comp_fir16132: li %91, 7 --> comp_fir16131 +comp_fir16131: li %92, 4 --> comp_fir16130 +comp_fir16130: mulo %90, %91, %92 --> comp_fir16129 +comp_fir16129: add %134, %89, %90 --> comp_fir16191 +comp_fir16191: sw %88, 0(%134) --> comp_fir16128 +comp_fir16128: emit c41 --> comp_fir16127 +comp_fir16127: li %83, 0 --> comp_fir16126 +comp_fir16126: addi %84, STACK, 0 --> comp_fir16125 +comp_fir16125: li %86, 8 --> comp_fir16124 +comp_fir16124: li %87, 4 --> comp_fir16123 +comp_fir16123: mulo %85, %86, %87 --> comp_fir16122 +comp_fir16122: add %133, %84, %85 --> comp_fir16190 +comp_fir16190: sw %83, 0(%133) --> comp_fir16121 +comp_fir16121: emit c40 --> comp_fir16120 +comp_fir16120: li %78, 0 --> comp_fir16119 +comp_fir16119: addi %79, STACK, 0 --> comp_fir16118 +comp_fir16118: li %81, 9 --> comp_fir16117 +comp_fir16117: li %82, 4 --> comp_fir16116 +comp_fir16116: mulo %80, %81, %82 --> comp_fir16115 +comp_fir16115: add %132, %79, %80 --> comp_fir16189 +comp_fir16189: sw %78, 0(%132) --> comp_fir16114 +comp_fir16114: emit c39 --> comp_fir16113 +comp_fir16113: li %73, 0 --> comp_fir16112 +comp_fir16112: addi %74, STACK, 0 --> comp_fir16111 +comp_fir16111: li %76, 10 --> comp_fir16110 +comp_fir16110: li %77, 4 --> comp_fir16109 +comp_fir16109: mulo %75, %76, %77 --> comp_fir16108 +comp_fir16108: add %130, %74, %75 --> comp_fir16187 +comp_fir16187: sw %73, 0(%130) --> comp_fir16107 +comp_fir16107: emit c38 --> comp_fir16106 +comp_fir16106: li %68, 0 --> comp_fir16105 +comp_fir16105: addi %69, STACK, 0 --> comp_fir16104 +comp_fir16104: li %71, 11 --> comp_fir16103 +comp_fir16103: li %72, 4 --> comp_fir16102 +comp_fir16102: mulo %70, %71, %72 --> comp_fir16101 +comp_fir16101: add %129, %69, %70 --> comp_fir16186 +comp_fir16186: sw %68, 0(%129) --> comp_fir16100 +comp_fir16100: emit c37 --> comp_fir1699 +comp_fir1699 : li %63, 0 --> comp_fir1698 +comp_fir1698 : addi %64, STACK, 0 --> comp_fir1697 +comp_fir1697 : li %66, 12 --> comp_fir1696 +comp_fir1696 : li %67, 4 --> comp_fir1695 +comp_fir1695 : mulo %65, %66, %67 --> comp_fir1694 +comp_fir1694 : add %153, %64, %65 --> comp_fir16210 +comp_fir16210: sw %63, 0(%153) --> comp_fir1693 +comp_fir1693 : emit c36 --> comp_fir1692 +comp_fir1692 : li %58, 0 --> comp_fir1691 +comp_fir1691 : addi %59, STACK, 0 --> comp_fir1690 +comp_fir1690 : li %61, 13 --> comp_fir1689 +comp_fir1689 : li %62, 4 --> comp_fir1688 +comp_fir1688 : mulo %60, %61, %62 --> comp_fir1687 +comp_fir1687 : add %152, %59, %60 --> comp_fir16209 +comp_fir16209: sw %58, 0(%152) --> comp_fir1686 +comp_fir1686 : emit c35 --> comp_fir1685 +comp_fir1685 : li %53, 0 --> comp_fir1684 +comp_fir1684 : addi %54, STACK, 0 --> comp_fir1683 +comp_fir1683 : li %56, 14 --> comp_fir1682 +comp_fir1682 : li %57, 4 --> comp_fir1681 +comp_fir1681 : mulo %55, %56, %57 --> comp_fir1680 +comp_fir1680 : add %151, %54, %55 --> comp_fir16208 +comp_fir16208: sw %53, 0(%151) --> comp_fir1679 +comp_fir1679 : emit c34 --> comp_fir1678 +comp_fir1678 : li %48, 0 --> comp_fir1677 +comp_fir1677 : addi %49, STACK, 0 --> comp_fir1676 +comp_fir1676 : li %51, 15 --> comp_fir1675 +comp_fir1675 : li %52, 4 --> comp_fir1674 +comp_fir1674 : mulo %50, %51, %52 --> comp_fir1673 +comp_fir1673 : add %150, %49, %50 --> comp_fir16207 +comp_fir16207: sw %48, 0(%150) --> comp_fir1672 +comp_fir1672 : emit c33 --> comp_fir1671 +comp_fir1671 : li %8, 0 --> comp_fir1670 +comp_fir1670 : emit c32 --> comp_fir1669 +comp_fir1669 : li %4, 0 --> comp_fir1668 +comp_fir1668 : emit c31 --> comp_fir1667 +comp_fir1667 : emit c30 --> comp_fir1666 +comp_fir1666 : li %6, 0 --> comp_fir167 +comp_fir167 : j --> comp_fir1665 +comp_fir1665 : li %46, 0 --> comp_fir1664 +comp_fir1664 : emit c29 --> comp_fir1663 +comp_fir1663 : slt %47, %6, %3 --> comp_fir1662 +comp_fir1662 : li %149, 0 --> comp_fir16206 +comp_fir16206: seq %45, %47, %149 --> comp_fir1661 +comp_fir1661 : beq %45, %46 --> comp_fir1660, comp_fir166 +comp_fir166 : emit c17 --> comp_fir165 +comp_fir165 : addi %10, STACK, 0 --> comp_fir164 +comp_fir164 : li %12, 0 --> comp_fir163 +comp_fir163 : li %13, 4 --> comp_fir162 +comp_fir162 : mulo %11, %12, %13 --> comp_fir161 +comp_fir161 : add %128, %10, %11 --> comp_fir16185 +comp_fir16185: lw %9, 0(%128) --> comp_fir160 +comp_fir160 : return %9 +comp_fir1660 : emit c27 --> comp_fir1659 +comp_fir1659 : li %44, 4 --> comp_fir1658 +comp_fir1658 : mulo %43, %6, %44 --> comp_fir1657 +comp_fir1657 : add %148, %0, %43 --> comp_fir16205 +comp_fir16205: lw %39, 0(%148) --> comp_fir1656 +comp_fir1656 : addi %40, STACK, 0 --> comp_fir1655 +comp_fir1655 : li %42, 4 --> comp_fir1654 +comp_fir1654 : mulo %41, %8, %42 --> comp_fir1653 +comp_fir1653 : add %147, %40, %41 --> comp_fir16204 +comp_fir16204: sw %39, 0(%147) --> comp_fir1652 +comp_fir1652 : emit c26 --> comp_fir1651 +comp_fir1651 : emit c25 --> comp_fir1650 +comp_fir1650 : li %7, 0 --> comp_fir1620 +comp_fir1620 : j --> comp_fir1649 +comp_fir1649 : li %36, 0 --> comp_fir1648 +comp_fir1648 : emit c24 --> comp_fir1647 +comp_fir1647 : li %38, 16 --> comp_fir1646 +comp_fir1646 : slt %37, %7, %38 --> comp_fir1645 +comp_fir1645 : li %146, 0 --> comp_fir16203 +comp_fir16203: seq %35, %37, %146 --> comp_fir1644 +comp_fir1644 : beq %35, %36 --> comp_fir1643, comp_fir1619 +comp_fir1619 : emit c19 --> comp_fir1618 +comp_fir1618 : li %19, 1 --> comp_fir1617 +comp_fir1617 : add %17, %8, %19 --> comp_fir1616 +comp_fir1616 : li %18, 16 --> comp_fir1615 +comp_fir1615 : la %137, mod --> comp_fir16194 +comp_fir16194: call %8, %137(%17, %18) --> comp_fir1614 +comp_fir1614 : emit c18 --> comp_fir1613 +comp_fir1613 : li %16, 4 --> comp_fir1612 +comp_fir1612 : mulo %15, %6, %16 --> comp_fir1611 +comp_fir1611 : add %131, %2, %15 --> comp_fir16188 +comp_fir16188: sw %4, 0(%131) --> comp_fir1610 +comp_fir1610 : emit c28 --> comp_fir169 +comp_fir169 : li %14, 1 --> comp_fir168 +comp_fir168 : add %6, %6, %14 --> comp_fir167 +comp_fir1643 : emit c22 --> comp_fir1642 +comp_fir1642 : addi %32, STACK, 0 --> comp_fir1641 +comp_fir1641 : li %34, 4 --> comp_fir1640 +comp_fir1640 : mulo %33, %8, %34 --> comp_fir1639 +comp_fir1639 : add %145, %32, %33 --> comp_fir16202 +comp_fir16202: lw %28, 0(%145) --> comp_fir1638 +comp_fir1638 : li %31, 4 --> comp_fir1637 +comp_fir1637 : mulo %30, %7, %31 --> comp_fir1636 +comp_fir1636 : add %144, %1, %30 --> comp_fir16201 +comp_fir16201: lw %29, 0(%144) --> comp_fir1635 +comp_fir1635 : mulo %24, %28, %29 --> comp_fir1634 +comp_fir1634 : li %26, 2 --> comp_fir1633 +comp_fir1633 : li %27, 16 --> comp_fir1632 +comp_fir1632 : xor %25, %26, %27 --> comp_fir1631 +comp_fir1631 : mulo %5, %24, %25 --> comp_fir1630 +comp_fir1630 : emit c21 --> comp_fir1629 +comp_fir1629 : add %4, %4, %5 --> comp_fir1628 +comp_fir1628 : emit c20 --> comp_fir1627 +comp_fir1627 : li %23, 1 --> comp_fir1626 +comp_fir1626 : add %21, %8, %23 --> comp_fir1625 +comp_fir1625 : li %22, 16 --> comp_fir1624 +comp_fir1624 : la %143, mod --> comp_fir16200 +comp_fir16200: call %8, %143(%21, %22) --> comp_fir1623 +comp_fir1623 : emit c23 --> comp_fir1622 +comp_fir1622 : li %20, 1 --> comp_fir1621 +comp_fir1621 : add %7, %7, %20 --> comp_fir1620 + +function _main() : %1 +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125 +entry main297 +main297: li %0, 0 --> main296 +main296: li %2, 0 --> main295 +main295: li %3, 0 --> main294 +main294: li %4, 0 --> main293 +main293: li %5, 0 --> main292 +main292: li %6, 0 --> main291 +main291: li %7, 0 --> main290 +main290: li %8, 0 --> main289 +main289: li %9, 0 --> main288 +main288: li %10, 0 --> main287 +main287: li %11, 0 --> main286 +main286: li %12, 0 --> main285 +main285: li %13, 0 --> main284 +main284: li %14, 0 --> main283 +main283: li %15, 0 --> main282 +main282: li %16, 0 --> main281 +main281: li %17, 0 --> main280 +main280: li %18, 0 --> main279 +main279: li %19, 0 --> main278 +main278: li %20, 0 --> main277 +main277: li %21, 0 --> main276 +main276: li %22, 0 --> main275 +main275: li %23, 0 --> main274 +main274: li %24, 0 --> main273 +main273: li %25, 0 --> main272 +main272: li %26, 0 --> main271 +main271: li %27, 0 --> main270 +main270: li %28, 0 --> main269 +main269: li %29, 0 --> main268 +main268: li %30, 0 --> main267 +main267: li %31, 0 --> main266 +main266: li %32, 0 --> main265 +main265: li %33, 0 --> main264 +main264: li %34, 0 --> main263 +main263: li %35, 0 --> main262 +main262: li %36, 0 --> main261 +main261: li %37, 0 --> main260 +main260: li %38, 0 --> main259 +main259: li %39, 0 --> main258 +main258: li %40, 0 --> main257 +main257: li %41, 0 --> main256 +main256: li %42, 0 --> main255 +main255: li %43, 0 --> main254 +main254: li %44, 0 --> main253 +main253: li %45, 0 --> main252 +main252: li %46, 0 --> main251 +main251: li %47, 0 --> main250 +main250: li %48, 0 --> main249 +main249: li %49, 0 --> main248 +main248: li %50, 0 --> main247 +main247: li %51, 0 --> main246 +main246: li %52, 0 --> main245 +main245: li %53, 0 --> main244 +main244: li %54, 0 --> main243 +main243: li %55, 0 --> main242 +main242: li %56, 0 --> main241 +main241: li %57, 0 --> main240 +main240: li %58, 0 --> main239 +main239: li %59, 0 --> main238 +main238: li %60, 0 --> main237 +main237: li %61, 0 --> main236 +main236: li %62, 0 --> main235 +main235: li %63, 0 --> main234 +main234: li %64, 0 --> main233 +main233: li %65, 0 --> main232 +main232: li %66, 0 --> main231 +main231: li %67, 0 --> main230 +main230: li %68, 0 --> main229 +main229: li %69, 0 --> main228 +main228: li %70, 0 --> main227 +main227: li %71, 0 --> main226 +main226: li %72, 0 --> main225 +main225: li %73, 0 --> main224 +main224: li %74, 0 --> main223 +main223: li %75, 0 --> main222 +main222: li %76, 0 --> main221 +main221: li %77, 0 --> main220 +main220: li %78, 0 --> main219 +main219: li %79, 0 --> main218 +main218: li %80, 0 --> main217 +main217: li %81, 0 --> main216 +main216: li %82, 0 --> main215 +main215: li %83, 0 --> main214 +main214: li %84, 0 --> main213 +main213: li %85, 0 --> main212 +main212: li %86, 0 --> main211 +main211: li %87, 0 --> main210 +main210: li %88, 0 --> main209 +main209: li %89, 0 --> main208 +main208: li %90, 0 --> main207 +main207: li %91, 0 --> main206 +main206: li %92, 0 --> main205 +main205: li %93, 0 --> main204 +main204: li %94, 0 --> main203 +main203: li %95, 0 --> main202 +main202: li %96, 0 --> main201 +main201: li %97, 0 --> main200 +main200: li %98, 0 --> main199 +main199: li %99, 0 --> main198 +main198: li %100, 0 --> main197 +main197: li %101, 0 --> main196 +main196: li %102, 0 --> main195 +main195: li %103, 0 --> main194 +main194: li %104, 0 --> main193 +main193: li %105, 0 --> main192 +main192: li %106, 0 --> main191 +main191: li %107, 0 --> main190 +main190: li %108, 0 --> main189 +main189: li %109, 0 --> main188 +main188: li %110, 0 --> main187 +main187: li %111, 0 --> main186 +main186: li %112, 0 --> main185 +main185: li %113, 0 --> main184 +main184: li %114, 0 --> main183 +main183: li %115, 0 --> main182 +main182: li %116, 0 --> main181 +main181: li %117, 0 --> main180 +main180: li %118, 0 --> main179 +main179: li %119, 0 --> main178 +main178: li %120, 0 --> main177 +main177: li %121, 0 --> main176 +main176: li %122, 0 --> main175 +main175: li %123, 0 --> main174 +main174: li %124, 0 --> main173 +main173: li %125, 0 --> main149 +main149: emit c165 --> main148 +main148: li %98, 10 --> main147 +main147: addi %99, STACK, 0 --> main146 +main146: li %101, 0 --> main145 +main145: li %102, 4 --> main144 +main144: mulo %100, %101, %102 --> main143 +main143: add %110, %99, %100 --> main157 +main157: sw %98, 0(%110) --> main142 +main142: emit c164 --> main141 +main141: li %93, 9 --> main140 +main140: addi %94, STACK, 0 --> main139 +main139: li %96, 1 --> main138 +main138: li %97, 4 --> main137 +main137: mulo %95, %96, %97 --> main136 +main136: add %109, %94, %95 --> main156 +main156: sw %93, 0(%109) --> main135 +main135: emit c163 --> main134 +main134: li %88, 8 --> main133 +main133: addi %89, STACK, 0 --> main132 +main132: li %91, 2 --> main131 +main131: li %92, 4 --> main130 +main130: mulo %90, %91, %92 --> main129 +main129: add %108, %89, %90 --> main155 +main155: sw %88, 0(%108) --> main128 +main128: emit c162 --> main127 +main127: li %83, 7 --> main126 +main126: addi %84, STACK, 0 --> main125 +main125: li %86, 3 --> main124 +main124: li %87, 4 --> main123 +main123: mulo %85, %86, %87 --> main122 +main122: add %107, %84, %85 --> main154 +main154: sw %83, 0(%107) --> main121 +main121: emit c161 --> main120 +main120: li %78, 6 --> main119 +main119: addi %79, STACK, 0 --> main118 +main118: li %81, 4 --> main117 +main117: li %82, 4 --> main116 +main116: mulo %80, %81, %82 --> main115 +main115: add %106, %79, %80 --> main153 +main153: sw %78, 0(%106) --> main114 +main114: emit c160 --> main113 +main113: li %73, 0 --> main112 +main112: addi %74, STACK, 0 --> main111 +main111: li %76, 5 --> main110 +main110: li %77, 4 --> main109 +main109: mulo %75, %76, %77 --> main108 +main108: add %104, %74, %75 --> main151 +main151: sw %73, 0(%104) --> main107 +main107: emit c159 --> main106 +main106: li %68, 5 --> main105 +main105: addi %69, STACK, 0 --> main104 +main104: li %71, 6 --> main103 +main103: li %72, 4 --> main102 +main102: mulo %70, %71, %72 --> main101 +main101: add %103, %69, %70 --> main150 +main150: sw %68, 0(%103) --> main100 +main100: emit c158 --> main99 +main99 : li %63, 4 --> main98 +main98 : addi %64, STACK, 0 --> main97 +main97 : li %66, 7 --> main96 +main96 : li %67, 4 --> main95 +main95 : mulo %65, %66, %67 --> main94 +main94 : add %125, %64, %65 --> main172 +main172: sw %63, 0(%125) --> main93 +main93 : emit c157 --> main92 +main92 : li %58, 3 --> main91 +main91 : addi %59, STACK, 0 --> main90 +main90 : li %61, 8 --> main89 +main89 : li %62, 4 --> main88 +main88 : mulo %60, %61, %62 --> main87 +main87 : add %124, %59, %60 --> main171 +main171: sw %58, 0(%124) --> main86 +main86 : emit c156 --> main85 +main85 : li %53, 2 --> main84 +main84 : addi %54, STACK, 0 --> main83 +main83 : li %56, 9 --> main82 +main82 : li %57, 4 --> main81 +main81 : mulo %55, %56, %57 --> main80 +main80 : add %123, %54, %55 --> main170 +main170: sw %53, 0(%123) --> main79 +main79 : emit c155 --> main78 +main78 : li %48, 0 --> main77 +main77 : addi %49, STACK, 0 --> main76 +main76 : li %51, 10 --> main75 +main75 : li %52, 4 --> main74 +main74 : mulo %50, %51, %52 --> main73 +main73 : add %122, %49, %50 --> main169 +main169: sw %48, 0(%122) --> main72 +main72 : emit c154 --> main71 +main71 : li %43, 0 --> main70 +main70 : addi %44, STACK, 0 --> main69 +main69 : li %46, 11 --> main68 +main68 : li %47, 4 --> main67 +main67 : mulo %45, %46, %47 --> main66 +main66 : add %121, %44, %45 --> main168 +main168: sw %43, 0(%121) --> main65 +main65 : emit c153 --> main64 +main64 : li %38, 0 --> main63 +main63 : addi %39, STACK, 0 --> main62 +main62 : li %41, 12 --> main61 +main61 : li %42, 4 --> main60 +main60 : mulo %40, %41, %42 --> main59 +main59 : add %120, %39, %40 --> main167 +main167: sw %38, 0(%120) --> main58 +main58 : emit c152 --> main57 +main57 : li %33, 0 --> main56 +main56 : addi %34, STACK, 0 --> main55 +main55 : li %36, 13 --> main54 +main54 : li %37, 4 --> main53 +main53 : mulo %35, %36, %37 --> main52 +main52 : add %119, %34, %35 --> main166 +main166: sw %33, 0(%119) --> main51 +main51 : emit c151 --> main50 +main50 : li %28, 0 --> main49 +main49 : addi %29, STACK, 0 --> main48 +main48 : li %31, 14 --> main47 +main47 : li %32, 4 --> main46 +main46 : mulo %30, %31, %32 --> main45 +main45 : add %117, %29, %30 --> main164 +main164: sw %28, 0(%117) --> main44 +main44 : emit c150 --> main43 +main43 : li %23, 0 --> main42 +main42 : addi %24, STACK, 0 --> main41 +main41 : li %26, 15 --> main40 +main40 : li %27, 4 --> main39 +main39 : mulo %25, %26, %27 --> main38 +main38 : add %116, %24, %25 --> main163 +main163: sw %23, 0(%116) --> main37 +main37 : emit c149 --> main36 +main36 : addi %18, STACK, 0 --> main35 +main35 : addi %19, STACK, 0 --> main34 +main34 : addi %20, STACK, 0 --> main33 +main33 : li %21, 10 --> main32 +main32 : li %22, 10 --> main31 +main31 : la %115, comp_fir_basic --> main162 +main162: call %0, %115(%18, %19, %20, %21, %22) --> main30 +main30 : emit c148 --> main29 +main29 : addi %14, STACK, 0 --> main28 +main28 : addi %15, STACK, 0 --> main27 +main27 : addi %16, STACK, 0 --> main26 +main26 : li %17, 16 --> main25 +main25 : la %113, comp_fir16 --> main160 +main160: call %0, %113(%14, %15, %16, %17) --> main24 +main24 : emit c147 --> main23 +main23 : li %11, 4 --> main22 +main22 : li %12, 1 --> main21 +main21 : li %13, 1 --> main20 +main20 : la %112, comp_ifFor --> main159 +main159: call %0, %112(%11, %12, %13) --> main19 +main19 : emit c146 --> main18 +main18 : addi %8, STACK, 0 --> main17 +main17 : li %9, 9 --> main16 +main16 : li %10, 3 --> main15 +main15 : la %111, comp_total --> main158 +main158: call %0, %111(%8, %9, %10) --> main14 +main14 : emit c145 --> main13 +main13 : addi %6, STACK, 0 --> main12 +main12 : li %7, 10 --> main11 +main11 : la %105, comp_tri --> main152 +main152: call %0, %105(%6, %7) --> main10 +main10 : emit c144 --> main9 +main9 : addi %2, STACK, 0 --> main8 +main8 : addi %3, STACK, 0 --> main7 +main7 : li %4, 10 --> main6 +main6 : li %5, 10 --> main5 +main5 : la %118, comp_forif2 --> main165 +main165: call %0, %118(%2, %3, %4, %5) --> main4 +main4 : emit c143 --> main3 +main3 : la %114, comp_forif --> main161 +main161: call %0, %114() --> main2 +main2 : emit c142 --> main1 +main1 : move %1, %0 --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/complets.RTLabs.expected b/tests/clight/complets.RTLabs.expected new file mode 100644 index 0000000..e45d49b --- /dev/null +++ b/tests/clight/complets.RTLabs.expected @@ -0,0 +1,1289 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "comp_fir_basic"(%0, %1, %2, %3, %4): int -> int -> int -> int -> int -> int + locals: %9, %5, %6, %7, %8, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44 + result: %9 + stacksize: 0 + entry: comp_fir_basic69 + exit: comp_fir_basic0 + + comp_fir_basic9: imm_int 1, %11, --> comp_fir_basic8 + comp_fir_basic8: sub %7, %7, %11 --> comp_fir_basic7 + comp_fir_basic7: --> comp_fir_basic25 + comp_fir_basic69: emit c16 --> comp_fir_basic68 + comp_fir_basic68: imm_int 0, %5, --> comp_fir_basic67 + comp_fir_basic67: emit c15 --> comp_fir_basic66 + comp_fir_basic66: emit c14 --> comp_fir_basic65 + comp_fir_basic65: imm_int 0, %6, --> comp_fir_basic3 + comp_fir_basic64: imm_int 0, %42, --> comp_fir_basic63 + comp_fir_basic63: emit c13 --> comp_fir_basic62 + comp_fir_basic62: imm_int 3, %44, --> comp_fir_basic61 + comp_fir_basic61: lt %43, %6, %44 --> comp_fir_basic60 + comp_fir_basic60: notbool %41, %43 --> comp_fir_basic59 + comp_fir_basic6: emit c12 --> comp_fir_basic5 + comp_fir_basic59: eq %41, %42 --> comp_fir_basic58, comp_fir_basic2 + comp_fir_basic58: emit c11 --> comp_fir_basic57 + comp_fir_basic57: imm_int 4, %40, --> comp_fir_basic56 + comp_fir_basic56: mul %39, %6, %40 --> comp_fir_basic55 + comp_fir_basic55: load int32, add, %0, %39, %35 --> comp_fir_basic54 + comp_fir_basic54: imm_int 0, %37, --> comp_fir_basic53 + comp_fir_basic53: imm_int 4, %38, --> comp_fir_basic52 + comp_fir_basic52: mul %36, %37, %38 --> comp_fir_basic51 + comp_fir_basic51: store int32, add, %2, %36, %35 --> comp_fir_basic50 + comp_fir_basic50: emit c10 --> comp_fir_basic49 + comp_fir_basic5: imm_int 1, %10, --> comp_fir_basic4 + comp_fir_basic49: emit c9 --> comp_fir_basic48 + comp_fir_basic48: imm_int 0, %8, --> comp_fir_basic29 + comp_fir_basic47: imm_int 0, %32, --> comp_fir_basic46 + comp_fir_basic46: emit c8 --> comp_fir_basic45 + comp_fir_basic45: imm_int 3, %34, --> comp_fir_basic44 + comp_fir_basic44: lt %33, %8, %34 --> comp_fir_basic43 + comp_fir_basic43: notbool %31, %33 --> comp_fir_basic42 + comp_fir_basic42: eq %31, %32 --> comp_fir_basic41, comp_fir_basic28 + comp_fir_basic41: emit c6 --> comp_fir_basic40 + comp_fir_basic40: imm_int 4, %30, --> comp_fir_basic39 + comp_fir_basic4: add %6, %6, %10 --> comp_fir_basic3 + comp_fir_basic39: mul %29, %8, %30 --> comp_fir_basic38 + comp_fir_basic38: load int32, add, %1, %29, %25 --> comp_fir_basic37 + comp_fir_basic37: imm_int 4, %28, --> comp_fir_basic36 + comp_fir_basic36: mul %27, %8, %28 --> comp_fir_basic35 + comp_fir_basic35: load int32, add, %2, %27, %26 --> comp_fir_basic34 + comp_fir_basic34: mul %24, %25, %26 --> comp_fir_basic33 + comp_fir_basic33: add %5, %5, %24 --> comp_fir_basic32 + comp_fir_basic32: emit c7 --> comp_fir_basic31 + comp_fir_basic31: imm_int 1, %23, --> comp_fir_basic30 + comp_fir_basic30: add %8, %8, %23 --> comp_fir_basic29 + comp_fir_basic3: --> comp_fir_basic64 + comp_fir_basic29: --> comp_fir_basic47 + comp_fir_basic28: emit c5 --> comp_fir_basic27 + comp_fir_basic27: emit c4 --> comp_fir_basic26 + comp_fir_basic26: imm_int 2, %7, --> comp_fir_basic7 + comp_fir_basic25: imm_int 0, %20, --> comp_fir_basic24 + comp_fir_basic24: emit c3 --> comp_fir_basic23 + comp_fir_basic23: imm_int 0, %22, --> comp_fir_basic22 + comp_fir_basic22: ge %21, %7, %22 --> comp_fir_basic21 + comp_fir_basic21: notbool %19, %21 --> comp_fir_basic20 + comp_fir_basic20: eq %19, %20 --> comp_fir_basic19, comp_fir_basic6 + comp_fir_basic2: emit c0 --> comp_fir_basic1 + comp_fir_basic19: emit c1 --> comp_fir_basic18 + comp_fir_basic18: imm_int 4, %18, --> comp_fir_basic17 + comp_fir_basic17: mul %17, %7, %18 --> comp_fir_basic16 + comp_fir_basic16: load int32, add, %2, %17, %12 --> comp_fir_basic15 + comp_fir_basic15: imm_int 1, %16, --> comp_fir_basic14 + comp_fir_basic14: add %14, %7, %16 --> comp_fir_basic13 + comp_fir_basic13: imm_int 4, %15, --> comp_fir_basic12 + comp_fir_basic12: mul %13, %14, %15 --> comp_fir_basic11 + comp_fir_basic11: store int32, add, %2, %13, %12 --> comp_fir_basic10 + comp_fir_basic10: emit c2 --> comp_fir_basic9 + comp_fir_basic1: mov %9, %5 --> comp_fir_basic0 + comp_fir_basic0: return %9 + + + "comp_fir16"(%0, %1, %2, %3): int -> int -> int -> int -> int + locals: %9, %4, %5, %6, %7, %8, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77, %78, %79, %80, %81, %82, %83, %84, %85, %86, %87, %88, %89, %90, %91, %92, %93, %94, %95, %96, %97, %98, %99, %100, %101, %102, %103, %104, %105, %106, %107, %108, %109, %110, %111, %112, %113, %114, %115, %116, %117, %118, %119, %120, %121, %122, %123, %124, %125, %126, %127 + result: %9 + stacksize: 64 + entry: comp_fir16184 + exit: comp_fir160 + + comp_fir1699: imm_int 0, %63, --> comp_fir1698 + comp_fir1698: imm_addr 0($sp), %64, --> comp_fir1697 + comp_fir1697: imm_int 12, %66, --> comp_fir1696 + comp_fir1696: imm_int 4, %67, --> comp_fir1695 + comp_fir1695: mul %65, %66, %67 --> comp_fir1694 + comp_fir1694: store int32, add, %64, %65, %63 --> comp_fir1693 + comp_fir1693: emit c36 --> comp_fir1692 + comp_fir1692: imm_int 0, %58, --> comp_fir1691 + comp_fir1691: imm_addr 0($sp), %59, --> comp_fir1690 + comp_fir1690: imm_int 13, %61, --> comp_fir1689 + comp_fir169: imm_int 1, %14, --> comp_fir168 + comp_fir1689: imm_int 4, %62, --> comp_fir1688 + comp_fir1688: mul %60, %61, %62 --> comp_fir1687 + comp_fir1687: store int32, add, %59, %60, %58 --> comp_fir1686 + comp_fir1686: emit c35 --> comp_fir1685 + comp_fir1685: imm_int 0, %53, --> comp_fir1684 + comp_fir1684: imm_addr 0($sp), %54, --> comp_fir1683 + comp_fir1683: imm_int 14, %56, --> comp_fir1682 + comp_fir1682: imm_int 4, %57, --> comp_fir1681 + comp_fir1681: mul %55, %56, %57 --> comp_fir1680 + comp_fir1680: store int32, add, %54, %55, %53 --> comp_fir1679 + comp_fir168: add %6, %6, %14 --> comp_fir167 + comp_fir1679: emit c34 --> comp_fir1678 + comp_fir1678: imm_int 0, %48, --> comp_fir1677 + comp_fir1677: imm_addr 0($sp), %49, --> comp_fir1676 + comp_fir1676: imm_int 15, %51, --> comp_fir1675 + comp_fir1675: imm_int 4, %52, --> comp_fir1674 + comp_fir1674: mul %50, %51, %52 --> comp_fir1673 + comp_fir1673: store int32, add, %49, %50, %48 --> comp_fir1672 + comp_fir1672: emit c33 --> comp_fir1671 + comp_fir1671: imm_int 0, %8, --> comp_fir1670 + comp_fir1670: emit c32 --> comp_fir1669 + comp_fir167: --> comp_fir1665 + comp_fir1669: imm_int 0, %4, --> comp_fir1668 + comp_fir1668: emit c31 --> comp_fir1667 + comp_fir1667: emit c30 --> comp_fir1666 + comp_fir1666: imm_int 0, %6, --> comp_fir167 + comp_fir1665: imm_int 0, %46, --> comp_fir1664 + comp_fir1664: emit c29 --> comp_fir1663 + comp_fir1663: lt %47, %6, %3 --> comp_fir1662 + comp_fir1662: notbool %45, %47 --> comp_fir1661 + comp_fir1661: eq %45, %46 --> comp_fir1660, comp_fir166 + comp_fir1660: emit c27 --> comp_fir1659 + comp_fir166: emit c17 --> comp_fir165 + comp_fir1659: imm_int 4, %44, --> comp_fir1658 + comp_fir1658: mul %43, %6, %44 --> comp_fir1657 + comp_fir1657: load int32, add, %0, %43, %39 --> comp_fir1656 + comp_fir1656: imm_addr 0($sp), %40, --> comp_fir1655 + comp_fir1655: imm_int 4, %42, --> comp_fir1654 + comp_fir1654: mul %41, %8, %42 --> comp_fir1653 + comp_fir1653: store int32, add, %40, %41, %39 --> comp_fir1652 + comp_fir1652: emit c26 --> comp_fir1651 + comp_fir1651: emit c25 --> comp_fir1650 + comp_fir1650: imm_int 0, %7, --> comp_fir1620 + comp_fir165: imm_addr 0($sp), %10, --> comp_fir164 + comp_fir1649: imm_int 0, %36, --> comp_fir1648 + comp_fir1648: emit c24 --> comp_fir1647 + comp_fir1647: imm_int 16, %38, --> comp_fir1646 + comp_fir1646: lt %37, %7, %38 --> comp_fir1645 + comp_fir1645: notbool %35, %37 --> comp_fir1644 + comp_fir1644: eq %35, %36 --> comp_fir1643, comp_fir1619 + comp_fir1643: emit c22 --> comp_fir1642 + comp_fir1642: imm_addr 0($sp), %32, --> comp_fir1641 + comp_fir1641: imm_int 4, %34, --> comp_fir1640 + comp_fir1640: mul %33, %8, %34 --> comp_fir1639 + comp_fir164: imm_int 0, %12, --> comp_fir163 + comp_fir1639: load int32, add, %32, %33, %28 --> comp_fir1638 + comp_fir1638: imm_int 4, %31, --> comp_fir1637 + comp_fir1637: mul %30, %7, %31 --> comp_fir1636 + comp_fir1636: load int32, add, %1, %30, %29 --> comp_fir1635 + comp_fir1635: mul %24, %28, %29 --> comp_fir1634 + comp_fir1634: imm_int 2, %26, --> comp_fir1633 + comp_fir1633: imm_int 16, %27, --> comp_fir1632 + comp_fir1632: xor %25, %26, %27 --> comp_fir1631 + comp_fir1631: mul %5, %24, %25 --> comp_fir1630 + comp_fir1630: emit c21 --> comp_fir1629 + comp_fir163: imm_int 4, %13, --> comp_fir162 + comp_fir1629: add %4, %4, %5 --> comp_fir1628 + comp_fir1628: emit c20 --> comp_fir1627 + comp_fir1627: imm_int 1, %23, --> comp_fir1626 + comp_fir1626: add %21, %8, %23 --> comp_fir1625 + comp_fir1625: imm_int 16, %22, --> comp_fir1624 + comp_fir1624: mod %8, %21, %22 --> comp_fir1623 + comp_fir1623: emit c23 --> comp_fir1622 + comp_fir1622: imm_int 1, %20, --> comp_fir1621 + comp_fir1621: add %7, %7, %20 --> comp_fir1620 + comp_fir1620: --> comp_fir1649 + comp_fir162: mul %11, %12, %13 --> comp_fir161 + comp_fir1619: emit c19 --> comp_fir1618 + comp_fir16184: emit c49 --> comp_fir16183 + comp_fir16183: imm_int 0, %123, --> comp_fir16182 + comp_fir16182: imm_addr 0($sp), %124, --> comp_fir16181 + comp_fir16181: imm_int 0, %126, --> comp_fir16180 + comp_fir16180: imm_int 4, %127, --> comp_fir16179 + comp_fir1618: imm_int 1, %19, --> comp_fir1617 + comp_fir16179: mul %125, %126, %127 --> comp_fir16178 + comp_fir16178: store int32, add, %124, %125, %123 --> comp_fir16177 + comp_fir16177: emit c48 --> comp_fir16176 + comp_fir16176: imm_int 0, %118, --> comp_fir16175 + comp_fir16175: imm_addr 0($sp), %119, --> comp_fir16174 + comp_fir16174: imm_int 1, %121, --> comp_fir16173 + comp_fir16173: imm_int 4, %122, --> comp_fir16172 + comp_fir16172: mul %120, %121, %122 --> comp_fir16171 + comp_fir16171: store int32, add, %119, %120, %118 --> comp_fir16170 + comp_fir16170: emit c47 --> comp_fir16169 + comp_fir1617: add %17, %8, %19 --> comp_fir1616 + comp_fir16169: imm_int 0, %113, --> comp_fir16168 + comp_fir16168: imm_addr 0($sp), %114, --> comp_fir16167 + comp_fir16167: imm_int 2, %116, --> comp_fir16166 + comp_fir16166: imm_int 4, %117, --> comp_fir16165 + comp_fir16165: mul %115, %116, %117 --> comp_fir16164 + comp_fir16164: store int32, add, %114, %115, %113 --> comp_fir16163 + comp_fir16163: emit c46 --> comp_fir16162 + comp_fir16162: imm_int 0, %108, --> comp_fir16161 + comp_fir16161: imm_addr 0($sp), %109, --> comp_fir16160 + comp_fir16160: imm_int 3, %111, --> comp_fir16159 + comp_fir1616: imm_int 16, %18, --> comp_fir1615 + comp_fir16159: imm_int 4, %112, --> comp_fir16158 + comp_fir16158: mul %110, %111, %112 --> comp_fir16157 + comp_fir16157: store int32, add, %109, %110, %108 --> comp_fir16156 + comp_fir16156: emit c45 --> comp_fir16155 + comp_fir16155: imm_int 0, %103, --> comp_fir16154 + comp_fir16154: imm_addr 0($sp), %104, --> comp_fir16153 + comp_fir16153: imm_int 4, %106, --> comp_fir16152 + comp_fir16152: imm_int 4, %107, --> comp_fir16151 + comp_fir16151: mul %105, %106, %107 --> comp_fir16150 + comp_fir16150: store int32, add, %104, %105, %103 --> comp_fir16149 + comp_fir1615: mod %8, %17, %18 --> comp_fir1614 + comp_fir16149: emit c44 --> comp_fir16148 + comp_fir16148: imm_int 0, %98, --> comp_fir16147 + comp_fir16147: imm_addr 0($sp), %99, --> comp_fir16146 + comp_fir16146: imm_int 5, %101, --> comp_fir16145 + comp_fir16145: imm_int 4, %102, --> comp_fir16144 + comp_fir16144: mul %100, %101, %102 --> comp_fir16143 + comp_fir16143: store int32, add, %99, %100, %98 --> comp_fir16142 + comp_fir16142: emit c43 --> comp_fir16141 + comp_fir16141: imm_int 0, %93, --> comp_fir16140 + comp_fir16140: imm_addr 0($sp), %94, --> comp_fir16139 + comp_fir1614: emit c18 --> comp_fir1613 + comp_fir16139: imm_int 6, %96, --> comp_fir16138 + comp_fir16138: imm_int 4, %97, --> comp_fir16137 + comp_fir16137: mul %95, %96, %97 --> comp_fir16136 + comp_fir16136: store int32, add, %94, %95, %93 --> comp_fir16135 + comp_fir16135: emit c42 --> comp_fir16134 + comp_fir16134: imm_int 0, %88, --> comp_fir16133 + comp_fir16133: imm_addr 0($sp), %89, --> comp_fir16132 + comp_fir16132: imm_int 7, %91, --> comp_fir16131 + comp_fir16131: imm_int 4, %92, --> comp_fir16130 + comp_fir16130: mul %90, %91, %92 --> comp_fir16129 + comp_fir1613: imm_int 4, %16, --> comp_fir1612 + comp_fir16129: store int32, add, %89, %90, %88 --> comp_fir16128 + comp_fir16128: emit c41 --> comp_fir16127 + comp_fir16127: imm_int 0, %83, --> comp_fir16126 + comp_fir16126: imm_addr 0($sp), %84, --> comp_fir16125 + comp_fir16125: imm_int 8, %86, --> comp_fir16124 + comp_fir16124: imm_int 4, %87, --> comp_fir16123 + comp_fir16123: mul %85, %86, %87 --> comp_fir16122 + comp_fir16122: store int32, add, %84, %85, %83 --> comp_fir16121 + comp_fir16121: emit c40 --> comp_fir16120 + comp_fir16120: imm_int 0, %78, --> comp_fir16119 + comp_fir1612: mul %15, %6, %16 --> comp_fir1611 + comp_fir16119: imm_addr 0($sp), %79, --> comp_fir16118 + comp_fir16118: imm_int 9, %81, --> comp_fir16117 + comp_fir16117: imm_int 4, %82, --> comp_fir16116 + comp_fir16116: mul %80, %81, %82 --> comp_fir16115 + comp_fir16115: store int32, add, %79, %80, %78 --> comp_fir16114 + comp_fir16114: emit c39 --> comp_fir16113 + comp_fir16113: imm_int 0, %73, --> comp_fir16112 + comp_fir16112: imm_addr 0($sp), %74, --> comp_fir16111 + comp_fir16111: imm_int 10, %76, --> comp_fir16110 + comp_fir16110: imm_int 4, %77, --> comp_fir16109 + comp_fir1611: store int32, add, %2, %15, %4 --> comp_fir1610 + comp_fir16109: mul %75, %76, %77 --> comp_fir16108 + comp_fir16108: store int32, add, %74, %75, %73 --> comp_fir16107 + comp_fir16107: emit c38 --> comp_fir16106 + comp_fir16106: imm_int 0, %68, --> comp_fir16105 + comp_fir16105: imm_addr 0($sp), %69, --> comp_fir16104 + comp_fir16104: imm_int 11, %71, --> comp_fir16103 + comp_fir16103: imm_int 4, %72, --> comp_fir16102 + comp_fir16102: mul %70, %71, %72 --> comp_fir16101 + comp_fir16101: store int32, add, %69, %70, %68 --> comp_fir16100 + comp_fir16100: emit c37 --> comp_fir1699 + comp_fir1610: emit c28 --> comp_fir169 + comp_fir161: load int32, add, %10, %11, %9 --> comp_fir160 + comp_fir160: return %9 + + + "comp_ifFor"(%0, %1, %2): int -> int -> int -> int + locals: %5, %3, %4, %6, %7, %8, %9, %10 + result: %5 + stacksize: 0 + entry: comp_ifFor23 + exit: comp_ifFor0 + + comp_ifFor9: emit c52 --> comp_ifFor8 + comp_ifFor8: add %4, %4, %3 --> comp_ifFor5 + comp_ifFor7: emit c51 --> comp_ifFor6 + comp_ifFor6: imm_int 0, %4, --> comp_ifFor5 + comp_ifFor5: emit c54 --> comp_ifFor4 + comp_ifFor4: add %3, %3, %2 --> comp_ifFor3 + comp_ifFor3: --> comp_ifFor18 + comp_ifFor23: emit c58 --> comp_ifFor22 + comp_ifFor22: imm_int 0, %4, --> comp_ifFor21 + comp_ifFor21: emit c57 --> comp_ifFor20 + comp_ifFor20: emit c56 --> comp_ifFor19 + comp_ifFor2: emit c50 --> comp_ifFor1 + comp_ifFor19: imm_int 0, %3, --> comp_ifFor3 + comp_ifFor18: imm_int 0, %9, --> comp_ifFor17 + comp_ifFor17: emit c55 --> comp_ifFor16 + comp_ifFor16: lt %10, %3, %0 --> comp_ifFor15 + comp_ifFor15: notbool %8, %10 --> comp_ifFor14 + comp_ifFor14: eq %8, %9 --> comp_ifFor13, comp_ifFor2 + comp_ifFor13: emit c53 --> comp_ifFor12 + comp_ifFor12: imm_int 0, %7, --> comp_ifFor11 + comp_ifFor11: ne %6, %3, %1 --> comp_ifFor10 + comp_ifFor10: eq %6, %7 --> comp_ifFor7, comp_ifFor9 + comp_ifFor1: mov %5, %4 --> comp_ifFor0 + comp_ifFor0: return %5 + + + "comp_total"(%0, %1, %2): int -> int -> int -> int + locals: %6, %3, %4, %5, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77, %78, %79, %80, %81, %82, %83, %84, %85, %86, %87, %88, %89, %90, %91, %92, %93, %94, %95, %96, %97, %98, %99, %100, %101, %102, %103, %104, %105, %106, %107, %108, %109, %110, %111, %112, %113, %114, %115, %116, %117, %118, %119, %120, %121, %122, %123, %124, %125, %126, %127, %128, %129, %130, %131, %132, %133, %134, %135, %136, %137, %138, %139 + result: %6 + stacksize: 80 + entry: comp_total205 + exit: comp_total0 + + comp_total99: imm_int 0, %60, --> comp_total98 + comp_total98: imm_addr 40($sp), %61, --> comp_total97 + comp_total97: imm_int 5, %63, --> comp_total96 + comp_total96: imm_int 4, %64, --> comp_total95 + comp_total95: mul %62, %63, %64 --> comp_total94 + comp_total94: store int32, add, %61, %62, %60 --> comp_total93 + comp_total93: emit c78 --> comp_total92 + comp_total92: imm_int 0, %55, --> comp_total91 + comp_total91: imm_addr 40($sp), %56, --> comp_total90 + comp_total90: imm_int 6, %58, --> comp_total89 + comp_total9: imm_int 1, %8, --> comp_total8 + comp_total89: imm_int 4, %59, --> comp_total88 + comp_total88: mul %57, %58, %59 --> comp_total87 + comp_total87: store int32, add, %56, %57, %55 --> comp_total86 + comp_total86: emit c77 --> comp_total85 + comp_total85: imm_int 0, %50, --> comp_total84 + comp_total84: imm_addr 40($sp), %51, --> comp_total83 + comp_total83: imm_int 7, %53, --> comp_total82 + comp_total82: imm_int 4, %54, --> comp_total81 + comp_total81: mul %52, %53, %54 --> comp_total80 + comp_total80: store int32, add, %51, %52, %50 --> comp_total79 + comp_total8: sub %4, %4, %8 --> comp_total7 + comp_total79: emit c76 --> comp_total78 + comp_total78: imm_int 0, %45, --> comp_total77 + comp_total77: imm_addr 40($sp), %46, --> comp_total76 + comp_total76: imm_int 8, %48, --> comp_total75 + comp_total75: imm_int 4, %49, --> comp_total74 + comp_total74: mul %47, %48, %49 --> comp_total73 + comp_total73: store int32, add, %46, %47, %45 --> comp_total72 + comp_total72: emit c75 --> comp_total71 + comp_total71: imm_int 0, %40, --> comp_total70 + comp_total70: imm_addr 40($sp), %41, --> comp_total69 + comp_total7: --> comp_total29 + comp_total69: imm_int 9, %43, --> comp_total68 + comp_total68: imm_int 4, %44, --> comp_total67 + comp_total67: mul %42, %43, %44 --> comp_total66 + comp_total66: store int32, add, %41, %42, %40 --> comp_total65 + comp_total65: emit c74 --> comp_total64 + comp_total64: imm_int 0, %39, --> comp_total63 + comp_total63: lt %38, %1, %2 --> comp_total62 + comp_total62: eq %38, %39 --> comp_total40, comp_total61 + comp_total61: emit c73 --> comp_total60 + comp_total60: emit c72 --> comp_total59 + comp_total6: emit c65 --> comp_total5 + comp_total59: imm_int 0, %5, --> comp_total41 + comp_total58: imm_int 0, %36, --> comp_total57 + comp_total57: emit c71 --> comp_total56 + comp_total56: le %37, %5, %1 --> comp_total55 + comp_total55: notbool %35, %37 --> comp_total54 + comp_total54: eq %35, %36 --> comp_total53, comp_total2 + comp_total53: emit c69 --> comp_total52 + comp_total52: sub %33, %1, %5 --> comp_total51 + comp_total51: imm_int 4, %34, --> comp_total50 + comp_total50: mul %32, %33, %34 --> comp_total49 + comp_total5: imm_int 1, %7, --> comp_total4 + comp_total49: load int32, add, %0, %32, %28 --> comp_total48 + comp_total48: imm_addr 0($sp), %29, --> comp_total47 + comp_total47: imm_int 4, %31, --> comp_total46 + comp_total46: mul %30, %5, %31 --> comp_total45 + comp_total45: store int32, add, %29, %30, %28 --> comp_total44 + comp_total44: emit c70 --> comp_total43 + comp_total43: imm_int 1, %27, --> comp_total42 + comp_total42: add %5, %5, %27 --> comp_total41 + comp_total41: --> comp_total58 + comp_total40: emit c68 --> comp_total39 + comp_total4: add %3, %3, %7 --> comp_total3 + comp_total39: emit c67 --> comp_total38 + comp_total38: imm_int 0, %3, --> comp_total3 + comp_total37: imm_int 0, %25, --> comp_total36 + comp_total36: emit c66 --> comp_total35 + comp_total35: lt %26, %3, %1 --> comp_total34 + comp_total34: notbool %24, %26 --> comp_total33 + comp_total33: eq %24, %25 --> comp_total32, comp_total2 + comp_total32: emit c64 --> comp_total31 + comp_total31: emit c63 --> comp_total30 + comp_total30: mov %4, %2 --> comp_total7 + comp_total3: --> comp_total37 + comp_total29: imm_int 0, %21, --> comp_total28 + comp_total28: emit c62 --> comp_total27 + comp_total27: imm_int 0, %23, --> comp_total26 + comp_total26: gt %22, %4, %23 --> comp_total25 + comp_total25: notbool %20, %22 --> comp_total24 + comp_total24: eq %20, %21 --> comp_total23, comp_total6 + comp_total23: emit c60 --> comp_total22 + comp_total22: imm_addr 0($sp), %17, --> comp_total21 + comp_total21: imm_int 4, %19, --> comp_total20 + comp_total205: emit c94 --> comp_total204 + comp_total204: imm_int 0, %135, --> comp_total203 + comp_total203: imm_addr 0($sp), %136, --> comp_total202 + comp_total202: imm_int 0, %138, --> comp_total201 + comp_total201: imm_int 4, %139, --> comp_total200 + comp_total200: mul %137, %138, %139 --> comp_total199 + comp_total20: mul %18, %3, %19 --> comp_total19 + comp_total2: emit c59 --> comp_total1 + comp_total199: store int32, add, %136, %137, %135 --> comp_total198 + comp_total198: emit c93 --> comp_total197 + comp_total197: imm_int 0, %130, --> comp_total196 + comp_total196: imm_addr 0($sp), %131, --> comp_total195 + comp_total195: imm_int 1, %133, --> comp_total194 + comp_total194: imm_int 4, %134, --> comp_total193 + comp_total193: mul %132, %133, %134 --> comp_total192 + comp_total192: store int32, add, %131, %132, %130 --> comp_total191 + comp_total191: emit c92 --> comp_total190 + comp_total190: imm_int 0, %125, --> comp_total189 + comp_total19: load int32, add, %17, %18, %12 --> comp_total18 + comp_total189: imm_addr 0($sp), %126, --> comp_total188 + comp_total188: imm_int 2, %128, --> comp_total187 + comp_total187: imm_int 4, %129, --> comp_total186 + comp_total186: mul %127, %128, %129 --> comp_total185 + comp_total185: store int32, add, %126, %127, %125 --> comp_total184 + comp_total184: emit c91 --> comp_total183 + comp_total183: imm_int 0, %120, --> comp_total182 + comp_total182: imm_addr 0($sp), %121, --> comp_total181 + comp_total181: imm_int 3, %123, --> comp_total180 + comp_total180: imm_int 4, %124, --> comp_total179 + comp_total18: imm_addr 40($sp), %14, --> comp_total17 + comp_total179: mul %122, %123, %124 --> comp_total178 + comp_total178: store int32, add, %121, %122, %120 --> comp_total177 + comp_total177: emit c90 --> comp_total176 + comp_total176: imm_int 0, %115, --> comp_total175 + comp_total175: imm_addr 0($sp), %116, --> comp_total174 + comp_total174: imm_int 4, %118, --> comp_total173 + comp_total173: imm_int 4, %119, --> comp_total172 + comp_total172: mul %117, %118, %119 --> comp_total171 + comp_total171: store int32, add, %116, %117, %115 --> comp_total170 + comp_total170: emit c89 --> comp_total169 + comp_total17: imm_int 4, %16, --> comp_total16 + comp_total169: imm_int 0, %110, --> comp_total168 + comp_total168: imm_addr 0($sp), %111, --> comp_total167 + comp_total167: imm_int 5, %113, --> comp_total166 + comp_total166: imm_int 4, %114, --> comp_total165 + comp_total165: mul %112, %113, %114 --> comp_total164 + comp_total164: store int32, add, %111, %112, %110 --> comp_total163 + comp_total163: emit c88 --> comp_total162 + comp_total162: imm_int 0, %105, --> comp_total161 + comp_total161: imm_addr 0($sp), %106, --> comp_total160 + comp_total160: imm_int 6, %108, --> comp_total159 + comp_total16: mul %15, %4, %16 --> comp_total15 + comp_total159: imm_int 4, %109, --> comp_total158 + comp_total158: mul %107, %108, %109 --> comp_total157 + comp_total157: store int32, add, %106, %107, %105 --> comp_total156 + comp_total156: emit c87 --> comp_total155 + comp_total155: imm_int 0, %100, --> comp_total154 + comp_total154: imm_addr 0($sp), %101, --> comp_total153 + comp_total153: imm_int 7, %103, --> comp_total152 + comp_total152: imm_int 4, %104, --> comp_total151 + comp_total151: mul %102, %103, %104 --> comp_total150 + comp_total150: store int32, add, %101, %102, %100 --> comp_total149 + comp_total15: load int32, add, %14, %15, %13 --> comp_total14 + comp_total149: emit c86 --> comp_total148 + comp_total148: imm_int 0, %95, --> comp_total147 + comp_total147: imm_addr 0($sp), %96, --> comp_total146 + comp_total146: imm_int 8, %98, --> comp_total145 + comp_total145: imm_int 4, %99, --> comp_total144 + comp_total144: mul %97, %98, %99 --> comp_total143 + comp_total143: store int32, add, %96, %97, %95 --> comp_total142 + comp_total142: emit c85 --> comp_total141 + comp_total141: imm_int 0, %90, --> comp_total140 + comp_total140: imm_addr 0($sp), %91, --> comp_total139 + comp_total14: add %9, %12, %13 --> comp_total13 + comp_total139: imm_int 9, %93, --> comp_total138 + comp_total138: imm_int 4, %94, --> comp_total137 + comp_total137: mul %92, %93, %94 --> comp_total136 + comp_total136: store int32, add, %91, %92, %90 --> comp_total135 + comp_total135: emit c84 --> comp_total134 + comp_total134: imm_int 0, %85, --> comp_total133 + comp_total133: imm_addr 40($sp), %86, --> comp_total132 + comp_total132: imm_int 0, %88, --> comp_total131 + comp_total131: imm_int 4, %89, --> comp_total130 + comp_total130: mul %87, %88, %89 --> comp_total129 + comp_total13: imm_int 4, %11, --> comp_total12 + comp_total129: store int32, add, %86, %87, %85 --> comp_total128 + comp_total128: emit c83 --> comp_total127 + comp_total127: imm_int 0, %80, --> comp_total126 + comp_total126: imm_addr 40($sp), %81, --> comp_total125 + comp_total125: imm_int 1, %83, --> comp_total124 + comp_total124: imm_int 4, %84, --> comp_total123 + comp_total123: mul %82, %83, %84 --> comp_total122 + comp_total122: store int32, add, %81, %82, %80 --> comp_total121 + comp_total121: emit c82 --> comp_total120 + comp_total120: imm_int 0, %75, --> comp_total119 + comp_total12: mul %10, %3, %11 --> comp_total11 + comp_total119: imm_addr 40($sp), %76, --> comp_total118 + comp_total118: imm_int 2, %78, --> comp_total117 + comp_total117: imm_int 4, %79, --> comp_total116 + comp_total116: mul %77, %78, %79 --> comp_total115 + comp_total115: store int32, add, %76, %77, %75 --> comp_total114 + comp_total114: emit c81 --> comp_total113 + comp_total113: imm_int 0, %70, --> comp_total112 + comp_total112: imm_addr 40($sp), %71, --> comp_total111 + comp_total111: imm_int 3, %73, --> comp_total110 + comp_total110: imm_int 4, %74, --> comp_total109 + comp_total11: store int32, add, %0, %10, %9 --> comp_total10 + comp_total109: mul %72, %73, %74 --> comp_total108 + comp_total108: store int32, add, %71, %72, %70 --> comp_total107 + comp_total107: emit c80 --> comp_total106 + comp_total106: imm_int 0, %65, --> comp_total105 + comp_total105: imm_addr 40($sp), %66, --> comp_total104 + comp_total104: imm_int 4, %68, --> comp_total103 + comp_total103: imm_int 4, %69, --> comp_total102 + comp_total102: mul %67, %68, %69 --> comp_total101 + comp_total101: store int32, add, %66, %67, %65 --> comp_total100 + comp_total100: emit c79 --> comp_total99 + comp_total10: emit c61 --> comp_total9 + comp_total1: imm_int 0, %6, --> comp_total0 + comp_total0: return %6 + + + "comp_tri"(%0, %1): int -> int -> int + locals: %5, %2, %3, %4, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37 + result: %5 + stacksize: 0 + entry: comp_tri60 + exit: comp_tri0 + + comp_tri9: imm_int 1, %7, --> comp_tri8 + comp_tri8: add %3, %3, %7 --> comp_tri7 + comp_tri7: --> comp_tri47 + comp_tri60: emit c108 --> comp_tri59 + comp_tri6: emit c104 --> comp_tri5 + comp_tri59: imm_int 0, %2, --> comp_tri58 + comp_tri58: emit c107 --> comp_tri57 + comp_tri57: emit c106 --> comp_tri56 + comp_tri56: imm_int 0, %4, --> comp_tri3 + comp_tri55: imm_int 0, %36, --> comp_tri54 + comp_tri54: emit c105 --> comp_tri53 + comp_tri53: lt %37, %4, %1 --> comp_tri52 + comp_tri52: notbool %35, %37 --> comp_tri51 + comp_tri51: eq %35, %36 --> comp_tri50, comp_tri2 + comp_tri50: emit c103 --> comp_tri49 + comp_tri5: imm_int 1, %6, --> comp_tri4 + comp_tri49: emit c102 --> comp_tri48 + comp_tri48: imm_int 1, %3, --> comp_tri7 + comp_tri47: imm_int 0, %32, --> comp_tri46 + comp_tri46: emit c101 --> comp_tri45 + comp_tri45: sub %34, %1, %4 --> comp_tri44 + comp_tri44: lt %33, %3, %34 --> comp_tri43 + comp_tri43: notbool %31, %33 --> comp_tri42 + comp_tri42: eq %31, %32 --> comp_tri41, comp_tri6 + comp_tri41: emit c99 --> comp_tri40 + comp_tri40: imm_int 0, %22, --> comp_tri39 + comp_tri4: add %4, %4, %6 --> comp_tri3 + comp_tri39: imm_int 4, %30, --> comp_tri38 + comp_tri38: mul %29, %3, %30 --> comp_tri37 + comp_tri37: load int32, add, %0, %29, %23 --> comp_tri36 + comp_tri36: imm_int 1, %28, --> comp_tri35 + comp_tri35: sub %26, %3, %28 --> comp_tri34 + comp_tri34: imm_int 4, %27, --> comp_tri33 + comp_tri33: mul %25, %26, %27 --> comp_tri32 + comp_tri32: load int32, add, %0, %25, %24 --> comp_tri31 + comp_tri31: lt %21, %23, %24 --> comp_tri30 + comp_tri30: eq %21, %22 --> comp_tri10, comp_tri29 + comp_tri3: --> comp_tri55 + comp_tri29: emit c98 --> comp_tri28 + comp_tri28: imm_int 1, %20, --> comp_tri27 + comp_tri27: sub %18, %3, %20 --> comp_tri26 + comp_tri26: imm_int 4, %19, --> comp_tri25 + comp_tri25: mul %17, %18, %19 --> comp_tri24 + comp_tri24: load int32, add, %0, %17, %2 --> comp_tri23 + comp_tri23: emit c97 --> comp_tri22 + comp_tri22: imm_int 4, %16, --> comp_tri21 + comp_tri21: mul %15, %3, %16 --> comp_tri20 + comp_tri20: load int32, add, %0, %15, %10 --> comp_tri19 + comp_tri2: emit c95 --> comp_tri1 + comp_tri19: imm_int 1, %14, --> comp_tri18 + comp_tri18: sub %12, %3, %14 --> comp_tri17 + comp_tri17: imm_int 4, %13, --> comp_tri16 + comp_tri16: mul %11, %12, %13 --> comp_tri15 + comp_tri15: store int32, add, %0, %11, %10 --> comp_tri14 + comp_tri14: emit c96 --> comp_tri13 + comp_tri13: imm_int 4, %9, --> comp_tri12 + comp_tri12: mul %8, %3, %9 --> comp_tri11 + comp_tri11: store int32, add, %0, %8, %2 --> comp_tri10 + comp_tri10: emit c100 --> comp_tri9 + comp_tri1: mov %5, %2 --> comp_tri0 + comp_tri0: return %5 + + + "comp_forif2"(%0, %1, %2, %3): int -> int -> int -> int -> int + locals: %9, %4, %5, %6, %7, %8, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45 + result: %9 + stacksize: 0 + entry: comp_forif282 + exit: comp_forif20 + + comp_forif29: imm_int 0, %13, --> comp_forif28 + comp_forif282: emit c130 --> comp_forif281 + comp_forif281: imm_int 0, %6, --> comp_forif280 + comp_forif280: emit c129 --> comp_forif279 + comp_forif28: eq %10, %12, %13 --> comp_forif27 + comp_forif279: imm_int 0, %5, --> comp_forif278 + comp_forif278: emit c128 --> comp_forif277 + comp_forif277: emit c127 --> comp_forif276 + comp_forif276: imm_int 0, %8, --> comp_forif262 + comp_forif275: imm_int 0, %44, --> comp_forif274 + comp_forif274: emit c126 --> comp_forif273 + comp_forif273: lt %45, %8, %2 --> comp_forif272 + comp_forif272: notbool %43, %45 --> comp_forif271 + comp_forif271: eq %43, %44 --> comp_forif270, comp_forif261 + comp_forif270: emit c124 --> comp_forif269 + comp_forif27: eq %10, %11 --> comp_forif24, comp_forif26 + comp_forif269: imm_int 4, %42, --> comp_forif268 + comp_forif268: mul %41, %8, %42 --> comp_forif267 + comp_forif267: load int32, add, %0, %41, %40 --> comp_forif266 + comp_forif266: add %6, %6, %40 --> comp_forif265 + comp_forif265: emit c125 --> comp_forif264 + comp_forif264: imm_int 1, %39, --> comp_forif263 + comp_forif263: add %8, %8, %39 --> comp_forif262 + comp_forif262: --> comp_forif275 + comp_forif261: emit c123 --> comp_forif260 + comp_forif260: emit c122 --> comp_forif259 + comp_forif26: emit c111 --> comp_forif25 + comp_forif259: imm_int 0, %7, --> comp_forif245 + comp_forif258: imm_int 0, %37, --> comp_forif257 + comp_forif257: emit c121 --> comp_forif256 + comp_forif256: lt %38, %7, %3 --> comp_forif255 + comp_forif255: notbool %36, %38 --> comp_forif254 + comp_forif254: eq %36, %37 --> comp_forif253, comp_forif244 + comp_forif253: emit c119 --> comp_forif252 + comp_forif252: imm_int 4, %35, --> comp_forif251 + comp_forif251: mul %34, %7, %35 --> comp_forif250 + comp_forif250: load int32, add, %1, %34, %33 --> comp_forif249 + comp_forif25: imm_int 2, %4, --> comp_forif22 + comp_forif249: add %5, %5, %33 --> comp_forif248 + comp_forif248: emit c120 --> comp_forif247 + comp_forif247: imm_int 1, %32, --> comp_forif246 + comp_forif246: add %7, %7, %32 --> comp_forif245 + comp_forif245: --> comp_forif258 + comp_forif244: emit c118 --> comp_forif243 + comp_forif243: imm_int 0, %21, --> comp_forif242 + comp_forif242: imm_int 0, %28, --> comp_forif241 + comp_forif241: emit c117 --> comp_forif240 + comp_forif240: imm_int 2, %31, --> comp_forif239 + comp_forif24: emit c110 --> comp_forif23 + comp_forif239: mod %29, %6, %31 --> comp_forif238 + comp_forif238: imm_int 0, %30, --> comp_forif237 + comp_forif237: eq %27, %29, %30 --> comp_forif236 + comp_forif236: eq %27, %28 --> comp_forif226, comp_forif235 + comp_forif235: imm_int 0, %23, --> comp_forif234 + comp_forif234: emit c116 --> comp_forif233 + comp_forif233: imm_int 2, %26, --> comp_forif232 + comp_forif232: mod %24, %5, %26 --> comp_forif231 + comp_forif231: imm_int 0, %25, --> comp_forif230 + comp_forif230: eq %22, %24, %25 --> comp_forif229 + comp_forif23: imm_int 3, %4, --> comp_forif22 + comp_forif229: eq %22, %23 --> comp_forif227, comp_forif228 + comp_forif228: imm_int 1, %20, --> comp_forif225 + comp_forif227: imm_int 0, %20, --> comp_forif225 + comp_forif226: imm_int 0, %20, --> comp_forif225 + comp_forif225: eq %20, %21 --> comp_forif222, comp_forif224 + comp_forif224: emit c115 --> comp_forif223 + comp_forif223: imm_int 0, %4, --> comp_forif22 + comp_forif222: emit c114 --> comp_forif221 + comp_forif221: imm_int 0, %16, --> comp_forif220 + comp_forif220: imm_int 2, %19, --> comp_forif219 + comp_forif22: emit c109 --> comp_forif21 + comp_forif219: mod %17, %6, %19 --> comp_forif218 + comp_forif218: imm_int 0, %18, --> comp_forif217 + comp_forif217: eq %15, %17, %18 --> comp_forif216 + comp_forif216: eq %15, %16 --> comp_forif213, comp_forif215 + comp_forif215: emit c113 --> comp_forif214 + comp_forif214: imm_int 1, %4, --> comp_forif22 + comp_forif213: emit c112 --> comp_forif212 + comp_forif212: imm_int 0, %11, --> comp_forif211 + comp_forif211: imm_int 2, %14, --> comp_forif210 + comp_forif210: mod %12, %5, %14 --> comp_forif29 + comp_forif21: imm_int 0, %9, --> comp_forif20 + comp_forif20: return %9 + + + "comp_forif"(): int + locals: %3, %0, %1, %2, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16 + result: %3 + stacksize: 0 + entry: comp_forif35 + exit: comp_forif0 + + comp_forif9: emit c132 --> comp_forif8 + comp_forif8: imm_int 1, %5, --> comp_forif7 + comp_forif7: add %0, %0, %5 --> comp_forif6 + comp_forif6: emit c136 --> comp_forif5 + comp_forif5: imm_int 1, %4, --> comp_forif4 + comp_forif4: add %2, %2, %4 --> comp_forif3 + comp_forif35: emit c141 --> comp_forif34 + comp_forif34: imm_int 0, %1, --> comp_forif33 + comp_forif33: emit c140 --> comp_forif32 + comp_forif32: imm_int 0, %0, --> comp_forif31 + comp_forif31: emit c139 --> comp_forif30 + comp_forif30: emit c138 --> comp_forif29 + comp_forif3: --> comp_forif28 + comp_forif29: imm_int 0, %2, --> comp_forif3 + comp_forif28: imm_int 0, %14, --> comp_forif27 + comp_forif27: emit c137 --> comp_forif26 + comp_forif26: imm_int 10, %16, --> comp_forif25 + comp_forif25: lt %15, %2, %16 --> comp_forif24 + comp_forif24: notbool %13, %15 --> comp_forif23 + comp_forif23: eq %13, %14 --> comp_forif22, comp_forif2 + comp_forif22: emit c135 --> comp_forif21 + comp_forif21: imm_int 1, %12, --> comp_forif20 + comp_forif20: add %1, %1, %12 --> comp_forif19 + comp_forif2: emit c131 --> comp_forif1 + comp_forif19: emit c134 --> comp_forif18 + comp_forif18: imm_int 1, %11, --> comp_forif17 + comp_forif17: add %1, %1, %11 --> comp_forif16 + comp_forif16: emit c133 --> comp_forif15 + comp_forif15: imm_int 0, %7, --> comp_forif14 + comp_forif14: imm_int 2, %10, --> comp_forif13 + comp_forif13: mod %8, %2, %10 --> comp_forif12 + comp_forif12: imm_int 0, %9, --> comp_forif11 + comp_forif11: eq %6, %8, %9 --> comp_forif10 + comp_forif10: eq %6, %7 --> comp_forif6, comp_forif9 + comp_forif1: mov %3, %1 --> comp_forif0 + comp_forif0: return %3 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77, %78, %79, %80, %81, %82, %83, %84, %85, %86, %87, %88, %89, %90, %91, %92, %93, %94, %95, %96, %97, %98, %99, %100, %101, %102 + result: %1 + stacksize: 64 + entry: main149 + exit: main0 + + main99: imm_int 4, %63, --> main98 + main98: imm_addr 0($sp), %64, --> main97 + main97: imm_int 7, %66, --> main96 + main96: imm_int 4, %67, --> main95 + main95: mul %65, %66, %67 --> main94 + main94: store int32, add, %64, %65, %63 --> main93 + main93: emit c157 --> main92 + main92: imm_int 3, %58, --> main91 + main91: imm_addr 0($sp), %59, --> main90 + main90: imm_int 8, %61, --> main89 + main9: imm_addr 0($sp), %2, --> main8 + main89: imm_int 4, %62, --> main88 + main88: mul %60, %61, %62 --> main87 + main87: store int32, add, %59, %60, %58 --> main86 + main86: emit c156 --> main85 + main85: imm_int 2, %53, --> main84 + main84: imm_addr 0($sp), %54, --> main83 + main83: imm_int 9, %56, --> main82 + main82: imm_int 4, %57, --> main81 + main81: mul %55, %56, %57 --> main80 + main80: store int32, add, %54, %55, %53 --> main79 + main8: imm_addr 0($sp), %3, --> main7 + main79: emit c155 --> main78 + main78: imm_int 0, %48, --> main77 + main77: imm_addr 0($sp), %49, --> main76 + main76: imm_int 10, %51, --> main75 + main75: imm_int 4, %52, --> main74 + main74: mul %50, %51, %52 --> main73 + main73: store int32, add, %49, %50, %48 --> main72 + main72: emit c154 --> main71 + main71: imm_int 0, %43, --> main70 + main70: imm_addr 0($sp), %44, --> main69 + main7: imm_int 10, %4, --> main6 + main69: imm_int 11, %46, --> main68 + main68: imm_int 4, %47, --> main67 + main67: mul %45, %46, %47 --> main66 + main66: store int32, add, %44, %45, %43 --> main65 + main65: emit c153 --> main64 + main64: imm_int 0, %38, --> main63 + main63: imm_addr 0($sp), %39, --> main62 + main62: imm_int 12, %41, --> main61 + main61: imm_int 4, %42, --> main60 + main60: mul %40, %41, %42 --> main59 + main6: imm_int 10, %5, --> main5 + main59: store int32, add, %39, %40, %38 --> main58 + main58: emit c152 --> main57 + main57: imm_int 0, %33, --> main56 + main56: imm_addr 0($sp), %34, --> main55 + main55: imm_int 13, %36, --> main54 + main54: imm_int 4, %37, --> main53 + main53: mul %35, %36, %37 --> main52 + main52: store int32, add, %34, %35, %33 --> main51 + main51: emit c151 --> main50 + main50: imm_int 0, %28, --> main49 + main5: call "comp_forif2", %2, %3, %4, %5, %0: int -> int -> int -> int -> int --> main4 + main49: imm_addr 0($sp), %29, --> main48 + main48: imm_int 14, %31, --> main47 + main47: imm_int 4, %32, --> main46 + main46: mul %30, %31, %32 --> main45 + main45: store int32, add, %29, %30, %28 --> main44 + main44: emit c150 --> main43 + main43: imm_int 0, %23, --> main42 + main42: imm_addr 0($sp), %24, --> main41 + main41: imm_int 15, %26, --> main40 + main40: imm_int 4, %27, --> main39 + main4: emit c143 --> main3 + main39: mul %25, %26, %27 --> main38 + main38: store int32, add, %24, %25, %23 --> main37 + main37: emit c149 --> main36 + main36: imm_addr 0($sp), %18, --> main35 + main35: imm_addr 0($sp), %19, --> main34 + main34: imm_addr 0($sp), %20, --> main33 + main33: imm_int 10, %21, --> main32 + main32: imm_int 10, %22, --> main31 + main31: call "comp_fir_basic", %18, %19, %20, %21, %22, %0: int -> int -> int -> int -> int -> int --> main30 + main30: emit c148 --> main29 + main3: call "comp_forif", , %0: int --> main2 + main29: imm_addr 0($sp), %14, --> main28 + main28: imm_addr 0($sp), %15, --> main27 + main27: imm_addr 0($sp), %16, --> main26 + main26: imm_int 16, %17, --> main25 + main25: call "comp_fir16", %14, %15, %16, %17, %0: int -> int -> int -> int -> int --> main24 + main24: emit c147 --> main23 + main23: imm_int 4, %11, --> main22 + main22: imm_int 1, %12, --> main21 + main21: imm_int 1, %13, --> main20 + main20: call "comp_ifFor", %11, %12, %13, %0: int -> int -> int -> int --> main19 + main2: emit c142 --> main1 + main19: emit c146 --> main18 + main18: imm_addr 0($sp), %8, --> main17 + main17: imm_int 9, %9, --> main16 + main16: imm_int 3, %10, --> main15 + main15: call "comp_total", %8, %9, %10, %0: int -> int -> int -> int --> main14 + main149: emit c165 --> main148 + main148: imm_int 10, %98, --> main147 + main147: imm_addr 0($sp), %99, --> main146 + main146: imm_int 0, %101, --> main145 + main145: imm_int 4, %102, --> main144 + main144: mul %100, %101, %102 --> main143 + main143: store int32, add, %99, %100, %98 --> main142 + main142: emit c164 --> main141 + main141: imm_int 9, %93, --> main140 + main140: imm_addr 0($sp), %94, --> main139 + main14: emit c145 --> main13 + main139: imm_int 1, %96, --> main138 + main138: imm_int 4, %97, --> main137 + main137: mul %95, %96, %97 --> main136 + main136: store int32, add, %94, %95, %93 --> main135 + main135: emit c163 --> main134 + main134: imm_int 8, %88, --> main133 + main133: imm_addr 0($sp), %89, --> main132 + main132: imm_int 2, %91, --> main131 + main131: imm_int 4, %92, --> main130 + main130: mul %90, %91, %92 --> main129 + main13: imm_addr 0($sp), %6, --> main12 + main129: store int32, add, %89, %90, %88 --> main128 + main128: emit c162 --> main127 + main127: imm_int 7, %83, --> main126 + main126: imm_addr 0($sp), %84, --> main125 + main125: imm_int 3, %86, --> main124 + main124: imm_int 4, %87, --> main123 + main123: mul %85, %86, %87 --> main122 + main122: store int32, add, %84, %85, %83 --> main121 + main121: emit c161 --> main120 + main120: imm_int 6, %78, --> main119 + main12: imm_int 10, %7, --> main11 + main119: imm_addr 0($sp), %79, --> main118 + main118: imm_int 4, %81, --> main117 + main117: imm_int 4, %82, --> main116 + main116: mul %80, %81, %82 --> main115 + main115: store int32, add, %79, %80, %78 --> main114 + main114: emit c160 --> main113 + main113: imm_int 0, %73, --> main112 + main112: imm_addr 0($sp), %74, --> main111 + main111: imm_int 5, %76, --> main110 + main110: imm_int 4, %77, --> main109 + main11: call "comp_tri", %6, %7, %0: int -> int -> int --> main10 + main109: mul %75, %76, %77 --> main108 + main108: store int32, add, %74, %75, %73 --> main107 + main107: emit c159 --> main106 + main106: imm_int 5, %68, --> main105 + main105: imm_addr 0($sp), %69, --> main104 + main104: imm_int 6, %71, --> main103 + main103: imm_int 4, %72, --> main102 + main102: mul %70, %71, %72 --> main101 + main101: store int32, add, %69, %70, %68 --> main100 + main100: emit c158 --> main99 + main10: emit c144 --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/complets.c b/tests/clight/complets.c new file mode 100644 index 0000000..6cc5041 --- /dev/null +++ b/tests/clight/complets.c @@ -0,0 +1,138 @@ +int comp_fir_basic(int input[], int h[], int z[], int N,int n) +{ + int i,j,k; + int y ; + y = 0; + /* calc FIR */ + for(k=0;k<3;k=k+1){ + + /* store input at the beginning of the delay line */ + z[0] = input[k]; + for (i = 0; i < 3; i=i+1) { + y = y +h[i] * z[i]; + } + + /* shift delay line */ + for (j = 2; j >=0; j=j-1) { + z[j + 1] = z[j]; + } + } + return y; +} + + +int comp_fir16(int in[], int c[], int out[], int size) { + int i,j,res,tmp; + int x[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int adx =0; + res =0; + for (j=0;j 0; j--) { + tabParam[k] = tabLocal1[k]+tabLocal2[j]; + } + } + } + return 0; +} + +int comp_tri (int t[], int n) { + int i,j,tmp; + tmp = 0; + + for(i = 0 ; (i < n); i=i+1) + { + for(j = 1 ; j < n- i ; j=j+1) + { + if(t[j] < t[j-1]) + { + tmp = t[j-1]; + t[j-1] = t[j]; + t[j] = tmp; + } + } + } + return tmp; +} +int comp_forif2 (int u[], int v[], int a, int b){ + int i,j,k,l,res; + k=0; + l=0; + for (i=0;i=0; j=j-1) { + z[j + 1] = z[j]; + } + } + return y; +} + + +int comp_fir16(int in[], int c[], int out[], int size) { + int i,j,res,tmp; + int x[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int adx =0; + res =0; + for (j=0;j 0; j--) { + tabParam[k] = tabLocal1[k]+tabLocal2[j]; + } + } + } + return 0; +} + +int comp_tri (int t[], int n) { + int i,j,tmp; + tmp = 0; + + for(i = 0 ; (i < n); i=i+1) + { + for(j = 1 ; j < n- i ; j=j+1) + { + if(t[j] < t[j-1]) + { + tmp = t[j-1]; + t[j-1] = t[j]; + t[j] = tmp; + } + } + } + return tmp; +} +int comp_forif2 (int u[], int v[], int a, int b){ + int i,j,k,l,res; + k=0; + l=0; + for (i=0;i RTL): + Constant not supported. diff --git a/tests/clight/fib.ASM.expected b/tests/clight/fib.ASM.expected new file mode 100644 index 0000000..517472c --- /dev/null +++ b/tests/clight/fib.ASM.expected @@ -0,0 +1,76 @@ +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main17 +write: +li $v0, 1 +syscall +jr $ra +writeln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +readln: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +# begin fib +fib37: +addiu $sp, $sp, -12 +sw $ra, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +move $s1, $a0 +c4: +li $v0, 2 +slt $v0, $s1, $v0 +beq $v0, $zero, fib10 +c3: +li $v0, 1 +fib48: +lw $ra, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +addiu $sp, $sp, 12 +jr $ra +fib10: +c2: +li $v0, 1 +subu $a0, $s1, $v0 +jal fib37 +move $s0, $v0 +c1: +li $v0, 2 +subu $a0, $s1, $v0 +jal fib37 +c0: +addu $v0, $s0, $v0 +j fib48 +# end fib + +# begin _main +main17: +addiu $sp, $sp, -4 +sw $ra, 0($sp) +c6: +li $a0, 10 +jal fib37 +c5: +lw $ra, 0($sp) +addiu $sp, $sp, 4 +jr $ra +# end _main diff --git a/tests/clight/fib.Clight.expected b/tests/clight/fib.Clight.expected new file mode 100644 index 0000000..e2086cc --- /dev/null +++ b/tests/clight/fib.Clight.expected @@ -0,0 +1,292 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int fib(int n) +{ + int t; + int t__1; + c4: + if (n < 2) { + c3: + return 1; + } else { + c2: + t = fib(n - 1); + c1: + t__1 = fib(n - 2); + c0: + return t + t__1; + } +} + +int main(void) +{ + int t; + c6: + t = fib(10); + c5: + return t; +} + + diff --git a/tests/clight/fib.Cminor.expected b/tests/clight/fib.Cminor.expected new file mode 100644 index 0000000..01b755b --- /dev/null +++ b/tests/clight/fib.Cminor.expected @@ -0,0 +1,436 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"fib" (n) : int -> int { + + stack 0; + + var t, t__1; + + c4: + if (n < 2) { + c3: + return 1; + } + else { + c2: + t = "fib"(n - 1) : int -> int; + c1: + t__1 = "fib"(n - 2) : int -> int; + c0: + return t + t__1; + } + +} + + +"main" () : int { + + stack 0; + + var t; + + c6: + t = "fib"(10) : int -> int; + c5: + return t; + +} + + diff --git a/tests/clight/fib.ERTL.expected b/tests/clight/fib.ERTL.expected new file mode 100644 index 0000000..934a9c9 --- /dev/null +++ b/tests/clight/fib.ERTL.expected @@ -0,0 +1,104 @@ +program + +globals 0 + +procedure fib(1) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19 +entry fib37 +fib37: newframe --> fib36 +fib36: move %19, $ra --> fib35 +fib35: move %18, $s7 --> fib34 +fib34: move %17, $s6 --> fib33 +fib33: move %16, $s5 --> fib32 +fib32: move %15, $s4 --> fib31 +fib31: move %14, $s3 --> fib30 +fib30: move %13, $s2 --> fib29 +fib29: move %12, $s1 --> fib28 +fib28: move %11, $s0 --> fib27 +fib27: move %0, $a0 --> fib26 +fib26: li %1, 0 --> fib25 +fib25: li %2, 0 --> fib24 +fib24: li %4, 0 --> fib23 +fib23: li %5, 0 --> fib22 +fib22: li %6, 0 --> fib21 +fib21: li %7, 0 --> fib20 +fib20: li %8, 0 --> fib19 +fib19: li %9, 0 --> fib18 +fib18: li %10, 0 --> fib17 +fib17: emit c4 --> fib16 +fib16: li %9, 0 --> fib15 +fib15: li %10, 2 --> fib14 +fib14: slt %8, %0, %10 --> fib13 +fib13: beq %8, %9 --> fib10, fib12 +fib12: emit c3 --> fib11 +fib11: li %3, 1 --> fib0 +fib0 : j --> fib49 +fib49: move $v0, %3 --> fib48 +fib48: move $ra, %19 --> fib47 +fib47: move $s7, %18 --> fib46 +fib46: move $s6, %17 --> fib45 +fib45: move $s5, %16 --> fib44 +fib44: move $s4, %15 --> fib43 +fib43: move $s3, %14 --> fib42 +fib42: move $s2, %13 --> fib41 +fib41: move $s1, %12 --> fib40 +fib40: move $s0, %11 --> fib39 +fib39: delframe --> fib38 +fib38: jr $ra (xmits $v0) +fib10: emit c2 --> fib9 +fib9 : li %7, 1 --> fib8 +fib8 : subu %6, %0, %7 --> fib7 +fib7 : j --> fib55 +fib55: move $a0, %6 --> fib54 +fib54: call fib(1) --> fib53 +fib53: move %1, $v0 --> fib6 +fib6 : emit c1 --> fib5 +fib5 : li %5, 2 --> fib4 +fib4 : subu %4, %0, %5 --> fib3 +fib3 : j --> fib52 +fib52: move $a0, %4 --> fib51 +fib51: call fib(1) --> fib50 +fib50: move %2, $v0 --> fib2 +fib2 : emit c0 --> fib1 +fib1 : addu %3, %1, %2 --> fib0 + +procedure _main(0) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11 +entry main17 +main17: newframe --> main16 +main16: move %11, $ra --> main15 +main15: move %10, $s7 --> main14 +main14: move %9, $s6 --> main13 +main13: move %8, $s5 --> main12 +main12: move %7, $s4 --> main11 +main11: move %6, $s3 --> main10 +main10: move %5, $s2 --> main9 +main9 : move %4, $s1 --> main8 +main8 : move %3, $s0 --> main7 +main7 : li %0, 0 --> main6 +main6 : li %2, 0 --> main5 +main5 : emit c6 --> main4 +main4 : li %2, 10 --> main3 +main3 : j --> main32 +main32: move $a0, %2 --> main31 +main31: call fib(1) --> main30 +main30: move %0, $v0 --> main2 +main2 : emit c5 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main29 +main29: move $v0, %1 --> main28 +main28: move $ra, %11 --> main27 +main27: move $s7, %10 --> main26 +main26: move $s6, %9 --> main25 +main25: move $s5, %8 --> main24 +main24: move $s4, %7 --> main23 +main23: move $s3, %6 --> main22 +main22: move $s2, %5 --> main21 +main21: move $s1, %4 --> main20 +main20: move $s0, %3 --> main19 +main19: delframe --> main18 +main18: jr $ra (xmits $v0) + diff --git a/tests/clight/fib.LIN.expected b/tests/clight/fib.LIN.expected new file mode 100644 index 0000000..da88ca0 --- /dev/null +++ b/tests/clight/fib.LIN.expected @@ -0,0 +1,51 @@ +program + +globals 0 + +procedure fib(1) +var 12 +fib37: +newframe +sets local(0), $ra +sets local(4), $s1 +sets local(8), $s0 +move $s1, $a0 +c4: +li $v0, 2 +slt $v0, $s1, $v0 +beq $v0, $zero, fib10 +c3: +li $v0, 1 +fib48: +gets $ra, local(0) +gets $s1, local(4) +gets $s0, local(8) +delframe +jr $ra +fib10: +c2: +li $v0, 1 +subu $a0, $s1, $v0 +call fib +move $s0, $v0 +c1: +li $v0, 2 +subu $a0, $s1, $v0 +call fib +c0: +addu $v0, $s0, $v0 +j fib48 + +procedure _main(0) +var 4 +main17: +newframe +sets local(0), $ra +c6: +li $a0, 10 +call fib +c5: +gets $ra, local(0) +delframe +jr $ra + diff --git a/tests/clight/fib.LTL.expected b/tests/clight/fib.LTL.expected new file mode 100644 index 0000000..1af0916 --- /dev/null +++ b/tests/clight/fib.LTL.expected @@ -0,0 +1,101 @@ +program + +globals 0 + +procedure fib(1) +var 12 +entry fib37 +fib37: newframe --> fib36 +fib36: sets local(0), $ra --> fib35 +fib35: j --> fib34 +fib34: j --> fib33 +fib33: j --> fib32 +fib32: j --> fib31 +fib31: j --> fib30 +fib30: j --> fib29 +fib29: sets local(4), $s1 --> fib28 +fib28: sets local(8), $s0 --> fib27 +fib27: move $s1, $a0 --> fib26 +fib26: j --> fib25 +fib25: j --> fib24 +fib24: j --> fib23 +fib23: j --> fib22 +fib22: j --> fib21 +fib21: j --> fib20 +fib20: j --> fib19 +fib19: j --> fib18 +fib18: j --> fib17 +fib17: emit c4 --> fib16 +fib16: j --> fib15 +fib15: li $v0, 2 --> fib14 +fib14: slt $v0, $s1, $v0 --> fib13 +fib13: beq $v0, $zero --> fib10, fib12 +fib12: emit c3 --> fib11 +fib11: li $v0, 1 --> fib0 +fib0 : j --> fib49 +fib49: j --> fib48 +fib48: gets $ra, local(0) --> fib47 +fib47: j --> fib46 +fib46: j --> fib45 +fib45: j --> fib44 +fib44: j --> fib43 +fib43: j --> fib42 +fib42: j --> fib41 +fib41: gets $s1, local(4) --> fib40 +fib40: gets $s0, local(8) --> fib39 +fib39: delframe --> fib38 +fib38: jr $ra +fib10: emit c2 --> fib9 +fib9 : li $v0, 1 --> fib8 +fib8 : subu $a0, $s1, $v0 --> fib7 +fib7 : j --> fib55 +fib55: j --> fib54 +fib54: call fib --> fib53 +fib53: move $s0, $v0 --> fib6 +fib6 : emit c1 --> fib5 +fib5 : li $v0, 2 --> fib4 +fib4 : subu $a0, $s1, $v0 --> fib3 +fib3 : j --> fib52 +fib52: j --> fib51 +fib51: call fib --> fib50 +fib50: j --> fib2 +fib2 : emit c0 --> fib1 +fib1 : addu $v0, $s0, $v0 --> fib0 + +procedure _main(0) +var 4 +entry main17 +main17: newframe --> main16 +main16: sets local(0), $ra --> main15 +main15: j --> main14 +main14: j --> main13 +main13: j --> main12 +main12: j --> main11 +main11: j --> main10 +main10: j --> main9 +main9 : j --> main8 +main8 : j --> main7 +main7 : j --> main6 +main6 : j --> main5 +main5 : emit c6 --> main4 +main4 : li $a0, 10 --> main3 +main3 : j --> main32 +main32: j --> main31 +main31: call fib --> main30 +main30: j --> main2 +main2 : emit c5 --> main1 +main1 : j --> main0 +main0 : j --> main29 +main29: j --> main28 +main28: gets $ra, local(0) --> main27 +main27: j --> main26 +main26: j --> main25 +main25: j --> main24 +main24: j --> main23 +main23: j --> main22 +main22: j --> main21 +main21: j --> main20 +main20: j --> main19 +main19: delframe --> main18 +main18: jr $ra + diff --git a/tests/clight/fib.RTL.expected b/tests/clight/fib.RTL.expected new file mode 100644 index 0000000..05cce69 --- /dev/null +++ b/tests/clight/fib.RTL.expected @@ -0,0 +1,48 @@ +program + +globals 0 + +function fib(%0) : %3 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10 +entry fib26 +exit fib0 +fib26: li %1, 0 --> fib25 +fib25: li %2, 0 --> fib24 +fib24: li %4, 0 --> fib23 +fib23: li %5, 0 --> fib22 +fib22: li %6, 0 --> fib21 +fib21: li %7, 0 --> fib20 +fib20: li %8, 0 --> fib19 +fib19: li %9, 0 --> fib18 +fib18: li %10, 0 --> fib17 +fib17: emit c4 --> fib16 +fib16: li %9, 0 --> fib15 +fib15: li %10, 2 --> fib14 +fib14: slt %8, %0, %10 --> fib13 +fib13: beq %8, %9 --> fib10, fib12 +fib12: emit c3 --> fib11 +fib11: li %3, 1 --> fib0 +fib10: emit c2 --> fib9 +fib9 : li %7, 1 --> fib8 +fib8 : subu %6, %0, %7 --> fib7 +fib7 : call %1, fib(%6) --> fib6 +fib6 : emit c1 --> fib5 +fib5 : li %5, 2 --> fib4 +fib4 : subu %4, %0, %5 --> fib3 +fib3 : call %2, fib(%4) --> fib2 +fib2 : emit c0 --> fib1 +fib1 : addu %3, %1, %2 --> fib0 + +function _main() : %1 +var %0, %1, %2 +entry main7 +exit main0 +main7: li %0, 0 --> main6 +main6: li %2, 0 --> main5 +main5: emit c6 --> main4 +main4: li %2, 10 --> main3 +main3: call %0, fib(%2) --> main2 +main2: emit c5 --> main1 +main1: move %1, %0 --> main0 + diff --git a/tests/clight/fib.RTLabs.expected b/tests/clight/fib.RTLabs.expected new file mode 100644 index 0000000..8ee6a73 --- /dev/null +++ b/tests/clight/fib.RTLabs.expected @@ -0,0 +1,444 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "fib"(%0): int -> int + locals: %3, %1, %2, %4, %5, %6, %7, %8, %9, %10 + result: %3 + stacksize: 0 + entry: fib17 + exit: fib0 + + fib9: imm_int 1, %7, --> fib8 + fib8: sub %6, %0, %7 --> fib7 + fib7: call "fib", %6, %1: int -> int --> fib6 + fib6: emit c1 --> fib5 + fib5: imm_int 2, %5, --> fib4 + fib4: sub %4, %0, %5 --> fib3 + fib3: call "fib", %4, %2: int -> int --> fib2 + fib2: emit c0 --> fib1 + fib17: emit c4 --> fib16 + fib16: imm_int 0, %9, --> fib15 + fib15: imm_int 2, %10, --> fib14 + fib14: lt %8, %0, %10 --> fib13 + fib13: eq %8, %9 --> fib10, fib12 + fib12: emit c3 --> fib11 + fib11: imm_int 1, %3, --> fib0 + fib10: emit c2 --> fib9 + fib1: add %3, %1, %2 --> fib0 + fib0: return %3 + + + "main"(): int + locals: %1, %0, %2 + result: %1 + stacksize: 0 + entry: main5 + exit: main0 + + main5: emit c6 --> main4 + main4: imm_int 10, %2, --> main3 + main3: call "fib", %2, %0: int -> int --> main2 + main2: emit c5 --> main1 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/fib.c b/tests/clight/fib.c new file mode 100644 index 0000000..bd121cf --- /dev/null +++ b/tests/clight/fib.c @@ -0,0 +1,11 @@ +int fib (int n) +{ + if (n < 2) + return 1; + else { + return fib (n-1) + fib (n-2); + } +} +int main () { + return fib (10); +} diff --git a/tests/clight/fib.c.expected b/tests/clight/fib.c.expected new file mode 100644 index 0000000..bd121cf --- /dev/null +++ b/tests/clight/fib.c.expected @@ -0,0 +1,11 @@ +int fib (int n) +{ + if (n < 2) + return 1; + else { + return fib (n-1) + fib (n-2); + } +} +int main () { + return fib (10); +} diff --git a/tests/clight/fib.log.expected b/tests/clight/fib.log.expected new file mode 100644 index 0000000..95e2628 --- /dev/null +++ b/tests/clight/fib.log.expected @@ -0,0 +1,4969 @@ +Warning (during instrumentation): + Clight instrumentation is not implemented yet. +Checking execution traces...OK. +thenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(13),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(21),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(13),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(34),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(13),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(21),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(55),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(13),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(21),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(8),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(3),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(seq,call) +Regular(seq,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,seq) +Regular(call,seq) +Call(func,call) +Regular(cost,call) +Regular(ifthenelse,call) +Regular(cost,call) +Regular(return,call) +Return(Int(1),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(2),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(5),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(13),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(34),call) +Regular(skip,seq) +Regular(cost,call) +Regular(return,call) +Return(Int(89),call) +Regular(skip,seq) +Regular(cost,stop) +Regular(return,stop) +Result: Int(89) +Memory dump: +n = 533 +block 1 : Free. + +block 2 : Free. + +block 3 : Free. + +block 4 : Free. + +block 5 : Free. + +block 6 : Free. + +block 7 : Free. + +block 8 : Free. + +block 9 : Free. + +block 10 : Free. + +block 11 : Free. + +block 12 : Free. + +block 13 : Free. + +block 14 : Free. + +block 15 : Free. + +block 16 : Free. + +block 17 : Free. + +block 18 : Free. + +block 19 : Free. + +block 20 : Free. + +block 21 : Free. + +block 22 : Free. + +block 23 : Free. + +block 24 : Free. + +block 25 : Free. + +block 26 : Free. + +block 27 : Free. + +block 28 : Free. + +block 29 : Free. + +block 30 : Free. + +block 31 : Free. + +block 32 : Free. + +block 33 : Free. + +block 34 : Free. + +block 35 : Free. + +block 36 : Free. + +block 37 : Free. + +block 38 : Free. + +block 39 : Free. + +block 40 : Free. + +block 41 : Free. + +block 42 : Free. + +block 43 : Free. + +block 44 : Free. + +block 45 : Free. + +block 46 : Free. + +block 47 : Free. + +block 48 : Free. + +block 49 : Free. + +block 50 : Free. + +block 51 : Free. + +block 52 : Free. + +block 53 : Free. + +block 54 : Free. + +block 55 : Free. + +block 56 : Free. + +block 57 : Free. + +block 58 : Free. + +block 59 : Free. + +block 60 : Free. + +block 61 : Free. + +block 62 : Free. + +block 63 : Free. + +block 64 : Free. + +block 65 : Free. + +block 66 : Free. + +block 67 : Free. + +block 68 : Free. + +block 69 : Free. + +block 70 : Free. + +block 71 : Free. + +block 72 : Free. + +block 73 : Free. + +block 74 : Free. + +block 75 : Free. + +block 76 : Free. + +block 77 : Free. + +block 78 : Free. + +block 79 : Free. + +block 80 : Free. + +block 81 : Free. + +block 82 : Free. + +block 83 : Free. + +block 84 : Free. + +block 85 : Free. + +block 86 : Free. + +block 87 : Free. + +block 88 : Free. + +block 89 : Free. + +block 90 : Free. + +block 91 : Free. + +block 92 : Free. + +block 93 : Free. + +block 94 : Free. + +block 95 : Free. + +block 96 : Free. + +block 97 : Free. + +block 98 : Free. + +block 99 : Free. + +block 100 : Free. + +block 101 : Free. + +block 102 : Free. + +block 103 : Free. + +block 104 : Free. + +block 105 : Free. + +block 106 : Free. + +block 107 : Free. + +block 108 : Free. + +block 109 : Free. + +block 110 : Free. + +block 111 : Free. + +block 112 : Free. + +block 113 : Free. + +block 114 : Free. + +block 115 : Free. + +block 116 : Free. + +block 117 : Free. + +block 118 : Free. + +block 119 : Free. + +block 120 : Free. + +block 121 : Free. + +block 122 : Free. + +block 123 : Free. + +block 124 : Free. + +block 125 : Free. + +block 126 : Free. + +block 127 : Free. + +block 128 : Free. + +block 129 : Free. + +block 130 : Free. + +block 131 : Free. + +block 132 : Free. + +block 133 : Free. + +block 134 : Free. + +block 135 : Free. + +block 136 : Free. + +block 137 : Free. + +block 138 : Free. + +block 139 : Free. + +block 140 : Free. + +block 141 : Free. + +block 142 : Free. + +block 143 : Free. + +block 144 : Free. + +block 145 : Free. + +block 146 : Free. + +block 147 : Free. + +block 148 : Free. + +block 149 : Free. + +block 150 : Free. + +block 151 : Free. + +block 152 : Free. + +block 153 : Free. + +block 154 : Free. + +block 155 : Free. + +block 156 : Free. + +block 157 : Free. + +block 158 : Free. + +block 159 : Free. + +block 160 : Free. + +block 161 : Free. + +block 162 : Free. + +block 163 : Free. + +block 164 : Free. + +block 165 : Free. + +block 166 : Free. + +block 167 : Free. + +block 168 : Free. + +block 169 : Free. + +block 170 : Free. + +block 171 : Free. + +block 172 : Free. + +block 173 : Free. + +block 174 : Free. + +block 175 : Free. + +block 176 : Free. + +block 177 : Free. + +block 178 : Free. + +block 179 : Free. + +block 180 : Free. + +block 181 : Free. + +block 182 : Free. + +block 183 : Free. + +block 184 : Free. + +block 185 : Free. + +block 186 : Free. + +block 187 : Free. + +block 188 : Free. + +block 189 : Free. + +block 190 : Free. + +block 191 : Free. + +block 192 : Free. + +block 193 : Free. + +block 194 : Free. + +block 195 : Free. + +block 196 : Free. + +block 197 : Free. + +block 198 : Free. + +block 199 : Free. + +block 200 : Free. + +block 201 : Free. + +block 202 : Free. + +block 203 : Free. + +block 204 : Free. + +block 205 : Free. + +block 206 : Free. + +block 207 : Free. + +block 208 : Free. + +block 209 : Free. + +block 210 : Free. + +block 211 : Free. + +block 212 : Free. + +block 213 : Free. + +block 214 : Free. + +block 215 : Free. + +block 216 : Free. + +block 217 : Free. + +block 218 : Free. + +block 219 : Free. + +block 220 : Free. + +block 221 : Free. + +block 222 : Free. + +block 223 : Free. + +block 224 : Free. + +block 225 : Free. + +block 226 : Free. + +block 227 : Free. + +block 228 : Free. + +block 229 : Free. + +block 230 : Free. + +block 231 : Free. + +block 232 : Free. + +block 233 : Free. + +block 234 : Free. + +block 235 : Free. + +block 236 : Free. + +block 237 : Free. + +block 238 : Free. + +block 239 : Free. + +block 240 : Free. + +block 241 : Free. + +block 242 : Free. + +block 243 : Free. + +block 244 : Free. + +block 245 : Free. + +block 246 : Free. + +block 247 : Free. + +block 248 : Free. + +block 249 : Free. + +block 250 : Free. + +block 251 : Free. + +block 252 : Free. + +block 253 : Free. + +block 254 : Free. + +block 255 : Free. + +block 256 : Free. + +block 257 : Free. + +block 258 : Free. + +block 259 : Free. + +block 260 : Free. + +block 261 : Free. + +block 262 : Free. + +block 263 : Free. + +block 264 : Free. + +block 265 : Free. + +block 266 : Free. + +block 267 : Free. + +block 268 : Free. + +block 269 : Free. + +block 270 : Free. + +block 271 : Free. + +block 272 : Free. + +block 273 : Free. + +block 274 : Free. + +block 275 : Free. + +block 276 : Free. + +block 277 : Free. + +block 278 : Free. + +block 279 : Free. + +block 280 : Free. + +block 281 : Free. + +block 282 : Free. + +block 283 : Free. + +block 284 : Free. + +block 285 : Free. + +block 286 : Free. + +block 287 : Free. + +block 288 : Free. + +block 289 : Free. + +block 290 : Free. + +block 291 : Free. + +block 292 : Free. + +block 293 : Free. + +block 294 : Free. + +block 295 : Free. + +block 296 : Free. + +block 297 : Free. + +block 298 : Free. + +block 299 : Free. + +block 300 : Free. + +block 301 : Free. + +block 302 : Free. + +block 303 : Free. + +block 304 : Free. + +block 305 : Free. + +block 306 : Free. + +block 307 : Free. + +block 308 : Free. + +block 309 : Free. + +block 310 : Free. + +block 311 : Free. + +block 312 : Free. + +block 313 : Free. + +block 314 : Free. + +block 315 : Free. + +block 316 : Free. + +block 317 : Free. + +block 318 : Free. + +block 319 : Free. + +block 320 : Free. + +block 321 : Free. + +block 322 : Free. + +block 323 : Free. + +block 324 : Free. + +block 325 : Free. + +block 326 : Free. + +block 327 : Free. + +block 328 : Free. + +block 329 : Free. + +block 330 : Free. + +block 331 : Free. + +block 332 : Free. + +block 333 : Free. + +block 334 : Free. + +block 335 : Free. + +block 336 : Free. + +block 337 : Free. + +block 338 : Free. + +block 339 : Free. + +block 340 : Free. + +block 341 : Free. + +block 342 : Free. + +block 343 : Free. + +block 344 : Free. + +block 345 : Free. + +block 346 : Free. + +block 347 : Free. + +block 348 : Free. + +block 349 : Free. + +block 350 : Free. + +block 351 : Free. + +block 352 : Free. + +block 353 : Free. + +block 354 : Free. + +block 355 : Free. + +block 356 : Free. + +block 357 : Free. + +block 358 : Free. + +block 359 : Free. + +block 360 : Free. + +block 361 : Free. + +block 362 : Free. + +block 363 : Free. + +block 364 : Free. + +block 365 : Free. + +block 366 : Free. + +block 367 : Free. + +block 368 : Free. + +block 369 : Free. + +block 370 : Free. + +block 371 : Free. + +block 372 : Free. + +block 373 : Free. + +block 374 : Free. + +block 375 : Free. + +block 376 : Free. + +block 377 : Free. + +block 378 : Free. + +block 379 : Free. + +block 380 : Free. + +block 381 : Free. + +block 382 : Free. + +block 383 : Free. + +block 384 : Free. + +block 385 : Free. + +block 386 : Free. + +block 387 : Free. + +block 388 : Free. + +block 389 : Free. + +block 390 : Free. + +block 391 : Free. + +block 392 : Free. + +block 393 : Free. + +block 394 : Free. + +block 395 : Free. + +block 396 : Free. + +block 397 : Free. + +block 398 : Free. + +block 399 : Free. + +block 400 : Free. + +block 401 : Free. + +block 402 : Free. + +block 403 : Free. + +block 404 : Free. + +block 405 : Free. + +block 406 : Free. + +block 407 : Free. + +block 408 : Free. + +block 409 : Free. + +block 410 : Free. + +block 411 : Free. + +block 412 : Free. + +block 413 : Free. + +block 414 : Free. + +block 415 : Free. + +block 416 : Free. + +block 417 : Free. + +block 418 : Free. + +block 419 : Free. + +block 420 : Free. + +block 421 : Free. + +block 422 : Free. + +block 423 : Free. + +block 424 : Free. + +block 425 : Free. + +block 426 : Free. + +block 427 : Free. + +block 428 : Free. + +block 429 : Free. + +block 430 : Free. + +block 431 : Free. + +block 432 : Free. + +block 433 : Free. + +block 434 : Free. + +block 435 : Free. + +block 436 : Free. + +block 437 : Free. + +block 438 : Free. + +block 439 : Free. + +block 440 : Free. + +block 441 : Free. + +block 442 : Free. + +block 443 : Free. + +block 444 : Free. + +block 445 : Free. + +block 446 : Free. + +block 447 : Free. + +block 448 : Free. + +block 449 : Free. + +block 450 : Free. + +block 451 : Free. + +block 452 : Free. + +block 453 : Free. + +block 454 : Free. + +block 455 : Free. + +block 456 : Free. + +block 457 : Free. + +block 458 : Free. + +block 459 : Free. + +block 460 : Free. + +block 461 : Free. + +block 462 : Free. + +block 463 : Free. + +block 464 : Free. + +block 465 : Free. + +block 466 : Free. + +block 467 : Free. + +block 468 : Free. + +block 469 : Free. + +block 470 : Free. + +block 471 : Free. + +block 472 : Free. + +block 473 : Free. + +block 474 : Free. + +block 475 : Free. + +block 476 : Free. + +block 477 : Free. + +block 478 : Free. + +block 479 : Free. + +block 480 : Free. + +block 481 : Free. + +block 482 : Free. + +block 483 : Free. + +block 484 : Free. + +block 485 : Free. + +block 486 : Free. + +block 487 : Free. + +block 488 : Free. + +block 489 : Free. + +block 490 : Free. + +block 491 : Free. + +block 492 : Free. + +block 493 : Free. + +block 494 : Free. + +block 495 : Free. + +block 496 : Free. + +block 497 : Free. + +block 498 : Free. + +block 499 : Free. + +block 500 : Free. + +block 501 : Free. + +block 502 : Free. + +block 503 : Free. + +block 504 : Free. + +block 505 : Free. + +block 506 : Free. + +block 507 : Free. + +block 508 : Free. + +block 509 : Free. + +block 510 : Free. + +block 511 : Free. + +block 512 : Free. + +block 513 : Free. + +block 514 : Free. + +block 515 : Free. + +block 516 : Free. + +block 517 : Free. + +block 518 : Free. + +block 519 : Free. + +block 520 : Free. + +block 521 : Free. + +block 522 : Free. + +block 523 : Free. + +block 524 : Free. + +block 525 : Free. + +block 526 : Free. + +block 527 : Free. + +block 528 : Free. + +block 529 : Free. + +block 530 : Free. + +block 531 : Free. + +block 532 : Free. + +State_call { function() - stop } +State_regular { seq - stop } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(10)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(9)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(8)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(7)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(6)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(13) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(21) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(6)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(13) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(34) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(7)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(6)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(13) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(21) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(55) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(8)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(7)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(6)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(13) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(21) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(6)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(5)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(8) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(4)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(3)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(3) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(2)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { seq - returnto } +State_regular { seq - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(1)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - cost::cont } +State_regular { call - cost::cont } +State_call { function(Int(0)) - returnto } +State_regular { cost - returnto } +State_regular { ifthenelse - returnto } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(1) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(2) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(5) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(13) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(34) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - returnto } +State_regular { return - returnto } +State_return { Int(89) - returnto } +State_regular { skip - cost::cont } +State_regular { cost - stop } +State_regular { return - stop } +Result: Int(89) +Memory dump: +n = 179 +block 1 : Free. + +block 2 : Free. + +block 3 : Free. + +block 4 : Free. + +block 5 : Free. + +block 6 : Free. + +block 7 : Free. + +block 8 : Free. + +block 9 : Free. + +block 10 : Free. + +block 11 : Free. + +block 12 : Free. + +block 13 : Free. + +block 14 : Free. + +block 15 : Free. + +block 16 : Free. + +block 17 : Free. + +block 18 : Free. + +block 19 : Free. + +block 20 : Free. + +block 21 : Free. + +block 22 : Free. + +block 23 : Free. + +block 24 : Free. + +block 25 : Free. + +block 26 : Free. + +block 27 : Free. + +block 28 : Free. + +block 29 : Free. + +block 30 : Free. + +block 31 : Free. + +block 32 : Free. + +block 33 : Free. + +block 34 : Free. + +block 35 : Free. + +block 36 : Free. + +block 37 : Free. + +block 38 : Free. + +block 39 : Free. + +block 40 : Free. + +block 41 : Free. + +block 42 : Free. + +block 43 : Free. + +block 44 : Free. + +block 45 : Free. + +block 46 : Free. + +block 47 : Free. + +block 48 : Free. + +block 49 : Free. + +block 50 : Free. + +block 51 : Free. + +block 52 : Free. + +block 53 : Free. + +block 54 : Free. + +block 55 : Free. + +block 56 : Free. + +block 57 : Free. + +block 58 : Free. + +block 59 : Free. + +block 60 : Free. + +block 61 : Free. + +block 62 : Free. + +block 63 : Free. + +block 64 : Free. + +block 65 : Free. + +block 66 : Free. + +block 67 : Free. + +block 68 : Free. + +block 69 : Free. + +block 70 : Free. + +block 71 : Free. + +block 72 : Free. + +block 73 : Free. + +block 74 : Free. + +block 75 : Free. + +block 76 : Free. + +block 77 : Free. + +block 78 : Free. + +block 79 : Free. + +block 80 : Free. + +block 81 : Free. + +block 82 : Free. + +block 83 : Free. + +block 84 : Free. + +block 85 : Free. + +block 86 : Free. + +block 87 : Free. + +block 88 : Free. + +block 89 : Free. + +block 90 : Free. + +block 91 : Free. + +block 92 : Free. + +block 93 : Free. + +block 94 : Free. + +block 95 : Free. + +block 96 : Free. + +block 97 : Free. + +block 98 : Free. + +block 99 : Free. + +block 100 : Free. + +block 101 : Free. + +block 102 : Free. + +block 103 : Free. + +block 104 : Free. + +block 105 : Free. + +block 106 : Free. + +block 107 : Free. + +block 108 : Free. + +block 109 : Free. + +block 110 : Free. + +block 111 : Free. + +block 112 : Free. + +block 113 : Free. + +block 114 : Free. + +block 115 : Free. + +block 116 : Free. + +block 117 : Free. + +block 118 : Free. + +block 119 : Free. + +block 120 : Free. + +block 121 : Free. + +block 122 : Free. + +block 123 : Free. + +block 124 : Free. + +block 125 : Free. + +block 126 : Free. + +block 127 : Free. + +block 128 : Free. + +block 129 : Free. + +block 130 : Free. + +block 131 : Free. + +block 132 : Free. + +block 133 : Free. + +block 134 : Free. + +block 135 : Free. + +block 136 : Free. + +block 137 : Free. + +block 138 : Free. + +block 139 : Free. + +block 140 : Free. + +block 141 : Free. + +block 142 : Free. + +block 143 : Free. + +block 144 : Free. + +block 145 : Free. + +block 146 : Free. + +block 147 : Free. + +block 148 : Free. + +block 149 : Free. + +block 150 : Free. + +block 151 : Free. + +block 152 : Free. + +block 153 : Free. + +block 154 : Free. + +block 155 : Free. + +block 156 : Free. + +block 157 : Free. + +block 158 : Free. + +block 159 : Free. + +block 160 : Free. + +block 161 : Free. + +block 162 : Free. + +block 163 : Free. + +block 164 : Free. + +block 165 : Free. + +block 166 : Free. + +block 167 : Free. + +block 168 : Free. + +block 169 : Free. + +block 170 : Free. + +block 171 : Free. + +block 172 : Free. + +block 173 : Free. + +block 174 : Free. + +block 175 : Free. + +block 176 : Free. + +block 177 : Free. + +block 178 : Free. + diff --git a/tests/clight/fib.s.expected b/tests/clight/fib.s.expected new file mode 100644 index 0000000..51b5442 --- /dev/null +++ b/tests/clight/fib.s.expected @@ -0,0 +1,363 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main19 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin fib +fib41: +addi $sp, $sp, -12 +sw $ra, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +move $s1, $a0 +c4: +li $v0, 2 +slt $v0, $s1, $v0 +beq $v0, $zero, fib10 +c3: +li $v0, 1 +fib52: +lw $ra, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +addi $sp, $sp, 12 +jr $ra +fib10: +c2: +li $v0, 1 +sub $a0, $s1, $v0 +la $v0, fib41 +jalr $v0 +move $s0, $v0 +c1: +li $v0, 2 +sub $a0, $s1, $v0 +la $v0, fib41 +jalr $v0 +c0: +add $v0, $s0, $v0 +j fib52 +# end fib + + +# begin _main +main19: +addi $sp, $sp, -4 +sw $ra, 0($sp) +c6: +li $a0, 10 +la $v0, fib41 +jalr $v0 +c5: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end _main diff --git a/tests/clight/fir4.ASM.expected b/tests/clight/fir4.ASM.expected new file mode 100644 index 0000000..f7f3641 --- /dev/null +++ b/tests/clight/fir4.ASM.expected @@ -0,0 +1,716 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 288 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main385 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin fir4 +fir4280: +addi $sp, $sp, -116 +sw $ra, 112($sp) +sw $s7, 108($sp) +sw $s6, 104($sp) +sw $s5, 100($sp) +sw $s4, 96($sp) +sw $s3, 92($sp) +sw $s2, 88($sp) +sw $s1, 84($sp) +sw $s0, 80($sp) +sw $a0, 64($sp) +move $s6, $a1 +sw $a2, 68($sp) +sw $a3, 72($sp) +c25: +li $s1, 0 +c24: +c23: +c22: +li $s3, 0 +fir4128: +li $a0, 0 +c21: +li $v0, 16 +slt $v0, $s3, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, fir4122 +c18: +c17: +li $s4, 0 +fir4109: +li $a0, 0 +c16: +lw $fp, 72($sp) +slt $v0, $s4, $fp +seq $v0, $v0, $zero +beq $v0, $a0, fir4104 +c0: +li $v0, 0 +lw $ra, 112($sp) +lw $s7, 108($sp) +lw $s6, 104($sp) +lw $s5, 100($sp) +lw $s4, 96($sp) +lw $s3, 92($sp) +lw $s2, 88($sp) +lw $s1, 84($sp) +lw $s0, 80($sp) +addi $sp, $sp, 116 +jr $ra +fir4104: +c14: +li $v0, 4 +mulo $v0, $s4, $v0 +lw $v1, 64($sp) +add $v0, $v1, $v0 +lw $a1, 0($v0) +move $a0, $sp +li $v0, 4 +mulo $v0, $s1, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c13: +li $s5, 0 +c12: +c11: +li $s3, 0 +fir491: +li $a0, 0 +c10: +li $v0, 16 +slt $v0, $s3, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, fir485 +c2: +li $v0, 1 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +jalr $v0 +move $s1, $v0 +c1: +li $v0, 16 +srav $a0, $s5, $v0 +li $v0, 4 +mulo $v0, $s4, $v0 +lw $v1, 68($sp) +add $v0, $v1, $v0 +sw $a0, 0($v0) +c15: +li $v0, 1 +add $s4, $s4, $v0 +j fir4109 +fir485: +c8: +move $a0, $sp +li $v0, 4 +mulo $v0, $s1, $v0 +add $v0, $a0, $v0 +lw $a0, 0($v0) +li $v0, 4 +mulo $v0, $s3, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $s2, $a0, $v0 +c7: +move $s0, $sp +li $v0, 1 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +jalr $v0 +li $a0, 4 +mulo $v0, $v0, $a0 +add $v0, $s0, $v0 +lw $a1, 0($v0) +li $v0, 1 +add $a0, $s3, $v0 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $v1, $a1, $v0 +sw $v1, 76($sp) +c6: +move $s0, $sp +li $v0, 2 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +jalr $v0 +li $a0, 4 +mulo $v0, $v0, $a0 +add $v0, $s0, $v0 +lw $a1, 0($v0) +li $v0, 2 +add $a0, $s3, $v0 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $s7, $a1, $v0 +c5: +move $s0, $sp +li $v0, 3 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +jalr $v0 +li $a0, 4 +mulo $v0, $v0, $a0 +add $v0, $s0, $v0 +lw $a1, 0($v0) +li $v0, 3 +add $a0, $s3, $v0 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $v0, $a1, $v0 +c4: +add $a0, $s5, $s2 +lw $fp, 76($sp) +add $a0, $a0, $fp +add $a0, $a0, $s7 +add $s5, $a0, $v0 +c3: +li $v0, 4 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +jalr $v0 +move $s1, $v0 +c9: +li $v0, 4 +add $s3, $s3, $v0 +j fir491 +fir4122: +c19: +move $a0, $sp +li $v0, 4 +mulo $v0, $s3, $v0 +add $v0, $a0, $v0 +sw $zero, 0($v0) +c20: +li $v0, 1 +add $s3, $s3, $v0 +j fir4128 +# end fir4 + + +# begin _main +main385: +addi $sp, $sp, -68 +sw $ra, 64($sp) +li $a0, 1129 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 60034 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 64720 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 5595 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 494 +move $v0, $gp +sw $a0, 16($v0) +li $a0, 59867 +move $v0, $gp +sw $a0, 20($v0) +li $a0, 65370 +move $v0, $gp +sw $a0, 24($v0) +li $a0, 5724 +move $v0, $gp +sw $a0, 28($v0) +li $a0, 5724 +move $v0, $gp +sw $a0, 32($v0) +li $a0, 65370 +move $v0, $gp +sw $a0, 36($v0) +li $a0, 59867 +move $v0, $gp +sw $a0, 40($v0) +li $a0, 494 +move $v0, $gp +sw $a0, 44($v0) +li $a0, 5595 +move $v0, $gp +sw $a0, 48($v0) +li $a0, 64720 +move $v0, $gp +sw $a0, 52($v0) +li $a0, 60034 +move $v0, $gp +sw $a0, 56($v0) +li $a0, 1129 +move $v0, $gp +sw $a0, 60($v0) +li $a0, 1 +move $v0, $gp +sw $a0, 64($v0) +move $v0, $gp +sw $zero, 68($v0) +li $a0, 16384 +move $v0, $gp +sw $a0, 72($v0) +move $v0, $gp +sw $zero, 76($v0) +move $v0, $gp +sw $zero, 80($v0) +move $v0, $gp +sw $zero, 84($v0) +move $v0, $gp +sw $zero, 88($v0) +move $v0, $gp +sw $zero, 92($v0) +move $v0, $gp +sw $zero, 96($v0) +move $v0, $gp +sw $zero, 100($v0) +move $v0, $gp +sw $zero, 104($v0) +move $v0, $gp +sw $zero, 108($v0) +move $v0, $gp +sw $zero, 112($v0) +move $v0, $gp +sw $zero, 116($v0) +move $v0, $gp +sw $zero, 120($v0) +move $v0, $gp +sw $zero, 124($v0) +move $v0, $gp +sw $zero, 128($v0) +move $v0, $gp +sw $zero, 132($v0) +move $v0, $gp +sw $zero, 136($v0) +move $v0, $gp +sw $zero, 140($v0) +move $v0, $gp +sw $zero, 144($v0) +move $v0, $gp +sw $zero, 148($v0) +move $v0, $gp +sw $zero, 152($v0) +move $v0, $gp +sw $zero, 156($v0) +move $v0, $gp +sw $zero, 160($v0) +li $a0, 7986 +move $v0, $gp +sw $a0, 164($v0) +li $a0, 8993 +move $v0, $gp +sw $a0, 168($v0) +li $a0, 1808 +move $v0, $gp +sw $a0, 172($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 176($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 180($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 184($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 188($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 192($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 196($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 200($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 204($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 208($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 212($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 216($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 220($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 224($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 228($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 232($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 236($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 240($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 244($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 248($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 252($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 256($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 260($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 264($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 268($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 272($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 276($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 280($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 284($v0) +c27: +move $a0, $gp +addi $a0, $a0, 64 +move $a1, $gp +move $a2, $sp +li $a3, 16 +la $v0, fir4280 +jalr $v0 +c26: +lw $ra, 64($sp) +addi $sp, $sp, 68 +jr $ra +# end _main diff --git a/tests/clight/fir4.Clight.expected b/tests/clight/fir4.Clight.expected new file mode 100644 index 0000000..61d6afc --- /dev/null +++ b/tests/clight/fir4.Clight.expected @@ -0,0 +1,333 @@ +int fir4_c[16] = { 1129, 60034, 64720, 5595, 494, 59867, 65370, 5724, 5724, + 65370, 59867, 494, 5595, 64720, 60034, 1129, }; + +int fir4_in[56] = { 1, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7986, 8993, 1808, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, }; + +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int fir4(int *fir4_in__1, int *fir4_c__1, int *fir4_out, int size) +{ + int i; + int j; + int tmp1; + int tmp2; + int tmp3; + int tmp4; + int x[16]; + int adx; + int res; + c25: + adx = 0; + c24: + res = 0; + c23: + for (({ c22: i = 0; }); (/* c21 */ i < 16); ({ c20: i = i + 1; })) { + c19: + x[i] = 0; + } + c18: + for (({ c17: j = 0; }); (/* c16 */ j < size); ({ c15: j = j + 1; })) { + c14: + x[adx] = fir4_in__1[j]; + c13: + res = 0; + c12: + for (({ c11: i = 0; }); (/* c10 */ i < 16); ({ c9: i = i + 4; })) { + c8: + tmp1 = x[adx] * fir4_c__1[i]; + c7: + tmp2 = x[((adx + 1) % 16)] * fir4_c__1[(i + 1)]; + c6: + tmp3 = x[((adx + 2) % 16)] * fir4_c__1[(i + 2)]; + c5: + tmp4 = x[((adx + 3) % 16)] * fir4_c__1[(i + 3)]; + c4: + res = (((res + tmp1) + tmp2) + tmp3) + tmp4; + c3: + adx = (adx + 4) % 16; + } + c2: + adx = (adx + 1) % 16; + c1: + fir4_out[j] = res >> 16; + } + c0: + return 0; +} + +int main(void) +{ + int fir4_out[16]; + int t; + c27: + t = fir4(fir4_in, fir4_c, fir4_out, 16); + c26: + return t; +} + + diff --git a/tests/clight/fir4.Cminor.expected b/tests/clight/fir4.Cminor.expected new file mode 100644 index 0000000..62b0c96 --- /dev/null +++ b/tests/clight/fir4.Cminor.expected @@ -0,0 +1,501 @@ + +var "fir4_c" {1129, 60034, 64720, 5595, 494, 59867, 65370, 5724, 5724, 65370, 59867, 494, 5595, 64720, 60034, 1129} +var "fir4_in" {1, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7986, 8993, 1808, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096} + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"fir4" (fir4_in__1, fir4_c__1, fir4_out, size) : int -> int -> int -> int -> int { + + stack 64; + + var res, j, i, tmp4, tmp3, tmp2, tmp1, adx; + + c25: + adx = 0; + c24: + res = 0; + c23: + c22: + i = 0; + block { + loop { + if (!(/* c21 */ i < 16)) { + exit 0; + } + else { + } + block { + c19: + int32[&0 + (i * 4)] = 0; + } + c20: + i = i + 1; + } + } + c18: + c17: + j = 0; + block { + loop { + if (!(/* c16 */ j < size)) { + exit 0; + } + else { + } + block { + c14: + int32[&0 + (adx * 4)] = int32[fir4_in__1 + (j * 4)]; + c13: + res = 0; + c12: + c11: + i = 0; + block { + loop { + if (!(/* c10 */ i < 16)) { + exit 0; + } + else { + } + block { + c8: + tmp1 = int32[&0 + (adx * 4)] * int32[fir4_c__1 + (i * 4)]; + c7: + tmp2 = int32[&0 + (((adx + 1) % 16) * 4)] * int32[fir4_c__1 + ((i + 1) * 4)]; + c6: + tmp3 = int32[&0 + (((adx + 2) % 16) * 4)] * int32[fir4_c__1 + ((i + 2) * 4)]; + c5: + tmp4 = int32[&0 + (((adx + 3) % 16) * 4)] * int32[fir4_c__1 + ((i + 3) * 4)]; + c4: + res = (((res + tmp1) + tmp2) + tmp3) + tmp4; + c3: + adx = (adx + 4) % 16; + } + c9: + i = i + 4; + } + } + c2: + adx = (adx + 1) % 16; + c1: + int32[fir4_out + (j * 4)] = res >> 16; + } + c15: + j = j + 1; + } + } + c0: + return 0; + +} + + +"main" () : int { + + stack 64; + + var t; + + c27: + t = "fir4"("fir4_in", "fir4_c", &0, 16) : int -> int -> int -> int -> int; + c26: + return t; + +} + + diff --git a/tests/clight/fir4.ERTL.expected b/tests/clight/fir4.ERTL.expected new file mode 100644 index 0000000..919b4ad --- /dev/null +++ b/tests/clight/fir4.ERTL.expected @@ -0,0 +1,1247 @@ +program + +globals 288 + +procedure fir4(4) +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124 +entry fir4280 +fir4280: newframe --> fir4279 +fir4279: move %124, $ra --> fir4278 +fir4278: move %123, $s7 --> fir4277 +fir4277: move %122, $s6 --> fir4276 +fir4276: move %121, $s5 --> fir4275 +fir4275: move %120, $s4 --> fir4274 +fir4274: move %119, $s3 --> fir4273 +fir4273: move %118, $s2 --> fir4272 +fir4272: move %117, $s1 --> fir4271 +fir4271: move %116, $s0 --> fir4270 +fir4270: move %0, $a0 --> fir4269 +fir4269: move %1, $a1 --> fir4268 +fir4268: move %2, $a2 --> fir4267 +fir4267: move %3, $a3 --> fir4266 +fir4266: li %4, 0 --> fir4265 +fir4265: li %5, 0 --> fir4264 +fir4264: li %6, 0 --> fir4263 +fir4263: li %7, 0 --> fir4262 +fir4262: li %8, 0 --> fir4261 +fir4261: li %9, 0 --> fir4260 +fir4260: li %10, 0 --> fir4259 +fir4259: li %11, 0 --> fir4258 +fir4258: li %13, 0 --> fir4257 +fir4257: li %14, 0 --> fir4256 +fir4256: li %15, 0 --> fir4255 +fir4255: li %16, 0 --> fir4254 +fir4254: li %17, 0 --> fir4253 +fir4253: li %18, 0 --> fir4252 +fir4252: li %19, 0 --> fir4251 +fir4251: li %20, 0 --> fir4250 +fir4250: li %21, 0 --> fir4249 +fir4249: li %22, 0 --> fir4248 +fir4248: li %23, 0 --> fir4247 +fir4247: li %24, 0 --> fir4246 +fir4246: li %25, 0 --> fir4245 +fir4245: li %26, 0 --> fir4244 +fir4244: li %27, 0 --> fir4243 +fir4243: li %28, 0 --> fir4242 +fir4242: li %29, 0 --> fir4241 +fir4241: li %30, 0 --> fir4240 +fir4240: li %31, 0 --> fir4239 +fir4239: li %32, 0 --> fir4238 +fir4238: li %33, 0 --> fir4237 +fir4237: li %34, 0 --> fir4236 +fir4236: li %35, 0 --> fir4235 +fir4235: li %36, 0 --> fir4234 +fir4234: li %37, 0 --> fir4233 +fir4233: li %38, 0 --> fir4232 +fir4232: li %39, 0 --> fir4231 +fir4231: li %40, 0 --> fir4230 +fir4230: li %41, 0 --> fir4229 +fir4229: li %42, 0 --> fir4228 +fir4228: li %43, 0 --> fir4227 +fir4227: li %44, 0 --> fir4226 +fir4226: li %45, 0 --> fir4225 +fir4225: li %46, 0 --> fir4224 +fir4224: li %47, 0 --> fir4223 +fir4223: li %48, 0 --> fir4222 +fir4222: li %49, 0 --> fir4221 +fir4221: li %50, 0 --> fir4220 +fir4220: li %51, 0 --> fir4219 +fir4219: li %52, 0 --> fir4218 +fir4218: li %53, 0 --> fir4217 +fir4217: li %54, 0 --> fir4216 +fir4216: li %55, 0 --> fir4215 +fir4215: li %56, 0 --> fir4214 +fir4214: li %57, 0 --> fir4213 +fir4213: li %58, 0 --> fir4212 +fir4212: li %59, 0 --> fir4211 +fir4211: li %60, 0 --> fir4210 +fir4210: li %61, 0 --> fir4209 +fir4209: li %62, 0 --> fir4208 +fir4208: li %63, 0 --> fir4207 +fir4207: li %64, 0 --> fir4206 +fir4206: li %65, 0 --> fir4205 +fir4205: li %66, 0 --> fir4204 +fir4204: li %67, 0 --> fir4203 +fir4203: li %68, 0 --> fir4202 +fir4202: li %69, 0 --> fir4201 +fir4201: li %70, 0 --> fir4200 +fir4200: li %71, 0 --> fir4199 +fir4199: li %72, 0 --> fir4198 +fir4198: li %73, 0 --> fir4197 +fir4197: li %74, 0 --> fir4196 +fir4196: li %75, 0 --> fir4195 +fir4195: li %76, 0 --> fir4194 +fir4194: li %77, 0 --> fir4193 +fir4193: li %78, 0 --> fir4192 +fir4192: li %79, 0 --> fir4191 +fir4191: li %80, 0 --> fir4190 +fir4190: li %81, 0 --> fir4189 +fir4189: li %82, 0 --> fir4188 +fir4188: li %83, 0 --> fir4187 +fir4187: li %84, 0 --> fir4186 +fir4186: li %85, 0 --> fir4185 +fir4185: li %86, 0 --> fir4184 +fir4184: li %87, 0 --> fir4183 +fir4183: li %88, 0 --> fir4182 +fir4182: li %89, 0 --> fir4181 +fir4181: li %90, 0 --> fir4180 +fir4180: li %91, 0 --> fir4179 +fir4179: li %92, 0 --> fir4178 +fir4178: li %93, 0 --> fir4177 +fir4177: li %94, 0 --> fir4176 +fir4176: li %95, 0 --> fir4175 +fir4175: li %96, 0 --> fir4174 +fir4174: li %97, 0 --> fir4173 +fir4173: li %98, 0 --> fir4172 +fir4172: li %99, 0 --> fir4171 +fir4171: li %100, 0 --> fir4170 +fir4170: li %101, 0 --> fir4169 +fir4169: li %102, 0 --> fir4168 +fir4168: li %103, 0 --> fir4167 +fir4167: li %104, 0 --> fir4166 +fir4166: li %105, 0 --> fir4165 +fir4165: li %106, 0 --> fir4164 +fir4164: li %107, 0 --> fir4163 +fir4163: li %108, 0 --> fir4162 +fir4162: li %109, 0 --> fir4161 +fir4161: li %110, 0 --> fir4160 +fir4160: li %111, 0 --> fir4159 +fir4159: li %112, 0 --> fir4158 +fir4158: li %113, 0 --> fir4157 +fir4157: li %114, 0 --> fir4156 +fir4156: li %115, 0 --> fir4135 +fir4135: emit c25 --> fir4134 +fir4134: li %11, 0 --> fir4133 +fir4133: emit c24 --> fir4132 +fir4132: li %4, 0 --> fir4131 +fir4131: emit c23 --> fir4130 +fir4130: emit c22 --> fir4129 +fir4129: li %6, 0 --> fir4113 +fir4113: j --> fir4128 +fir4128: li %93, 0 --> fir4127 +fir4127: emit c21 --> fir4126 +fir4126: li %95, 16 --> fir4125 +fir4125: slt %94, %6, %95 --> fir4124 +fir4124: li %99, 0 --> fir4139 +fir4139: seq %92, %94, %99 --> fir4123 +fir4123: beq %92, %93 --> fir4122, fir4112 +fir4112: emit c18 --> fir4111 +fir4111: emit c17 --> fir4110 +fir4110: li %5, 0 --> fir43 +fir43 : j --> fir4109 +fir4109: li %85, 0 --> fir4108 +fir4108: emit c16 --> fir4107 +fir4107: slt %86, %5, %3 --> fir4106 +fir4106: li %97, 0 --> fir4137 +fir4137: seq %84, %86, %97 --> fir4105 +fir4105: beq %84, %85 --> fir4104, fir42 +fir42 : emit c0 --> fir41 +fir41 : li %12, 0 --> fir40 +fir40 : j --> fir4292 +fir4292: move $v0, %12 --> fir4291 +fir4291: move $ra, %124 --> fir4290 +fir4290: move $s7, %123 --> fir4289 +fir4289: move $s6, %122 --> fir4288 +fir4288: move $s5, %121 --> fir4287 +fir4287: move $s4, %120 --> fir4286 +fir4286: move $s3, %119 --> fir4285 +fir4285: move $s2, %118 --> fir4284 +fir4284: move $s1, %117 --> fir4283 +fir4283: move $s0, %116 --> fir4282 +fir4282: delframe --> fir4281 +fir4281: jr $ra (xmits $v0) +fir4104: emit c14 --> fir4103 +fir4103: li %83, 4 --> fir4102 +fir4102: mulo %82, %5, %83 --> fir4101 +fir4101: add %96, %0, %82 --> fir4136 +fir4136: lw %78, 0(%96) --> fir4100 +fir4100: move %79, $sp --> fir4293 +fir4293: move %79, %79 --> fir499 +fir499 : li %81, 4 --> fir498 +fir498 : mulo %80, %11, %81 --> fir497 +fir497 : add %115, %79, %80 --> fir4155 +fir4155: sw %78, 0(%115) --> fir496 +fir496 : emit c13 --> fir495 +fir495 : li %4, 0 --> fir494 +fir494 : emit c12 --> fir493 +fir493 : emit c11 --> fir492 +fir492 : li %6, 0 --> fir418 +fir418 : j --> fir491 +fir491 : li %75, 0 --> fir490 +fir490 : emit c10 --> fir489 +fir489 : li %77, 16 --> fir488 +fir488 : slt %76, %6, %77 --> fir487 +fir487 : li %114, 0 --> fir4154 +fir4154: seq %74, %76, %114 --> fir486 +fir486 : beq %74, %75 --> fir485, fir417 +fir417 : emit c2 --> fir416 +fir416 : li %20, 1 --> fir415 +fir415 : add %18, %11, %20 --> fir414 +fir414 : li %19, 16 --> fir413 +fir413 : la %100, mod --> fir4140 +fir4140: j --> fir4298 +fir4298: move $a0, %18 --> fir4297 +fir4297: move $a1, %19 --> fir4296 +fir4296: call %100(2) --> fir4295 +fir4295: move %11, $v0 --> fir412 +fir412 : emit c1 --> fir411 +fir411 : li %17, 16 --> fir410 +fir410 : srav %14, %4, %17 --> fir49 +fir49 : li %16, 4 --> fir48 +fir48 : mulo %15, %5, %16 --> fir47 +fir47 : add %110, %2, %15 --> fir4150 +fir4150: sw %14, 0(%110) --> fir46 +fir46 : emit c15 --> fir45 +fir45 : li %13, 1 --> fir44 +fir44 : add %5, %5, %13 --> fir43 +fir485 : emit c8 --> fir484 +fir484 : move %71, $sp --> fir4318 +fir4318: move %71, %71 --> fir483 +fir483 : li %73, 4 --> fir482 +fir482 : mulo %72, %11, %73 --> fir481 +fir481 : add %113, %71, %72 --> fir4153 +fir4153: lw %67, 0(%113) --> fir480 +fir480 : li %70, 4 --> fir479 +fir479 : mulo %69, %6, %70 --> fir478 +fir478 : add %112, %1, %69 --> fir4152 +fir4152: lw %68, 0(%112) --> fir477 +fir477 : mulo %10, %67, %68 --> fir476 +fir476 : emit c7 --> fir475 +fir475 : move %60, $sp --> fir4317 +fir4317: move %60, %60 --> fir474 +fir474 : li %66, 1 --> fir473 +fir473 : add %64, %11, %66 --> fir472 +fir472 : li %65, 16 --> fir471 +fir471 : la %111, mod --> fir4151 +fir4151: j --> fir4314 +fir4314: move $a0, %64 --> fir4313 +fir4313: move $a1, %65 --> fir4312 +fir4312: call %111(2) --> fir4311 +fir4311: move %62, $v0 --> fir470 +fir470 : li %63, 4 --> fir469 +fir469 : mulo %61, %62, %63 --> fir468 +fir468 : add %109, %60, %61 --> fir4149 +fir4149: lw %54, 0(%109) --> fir467 +fir467 : li %59, 1 --> fir466 +fir466 : add %57, %6, %59 --> fir465 +fir465 : li %58, 4 --> fir464 +fir464 : mulo %56, %57, %58 --> fir463 +fir463 : add %108, %1, %56 --> fir4148 +fir4148: lw %55, 0(%108) --> fir462 +fir462 : mulo %9, %54, %55 --> fir461 +fir461 : emit c6 --> fir460 +fir460 : move %47, $sp --> fir4316 +fir4316: move %47, %47 --> fir459 +fir459 : li %53, 2 --> fir458 +fir458 : add %51, %11, %53 --> fir457 +fir457 : li %52, 16 --> fir456 +fir456 : la %107, mod --> fir4147 +fir4147: j --> fir4310 +fir4310: move $a0, %51 --> fir4309 +fir4309: move $a1, %52 --> fir4308 +fir4308: call %107(2) --> fir4307 +fir4307: move %49, $v0 --> fir455 +fir455 : li %50, 4 --> fir454 +fir454 : mulo %48, %49, %50 --> fir453 +fir453 : add %106, %47, %48 --> fir4146 +fir4146: lw %41, 0(%106) --> fir452 +fir452 : li %46, 2 --> fir451 +fir451 : add %44, %6, %46 --> fir450 +fir450 : li %45, 4 --> fir449 +fir449 : mulo %43, %44, %45 --> fir448 +fir448 : add %105, %1, %43 --> fir4145 +fir4145: lw %42, 0(%105) --> fir447 +fir447 : mulo %8, %41, %42 --> fir446 +fir446 : emit c5 --> fir445 +fir445 : move %34, $sp --> fir4315 +fir4315: move %34, %34 --> fir444 +fir444 : li %40, 3 --> fir443 +fir443 : add %38, %11, %40 --> fir442 +fir442 : li %39, 16 --> fir441 +fir441 : la %104, mod --> fir4144 +fir4144: j --> fir4306 +fir4306: move $a0, %38 --> fir4305 +fir4305: move $a1, %39 --> fir4304 +fir4304: call %104(2) --> fir4303 +fir4303: move %36, $v0 --> fir440 +fir440 : li %37, 4 --> fir439 +fir439 : mulo %35, %36, %37 --> fir438 +fir438 : add %103, %34, %35 --> fir4143 +fir4143: lw %28, 0(%103) --> fir437 +fir437 : li %33, 3 --> fir436 +fir436 : add %31, %6, %33 --> fir435 +fir435 : li %32, 4 --> fir434 +fir434 : mulo %30, %31, %32 --> fir433 +fir433 : add %102, %1, %30 --> fir4142 +fir4142: lw %29, 0(%102) --> fir432 +fir432 : mulo %7, %28, %29 --> fir431 +fir431 : emit c4 --> fir430 +fir430 : add %27, %4, %10 --> fir429 +fir429 : add %26, %27, %9 --> fir428 +fir428 : add %25, %26, %8 --> fir427 +fir427 : add %4, %25, %7 --> fir426 +fir426 : emit c3 --> fir425 +fir425 : li %24, 4 --> fir424 +fir424 : add %22, %11, %24 --> fir423 +fir423 : li %23, 16 --> fir422 +fir422 : la %101, mod --> fir4141 +fir4141: j --> fir4302 +fir4302: move $a0, %22 --> fir4301 +fir4301: move $a1, %23 --> fir4300 +fir4300: call %101(2) --> fir4299 +fir4299: move %11, $v0 --> fir421 +fir421 : emit c9 --> fir420 +fir420 : li %21, 4 --> fir419 +fir419 : add %6, %6, %21 --> fir418 +fir4122: emit c19 --> fir4121 +fir4121: li %88, 0 --> fir4120 +fir4120: move %89, $sp --> fir4294 +fir4294: move %89, %89 --> fir4119 +fir4119: li %91, 4 --> fir4118 +fir4118: mulo %90, %6, %91 --> fir4117 +fir4117: add %98, %89, %90 --> fir4138 +fir4138: sw %88, 0(%98) --> fir4116 +fir4116: emit c20 --> fir4115 +fir4115: li %87, 1 --> fir4114 +fir4114: add %6, %6, %87 --> fir4113 + +procedure _main(0) +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134, %135, %136, %137, %138, %139, + %140, %141, %142, %143, %144, %145, %146, + %147, %148, %149, %150, %151, %152, %153, + %154, %155, %156, %157, %158, %159 +entry main385 +main385: newframe --> main384 +main384: move %159, $ra --> main383 +main383: move %158, $s7 --> main382 +main382: move %157, $s6 --> main381 +main381: move %156, $s5 --> main380 +main380: move %155, $s4 --> main379 +main379: move %154, $s3 --> main378 +main378: move %153, $s2 --> main377 +main377: move %152, $s1 --> main376 +main376: move %151, $s0 --> main375 +main375: li %0, 0 --> main374 +main374: li %2, 0 --> main373 +main373: li %3, 0 --> main372 +main372: li %4, 0 --> main371 +main371: li %5, 0 --> main370 +main370: li %6, 0 --> main369 +main369: li %7, 0 --> main368 +main368: li %8, 0 --> main367 +main367: li %9, 0 --> main366 +main366: li %10, 0 --> main365 +main365: li %11, 0 --> main364 +main364: li %12, 0 --> main363 +main363: li %13, 0 --> main362 +main362: li %14, 0 --> main361 +main361: li %15, 0 --> main360 +main360: li %16, 0 --> main359 +main359: li %17, 0 --> main358 +main358: li %18, 0 --> main357 +main357: li %19, 0 --> main356 +main356: li %20, 0 --> main355 +main355: li %21, 0 --> main354 +main354: li %22, 0 --> main353 +main353: li %23, 0 --> main352 +main352: li %24, 0 --> main351 +main351: li %25, 0 --> main350 +main350: li %26, 0 --> main349 +main349: li %27, 0 --> main348 +main348: li %28, 0 --> main347 +main347: li %29, 0 --> main346 +main346: li %30, 0 --> main345 +main345: li %31, 0 --> main344 +main344: li %32, 0 --> main343 +main343: li %33, 0 --> main342 +main342: li %34, 0 --> main341 +main341: li %35, 0 --> main340 +main340: li %36, 0 --> main339 +main339: li %37, 0 --> main338 +main338: li %38, 0 --> main337 +main337: li %39, 0 --> main336 +main336: li %40, 0 --> main335 +main335: li %41, 0 --> main334 +main334: li %42, 0 --> main333 +main333: li %43, 0 --> main332 +main332: li %44, 0 --> main331 +main331: li %45, 0 --> main330 +main330: li %46, 0 --> main329 +main329: li %47, 0 --> main328 +main328: li %48, 0 --> main327 +main327: li %49, 0 --> main326 +main326: li %50, 0 --> main325 +main325: li %51, 0 --> main324 +main324: li %52, 0 --> main323 +main323: li %53, 0 --> main322 +main322: li %54, 0 --> main321 +main321: li %55, 0 --> main320 +main320: li %56, 0 --> main319 +main319: li %57, 0 --> main318 +main318: li %58, 0 --> main317 +main317: li %59, 0 --> main316 +main316: li %60, 0 --> main315 +main315: li %61, 0 --> main314 +main314: li %62, 0 --> main313 +main313: li %63, 0 --> main312 +main312: li %64, 0 --> main311 +main311: li %65, 0 --> main310 +main310: li %66, 0 --> main309 +main309: li %67, 0 --> main308 +main308: li %68, 0 --> main307 +main307: li %69, 0 --> main306 +main306: li %70, 0 --> main305 +main305: li %71, 0 --> main304 +main304: li %72, 0 --> main303 +main303: li %73, 0 --> main302 +main302: li %74, 0 --> main301 +main301: li %75, 0 --> main300 +main300: li %76, 0 --> main299 +main299: li %77, 0 --> main298 +main298: li %78, 0 --> main297 +main297: li %79, 0 --> main296 +main296: li %80, 0 --> main295 +main295: li %81, 0 --> main294 +main294: li %82, 0 --> main293 +main293: li %83, 0 --> main292 +main292: li %84, 0 --> main291 +main291: li %85, 0 --> main290 +main290: li %86, 0 --> main289 +main289: li %87, 0 --> main288 +main288: li %88, 0 --> main287 +main287: li %89, 0 --> main286 +main286: li %90, 0 --> main285 +main285: li %91, 0 --> main284 +main284: li %92, 0 --> main283 +main283: li %93, 0 --> main282 +main282: li %94, 0 --> main281 +main281: li %95, 0 --> main280 +main280: li %96, 0 --> main279 +main279: li %97, 0 --> main278 +main278: li %98, 0 --> main277 +main277: li %99, 0 --> main276 +main276: li %100, 0 --> main275 +main275: li %101, 0 --> main274 +main274: li %102, 0 --> main273 +main273: li %103, 0 --> main272 +main272: li %104, 0 --> main271 +main271: li %105, 0 --> main270 +main270: li %106, 0 --> main269 +main269: li %107, 0 --> main268 +main268: li %108, 0 --> main267 +main267: li %109, 0 --> main266 +main266: li %110, 0 --> main265 +main265: li %111, 0 --> main264 +main264: li %112, 0 --> main263 +main263: li %113, 0 --> main262 +main262: li %114, 0 --> main261 +main261: li %115, 0 --> main260 +main260: li %116, 0 --> main259 +main259: li %117, 0 --> main258 +main258: li %118, 0 --> main257 +main257: li %119, 0 --> main256 +main256: li %120, 0 --> main255 +main255: li %121, 0 --> main254 +main254: li %122, 0 --> main253 +main253: li %123, 0 --> main252 +main252: li %124, 0 --> main251 +main251: li %125, 0 --> main250 +main250: li %126, 0 --> main249 +main249: li %127, 0 --> main248 +main248: li %128, 0 --> main247 +main247: li %129, 0 --> main246 +main246: li %130, 0 --> main245 +main245: li %131, 0 --> main244 +main244: li %132, 0 --> main243 +main243: li %133, 0 --> main242 +main242: li %134, 0 --> main241 +main241: li %135, 0 --> main240 +main240: li %136, 0 --> main239 +main239: li %137, 0 --> main238 +main238: li %138, 0 --> main237 +main237: li %139, 0 --> main236 +main236: li %140, 0 --> main235 +main235: li %141, 0 --> main234 +main234: li %142, 0 --> main233 +main233: li %143, 0 --> main232 +main232: li %144, 0 --> main231 +main231: li %145, 0 --> main230 +main230: li %146, 0 --> main229 +main229: li %147, 0 --> main228 +main228: li %148, 0 --> main227 +main227: li %149, 0 --> main226 +main226: li %150, 0 --> main152 +main152: li %77, 1129 --> main151 +main151: move %106, $gp --> main426 +main426: move %106, %106 --> main181 +main181: sw %77, 0(%106) --> main150 +main150: li %76, 60034 --> main149 +main149: move %104, $gp --> main424 +main424: move %104, %104 --> main179 +main179: sw %76, 4(%104) --> main148 +main148: li %75, 64720 --> main147 +main147: move %103, $gp --> main423 +main423: move %103, %103 --> main178 +main178: sw %75, 8(%103) --> main146 +main146: li %74, 5595 --> main145 +main145: move %102, $gp --> main422 +main422: move %102, %102 --> main177 +main177: sw %74, 12(%102) --> main144 +main144: li %73, 494 --> main143 +main143: move %101, $gp --> main421 +main421: move %101, %101 --> main176 +main176: sw %73, 16(%101) --> main142 +main142: li %72, 59867 --> main141 +main141: move %100, $gp --> main420 +main420: move %100, %100 --> main175 +main175: sw %72, 20(%100) --> main140 +main140: li %71, 65370 --> main139 +main139: move %99, $gp --> main419 +main419: move %99, %99 --> main174 +main174: sw %71, 24(%99) --> main138 +main138: li %70, 5724 --> main137 +main137: move %98, $gp --> main418 +main418: move %98, %98 --> main173 +main173: sw %70, 28(%98) --> main136 +main136: li %69, 5724 --> main135 +main135: move %97, $gp --> main417 +main417: move %97, %97 --> main172 +main172: sw %69, 32(%97) --> main134 +main134: li %68, 65370 --> main133 +main133: move %96, $gp --> main416 +main416: move %96, %96 --> main171 +main171: sw %68, 36(%96) --> main132 +main132: li %67, 59867 --> main131 +main131: move %95, $gp --> main415 +main415: move %95, %95 --> main170 +main170: sw %67, 40(%95) --> main130 +main130: li %66, 494 --> main129 +main129: move %93, $gp --> main413 +main413: move %93, %93 --> main168 +main168: sw %66, 44(%93) --> main128 +main128: li %65, 5595 --> main127 +main127: move %92, $gp --> main412 +main412: move %92, %92 --> main167 +main167: sw %65, 48(%92) --> main126 +main126: li %64, 64720 --> main125 +main125: move %91, $gp --> main411 +main411: move %91, %91 --> main166 +main166: sw %64, 52(%91) --> main124 +main124: li %63, 60034 --> main123 +main123: move %90, $gp --> main410 +main410: move %90, %90 --> main165 +main165: sw %63, 56(%90) --> main122 +main122: li %62, 1129 --> main121 +main121: move %89, $gp --> main409 +main409: move %89, %89 --> main164 +main164: sw %62, 60(%89) --> main120 +main120: li %61, 1 --> main119 +main119: move %88, $gp --> main408 +main408: move %88, %88 --> main163 +main163: sw %61, 64(%88) --> main118 +main118: li %60, 0 --> main117 +main117: move %87, $gp --> main407 +main407: move %87, %87 --> main162 +main162: sw %60, 68(%87) --> main116 +main116: li %59, 16384 --> main115 +main115: move %86, $gp --> main406 +main406: move %86, %86 --> main161 +main161: sw %59, 72(%86) --> main114 +main114: li %58, 0 --> main113 +main113: move %85, $gp --> main405 +main405: move %85, %85 --> main160 +main160: sw %58, 76(%85) --> main112 +main112: li %57, 0 --> main111 +main111: move %84, $gp --> main404 +main404: move %84, %84 --> main159 +main159: sw %57, 80(%84) --> main110 +main110: li %56, 0 --> main109 +main109: move %82, $gp --> main402 +main402: move %82, %82 --> main157 +main157: sw %56, 84(%82) --> main108 +main108: li %55, 0 --> main107 +main107: move %81, $gp --> main401 +main401: move %81, %81 --> main156 +main156: sw %55, 88(%81) --> main106 +main106: li %54, 0 --> main105 +main105: move %80, $gp --> main400 +main400: move %80, %80 --> main155 +main155: sw %54, 92(%80) --> main104 +main104: li %53, 0 --> main103 +main103: move %79, $gp --> main399 +main399: move %79, %79 --> main154 +main154: sw %53, 96(%79) --> main102 +main102: li %52, 0 --> main101 +main101: move %78, $gp --> main398 +main398: move %78, %78 --> main153 +main153: sw %52, 100(%78) --> main100 +main100: li %51, 0 --> main99 +main99 : move %150, $gp --> main478 +main478: move %150, %150 --> main225 +main225: sw %51, 104(%150) --> main98 +main98 : li %50, 0 --> main97 +main97 : move %149, $gp --> main477 +main477: move %149, %149 --> main224 +main224: sw %50, 108(%149) --> main96 +main96 : li %49, 0 --> main95 +main95 : move %148, $gp --> main476 +main476: move %148, %148 --> main223 +main223: sw %49, 112(%148) --> main94 +main94 : li %48, 0 --> main93 +main93 : move %147, $gp --> main475 +main475: move %147, %147 --> main222 +main222: sw %48, 116(%147) --> main92 +main92 : li %47, 0 --> main91 +main91 : move %146, $gp --> main474 +main474: move %146, %146 --> main221 +main221: sw %47, 120(%146) --> main90 +main90 : li %46, 0 --> main89 +main89 : move %144, $gp --> main472 +main472: move %144, %144 --> main219 +main219: sw %46, 124(%144) --> main88 +main88 : li %45, 0 --> main87 +main87 : move %143, $gp --> main471 +main471: move %143, %143 --> main218 +main218: sw %45, 128(%143) --> main86 +main86 : li %44, 0 --> main85 +main85 : move %142, $gp --> main470 +main470: move %142, %142 --> main217 +main217: sw %44, 132(%142) --> main84 +main84 : li %43, 0 --> main83 +main83 : move %141, $gp --> main469 +main469: move %141, %141 --> main216 +main216: sw %43, 136(%141) --> main82 +main82 : li %42, 0 --> main81 +main81 : move %140, $gp --> main468 +main468: move %140, %140 --> main215 +main215: sw %42, 140(%140) --> main80 +main80 : li %41, 0 --> main79 +main79 : move %139, $gp --> main467 +main467: move %139, %139 --> main214 +main214: sw %41, 144(%139) --> main78 +main78 : li %40, 0 --> main77 +main77 : move %138, $gp --> main466 +main466: move %138, %138 --> main213 +main213: sw %40, 148(%138) --> main76 +main76 : li %39, 0 --> main75 +main75 : move %137, $gp --> main465 +main465: move %137, %137 --> main212 +main212: sw %39, 152(%137) --> main74 +main74 : li %38, 0 --> main73 +main73 : move %136, $gp --> main464 +main464: move %136, %136 --> main211 +main211: sw %38, 156(%136) --> main72 +main72 : li %37, 0 --> main71 +main71 : move %135, $gp --> main463 +main463: move %135, %135 --> main210 +main210: sw %37, 160(%135) --> main70 +main70 : li %36, 7986 --> main69 +main69 : move %134, $gp --> main461 +main461: move %134, %134 --> main209 +main209: sw %36, 164(%134) --> main68 +main68 : li %35, 8993 --> main67 +main67 : move %133, $gp --> main460 +main460: move %133, %133 --> main208 +main208: sw %35, 168(%133) --> main66 +main66 : li %34, 1808 --> main65 +main65 : move %132, $gp --> main459 +main459: move %132, %132 --> main207 +main207: sw %34, 172(%132) --> main64 +main64 : li %33, 4096 --> main63 +main63 : move %131, $gp --> main458 +main458: move %131, %131 --> main206 +main206: sw %33, 176(%131) --> main62 +main62 : li %32, 4096 --> main61 +main61 : move %130, $gp --> main457 +main457: move %130, %130 --> main205 +main205: sw %32, 180(%130) --> main60 +main60 : li %31, 4096 --> main59 +main59 : move %129, $gp --> main455 +main455: move %129, %129 --> main204 +main204: sw %31, 184(%129) --> main58 +main58 : li %30, 4096 --> main57 +main57 : move %128, $gp --> main454 +main454: move %128, %128 --> main203 +main203: sw %30, 188(%128) --> main56 +main56 : li %29, 4096 --> main55 +main55 : move %127, $gp --> main453 +main453: move %127, %127 --> main202 +main202: sw %29, 192(%127) --> main54 +main54 : li %28, 4096 --> main53 +main53 : move %126, $gp --> main452 +main452: move %126, %126 --> main201 +main201: sw %28, 196(%126) --> main52 +main52 : li %27, 4096 --> main51 +main51 : move %125, $gp --> main451 +main451: move %125, %125 --> main200 +main200: sw %27, 200(%125) --> main50 +main50 : li %26, 4096 --> main49 +main49 : move %124, $gp --> main449 +main449: move %124, %124 --> main199 +main199: sw %26, 204(%124) --> main48 +main48 : li %25, 4096 --> main47 +main47 : move %123, $gp --> main448 +main448: move %123, %123 --> main198 +main198: sw %25, 208(%123) --> main46 +main46 : li %24, 4096 --> main45 +main45 : move %122, $gp --> main447 +main447: move %122, %122 --> main197 +main197: sw %24, 212(%122) --> main44 +main44 : li %23, 4096 --> main43 +main43 : move %121, $gp --> main446 +main446: move %121, %121 --> main196 +main196: sw %23, 216(%121) --> main42 +main42 : li %22, 4096 --> main41 +main41 : move %120, $gp --> main445 +main445: move %120, %120 --> main195 +main195: sw %22, 220(%120) --> main40 +main40 : li %21, 4096 --> main39 +main39 : move %119, $gp --> main444 +main444: move %119, %119 --> main194 +main194: sw %21, 224(%119) --> main38 +main38 : li %20, 4096 --> main37 +main37 : move %118, $gp --> main443 +main443: move %118, %118 --> main193 +main193: sw %20, 228(%118) --> main36 +main36 : li %19, 4096 --> main35 +main35 : move %117, $gp --> main442 +main442: move %117, %117 --> main192 +main192: sw %19, 232(%117) --> main34 +main34 : li %18, 4096 --> main33 +main33 : move %116, $gp --> main441 +main441: move %116, %116 --> main191 +main191: sw %18, 236(%116) --> main32 +main32 : li %17, 4096 --> main31 +main31 : move %115, $gp --> main440 +main440: move %115, %115 --> main190 +main190: sw %17, 240(%115) --> main30 +main30 : li %16, 4096 --> main29 +main29 : move %113, $gp --> main439 +main439: move %113, %113 --> main188 +main188: sw %16, 244(%113) --> main28 +main28 : li %15, 4096 --> main27 +main27 : move %112, $gp --> main438 +main438: move %112, %112 --> main187 +main187: sw %15, 248(%112) --> main26 +main26 : li %14, 4096 --> main25 +main25 : move %111, $gp --> main437 +main437: move %111, %111 --> main186 +main186: sw %14, 252(%111) --> main24 +main24 : li %13, 4096 --> main23 +main23 : move %110, $gp --> main436 +main436: move %110, %110 --> main185 +main185: sw %13, 256(%110) --> main22 +main22 : li %12, 4096 --> main21 +main21 : move %109, $gp --> main435 +main435: move %109, %109 --> main184 +main184: sw %12, 260(%109) --> main20 +main20 : li %11, 4096 --> main19 +main19 : move %108, $gp --> main434 +main434: move %108, %108 --> main183 +main183: sw %11, 264(%108) --> main18 +main18 : li %10, 4096 --> main17 +main17 : move %107, $gp --> main427 +main427: move %107, %107 --> main182 +main182: sw %10, 268(%107) --> main16 +main16 : li %9, 4096 --> main15 +main15 : move %105, $gp --> main425 +main425: move %105, %105 --> main180 +main180: sw %9, 272(%105) --> main14 +main14 : li %8, 4096 --> main13 +main13 : move %94, $gp --> main414 +main414: move %94, %94 --> main169 +main169: sw %8, 276(%94) --> main12 +main12 : li %7, 4096 --> main11 +main11 : move %83, $gp --> main403 +main403: move %83, %83 --> main158 +main158: sw %7, 280(%83) --> main10 +main10 : li %6, 4096 --> main9 +main9 : move %145, $gp --> main473 +main473: move %145, %145 --> main220 +main220: sw %6, 284(%145) --> main8 +main8 : emit c27 --> main7 +main7 : move %2, $gp --> main462 +main462: addi %2, %2, 64 --> main6 +main6 : move %3, $gp --> main456 +main456: move %3, %3 --> main5 +main5 : move %4, $sp --> main450 +main450: move %4, %4 --> main4 +main4 : li %5, 16 --> main3 +main3 : la %114, fir4 --> main189 +main189: j --> main433 +main433: move $a0, %2 --> main432 +main432: move $a1, %3 --> main431 +main431: move $a2, %4 --> main430 +main430: move $a3, %5 --> main429 +main429: call %114(4) --> main428 +main428: move %0, $v0 --> main2 +main2 : emit c26 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main397 +main397: move $v0, %1 --> main396 +main396: move $ra, %159 --> main395 +main395: move $s7, %158 --> main394 +main394: move $s6, %157 --> main393 +main393: move $s5, %156 --> main392 +main392: move $s4, %155 --> main391 +main391: move $s3, %154 --> main390 +main390: move $s2, %153 --> main389 +main389: move $s1, %152 --> main388 +main388: move $s0, %151 --> main387 +main387: delframe --> main386 +main386: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir4.LIN.expected b/tests/clight/fir4.LIN.expected new file mode 100644 index 0000000..cd6ac0b --- /dev/null +++ b/tests/clight/fir4.LIN.expected @@ -0,0 +1,803 @@ +program + +globals 288 + +procedure fir4(4) +var 116 +fir4280: +newframe +sw $ra, 112($sp) +sw $s7, 108($sp) +sw $s6, 104($sp) +sw $s5, 100($sp) +sw $s4, 96($sp) +sw $s3, 92($sp) +sw $s2, 88($sp) +sw $s1, 84($sp) +sw $s0, 80($sp) +sw $a0, 64($sp) +move $s6, $a1 +sw $a2, 68($sp) +sw $a3, 72($sp) +c25: +li $s1, 0 +c24: +c23: +c22: +li $s3, 0 +fir4128: +li $a0, 0 +c21: +li $v0, 16 +slt $v0, $s3, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, fir4122 +c18: +c17: +li $s4, 0 +fir4109: +li $a0, 0 +c16: +lw $fp, 72($sp) +slt $v0, $s4, $fp +seq $v0, $v0, $zero +beq $v0, $a0, fir4104 +c0: +li $v0, 0 +lw $ra, 112($sp) +lw $s7, 108($sp) +lw $s6, 104($sp) +lw $s5, 100($sp) +lw $s4, 96($sp) +lw $s3, 92($sp) +lw $s2, 88($sp) +lw $s1, 84($sp) +lw $s0, 80($sp) +delframe +jr $ra +fir4104: +c14: +li $v0, 4 +mulo $v0, $s4, $v0 +lw $v1, 64($sp) +add $v0, $v1, $v0 +lw $a1, 0($v0) +move $a0, $sp +li $v0, 4 +mulo $v0, $s1, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c13: +li $s5, 0 +c12: +c11: +li $s3, 0 +fir491: +li $a0, 0 +c10: +li $v0, 16 +slt $v0, $s3, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, fir485 +c2: +li $v0, 1 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +call $v0 +move $s1, $v0 +c1: +li $v0, 16 +srav $a0, $s5, $v0 +li $v0, 4 +mulo $v0, $s4, $v0 +lw $v1, 68($sp) +add $v0, $v1, $v0 +sw $a0, 0($v0) +c15: +li $v0, 1 +add $s4, $s4, $v0 +j fir4109 +fir485: +c8: +move $a0, $sp +li $v0, 4 +mulo $v0, $s1, $v0 +add $v0, $a0, $v0 +lw $a0, 0($v0) +li $v0, 4 +mulo $v0, $s3, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $s2, $a0, $v0 +c7: +move $s0, $sp +li $v0, 1 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +call $v0 +li $a0, 4 +mulo $v0, $v0, $a0 +add $v0, $s0, $v0 +lw $a1, 0($v0) +li $v0, 1 +add $a0, $s3, $v0 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $v1, $a1, $v0 +sw $v1, 76($sp) +c6: +move $s0, $sp +li $v0, 2 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +call $v0 +li $a0, 4 +mulo $v0, $v0, $a0 +add $v0, $s0, $v0 +lw $a1, 0($v0) +li $v0, 2 +add $a0, $s3, $v0 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $s7, $a1, $v0 +c5: +move $s0, $sp +li $v0, 3 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +call $v0 +li $a0, 4 +mulo $v0, $v0, $a0 +add $v0, $s0, $v0 +lw $a1, 0($v0) +li $v0, 3 +add $a0, $s3, $v0 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $s6, $v0 +lw $v0, 0($v0) +mulo $v0, $a1, $v0 +c4: +add $a0, $s5, $s2 +lw $fp, 76($sp) +add $a0, $a0, $fp +add $a0, $a0, $s7 +add $s5, $a0, $v0 +c3: +li $v0, 4 +add $a0, $s1, $v0 +li $a1, 16 +la $v0, mod +call $v0 +move $s1, $v0 +c9: +li $v0, 4 +add $s3, $s3, $v0 +j fir491 +fir4122: +c19: +move $a0, $sp +li $v0, 4 +mulo $v0, $s3, $v0 +add $v0, $a0, $v0 +sw $zero, 0($v0) +c20: +li $v0, 1 +add $s3, $s3, $v0 +j fir4128 + +procedure _main(0) +var 68 +main385: +newframe +sw $ra, 64($sp) +li $a0, 1129 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 60034 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 64720 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 5595 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 494 +move $v0, $gp +sw $a0, 16($v0) +li $a0, 59867 +move $v0, $gp +sw $a0, 20($v0) +li $a0, 65370 +move $v0, $gp +sw $a0, 24($v0) +li $a0, 5724 +move $v0, $gp +sw $a0, 28($v0) +li $a0, 5724 +move $v0, $gp +sw $a0, 32($v0) +li $a0, 65370 +move $v0, $gp +sw $a0, 36($v0) +li $a0, 59867 +move $v0, $gp +sw $a0, 40($v0) +li $a0, 494 +move $v0, $gp +sw $a0, 44($v0) +li $a0, 5595 +move $v0, $gp +sw $a0, 48($v0) +li $a0, 64720 +move $v0, $gp +sw $a0, 52($v0) +li $a0, 60034 +move $v0, $gp +sw $a0, 56($v0) +li $a0, 1129 +move $v0, $gp +sw $a0, 60($v0) +li $a0, 1 +move $v0, $gp +sw $a0, 64($v0) +move $v0, $gp +sw $zero, 68($v0) +li $a0, 16384 +move $v0, $gp +sw $a0, 72($v0) +move $v0, $gp +sw $zero, 76($v0) +move $v0, $gp +sw $zero, 80($v0) +move $v0, $gp +sw $zero, 84($v0) +move $v0, $gp +sw $zero, 88($v0) +move $v0, $gp +sw $zero, 92($v0) +move $v0, $gp +sw $zero, 96($v0) +move $v0, $gp +sw $zero, 100($v0) +move $v0, $gp +sw $zero, 104($v0) +move $v0, $gp +sw $zero, 108($v0) +move $v0, $gp +sw $zero, 112($v0) +move $v0, $gp +sw $zero, 116($v0) +move $v0, $gp +sw $zero, 120($v0) +move $v0, $gp +sw $zero, 124($v0) +move $v0, $gp +sw $zero, 128($v0) +move $v0, $gp +sw $zero, 132($v0) +move $v0, $gp +sw $zero, 136($v0) +move $v0, $gp +sw $zero, 140($v0) +move $v0, $gp +sw $zero, 144($v0) +move $v0, $gp +sw $zero, 148($v0) +move $v0, $gp +sw $zero, 152($v0) +move $v0, $gp +sw $zero, 156($v0) +move $v0, $gp +sw $zero, 160($v0) +li $a0, 7986 +move $v0, $gp +sw $a0, 164($v0) +li $a0, 8993 +move $v0, $gp +sw $a0, 168($v0) +li $a0, 1808 +move $v0, $gp +sw $a0, 172($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 176($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 180($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 184($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 188($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 192($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 196($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 200($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 204($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 208($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 212($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 216($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 220($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 224($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 228($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 232($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 236($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 240($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 244($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 248($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 252($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 256($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 260($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 264($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 268($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 272($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 276($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 280($v0) +li $a0, 4096 +move $v0, $gp +sw $a0, 284($v0) +c27: +move $a0, $gp +addi $a0, $a0, 64 +move $a1, $gp +move $a2, $sp +li $a3, 16 +la $v0, fir4 +call $v0 +c26: +lw $ra, 64($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir4.LTL.expected b/tests/clight/fir4.LTL.expected new file mode 100644 index 0000000..742af04 --- /dev/null +++ b/tests/clight/fir4.LTL.expected @@ -0,0 +1,1211 @@ +program + +globals 288 + +procedure fir4(4) +var 116 +entry fir4280 +fir4280: newframe --> fir4279 +fir4279: lw $ra, 112($sp) --> fir4278 +fir4278: lw $s7, 108($sp) --> fir4277 +fir4277: lw $s6, 104($sp) --> fir4276 +fir4276: lw $s5, 100($sp) --> fir4275 +fir4275: lw $s4, 96($sp) --> fir4274 +fir4274: lw $s3, 92($sp) --> fir4273 +fir4273: lw $s2, 88($sp) --> fir4272 +fir4272: lw $s1, 84($sp) --> fir4271 +fir4271: lw $s0, 80($sp) --> fir4270 +fir4270: lw $a0, 64($sp) --> fir4269 +fir4269: move $s6, $a1 --> fir4268 +fir4268: lw $a2, 68($sp) --> fir4267 +fir4267: lw $a3, 72($sp) --> fir4266 +fir4266: j --> fir4265 +fir4265: j --> fir4264 +fir4264: j --> fir4263 +fir4263: j --> fir4262 +fir4262: j --> fir4261 +fir4261: j --> fir4260 +fir4260: j --> fir4259 +fir4259: j --> fir4258 +fir4258: j --> fir4257 +fir4257: j --> fir4256 +fir4256: j --> fir4255 +fir4255: j --> fir4254 +fir4254: j --> fir4253 +fir4253: j --> fir4252 +fir4252: j --> fir4251 +fir4251: j --> fir4250 +fir4250: j --> fir4249 +fir4249: j --> fir4248 +fir4248: j --> fir4247 +fir4247: j --> fir4246 +fir4246: j --> fir4245 +fir4245: j --> fir4244 +fir4244: j --> fir4243 +fir4243: j --> fir4242 +fir4242: j --> fir4241 +fir4241: j --> fir4240 +fir4240: j --> fir4239 +fir4239: j --> fir4238 +fir4238: j --> fir4237 +fir4237: j --> fir4236 +fir4236: j --> fir4235 +fir4235: j --> fir4234 +fir4234: j --> fir4233 +fir4233: j --> fir4232 +fir4232: j --> fir4231 +fir4231: j --> fir4230 +fir4230: j --> fir4229 +fir4229: j --> fir4228 +fir4228: j --> fir4227 +fir4227: j --> fir4226 +fir4226: j --> fir4225 +fir4225: j --> fir4224 +fir4224: j --> fir4223 +fir4223: j --> fir4222 +fir4222: j --> fir4221 +fir4221: j --> fir4220 +fir4220: j --> fir4219 +fir4219: j --> fir4218 +fir4218: j --> fir4217 +fir4217: j --> fir4216 +fir4216: j --> fir4215 +fir4215: j --> fir4214 +fir4214: j --> fir4213 +fir4213: j --> fir4212 +fir4212: j --> fir4211 +fir4211: j --> fir4210 +fir4210: j --> fir4209 +fir4209: j --> fir4208 +fir4208: j --> fir4207 +fir4207: j --> fir4206 +fir4206: j --> fir4205 +fir4205: j --> fir4204 +fir4204: j --> fir4203 +fir4203: j --> fir4202 +fir4202: j --> fir4201 +fir4201: j --> fir4200 +fir4200: j --> fir4199 +fir4199: j --> fir4198 +fir4198: j --> fir4197 +fir4197: j --> fir4196 +fir4196: j --> fir4195 +fir4195: j --> fir4194 +fir4194: j --> fir4193 +fir4193: j --> fir4192 +fir4192: j --> fir4191 +fir4191: j --> fir4190 +fir4190: j --> fir4189 +fir4189: j --> fir4188 +fir4188: j --> fir4187 +fir4187: j --> fir4186 +fir4186: j --> fir4185 +fir4185: j --> fir4184 +fir4184: j --> fir4183 +fir4183: j --> fir4182 +fir4182: j --> fir4181 +fir4181: j --> fir4180 +fir4180: j --> fir4179 +fir4179: j --> fir4178 +fir4178: j --> fir4177 +fir4177: j --> fir4176 +fir4176: j --> fir4175 +fir4175: j --> fir4174 +fir4174: j --> fir4173 +fir4173: j --> fir4172 +fir4172: j --> fir4171 +fir4171: j --> fir4170 +fir4170: j --> fir4169 +fir4169: j --> fir4168 +fir4168: j --> fir4167 +fir4167: j --> fir4166 +fir4166: j --> fir4165 +fir4165: j --> fir4164 +fir4164: j --> fir4163 +fir4163: j --> fir4162 +fir4162: j --> fir4161 +fir4161: j --> fir4160 +fir4160: j --> fir4159 +fir4159: j --> fir4158 +fir4158: j --> fir4157 +fir4157: j --> fir4156 +fir4156: j --> fir4135 +fir4135: emit c25 --> fir4134 +fir4134: li $s1, 0 --> fir4133 +fir4133: emit c24 --> fir4132 +fir4132: j --> fir4131 +fir4131: emit c23 --> fir4130 +fir4130: emit c22 --> fir4129 +fir4129: li $s3, 0 --> fir4113 +fir4113: j --> fir4128 +fir4128: li $a0, 0 --> fir4127 +fir4127: emit c21 --> fir4126 +fir4126: li $v0, 16 --> fir4125 +fir4125: slt $v0, $s3, $v0 --> fir4124 +fir4124: j --> fir4139 +fir4139: seq $v0, $v0, $zero --> fir4123 +fir4123: beq $v0, $a0 --> fir4122, fir4112 +fir4112: emit c18 --> fir4111 +fir4111: emit c17 --> fir4110 +fir4110: li $s4, 0 --> fir43 +fir43 : j --> fir4109 +fir4109: li $a0, 0 --> fir4108 +fir4108: emit c16 --> fir4107 +fir4107: lw $fp, 72($sp) --> fir4320 +fir4320: slt $v0, $s4, $fp --> fir4106 +fir4106: j --> fir4137 +fir4137: seq $v0, $v0, $zero --> fir4105 +fir4105: beq $v0, $a0 --> fir4104, fir42 +fir42 : emit c0 --> fir41 +fir41 : li $v0, 0 --> fir40 +fir40 : j --> fir4292 +fir4292: j --> fir4291 +fir4291: lw $ra, 112($sp) --> fir4290 +fir4290: lw $s7, 108($sp) --> fir4289 +fir4289: lw $s6, 104($sp) --> fir4288 +fir4288: lw $s5, 100($sp) --> fir4287 +fir4287: lw $s4, 96($sp) --> fir4286 +fir4286: lw $s3, 92($sp) --> fir4285 +fir4285: lw $s2, 88($sp) --> fir4284 +fir4284: lw $s1, 84($sp) --> fir4283 +fir4283: lw $s0, 80($sp) --> fir4282 +fir4282: delframe --> fir4281 +fir4281: jr $ra +fir4104: emit c14 --> fir4103 +fir4103: li $v0, 4 --> fir4102 +fir4102: mulo $v0, $s4, $v0 --> fir4101 +fir4101: lw $v1, 64($sp) --> fir4319 +fir4319: add $v0, $v1, $v0 --> fir4136 +fir4136: lw $a1, 0($v0) --> fir4100 +fir4100: move $a0, $sp --> fir4293 +fir4293: j --> fir499 +fir499 : li $v0, 4 --> fir498 +fir498 : mulo $v0, $s1, $v0 --> fir497 +fir497 : add $v0, $a0, $v0 --> fir4155 +fir4155: lw $a1, 0($v0) --> fir496 +fir496 : emit c13 --> fir495 +fir495 : li $s5, 0 --> fir494 +fir494 : emit c12 --> fir493 +fir493 : emit c11 --> fir492 +fir492 : li $s3, 0 --> fir418 +fir418 : j --> fir491 +fir491 : li $a0, 0 --> fir490 +fir490 : emit c10 --> fir489 +fir489 : li $v0, 16 --> fir488 +fir488 : slt $v0, $s3, $v0 --> fir487 +fir487 : j --> fir4154 +fir4154: seq $v0, $v0, $zero --> fir486 +fir486 : beq $v0, $a0 --> fir485, fir417 +fir417 : emit c2 --> fir416 +fir416 : li $v0, 1 --> fir415 +fir415 : add $a0, $s1, $v0 --> fir414 +fir414 : li $a1, 16 --> fir413 +fir413 : la $v0, mod --> fir4140 +fir4140: j --> fir4298 +fir4298: j --> fir4297 +fir4297: j --> fir4296 +fir4296: call $v0 --> fir4295 +fir4295: move $s1, $v0 --> fir412 +fir412 : emit c1 --> fir411 +fir411 : li $v0, 16 --> fir410 +fir410 : srav $a0, $s5, $v0 --> fir49 +fir49 : li $v0, 4 --> fir48 +fir48 : mulo $v0, $s4, $v0 --> fir47 +fir47 : lw $v1, 68($sp) --> fir4323 +fir4323: add $v0, $v1, $v0 --> fir4150 +fir4150: lw $a0, 0($v0) --> fir46 +fir46 : emit c15 --> fir45 +fir45 : li $v0, 1 --> fir44 +fir44 : add $s4, $s4, $v0 --> fir43 +fir485 : emit c8 --> fir484 +fir484 : move $a0, $sp --> fir4318 +fir4318: j --> fir483 +fir483 : li $v0, 4 --> fir482 +fir482 : mulo $v0, $s1, $v0 --> fir481 +fir481 : add $v0, $a0, $v0 --> fir4153 +fir4153: lw $a0, 0($v0) --> fir480 +fir480 : li $v0, 4 --> fir479 +fir479 : mulo $v0, $s3, $v0 --> fir478 +fir478 : add $v0, $s6, $v0 --> fir4152 +fir4152: lw $v0, 0($v0) --> fir477 +fir477 : mulo $s2, $a0, $v0 --> fir476 +fir476 : emit c7 --> fir475 +fir475 : move $s0, $sp --> fir4317 +fir4317: j --> fir474 +fir474 : li $v0, 1 --> fir473 +fir473 : add $a0, $s1, $v0 --> fir472 +fir472 : li $a1, 16 --> fir471 +fir471 : la $v0, mod --> fir4151 +fir4151: j --> fir4314 +fir4314: j --> fir4313 +fir4313: j --> fir4312 +fir4312: call $v0 --> fir4311 +fir4311: j --> fir470 +fir470 : li $a0, 4 --> fir469 +fir469 : mulo $v0, $v0, $a0 --> fir468 +fir468 : add $v0, $s0, $v0 --> fir4149 +fir4149: lw $a1, 0($v0) --> fir467 +fir467 : li $v0, 1 --> fir466 +fir466 : add $a0, $s3, $v0 --> fir465 +fir465 : li $v0, 4 --> fir464 +fir464 : mulo $v0, $a0, $v0 --> fir463 +fir463 : add $v0, $s6, $v0 --> fir4148 +fir4148: lw $v0, 0($v0) --> fir462 +fir462 : mulo $v1, $a1, $v0 --> fir4322 +fir4322: lw $v1, 76($sp) --> fir461 +fir461 : emit c6 --> fir460 +fir460 : move $s0, $sp --> fir4316 +fir4316: j --> fir459 +fir459 : li $v0, 2 --> fir458 +fir458 : add $a0, $s1, $v0 --> fir457 +fir457 : li $a1, 16 --> fir456 +fir456 : la $v0, mod --> fir4147 +fir4147: j --> fir4310 +fir4310: j --> fir4309 +fir4309: j --> fir4308 +fir4308: call $v0 --> fir4307 +fir4307: j --> fir455 +fir455 : li $a0, 4 --> fir454 +fir454 : mulo $v0, $v0, $a0 --> fir453 +fir453 : add $v0, $s0, $v0 --> fir4146 +fir4146: lw $a1, 0($v0) --> fir452 +fir452 : li $v0, 2 --> fir451 +fir451 : add $a0, $s3, $v0 --> fir450 +fir450 : li $v0, 4 --> fir449 +fir449 : mulo $v0, $a0, $v0 --> fir448 +fir448 : add $v0, $s6, $v0 --> fir4145 +fir4145: lw $v0, 0($v0) --> fir447 +fir447 : mulo $s7, $a1, $v0 --> fir446 +fir446 : emit c5 --> fir445 +fir445 : move $s0, $sp --> fir4315 +fir4315: j --> fir444 +fir444 : li $v0, 3 --> fir443 +fir443 : add $a0, $s1, $v0 --> fir442 +fir442 : li $a1, 16 --> fir441 +fir441 : la $v0, mod --> fir4144 +fir4144: j --> fir4306 +fir4306: j --> fir4305 +fir4305: j --> fir4304 +fir4304: call $v0 --> fir4303 +fir4303: j --> fir440 +fir440 : li $a0, 4 --> fir439 +fir439 : mulo $v0, $v0, $a0 --> fir438 +fir438 : add $v0, $s0, $v0 --> fir4143 +fir4143: lw $a1, 0($v0) --> fir437 +fir437 : li $v0, 3 --> fir436 +fir436 : add $a0, $s3, $v0 --> fir435 +fir435 : li $v0, 4 --> fir434 +fir434 : mulo $v0, $a0, $v0 --> fir433 +fir433 : add $v0, $s6, $v0 --> fir4142 +fir4142: lw $v0, 0($v0) --> fir432 +fir432 : mulo $v0, $a1, $v0 --> fir431 +fir431 : emit c4 --> fir430 +fir430 : add $a0, $s5, $s2 --> fir429 +fir429 : lw $fp, 76($sp) --> fir4321 +fir4321: add $a0, $a0, $fp --> fir428 +fir428 : add $a0, $a0, $s7 --> fir427 +fir427 : add $s5, $a0, $v0 --> fir426 +fir426 : emit c3 --> fir425 +fir425 : li $v0, 4 --> fir424 +fir424 : add $a0, $s1, $v0 --> fir423 +fir423 : li $a1, 16 --> fir422 +fir422 : la $v0, mod --> fir4141 +fir4141: j --> fir4302 +fir4302: j --> fir4301 +fir4301: j --> fir4300 +fir4300: call $v0 --> fir4299 +fir4299: move $s1, $v0 --> fir421 +fir421 : emit c9 --> fir420 +fir420 : li $v0, 4 --> fir419 +fir419 : add $s3, $s3, $v0 --> fir418 +fir4122: emit c19 --> fir4121 +fir4121: j --> fir4120 +fir4120: move $a0, $sp --> fir4294 +fir4294: j --> fir4119 +fir4119: li $v0, 4 --> fir4118 +fir4118: mulo $v0, $s3, $v0 --> fir4117 +fir4117: add $v0, $a0, $v0 --> fir4138 +fir4138: lw $zero, 0($v0) --> fir4116 +fir4116: emit c20 --> fir4115 +fir4115: li $v0, 1 --> fir4114 +fir4114: add $s3, $s3, $v0 --> fir4113 + +procedure _main(0) +var 68 +entry main385 +main385: newframe --> main384 +main384: lw $ra, 64($sp) --> main383 +main383: j --> main382 +main382: j --> main381 +main381: j --> main380 +main380: j --> main379 +main379: j --> main378 +main378: j --> main377 +main377: j --> main376 +main376: j --> main375 +main375: j --> main374 +main374: j --> main373 +main373: j --> main372 +main372: j --> main371 +main371: j --> main370 +main370: j --> main369 +main369: j --> main368 +main368: j --> main367 +main367: j --> main366 +main366: j --> main365 +main365: j --> main364 +main364: j --> main363 +main363: j --> main362 +main362: j --> main361 +main361: j --> main360 +main360: j --> main359 +main359: j --> main358 +main358: j --> main357 +main357: j --> main356 +main356: j --> main355 +main355: j --> main354 +main354: j --> main353 +main353: j --> main352 +main352: j --> main351 +main351: j --> main350 +main350: j --> main349 +main349: j --> main348 +main348: j --> main347 +main347: j --> main346 +main346: j --> main345 +main345: j --> main344 +main344: j --> main343 +main343: j --> main342 +main342: j --> main341 +main341: j --> main340 +main340: j --> main339 +main339: j --> main338 +main338: j --> main337 +main337: j --> main336 +main336: j --> main335 +main335: j --> main334 +main334: j --> main333 +main333: j --> main332 +main332: j --> main331 +main331: j --> main330 +main330: j --> main329 +main329: j --> main328 +main328: j --> main327 +main327: j --> main326 +main326: j --> main325 +main325: j --> main324 +main324: j --> main323 +main323: j --> main322 +main322: j --> main321 +main321: j --> main320 +main320: j --> main319 +main319: j --> main318 +main318: j --> main317 +main317: j --> main316 +main316: j --> main315 +main315: j --> main314 +main314: j --> main313 +main313: j --> main312 +main312: j --> main311 +main311: j --> main310 +main310: j --> main309 +main309: j --> main308 +main308: j --> main307 +main307: j --> main306 +main306: j --> main305 +main305: j --> main304 +main304: j --> main303 +main303: j --> main302 +main302: j --> main301 +main301: j --> main300 +main300: j --> main299 +main299: j --> main298 +main298: j --> main297 +main297: j --> main296 +main296: j --> main295 +main295: j --> main294 +main294: j --> main293 +main293: j --> main292 +main292: j --> main291 +main291: j --> main290 +main290: j --> main289 +main289: j --> main288 +main288: j --> main287 +main287: j --> main286 +main286: j --> main285 +main285: j --> main284 +main284: j --> main283 +main283: j --> main282 +main282: j --> main281 +main281: j --> main280 +main280: j --> main279 +main279: j --> main278 +main278: j --> main277 +main277: j --> main276 +main276: j --> main275 +main275: j --> main274 +main274: j --> main273 +main273: j --> main272 +main272: j --> main271 +main271: j --> main270 +main270: j --> main269 +main269: j --> main268 +main268: j --> main267 +main267: j --> main266 +main266: j --> main265 +main265: j --> main264 +main264: j --> main263 +main263: j --> main262 +main262: j --> main261 +main261: j --> main260 +main260: j --> main259 +main259: j --> main258 +main258: j --> main257 +main257: j --> main256 +main256: j --> main255 +main255: j --> main254 +main254: j --> main253 +main253: j --> main252 +main252: j --> main251 +main251: j --> main250 +main250: j --> main249 +main249: j --> main248 +main248: j --> main247 +main247: j --> main246 +main246: j --> main245 +main245: j --> main244 +main244: j --> main243 +main243: j --> main242 +main242: j --> main241 +main241: j --> main240 +main240: j --> main239 +main239: j --> main238 +main238: j --> main237 +main237: j --> main236 +main236: j --> main235 +main235: j --> main234 +main234: j --> main233 +main233: j --> main232 +main232: j --> main231 +main231: j --> main230 +main230: j --> main229 +main229: j --> main228 +main228: j --> main227 +main227: j --> main226 +main226: j --> main152 +main152: li $a0, 1129 --> main151 +main151: move $v0, $gp --> main426 +main426: j --> main181 +main181: lw $a0, 0($v0) --> main150 +main150: li $a0, 60034 --> main149 +main149: move $v0, $gp --> main424 +main424: j --> main179 +main179: lw $a0, 4($v0) --> main148 +main148: li $a0, 64720 --> main147 +main147: move $v0, $gp --> main423 +main423: j --> main178 +main178: lw $a0, 8($v0) --> main146 +main146: li $a0, 5595 --> main145 +main145: move $v0, $gp --> main422 +main422: j --> main177 +main177: lw $a0, 12($v0) --> main144 +main144: li $a0, 494 --> main143 +main143: move $v0, $gp --> main421 +main421: j --> main176 +main176: lw $a0, 16($v0) --> main142 +main142: li $a0, 59867 --> main141 +main141: move $v0, $gp --> main420 +main420: j --> main175 +main175: lw $a0, 20($v0) --> main140 +main140: li $a0, 65370 --> main139 +main139: move $v0, $gp --> main419 +main419: j --> main174 +main174: lw $a0, 24($v0) --> main138 +main138: li $a0, 5724 --> main137 +main137: move $v0, $gp --> main418 +main418: j --> main173 +main173: lw $a0, 28($v0) --> main136 +main136: li $a0, 5724 --> main135 +main135: move $v0, $gp --> main417 +main417: j --> main172 +main172: lw $a0, 32($v0) --> main134 +main134: li $a0, 65370 --> main133 +main133: move $v0, $gp --> main416 +main416: j --> main171 +main171: lw $a0, 36($v0) --> main132 +main132: li $a0, 59867 --> main131 +main131: move $v0, $gp --> main415 +main415: j --> main170 +main170: lw $a0, 40($v0) --> main130 +main130: li $a0, 494 --> main129 +main129: move $v0, $gp --> main413 +main413: j --> main168 +main168: lw $a0, 44($v0) --> main128 +main128: li $a0, 5595 --> main127 +main127: move $v0, $gp --> main412 +main412: j --> main167 +main167: lw $a0, 48($v0) --> main126 +main126: li $a0, 64720 --> main125 +main125: move $v0, $gp --> main411 +main411: j --> main166 +main166: lw $a0, 52($v0) --> main124 +main124: li $a0, 60034 --> main123 +main123: move $v0, $gp --> main410 +main410: j --> main165 +main165: lw $a0, 56($v0) --> main122 +main122: li $a0, 1129 --> main121 +main121: move $v0, $gp --> main409 +main409: j --> main164 +main164: lw $a0, 60($v0) --> main120 +main120: li $a0, 1 --> main119 +main119: move $v0, $gp --> main408 +main408: j --> main163 +main163: lw $a0, 64($v0) --> main118 +main118: j --> main117 +main117: move $v0, $gp --> main407 +main407: j --> main162 +main162: lw $zero, 68($v0) --> main116 +main116: li $a0, 16384 --> main115 +main115: move $v0, $gp --> main406 +main406: j --> main161 +main161: lw $a0, 72($v0) --> main114 +main114: j --> main113 +main113: move $v0, $gp --> main405 +main405: j --> main160 +main160: lw $zero, 76($v0) --> main112 +main112: j --> main111 +main111: move $v0, $gp --> main404 +main404: j --> main159 +main159: lw $zero, 80($v0) --> main110 +main110: j --> main109 +main109: move $v0, $gp --> main402 +main402: j --> main157 +main157: lw $zero, 84($v0) --> main108 +main108: j --> main107 +main107: move $v0, $gp --> main401 +main401: j --> main156 +main156: lw $zero, 88($v0) --> main106 +main106: j --> main105 +main105: move $v0, $gp --> main400 +main400: j --> main155 +main155: lw $zero, 92($v0) --> main104 +main104: j --> main103 +main103: move $v0, $gp --> main399 +main399: j --> main154 +main154: lw $zero, 96($v0) --> main102 +main102: j --> main101 +main101: move $v0, $gp --> main398 +main398: j --> main153 +main153: lw $zero, 100($v0) --> main100 +main100: j --> main99 +main99 : move $v0, $gp --> main478 +main478: j --> main225 +main225: lw $zero, 104($v0) --> main98 +main98 : j --> main97 +main97 : move $v0, $gp --> main477 +main477: j --> main224 +main224: lw $zero, 108($v0) --> main96 +main96 : j --> main95 +main95 : move $v0, $gp --> main476 +main476: j --> main223 +main223: lw $zero, 112($v0) --> main94 +main94 : j --> main93 +main93 : move $v0, $gp --> main475 +main475: j --> main222 +main222: lw $zero, 116($v0) --> main92 +main92 : j --> main91 +main91 : move $v0, $gp --> main474 +main474: j --> main221 +main221: lw $zero, 120($v0) --> main90 +main90 : j --> main89 +main89 : move $v0, $gp --> main472 +main472: j --> main219 +main219: lw $zero, 124($v0) --> main88 +main88 : j --> main87 +main87 : move $v0, $gp --> main471 +main471: j --> main218 +main218: lw $zero, 128($v0) --> main86 +main86 : j --> main85 +main85 : move $v0, $gp --> main470 +main470: j --> main217 +main217: lw $zero, 132($v0) --> main84 +main84 : j --> main83 +main83 : move $v0, $gp --> main469 +main469: j --> main216 +main216: lw $zero, 136($v0) --> main82 +main82 : j --> main81 +main81 : move $v0, $gp --> main468 +main468: j --> main215 +main215: lw $zero, 140($v0) --> main80 +main80 : j --> main79 +main79 : move $v0, $gp --> main467 +main467: j --> main214 +main214: lw $zero, 144($v0) --> main78 +main78 : j --> main77 +main77 : move $v0, $gp --> main466 +main466: j --> main213 +main213: lw $zero, 148($v0) --> main76 +main76 : j --> main75 +main75 : move $v0, $gp --> main465 +main465: j --> main212 +main212: lw $zero, 152($v0) --> main74 +main74 : j --> main73 +main73 : move $v0, $gp --> main464 +main464: j --> main211 +main211: lw $zero, 156($v0) --> main72 +main72 : j --> main71 +main71 : move $v0, $gp --> main463 +main463: j --> main210 +main210: lw $zero, 160($v0) --> main70 +main70 : li $a0, 7986 --> main69 +main69 : move $v0, $gp --> main461 +main461: j --> main209 +main209: lw $a0, 164($v0) --> main68 +main68 : li $a0, 8993 --> main67 +main67 : move $v0, $gp --> main460 +main460: j --> main208 +main208: lw $a0, 168($v0) --> main66 +main66 : li $a0, 1808 --> main65 +main65 : move $v0, $gp --> main459 +main459: j --> main207 +main207: lw $a0, 172($v0) --> main64 +main64 : li $a0, 4096 --> main63 +main63 : move $v0, $gp --> main458 +main458: j --> main206 +main206: lw $a0, 176($v0) --> main62 +main62 : li $a0, 4096 --> main61 +main61 : move $v0, $gp --> main457 +main457: j --> main205 +main205: lw $a0, 180($v0) --> main60 +main60 : li $a0, 4096 --> main59 +main59 : move $v0, $gp --> main455 +main455: j --> main204 +main204: lw $a0, 184($v0) --> main58 +main58 : li $a0, 4096 --> main57 +main57 : move $v0, $gp --> main454 +main454: j --> main203 +main203: lw $a0, 188($v0) --> main56 +main56 : li $a0, 4096 --> main55 +main55 : move $v0, $gp --> main453 +main453: j --> main202 +main202: lw $a0, 192($v0) --> main54 +main54 : li $a0, 4096 --> main53 +main53 : move $v0, $gp --> main452 +main452: j --> main201 +main201: lw $a0, 196($v0) --> main52 +main52 : li $a0, 4096 --> main51 +main51 : move $v0, $gp --> main451 +main451: j --> main200 +main200: lw $a0, 200($v0) --> main50 +main50 : li $a0, 4096 --> main49 +main49 : move $v0, $gp --> main449 +main449: j --> main199 +main199: lw $a0, 204($v0) --> main48 +main48 : li $a0, 4096 --> main47 +main47 : move $v0, $gp --> main448 +main448: j --> main198 +main198: lw $a0, 208($v0) --> main46 +main46 : li $a0, 4096 --> main45 +main45 : move $v0, $gp --> main447 +main447: j --> main197 +main197: lw $a0, 212($v0) --> main44 +main44 : li $a0, 4096 --> main43 +main43 : move $v0, $gp --> main446 +main446: j --> main196 +main196: lw $a0, 216($v0) --> main42 +main42 : li $a0, 4096 --> main41 +main41 : move $v0, $gp --> main445 +main445: j --> main195 +main195: lw $a0, 220($v0) --> main40 +main40 : li $a0, 4096 --> main39 +main39 : move $v0, $gp --> main444 +main444: j --> main194 +main194: lw $a0, 224($v0) --> main38 +main38 : li $a0, 4096 --> main37 +main37 : move $v0, $gp --> main443 +main443: j --> main193 +main193: lw $a0, 228($v0) --> main36 +main36 : li $a0, 4096 --> main35 +main35 : move $v0, $gp --> main442 +main442: j --> main192 +main192: lw $a0, 232($v0) --> main34 +main34 : li $a0, 4096 --> main33 +main33 : move $v0, $gp --> main441 +main441: j --> main191 +main191: lw $a0, 236($v0) --> main32 +main32 : li $a0, 4096 --> main31 +main31 : move $v0, $gp --> main440 +main440: j --> main190 +main190: lw $a0, 240($v0) --> main30 +main30 : li $a0, 4096 --> main29 +main29 : move $v0, $gp --> main439 +main439: j --> main188 +main188: lw $a0, 244($v0) --> main28 +main28 : li $a0, 4096 --> main27 +main27 : move $v0, $gp --> main438 +main438: j --> main187 +main187: lw $a0, 248($v0) --> main26 +main26 : li $a0, 4096 --> main25 +main25 : move $v0, $gp --> main437 +main437: j --> main186 +main186: lw $a0, 252($v0) --> main24 +main24 : li $a0, 4096 --> main23 +main23 : move $v0, $gp --> main436 +main436: j --> main185 +main185: lw $a0, 256($v0) --> main22 +main22 : li $a0, 4096 --> main21 +main21 : move $v0, $gp --> main435 +main435: j --> main184 +main184: lw $a0, 260($v0) --> main20 +main20 : li $a0, 4096 --> main19 +main19 : move $v0, $gp --> main434 +main434: j --> main183 +main183: lw $a0, 264($v0) --> main18 +main18 : li $a0, 4096 --> main17 +main17 : move $v0, $gp --> main427 +main427: j --> main182 +main182: lw $a0, 268($v0) --> main16 +main16 : li $a0, 4096 --> main15 +main15 : move $v0, $gp --> main425 +main425: j --> main180 +main180: lw $a0, 272($v0) --> main14 +main14 : li $a0, 4096 --> main13 +main13 : move $v0, $gp --> main414 +main414: j --> main169 +main169: lw $a0, 276($v0) --> main12 +main12 : li $a0, 4096 --> main11 +main11 : move $v0, $gp --> main403 +main403: j --> main158 +main158: lw $a0, 280($v0) --> main10 +main10 : li $a0, 4096 --> main9 +main9 : move $v0, $gp --> main473 +main473: j --> main220 +main220: lw $a0, 284($v0) --> main8 +main8 : emit c27 --> main7 +main7 : move $a0, $gp --> main462 +main462: addi $a0, $a0, 64 --> main6 +main6 : move $a1, $gp --> main456 +main456: j --> main5 +main5 : move $a2, $sp --> main450 +main450: j --> main4 +main4 : li $a3, 16 --> main3 +main3 : la $v0, fir4 --> main189 +main189: j --> main433 +main433: j --> main432 +main432: j --> main431 +main431: j --> main430 +main430: j --> main429 +main429: call $v0 --> main428 +main428: j --> main2 +main2 : emit c26 --> main1 +main1 : j --> main0 +main0 : j --> main397 +main397: j --> main396 +main396: lw $ra, 64($sp) --> main395 +main395: j --> main394 +main394: j --> main393 +main393: j --> main392 +main392: j --> main391 +main391: j --> main390 +main390: j --> main389 +main389: j --> main388 +main388: j --> main387 +main387: delframe --> main386 +main386: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir4.RTL.expected b/tests/clight/fir4.RTL.expected new file mode 100644 index 0000000..5d68fba --- /dev/null +++ b/tests/clight/fir4.RTL.expected @@ -0,0 +1,1090 @@ +program + +globals 288 + +function fir4(%0; %1; %2; %3) : %12 +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115 +entry fir4266 +fir4266: li %4, 0 --> fir4265 +fir4265: li %5, 0 --> fir4264 +fir4264: li %6, 0 --> fir4263 +fir4263: li %7, 0 --> fir4262 +fir4262: li %8, 0 --> fir4261 +fir4261: li %9, 0 --> fir4260 +fir4260: li %10, 0 --> fir4259 +fir4259: li %11, 0 --> fir4258 +fir4258: li %13, 0 --> fir4257 +fir4257: li %14, 0 --> fir4256 +fir4256: li %15, 0 --> fir4255 +fir4255: li %16, 0 --> fir4254 +fir4254: li %17, 0 --> fir4253 +fir4253: li %18, 0 --> fir4252 +fir4252: li %19, 0 --> fir4251 +fir4251: li %20, 0 --> fir4250 +fir4250: li %21, 0 --> fir4249 +fir4249: li %22, 0 --> fir4248 +fir4248: li %23, 0 --> fir4247 +fir4247: li %24, 0 --> fir4246 +fir4246: li %25, 0 --> fir4245 +fir4245: li %26, 0 --> fir4244 +fir4244: li %27, 0 --> fir4243 +fir4243: li %28, 0 --> fir4242 +fir4242: li %29, 0 --> fir4241 +fir4241: li %30, 0 --> fir4240 +fir4240: li %31, 0 --> fir4239 +fir4239: li %32, 0 --> fir4238 +fir4238: li %33, 0 --> fir4237 +fir4237: li %34, 0 --> fir4236 +fir4236: li %35, 0 --> fir4235 +fir4235: li %36, 0 --> fir4234 +fir4234: li %37, 0 --> fir4233 +fir4233: li %38, 0 --> fir4232 +fir4232: li %39, 0 --> fir4231 +fir4231: li %40, 0 --> fir4230 +fir4230: li %41, 0 --> fir4229 +fir4229: li %42, 0 --> fir4228 +fir4228: li %43, 0 --> fir4227 +fir4227: li %44, 0 --> fir4226 +fir4226: li %45, 0 --> fir4225 +fir4225: li %46, 0 --> fir4224 +fir4224: li %47, 0 --> fir4223 +fir4223: li %48, 0 --> fir4222 +fir4222: li %49, 0 --> fir4221 +fir4221: li %50, 0 --> fir4220 +fir4220: li %51, 0 --> fir4219 +fir4219: li %52, 0 --> fir4218 +fir4218: li %53, 0 --> fir4217 +fir4217: li %54, 0 --> fir4216 +fir4216: li %55, 0 --> fir4215 +fir4215: li %56, 0 --> fir4214 +fir4214: li %57, 0 --> fir4213 +fir4213: li %58, 0 --> fir4212 +fir4212: li %59, 0 --> fir4211 +fir4211: li %60, 0 --> fir4210 +fir4210: li %61, 0 --> fir4209 +fir4209: li %62, 0 --> fir4208 +fir4208: li %63, 0 --> fir4207 +fir4207: li %64, 0 --> fir4206 +fir4206: li %65, 0 --> fir4205 +fir4205: li %66, 0 --> fir4204 +fir4204: li %67, 0 --> fir4203 +fir4203: li %68, 0 --> fir4202 +fir4202: li %69, 0 --> fir4201 +fir4201: li %70, 0 --> fir4200 +fir4200: li %71, 0 --> fir4199 +fir4199: li %72, 0 --> fir4198 +fir4198: li %73, 0 --> fir4197 +fir4197: li %74, 0 --> fir4196 +fir4196: li %75, 0 --> fir4195 +fir4195: li %76, 0 --> fir4194 +fir4194: li %77, 0 --> fir4193 +fir4193: li %78, 0 --> fir4192 +fir4192: li %79, 0 --> fir4191 +fir4191: li %80, 0 --> fir4190 +fir4190: li %81, 0 --> fir4189 +fir4189: li %82, 0 --> fir4188 +fir4188: li %83, 0 --> fir4187 +fir4187: li %84, 0 --> fir4186 +fir4186: li %85, 0 --> fir4185 +fir4185: li %86, 0 --> fir4184 +fir4184: li %87, 0 --> fir4183 +fir4183: li %88, 0 --> fir4182 +fir4182: li %89, 0 --> fir4181 +fir4181: li %90, 0 --> fir4180 +fir4180: li %91, 0 --> fir4179 +fir4179: li %92, 0 --> fir4178 +fir4178: li %93, 0 --> fir4177 +fir4177: li %94, 0 --> fir4176 +fir4176: li %95, 0 --> fir4175 +fir4175: li %96, 0 --> fir4174 +fir4174: li %97, 0 --> fir4173 +fir4173: li %98, 0 --> fir4172 +fir4172: li %99, 0 --> fir4171 +fir4171: li %100, 0 --> fir4170 +fir4170: li %101, 0 --> fir4169 +fir4169: li %102, 0 --> fir4168 +fir4168: li %103, 0 --> fir4167 +fir4167: li %104, 0 --> fir4166 +fir4166: li %105, 0 --> fir4165 +fir4165: li %106, 0 --> fir4164 +fir4164: li %107, 0 --> fir4163 +fir4163: li %108, 0 --> fir4162 +fir4162: li %109, 0 --> fir4161 +fir4161: li %110, 0 --> fir4160 +fir4160: li %111, 0 --> fir4159 +fir4159: li %112, 0 --> fir4158 +fir4158: li %113, 0 --> fir4157 +fir4157: li %114, 0 --> fir4156 +fir4156: li %115, 0 --> fir4135 +fir4135: emit c25 --> fir4134 +fir4134: li %11, 0 --> fir4133 +fir4133: emit c24 --> fir4132 +fir4132: li %4, 0 --> fir4131 +fir4131: emit c23 --> fir4130 +fir4130: emit c22 --> fir4129 +fir4129: li %6, 0 --> fir4113 +fir4113: j --> fir4128 +fir4128: li %93, 0 --> fir4127 +fir4127: emit c21 --> fir4126 +fir4126: li %95, 16 --> fir4125 +fir4125: slt %94, %6, %95 --> fir4124 +fir4124: li %99, 0 --> fir4139 +fir4139: seq %92, %94, %99 --> fir4123 +fir4123: beq %92, %93 --> fir4122, fir4112 +fir4112: emit c18 --> fir4111 +fir4111: emit c17 --> fir4110 +fir4110: li %5, 0 --> fir43 +fir43 : j --> fir4109 +fir4109: li %85, 0 --> fir4108 +fir4108: emit c16 --> fir4107 +fir4107: slt %86, %5, %3 --> fir4106 +fir4106: li %97, 0 --> fir4137 +fir4137: seq %84, %86, %97 --> fir4105 +fir4105: beq %84, %85 --> fir4104, fir42 +fir42 : emit c0 --> fir41 +fir41 : li %12, 0 --> fir40 +fir40 : return %12 +fir4104: emit c14 --> fir4103 +fir4103: li %83, 4 --> fir4102 +fir4102: mulo %82, %5, %83 --> fir4101 +fir4101: add %96, %0, %82 --> fir4136 +fir4136: lw %78, 0(%96) --> fir4100 +fir4100: addi %79, STACK, 0 --> fir499 +fir499 : li %81, 4 --> fir498 +fir498 : mulo %80, %11, %81 --> fir497 +fir497 : add %115, %79, %80 --> fir4155 +fir4155: sw %78, 0(%115) --> fir496 +fir496 : emit c13 --> fir495 +fir495 : li %4, 0 --> fir494 +fir494 : emit c12 --> fir493 +fir493 : emit c11 --> fir492 +fir492 : li %6, 0 --> fir418 +fir418 : j --> fir491 +fir491 : li %75, 0 --> fir490 +fir490 : emit c10 --> fir489 +fir489 : li %77, 16 --> fir488 +fir488 : slt %76, %6, %77 --> fir487 +fir487 : li %114, 0 --> fir4154 +fir4154: seq %74, %76, %114 --> fir486 +fir486 : beq %74, %75 --> fir485, fir417 +fir417 : emit c2 --> fir416 +fir416 : li %20, 1 --> fir415 +fir415 : add %18, %11, %20 --> fir414 +fir414 : li %19, 16 --> fir413 +fir413 : la %100, mod --> fir4140 +fir4140: call %11, %100(%18, %19) --> fir412 +fir412 : emit c1 --> fir411 +fir411 : li %17, 16 --> fir410 +fir410 : srav %14, %4, %17 --> fir49 +fir49 : li %16, 4 --> fir48 +fir48 : mulo %15, %5, %16 --> fir47 +fir47 : add %110, %2, %15 --> fir4150 +fir4150: sw %14, 0(%110) --> fir46 +fir46 : emit c15 --> fir45 +fir45 : li %13, 1 --> fir44 +fir44 : add %5, %5, %13 --> fir43 +fir485 : emit c8 --> fir484 +fir484 : addi %71, STACK, 0 --> fir483 +fir483 : li %73, 4 --> fir482 +fir482 : mulo %72, %11, %73 --> fir481 +fir481 : add %113, %71, %72 --> fir4153 +fir4153: lw %67, 0(%113) --> fir480 +fir480 : li %70, 4 --> fir479 +fir479 : mulo %69, %6, %70 --> fir478 +fir478 : add %112, %1, %69 --> fir4152 +fir4152: lw %68, 0(%112) --> fir477 +fir477 : mulo %10, %67, %68 --> fir476 +fir476 : emit c7 --> fir475 +fir475 : addi %60, STACK, 0 --> fir474 +fir474 : li %66, 1 --> fir473 +fir473 : add %64, %11, %66 --> fir472 +fir472 : li %65, 16 --> fir471 +fir471 : la %111, mod --> fir4151 +fir4151: call %62, %111(%64, %65) --> fir470 +fir470 : li %63, 4 --> fir469 +fir469 : mulo %61, %62, %63 --> fir468 +fir468 : add %109, %60, %61 --> fir4149 +fir4149: lw %54, 0(%109) --> fir467 +fir467 : li %59, 1 --> fir466 +fir466 : add %57, %6, %59 --> fir465 +fir465 : li %58, 4 --> fir464 +fir464 : mulo %56, %57, %58 --> fir463 +fir463 : add %108, %1, %56 --> fir4148 +fir4148: lw %55, 0(%108) --> fir462 +fir462 : mulo %9, %54, %55 --> fir461 +fir461 : emit c6 --> fir460 +fir460 : addi %47, STACK, 0 --> fir459 +fir459 : li %53, 2 --> fir458 +fir458 : add %51, %11, %53 --> fir457 +fir457 : li %52, 16 --> fir456 +fir456 : la %107, mod --> fir4147 +fir4147: call %49, %107(%51, %52) --> fir455 +fir455 : li %50, 4 --> fir454 +fir454 : mulo %48, %49, %50 --> fir453 +fir453 : add %106, %47, %48 --> fir4146 +fir4146: lw %41, 0(%106) --> fir452 +fir452 : li %46, 2 --> fir451 +fir451 : add %44, %6, %46 --> fir450 +fir450 : li %45, 4 --> fir449 +fir449 : mulo %43, %44, %45 --> fir448 +fir448 : add %105, %1, %43 --> fir4145 +fir4145: lw %42, 0(%105) --> fir447 +fir447 : mulo %8, %41, %42 --> fir446 +fir446 : emit c5 --> fir445 +fir445 : addi %34, STACK, 0 --> fir444 +fir444 : li %40, 3 --> fir443 +fir443 : add %38, %11, %40 --> fir442 +fir442 : li %39, 16 --> fir441 +fir441 : la %104, mod --> fir4144 +fir4144: call %36, %104(%38, %39) --> fir440 +fir440 : li %37, 4 --> fir439 +fir439 : mulo %35, %36, %37 --> fir438 +fir438 : add %103, %34, %35 --> fir4143 +fir4143: lw %28, 0(%103) --> fir437 +fir437 : li %33, 3 --> fir436 +fir436 : add %31, %6, %33 --> fir435 +fir435 : li %32, 4 --> fir434 +fir434 : mulo %30, %31, %32 --> fir433 +fir433 : add %102, %1, %30 --> fir4142 +fir4142: lw %29, 0(%102) --> fir432 +fir432 : mulo %7, %28, %29 --> fir431 +fir431 : emit c4 --> fir430 +fir430 : add %27, %4, %10 --> fir429 +fir429 : add %26, %27, %9 --> fir428 +fir428 : add %25, %26, %8 --> fir427 +fir427 : add %4, %25, %7 --> fir426 +fir426 : emit c3 --> fir425 +fir425 : li %24, 4 --> fir424 +fir424 : add %22, %11, %24 --> fir423 +fir423 : li %23, 16 --> fir422 +fir422 : la %101, mod --> fir4141 +fir4141: call %11, %101(%22, %23) --> fir421 +fir421 : emit c9 --> fir420 +fir420 : li %21, 4 --> fir419 +fir419 : add %6, %6, %21 --> fir418 +fir4122: emit c19 --> fir4121 +fir4121: li %88, 0 --> fir4120 +fir4120: addi %89, STACK, 0 --> fir4119 +fir4119: li %91, 4 --> fir4118 +fir4118: mulo %90, %6, %91 --> fir4117 +fir4117: add %98, %89, %90 --> fir4138 +fir4138: sw %88, 0(%98) --> fir4116 +fir4116: emit c20 --> fir4115 +fir4115: li %87, 1 --> fir4114 +fir4114: add %6, %6, %87 --> fir4113 + +function _main() : %1 +stacksize 64 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115, %116, %117, %118, + %119, %120, %121, %122, %123, %124, %125, + %126, %127, %128, %129, %130, %131, %132, + %133, %134, %135, %136, %137, %138, %139, + %140, %141, %142, %143, %144, %145, %146, + %147, %148, %149, %150 +entry main375 +main375: li %0, 0 --> main374 +main374: li %2, 0 --> main373 +main373: li %3, 0 --> main372 +main372: li %4, 0 --> main371 +main371: li %5, 0 --> main370 +main370: li %6, 0 --> main369 +main369: li %7, 0 --> main368 +main368: li %8, 0 --> main367 +main367: li %9, 0 --> main366 +main366: li %10, 0 --> main365 +main365: li %11, 0 --> main364 +main364: li %12, 0 --> main363 +main363: li %13, 0 --> main362 +main362: li %14, 0 --> main361 +main361: li %15, 0 --> main360 +main360: li %16, 0 --> main359 +main359: li %17, 0 --> main358 +main358: li %18, 0 --> main357 +main357: li %19, 0 --> main356 +main356: li %20, 0 --> main355 +main355: li %21, 0 --> main354 +main354: li %22, 0 --> main353 +main353: li %23, 0 --> main352 +main352: li %24, 0 --> main351 +main351: li %25, 0 --> main350 +main350: li %26, 0 --> main349 +main349: li %27, 0 --> main348 +main348: li %28, 0 --> main347 +main347: li %29, 0 --> main346 +main346: li %30, 0 --> main345 +main345: li %31, 0 --> main344 +main344: li %32, 0 --> main343 +main343: li %33, 0 --> main342 +main342: li %34, 0 --> main341 +main341: li %35, 0 --> main340 +main340: li %36, 0 --> main339 +main339: li %37, 0 --> main338 +main338: li %38, 0 --> main337 +main337: li %39, 0 --> main336 +main336: li %40, 0 --> main335 +main335: li %41, 0 --> main334 +main334: li %42, 0 --> main333 +main333: li %43, 0 --> main332 +main332: li %44, 0 --> main331 +main331: li %45, 0 --> main330 +main330: li %46, 0 --> main329 +main329: li %47, 0 --> main328 +main328: li %48, 0 --> main327 +main327: li %49, 0 --> main326 +main326: li %50, 0 --> main325 +main325: li %51, 0 --> main324 +main324: li %52, 0 --> main323 +main323: li %53, 0 --> main322 +main322: li %54, 0 --> main321 +main321: li %55, 0 --> main320 +main320: li %56, 0 --> main319 +main319: li %57, 0 --> main318 +main318: li %58, 0 --> main317 +main317: li %59, 0 --> main316 +main316: li %60, 0 --> main315 +main315: li %61, 0 --> main314 +main314: li %62, 0 --> main313 +main313: li %63, 0 --> main312 +main312: li %64, 0 --> main311 +main311: li %65, 0 --> main310 +main310: li %66, 0 --> main309 +main309: li %67, 0 --> main308 +main308: li %68, 0 --> main307 +main307: li %69, 0 --> main306 +main306: li %70, 0 --> main305 +main305: li %71, 0 --> main304 +main304: li %72, 0 --> main303 +main303: li %73, 0 --> main302 +main302: li %74, 0 --> main301 +main301: li %75, 0 --> main300 +main300: li %76, 0 --> main299 +main299: li %77, 0 --> main298 +main298: li %78, 0 --> main297 +main297: li %79, 0 --> main296 +main296: li %80, 0 --> main295 +main295: li %81, 0 --> main294 +main294: li %82, 0 --> main293 +main293: li %83, 0 --> main292 +main292: li %84, 0 --> main291 +main291: li %85, 0 --> main290 +main290: li %86, 0 --> main289 +main289: li %87, 0 --> main288 +main288: li %88, 0 --> main287 +main287: li %89, 0 --> main286 +main286: li %90, 0 --> main285 +main285: li %91, 0 --> main284 +main284: li %92, 0 --> main283 +main283: li %93, 0 --> main282 +main282: li %94, 0 --> main281 +main281: li %95, 0 --> main280 +main280: li %96, 0 --> main279 +main279: li %97, 0 --> main278 +main278: li %98, 0 --> main277 +main277: li %99, 0 --> main276 +main276: li %100, 0 --> main275 +main275: li %101, 0 --> main274 +main274: li %102, 0 --> main273 +main273: li %103, 0 --> main272 +main272: li %104, 0 --> main271 +main271: li %105, 0 --> main270 +main270: li %106, 0 --> main269 +main269: li %107, 0 --> main268 +main268: li %108, 0 --> main267 +main267: li %109, 0 --> main266 +main266: li %110, 0 --> main265 +main265: li %111, 0 --> main264 +main264: li %112, 0 --> main263 +main263: li %113, 0 --> main262 +main262: li %114, 0 --> main261 +main261: li %115, 0 --> main260 +main260: li %116, 0 --> main259 +main259: li %117, 0 --> main258 +main258: li %118, 0 --> main257 +main257: li %119, 0 --> main256 +main256: li %120, 0 --> main255 +main255: li %121, 0 --> main254 +main254: li %122, 0 --> main253 +main253: li %123, 0 --> main252 +main252: li %124, 0 --> main251 +main251: li %125, 0 --> main250 +main250: li %126, 0 --> main249 +main249: li %127, 0 --> main248 +main248: li %128, 0 --> main247 +main247: li %129, 0 --> main246 +main246: li %130, 0 --> main245 +main245: li %131, 0 --> main244 +main244: li %132, 0 --> main243 +main243: li %133, 0 --> main242 +main242: li %134, 0 --> main241 +main241: li %135, 0 --> main240 +main240: li %136, 0 --> main239 +main239: li %137, 0 --> main238 +main238: li %138, 0 --> main237 +main237: li %139, 0 --> main236 +main236: li %140, 0 --> main235 +main235: li %141, 0 --> main234 +main234: li %142, 0 --> main233 +main233: li %143, 0 --> main232 +main232: li %144, 0 --> main231 +main231: li %145, 0 --> main230 +main230: li %146, 0 --> main229 +main229: li %147, 0 --> main228 +main228: li %148, 0 --> main227 +main227: li %149, 0 --> main226 +main226: li %150, 0 --> main152 +main152: li %77, 1129 --> main151 +main151: addi %106, GLOBALS, 0 --> main181 +main181: sw %77, 0(%106) --> main150 +main150: li %76, 60034 --> main149 +main149: addi %104, GLOBALS, 0 --> main179 +main179: sw %76, 4(%104) --> main148 +main148: li %75, 64720 --> main147 +main147: addi %103, GLOBALS, 0 --> main178 +main178: sw %75, 8(%103) --> main146 +main146: li %74, 5595 --> main145 +main145: addi %102, GLOBALS, 0 --> main177 +main177: sw %74, 12(%102) --> main144 +main144: li %73, 494 --> main143 +main143: addi %101, GLOBALS, 0 --> main176 +main176: sw %73, 16(%101) --> main142 +main142: li %72, 59867 --> main141 +main141: addi %100, GLOBALS, 0 --> main175 +main175: sw %72, 20(%100) --> main140 +main140: li %71, 65370 --> main139 +main139: addi %99, GLOBALS, 0 --> main174 +main174: sw %71, 24(%99) --> main138 +main138: li %70, 5724 --> main137 +main137: addi %98, GLOBALS, 0 --> main173 +main173: sw %70, 28(%98) --> main136 +main136: li %69, 5724 --> main135 +main135: addi %97, GLOBALS, 0 --> main172 +main172: sw %69, 32(%97) --> main134 +main134: li %68, 65370 --> main133 +main133: addi %96, GLOBALS, 0 --> main171 +main171: sw %68, 36(%96) --> main132 +main132: li %67, 59867 --> main131 +main131: addi %95, GLOBALS, 0 --> main170 +main170: sw %67, 40(%95) --> main130 +main130: li %66, 494 --> main129 +main129: addi %93, GLOBALS, 0 --> main168 +main168: sw %66, 44(%93) --> main128 +main128: li %65, 5595 --> main127 +main127: addi %92, GLOBALS, 0 --> main167 +main167: sw %65, 48(%92) --> main126 +main126: li %64, 64720 --> main125 +main125: addi %91, GLOBALS, 0 --> main166 +main166: sw %64, 52(%91) --> main124 +main124: li %63, 60034 --> main123 +main123: addi %90, GLOBALS, 0 --> main165 +main165: sw %63, 56(%90) --> main122 +main122: li %62, 1129 --> main121 +main121: addi %89, GLOBALS, 0 --> main164 +main164: sw %62, 60(%89) --> main120 +main120: li %61, 1 --> main119 +main119: addi %88, GLOBALS, 0 --> main163 +main163: sw %61, 64(%88) --> main118 +main118: li %60, 0 --> main117 +main117: addi %87, GLOBALS, 0 --> main162 +main162: sw %60, 68(%87) --> main116 +main116: li %59, 16384 --> main115 +main115: addi %86, GLOBALS, 0 --> main161 +main161: sw %59, 72(%86) --> main114 +main114: li %58, 0 --> main113 +main113: addi %85, GLOBALS, 0 --> main160 +main160: sw %58, 76(%85) --> main112 +main112: li %57, 0 --> main111 +main111: addi %84, GLOBALS, 0 --> main159 +main159: sw %57, 80(%84) --> main110 +main110: li %56, 0 --> main109 +main109: addi %82, GLOBALS, 0 --> main157 +main157: sw %56, 84(%82) --> main108 +main108: li %55, 0 --> main107 +main107: addi %81, GLOBALS, 0 --> main156 +main156: sw %55, 88(%81) --> main106 +main106: li %54, 0 --> main105 +main105: addi %80, GLOBALS, 0 --> main155 +main155: sw %54, 92(%80) --> main104 +main104: li %53, 0 --> main103 +main103: addi %79, GLOBALS, 0 --> main154 +main154: sw %53, 96(%79) --> main102 +main102: li %52, 0 --> main101 +main101: addi %78, GLOBALS, 0 --> main153 +main153: sw %52, 100(%78) --> main100 +main100: li %51, 0 --> main99 +main99 : addi %150, GLOBALS, 0 --> main225 +main225: sw %51, 104(%150) --> main98 +main98 : li %50, 0 --> main97 +main97 : addi %149, GLOBALS, 0 --> main224 +main224: sw %50, 108(%149) --> main96 +main96 : li %49, 0 --> main95 +main95 : addi %148, GLOBALS, 0 --> main223 +main223: sw %49, 112(%148) --> main94 +main94 : li %48, 0 --> main93 +main93 : addi %147, GLOBALS, 0 --> main222 +main222: sw %48, 116(%147) --> main92 +main92 : li %47, 0 --> main91 +main91 : addi %146, GLOBALS, 0 --> main221 +main221: sw %47, 120(%146) --> main90 +main90 : li %46, 0 --> main89 +main89 : addi %144, GLOBALS, 0 --> main219 +main219: sw %46, 124(%144) --> main88 +main88 : li %45, 0 --> main87 +main87 : addi %143, GLOBALS, 0 --> main218 +main218: sw %45, 128(%143) --> main86 +main86 : li %44, 0 --> main85 +main85 : addi %142, GLOBALS, 0 --> main217 +main217: sw %44, 132(%142) --> main84 +main84 : li %43, 0 --> main83 +main83 : addi %141, GLOBALS, 0 --> main216 +main216: sw %43, 136(%141) --> main82 +main82 : li %42, 0 --> main81 +main81 : addi %140, GLOBALS, 0 --> main215 +main215: sw %42, 140(%140) --> main80 +main80 : li %41, 0 --> main79 +main79 : addi %139, GLOBALS, 0 --> main214 +main214: sw %41, 144(%139) --> main78 +main78 : li %40, 0 --> main77 +main77 : addi %138, GLOBALS, 0 --> main213 +main213: sw %40, 148(%138) --> main76 +main76 : li %39, 0 --> main75 +main75 : addi %137, GLOBALS, 0 --> main212 +main212: sw %39, 152(%137) --> main74 +main74 : li %38, 0 --> main73 +main73 : addi %136, GLOBALS, 0 --> main211 +main211: sw %38, 156(%136) --> main72 +main72 : li %37, 0 --> main71 +main71 : addi %135, GLOBALS, 0 --> main210 +main210: sw %37, 160(%135) --> main70 +main70 : li %36, 7986 --> main69 +main69 : addi %134, GLOBALS, 0 --> main209 +main209: sw %36, 164(%134) --> main68 +main68 : li %35, 8993 --> main67 +main67 : addi %133, GLOBALS, 0 --> main208 +main208: sw %35, 168(%133) --> main66 +main66 : li %34, 1808 --> main65 +main65 : addi %132, GLOBALS, 0 --> main207 +main207: sw %34, 172(%132) --> main64 +main64 : li %33, 4096 --> main63 +main63 : addi %131, GLOBALS, 0 --> main206 +main206: sw %33, 176(%131) --> main62 +main62 : li %32, 4096 --> main61 +main61 : addi %130, GLOBALS, 0 --> main205 +main205: sw %32, 180(%130) --> main60 +main60 : li %31, 4096 --> main59 +main59 : addi %129, GLOBALS, 0 --> main204 +main204: sw %31, 184(%129) --> main58 +main58 : li %30, 4096 --> main57 +main57 : addi %128, GLOBALS, 0 --> main203 +main203: sw %30, 188(%128) --> main56 +main56 : li %29, 4096 --> main55 +main55 : addi %127, GLOBALS, 0 --> main202 +main202: sw %29, 192(%127) --> main54 +main54 : li %28, 4096 --> main53 +main53 : addi %126, GLOBALS, 0 --> main201 +main201: sw %28, 196(%126) --> main52 +main52 : li %27, 4096 --> main51 +main51 : addi %125, GLOBALS, 0 --> main200 +main200: sw %27, 200(%125) --> main50 +main50 : li %26, 4096 --> main49 +main49 : addi %124, GLOBALS, 0 --> main199 +main199: sw %26, 204(%124) --> main48 +main48 : li %25, 4096 --> main47 +main47 : addi %123, GLOBALS, 0 --> main198 +main198: sw %25, 208(%123) --> main46 +main46 : li %24, 4096 --> main45 +main45 : addi %122, GLOBALS, 0 --> main197 +main197: sw %24, 212(%122) --> main44 +main44 : li %23, 4096 --> main43 +main43 : addi %121, GLOBALS, 0 --> main196 +main196: sw %23, 216(%121) --> main42 +main42 : li %22, 4096 --> main41 +main41 : addi %120, GLOBALS, 0 --> main195 +main195: sw %22, 220(%120) --> main40 +main40 : li %21, 4096 --> main39 +main39 : addi %119, GLOBALS, 0 --> main194 +main194: sw %21, 224(%119) --> main38 +main38 : li %20, 4096 --> main37 +main37 : addi %118, GLOBALS, 0 --> main193 +main193: sw %20, 228(%118) --> main36 +main36 : li %19, 4096 --> main35 +main35 : addi %117, GLOBALS, 0 --> main192 +main192: sw %19, 232(%117) --> main34 +main34 : li %18, 4096 --> main33 +main33 : addi %116, GLOBALS, 0 --> main191 +main191: sw %18, 236(%116) --> main32 +main32 : li %17, 4096 --> main31 +main31 : addi %115, GLOBALS, 0 --> main190 +main190: sw %17, 240(%115) --> main30 +main30 : li %16, 4096 --> main29 +main29 : addi %113, GLOBALS, 0 --> main188 +main188: sw %16, 244(%113) --> main28 +main28 : li %15, 4096 --> main27 +main27 : addi %112, GLOBALS, 0 --> main187 +main187: sw %15, 248(%112) --> main26 +main26 : li %14, 4096 --> main25 +main25 : addi %111, GLOBALS, 0 --> main186 +main186: sw %14, 252(%111) --> main24 +main24 : li %13, 4096 --> main23 +main23 : addi %110, GLOBALS, 0 --> main185 +main185: sw %13, 256(%110) --> main22 +main22 : li %12, 4096 --> main21 +main21 : addi %109, GLOBALS, 0 --> main184 +main184: sw %12, 260(%109) --> main20 +main20 : li %11, 4096 --> main19 +main19 : addi %108, GLOBALS, 0 --> main183 +main183: sw %11, 264(%108) --> main18 +main18 : li %10, 4096 --> main17 +main17 : addi %107, GLOBALS, 0 --> main182 +main182: sw %10, 268(%107) --> main16 +main16 : li %9, 4096 --> main15 +main15 : addi %105, GLOBALS, 0 --> main180 +main180: sw %9, 272(%105) --> main14 +main14 : li %8, 4096 --> main13 +main13 : addi %94, GLOBALS, 0 --> main169 +main169: sw %8, 276(%94) --> main12 +main12 : li %7, 4096 --> main11 +main11 : addi %83, GLOBALS, 0 --> main158 +main158: sw %7, 280(%83) --> main10 +main10 : li %6, 4096 --> main9 +main9 : addi %145, GLOBALS, 0 --> main220 +main220: sw %6, 284(%145) --> main8 +main8 : emit c27 --> main7 +main7 : addi %2, GLOBALS, 64 --> main6 +main6 : addi %3, GLOBALS, 0 --> main5 +main5 : addi %4, STACK, 0 --> main4 +main4 : li %5, 16 --> main3 +main3 : la %114, fir4 --> main189 +main189: call %0, %114(%2, %3, %4, %5) --> main2 +main2 : emit c26 --> main1 +main1 : move %1, %0 --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir4.RTLabs.expected b/tests/clight/fir4.RTLabs.expected new file mode 100644 index 0000000..8e2806a --- /dev/null +++ b/tests/clight/fir4.RTLabs.expected @@ -0,0 +1,711 @@ +program: (main function is "main") + + + globals: + "fir4_c" = {1129, 60034, 64720, 5595, 494, 59867, 65370, 5724, 5724, 65370, 59867, 494, 5595, 64720, 60034, 1129} + "fir4_in" = {1, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7986, 8993, 1808, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096} + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "fir4"(%0, %1, %2, %3): int -> int -> int -> int -> int + locals: %12, %4, %5, %6, %7, %8, %9, %10, %11, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77, %78, %79, %80, %81, %82, %83, %84, %85, %86, %87, %88, %89, %90, %91, %92, %93, %94, %95 + result: %12 + stacksize: 64 + entry: fir4135 + exit: fir40 + + fir499: imm_int 4, %81, --> fir498 + fir498: mul %80, %11, %81 --> fir497 + fir497: store int32, add, %79, %80, %78 --> fir496 + fir496: emit c13 --> fir495 + fir495: imm_int 0, %4, --> fir494 + fir494: emit c12 --> fir493 + fir493: emit c11 --> fir492 + fir492: imm_int 0, %6, --> fir418 + fir491: imm_int 0, %75, --> fir490 + fir490: emit c10 --> fir489 + fir49: imm_int 4, %16, --> fir48 + fir489: imm_int 16, %77, --> fir488 + fir488: lt %76, %6, %77 --> fir487 + fir487: notbool %74, %76 --> fir486 + fir486: eq %74, %75 --> fir485, fir417 + fir485: emit c8 --> fir484 + fir484: imm_addr 0($sp), %71, --> fir483 + fir483: imm_int 4, %73, --> fir482 + fir482: mul %72, %11, %73 --> fir481 + fir481: load int32, add, %71, %72, %67 --> fir480 + fir480: imm_int 4, %70, --> fir479 + fir48: mul %15, %5, %16 --> fir47 + fir479: mul %69, %6, %70 --> fir478 + fir478: load int32, add, %1, %69, %68 --> fir477 + fir477: mul %10, %67, %68 --> fir476 + fir476: emit c7 --> fir475 + fir475: imm_addr 0($sp), %60, --> fir474 + fir474: imm_int 1, %66, --> fir473 + fir473: add %64, %11, %66 --> fir472 + fir472: imm_int 16, %65, --> fir471 + fir471: mod %62, %64, %65 --> fir470 + fir470: imm_int 4, %63, --> fir469 + fir47: store int32, add, %2, %15, %14 --> fir46 + fir469: mul %61, %62, %63 --> fir468 + fir468: load int32, add, %60, %61, %54 --> fir467 + fir467: imm_int 1, %59, --> fir466 + fir466: add %57, %6, %59 --> fir465 + fir465: imm_int 4, %58, --> fir464 + fir464: mul %56, %57, %58 --> fir463 + fir463: load int32, add, %1, %56, %55 --> fir462 + fir462: mul %9, %54, %55 --> fir461 + fir461: emit c6 --> fir460 + fir460: imm_addr 0($sp), %47, --> fir459 + fir46: emit c15 --> fir45 + fir459: imm_int 2, %53, --> fir458 + fir458: add %51, %11, %53 --> fir457 + fir457: imm_int 16, %52, --> fir456 + fir456: mod %49, %51, %52 --> fir455 + fir455: imm_int 4, %50, --> fir454 + fir454: mul %48, %49, %50 --> fir453 + fir453: load int32, add, %47, %48, %41 --> fir452 + fir452: imm_int 2, %46, --> fir451 + fir451: add %44, %6, %46 --> fir450 + fir450: imm_int 4, %45, --> fir449 + fir45: imm_int 1, %13, --> fir44 + fir449: mul %43, %44, %45 --> fir448 + fir448: load int32, add, %1, %43, %42 --> fir447 + fir447: mul %8, %41, %42 --> fir446 + fir446: emit c5 --> fir445 + fir445: imm_addr 0($sp), %34, --> fir444 + fir444: imm_int 3, %40, --> fir443 + fir443: add %38, %11, %40 --> fir442 + fir442: imm_int 16, %39, --> fir441 + fir441: mod %36, %38, %39 --> fir440 + fir440: imm_int 4, %37, --> fir439 + fir44: add %5, %5, %13 --> fir43 + fir439: mul %35, %36, %37 --> fir438 + fir438: load int32, add, %34, %35, %28 --> fir437 + fir437: imm_int 3, %33, --> fir436 + fir436: add %31, %6, %33 --> fir435 + fir435: imm_int 4, %32, --> fir434 + fir434: mul %30, %31, %32 --> fir433 + fir433: load int32, add, %1, %30, %29 --> fir432 + fir432: mul %7, %28, %29 --> fir431 + fir431: emit c4 --> fir430 + fir430: add %27, %4, %10 --> fir429 + fir43: --> fir4109 + fir429: add %26, %27, %9 --> fir428 + fir428: add %25, %26, %8 --> fir427 + fir427: add %4, %25, %7 --> fir426 + fir426: emit c3 --> fir425 + fir425: imm_int 4, %24, --> fir424 + fir424: add %22, %11, %24 --> fir423 + fir423: imm_int 16, %23, --> fir422 + fir422: mod %11, %22, %23 --> fir421 + fir421: emit c9 --> fir420 + fir420: imm_int 4, %21, --> fir419 + fir42: emit c0 --> fir41 + fir419: add %6, %6, %21 --> fir418 + fir418: --> fir491 + fir417: emit c2 --> fir416 + fir416: imm_int 1, %20, --> fir415 + fir415: add %18, %11, %20 --> fir414 + fir414: imm_int 16, %19, --> fir413 + fir4135: emit c25 --> fir4134 + fir4134: imm_int 0, %11, --> fir4133 + fir4133: emit c24 --> fir4132 + fir4132: imm_int 0, %4, --> fir4131 + fir4131: emit c23 --> fir4130 + fir4130: emit c22 --> fir4129 + fir413: mod %11, %18, %19 --> fir412 + fir4129: imm_int 0, %6, --> fir4113 + fir4128: imm_int 0, %93, --> fir4127 + fir4127: emit c21 --> fir4126 + fir4126: imm_int 16, %95, --> fir4125 + fir4125: lt %94, %6, %95 --> fir4124 + fir4124: notbool %92, %94 --> fir4123 + fir4123: eq %92, %93 --> fir4122, fir4112 + fir4122: emit c19 --> fir4121 + fir4121: imm_int 0, %88, --> fir4120 + fir4120: imm_addr 0($sp), %89, --> fir4119 + fir412: emit c1 --> fir411 + fir4119: imm_int 4, %91, --> fir4118 + fir4118: mul %90, %6, %91 --> fir4117 + fir4117: store int32, add, %89, %90, %88 --> fir4116 + fir4116: emit c20 --> fir4115 + fir4115: imm_int 1, %87, --> fir4114 + fir4114: add %6, %6, %87 --> fir4113 + fir4113: --> fir4128 + fir4112: emit c18 --> fir4111 + fir4111: emit c17 --> fir4110 + fir4110: imm_int 0, %5, --> fir43 + fir411: imm_int 16, %17, --> fir410 + fir4109: imm_int 0, %85, --> fir4108 + fir4108: emit c16 --> fir4107 + fir4107: lt %86, %5, %3 --> fir4106 + fir4106: notbool %84, %86 --> fir4105 + fir4105: eq %84, %85 --> fir4104, fir42 + fir4104: emit c14 --> fir4103 + fir4103: imm_int 4, %83, --> fir4102 + fir4102: mul %82, %5, %83 --> fir4101 + fir4101: load int32, add, %0, %82, %78 --> fir4100 + fir4100: imm_addr 0($sp), %79, --> fir499 + fir410: shr %14, %4, %17 --> fir49 + fir41: imm_int 0, %12, --> fir40 + fir40: return %12 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77 + result: %1 + stacksize: 64 + entry: main152 + exit: main0 + + main99: store int32, 40("fir4_in"), , %51 --> main98 + main98: imm_int 0, %50, --> main97 + main97: store int32, 44("fir4_in"), , %50 --> main96 + main96: imm_int 0, %49, --> main95 + main95: store int32, 48("fir4_in"), , %49 --> main94 + main94: imm_int 0, %48, --> main93 + main93: store int32, 52("fir4_in"), , %48 --> main92 + main92: imm_int 0, %47, --> main91 + main91: store int32, 56("fir4_in"), , %47 --> main90 + main90: imm_int 0, %46, --> main89 + main9: store int32, 220("fir4_in"), , %6 --> main8 + main89: store int32, 60("fir4_in"), , %46 --> main88 + main88: imm_int 0, %45, --> main87 + main87: store int32, 64("fir4_in"), , %45 --> main86 + main86: imm_int 0, %44, --> main85 + main85: store int32, 68("fir4_in"), , %44 --> main84 + main84: imm_int 0, %43, --> main83 + main83: store int32, 72("fir4_in"), , %43 --> main82 + main82: imm_int 0, %42, --> main81 + main81: store int32, 76("fir4_in"), , %42 --> main80 + main80: imm_int 0, %41, --> main79 + main8: emit c27 --> main7 + main79: store int32, 80("fir4_in"), , %41 --> main78 + main78: imm_int 0, %40, --> main77 + main77: store int32, 84("fir4_in"), , %40 --> main76 + main76: imm_int 0, %39, --> main75 + main75: store int32, 88("fir4_in"), , %39 --> main74 + main74: imm_int 0, %38, --> main73 + main73: store int32, 92("fir4_in"), , %38 --> main72 + main72: imm_int 0, %37, --> main71 + main71: store int32, 96("fir4_in"), , %37 --> main70 + main70: imm_int 7986, %36, --> main69 + main7: imm_addr "fir4_in", %2, --> main6 + main69: store int32, 100("fir4_in"), , %36 --> main68 + main68: imm_int 8993, %35, --> main67 + main67: store int32, 104("fir4_in"), , %35 --> main66 + main66: imm_int 1808, %34, --> main65 + main65: store int32, 108("fir4_in"), , %34 --> main64 + main64: imm_int 4096, %33, --> main63 + main63: store int32, 112("fir4_in"), , %33 --> main62 + main62: imm_int 4096, %32, --> main61 + main61: store int32, 116("fir4_in"), , %32 --> main60 + main60: imm_int 4096, %31, --> main59 + main6: imm_addr "fir4_c", %3, --> main5 + main59: store int32, 120("fir4_in"), , %31 --> main58 + main58: imm_int 4096, %30, --> main57 + main57: store int32, 124("fir4_in"), , %30 --> main56 + main56: imm_int 4096, %29, --> main55 + main55: store int32, 128("fir4_in"), , %29 --> main54 + main54: imm_int 4096, %28, --> main53 + main53: store int32, 132("fir4_in"), , %28 --> main52 + main52: imm_int 4096, %27, --> main51 + main51: store int32, 136("fir4_in"), , %27 --> main50 + main50: imm_int 4096, %26, --> main49 + main5: imm_addr 0($sp), %4, --> main4 + main49: store int32, 140("fir4_in"), , %26 --> main48 + main48: imm_int 4096, %25, --> main47 + main47: store int32, 144("fir4_in"), , %25 --> main46 + main46: imm_int 4096, %24, --> main45 + main45: store int32, 148("fir4_in"), , %24 --> main44 + main44: imm_int 4096, %23, --> main43 + main43: store int32, 152("fir4_in"), , %23 --> main42 + main42: imm_int 4096, %22, --> main41 + main41: store int32, 156("fir4_in"), , %22 --> main40 + main40: imm_int 4096, %21, --> main39 + main4: imm_int 16, %5, --> main3 + main39: store int32, 160("fir4_in"), , %21 --> main38 + main38: imm_int 4096, %20, --> main37 + main37: store int32, 164("fir4_in"), , %20 --> main36 + main36: imm_int 4096, %19, --> main35 + main35: store int32, 168("fir4_in"), , %19 --> main34 + main34: imm_int 4096, %18, --> main33 + main33: store int32, 172("fir4_in"), , %18 --> main32 + main32: imm_int 4096, %17, --> main31 + main31: store int32, 176("fir4_in"), , %17 --> main30 + main30: imm_int 4096, %16, --> main29 + main3: call "fir4", %2, %3, %4, %5, %0: int -> int -> int -> int -> int --> main2 + main29: store int32, 180("fir4_in"), , %16 --> main28 + main28: imm_int 4096, %15, --> main27 + main27: store int32, 184("fir4_in"), , %15 --> main26 + main26: imm_int 4096, %14, --> main25 + main25: store int32, 188("fir4_in"), , %14 --> main24 + main24: imm_int 4096, %13, --> main23 + main23: store int32, 192("fir4_in"), , %13 --> main22 + main22: imm_int 4096, %12, --> main21 + main21: store int32, 196("fir4_in"), , %12 --> main20 + main20: imm_int 4096, %11, --> main19 + main2: emit c26 --> main1 + main19: store int32, 200("fir4_in"), , %11 --> main18 + main18: imm_int 4096, %10, --> main17 + main17: store int32, 204("fir4_in"), , %10 --> main16 + main16: imm_int 4096, %9, --> main15 + main152: imm_int 1129, %77, --> main151 + main151: store int32, 0("fir4_c"), , %77 --> main150 + main150: imm_int 60034, %76, --> main149 + main15: store int32, 208("fir4_in"), , %9 --> main14 + main149: store int32, 4("fir4_c"), , %76 --> main148 + main148: imm_int 64720, %75, --> main147 + main147: store int32, 8("fir4_c"), , %75 --> main146 + main146: imm_int 5595, %74, --> main145 + main145: store int32, 12("fir4_c"), , %74 --> main144 + main144: imm_int 494, %73, --> main143 + main143: store int32, 16("fir4_c"), , %73 --> main142 + main142: imm_int 59867, %72, --> main141 + main141: store int32, 20("fir4_c"), , %72 --> main140 + main140: imm_int 65370, %71, --> main139 + main14: imm_int 4096, %8, --> main13 + main139: store int32, 24("fir4_c"), , %71 --> main138 + main138: imm_int 5724, %70, --> main137 + main137: store int32, 28("fir4_c"), , %70 --> main136 + main136: imm_int 5724, %69, --> main135 + main135: store int32, 32("fir4_c"), , %69 --> main134 + main134: imm_int 65370, %68, --> main133 + main133: store int32, 36("fir4_c"), , %68 --> main132 + main132: imm_int 59867, %67, --> main131 + main131: store int32, 40("fir4_c"), , %67 --> main130 + main130: imm_int 494, %66, --> main129 + main13: store int32, 212("fir4_in"), , %8 --> main12 + main129: store int32, 44("fir4_c"), , %66 --> main128 + main128: imm_int 5595, %65, --> main127 + main127: store int32, 48("fir4_c"), , %65 --> main126 + main126: imm_int 64720, %64, --> main125 + main125: store int32, 52("fir4_c"), , %64 --> main124 + main124: imm_int 60034, %63, --> main123 + main123: store int32, 56("fir4_c"), , %63 --> main122 + main122: imm_int 1129, %62, --> main121 + main121: store int32, 60("fir4_c"), , %62 --> main120 + main120: imm_int 1, %61, --> main119 + main12: imm_int 4096, %7, --> main11 + main119: store int32, 0("fir4_in"), , %61 --> main118 + main118: imm_int 0, %60, --> main117 + main117: store int32, 4("fir4_in"), , %60 --> main116 + main116: imm_int 16384, %59, --> main115 + main115: store int32, 8("fir4_in"), , %59 --> main114 + main114: imm_int 0, %58, --> main113 + main113: store int32, 12("fir4_in"), , %58 --> main112 + main112: imm_int 0, %57, --> main111 + main111: store int32, 16("fir4_in"), , %57 --> main110 + main110: imm_int 0, %56, --> main109 + main11: store int32, 216("fir4_in"), , %7 --> main10 + main109: store int32, 20("fir4_in"), , %56 --> main108 + main108: imm_int 0, %55, --> main107 + main107: store int32, 24("fir4_in"), , %55 --> main106 + main106: imm_int 0, %54, --> main105 + main105: store int32, 28("fir4_in"), , %54 --> main104 + main104: imm_int 0, %53, --> main103 + main103: store int32, 32("fir4_in"), , %53 --> main102 + main102: imm_int 0, %52, --> main101 + main101: store int32, 36("fir4_in"), , %52 --> main100 + main100: imm_int 0, %51, --> main99 + main10: imm_int 4096, %6, --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/fir4.c b/tests/clight/fir4.c new file mode 100644 index 0000000..bccdac0 --- /dev/null +++ b/tests/clight/fir4.c @@ -0,0 +1,35 @@ +int fir4_c[] = {1129,60034,64720,5595,494,59867,65370,5724,5724,65370,59867,494,5595,64720,60034,1129}; +int fir4_in[] = {1, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7986, 8993, 1808, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096}; + +int fir4(int fir4_in[], int fir4_c[], int fir4_out[], int size) { + int i,j, tmp1, tmp2, tmp3, tmp4; + int x[16]; + int adx = 0; + int res = 0; + + for(i = 0; i < 16; i = i+1){ + x[i] = 0; + } + + for (j = 0; j < size; j = j+1) { + x[adx] = fir4_in[j]; + res = 0; + + for(i = 0; i < 16; i = i+4){ + tmp1 = (x[adx]*fir4_c[i]); + tmp2 = (x[(adx+1)%16]*fir4_c[i+1]); + tmp3 = (x[(adx+2)%16]*fir4_c[i+2]); + tmp4 = (x[(adx+3)%16]*fir4_c[i+3]); + res = res + tmp1 + tmp2 + tmp3 + tmp4; + adx = (adx+4)%16; + } + adx=(adx+1)%16; + fir4_out[j] = res >> 16; + } + return 0; +} + +int main(){ + int fir4_out[16]; + return fir4(fir4_in,fir4_c,fir4_out,16); +} diff --git a/tests/clight/fir4.c.expected b/tests/clight/fir4.c.expected new file mode 100644 index 0000000..3556cd0 --- /dev/null +++ b/tests/clight/fir4.c.expected @@ -0,0 +1,35 @@ +int fir4_c[] = {1129,60034,64720,5595,494,59867,65370,5724,5724,65370,59867,494,5595,64720,60034,1129}; +int fir4_in[] = {0, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7986, 8993, 1808, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096}; + +int fir4(int fir4_in[], int fir4_c[], int fir4_out[], int size) { + int i,j, tmp1, tmp2, tmp3, tmp4; + int x[16]; + int adx = 0; + int res = 0; + + for(i = 0; i < 16; i = i+1){ + x[i] = 0; + } + + for (j = 0; j < size; j = j+1) { + x[adx] = fir4_in[j]; + res = 0; + + for(i = 0; i < 16; i = i+4){ + tmp1 = (x[adx]*fir4_c[i]); + tmp2 = (x[(adx+1)%16]*fir4_c[i+1]); + tmp3 = (x[(adx+2)%16]*fir4_c[i+2]); + tmp4 = (x[(adx+3)%16]*fir4_c[i+3]); + res = res + tmp1 + tmp2 + tmp3 + tmp4; + adx = (adx+4)%16; + } + adx=(adx+1)%16; + fir4_out[j] = res >> 16; + } + return 0; +} + +int main(){ + int fir4_out[16]; + return fir4(fir4_in,fir4_c,fir4_out,16); +} diff --git a/tests/clight/fir4.log.expected b/tests/clight/fir4.log.expected new file mode 100644 index 0000000..962e977 --- /dev/null +++ b/tests/clight/fir4.log.expected @@ -0,0 +1 @@ +Fatal error: exception Assert_failure("src/RTLabs/RTLabsToRTL.ml", 23, 9) diff --git a/tests/clight/fir_complexe.ASM.expected b/tests/clight/fir_complexe.ASM.expected new file mode 100644 index 0000000..b7f8bfa --- /dev/null +++ b/tests/clight/fir_complexe.ASM.expected @@ -0,0 +1,595 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 384 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main36 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin init +init97: +c9: +c8: +li $a2, 0 +init40: +li $a0, 0 +c7: +li $v0, 16 +slt $v0, $a2, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, init34 +jr $ra +init34: +c5: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 0($v0) +c4: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 64($v0) +c3: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 128($v0) +c2: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 192($v0) +c1: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 256($v0) +c0: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 320($v0) +c6: +li $v0, 1 +add $a2, $a2, $v0 +j init40 +# end init + + +# begin comp_fir_complexe +comp_fir_complexe265: +addi $sp, $sp, -188 +sw $ra, 172($sp) +sw $s7, 168($sp) +sw $s6, 164($sp) +sw $s5, 160($sp) +sw $s4, 156($sp) +sw $s3, 152($sp) +sw $s2, 148($sp) +sw $s1, 144($sp) +sw $s0, 140($sp) +sw $a0, 128($sp) +sw $a1, 132($sp) +move $s6, $a2 +move $s5, $a3 +lw $v1, 176($sp) +sw $v1, 136($sp) +lw $s7, 180($sp) +lw $s4, 184($sp) +c39: +c38: +li $a1, 0 +comp_fir_complexe127: +li $a0, 0 +c37: +li $v0, 16 +slt $v0, $a1, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, comp_fir_complexe121 +c33: +li $v0, 0 +c32: +li $s0, 0 +c31: +li $s3, 0 +c30: +c29: +li $s2, 0 +comp_fir_complexe96: +li $a1, 0 +c28: +slt $a0, $s2, $s4 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir_complexe91 +c10: +li $v0, 0 +lw $ra, 172($sp) +lw $s7, 168($sp) +lw $s6, 164($sp) +lw $s5, 160($sp) +lw $s4, 156($sp) +lw $s3, 152($sp) +lw $s2, 148($sp) +lw $s1, 144($sp) +lw $s0, 140($sp) +addi $sp, $sp, 188 +jr $ra +comp_fir_complexe91: +c26: +li $a0, 4 +mulo $a0, $s2, $a0 +lw $v1, 128($sp) +add $a0, $v1, $a0 +lw $a2, 0($a0) +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +sw $a2, 0($a0) +c25: +li $a0, 4 +mulo $a0, $s2, $a0 +lw $v1, 132($sp) +add $a0, $v1, $a0 +lw $a2, 0($a0) +move $a1, $sp +addi $a1, $a1, 64 +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +sw $a2, 0($a0) +c24: +c23: +li $s1, 0 +comp_fir_complexe72: +li $a1, 0 +c22: +li $a0, 16 +slt $a0, $s1, $a0 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir_complexe66 +c13: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +jalr $v0 +c12: +li $a0, 4 +mulo $a0, $s2, $a0 +lw $v1, 136($sp) +add $a0, $v1, $a0 +sw $s0, 0($a0) +c11: +li $a0, 4 +mulo $a0, $s2, $a0 +add $a0, $s7, $a0 +sw $s3, 0($a0) +c27: +li $a0, 1 +add $s2, $s2, $a0 +j comp_fir_complexe96 +comp_fir_complexe66: +c20: +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +lw $a2, 0($a0) +c19: +move $a1, $sp +addi $a1, $a1, 64 +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +lw $a3, 0($a0) +c18: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s6, $a0 +lw $a0, 0($a0) +mulo $a1, $a2, $a0 +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s5, $a0 +lw $a0, 0($a0) +mulo $a0, $a3, $a0 +sub $a1, $a1, $a0 +li $a0, 4 +srav $a1, $a1, $a0 +c17: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s5, $a0 +lw $a0, 0($a0) +mulo $a2, $a2, $a0 +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s6, $a0 +lw $a0, 0($a0) +mulo $a0, $a3, $a0 +add $a2, $a2, $a0 +li $a0, 4 +srav $a0, $a2, $a0 +c16: +add $s0, $s0, $a1 +c15: +add $s3, $s3, $a0 +c14: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +jalr $v0 +c21: +li $a0, 1 +add $s1, $s1, $a0 +j comp_fir_complexe72 +comp_fir_complexe121: +c35: +move $a0, $sp +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $zero, 0($v0) +c34: +move $a0, $sp +addi $a0, $a0, 64 +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $zero, 0($v0) +c36: +li $v0, 1 +add $a1, $a1, $v0 +j comp_fir_complexe127 +# end comp_fir_complexe + + +# begin _main +main36: +addi $sp, $sp, -4 +sw $ra, 0($sp) +c42: +la $v0, init97 +jalr $v0 +c41: +move $a0, $gp +move $a1, $gp +addi $a1, $a1, 64 +move $a2, $gp +addi $a2, $a2, 128 +move $a3, $gp +addi $a3, $a3, 192 +move $v0, $gp +addi $v0, $v0, 256 +addi $gp, $gp, 320 +li $t1, 16 +la $t0, comp_fir_complexe265 +sw $v0, -12($sp) +sw $gp, -8($sp) +sw $t1, -4($sp) +jalr $t0 +c40: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end _main diff --git a/tests/clight/fir_complexe.Clight.expected b/tests/clight/fir_complexe.Clight.expected new file mode 100644 index 0000000..0835ecc --- /dev/null +++ b/tests/clight/fir_complexe.Clight.expected @@ -0,0 +1,369 @@ +int t1[16]; + +int t2[16]; + +int t3[16]; + +int t4[16]; + +int t5[16]; + +int t6[16]; + +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +void init(void) +{ + int i; + c9: + for (({ c8: i = 0; }); (/* c7 */ i < 16); ({ c6: i = i + 1; })) { + c5: + t1[i] = 2; + c4: + t2[i] = 2; + c3: + t3[i] = 2; + c2: + t4[i] = 2; + c1: + t5[i] = 2; + c0: + t6[i] = 2; + } +} + +int comp_fir_complexe(int *in_re, int *in_im, int *c_re, int *c_im, int *out_re, int *out_im, int size) +{ + int i; + int j; + int res_re; + int res_im; + int tmp_im; + int tmp_re; + int tmp_x_re; + int tmp_x_im; + int x_re[16]; + int x_im[16]; + int ii; + int adx; + c39: + for (({ c38: ii = 0; }); (/* c37 */ ii < 16); ({ c36: ii = ii + 1; })) { + c35: + x_re[ii] = 0; + c34: + x_im[ii] = 0; + } + c33: + adx = 0; + c32: + res_re = 0; + c31: + res_im = 0; + c30: + for (({ c29: j = 0; }); (/* c28 */ j < size); ({ c27: j = j + 1; })) { + c26: + x_re[adx] = in_re[j]; + c25: + x_im[adx] = in_im[j]; + c24: + for (({ c23: i = 0; }); (/* c22 */ i < 16); ({ c21: i = i + 1; })) { + c20: + tmp_x_re = x_re[adx]; + c19: + tmp_x_im = x_im[adx]; + c18: + tmp_re = (tmp_x_re * c_re[i] - tmp_x_im * c_im[i]) >> 4; + c17: + tmp_im = (tmp_x_re * c_im[i] + tmp_x_im * c_re[i]) >> 4; + c16: + res_re = res_re + tmp_re; + c15: + res_im = res_im + tmp_im; + c14: + adx = (adx + 1) % 16; + } + c13: + adx = (adx + 1) % 16; + c12: + out_re[j] = res_re; + c11: + out_im[j] = res_im; + } + c10: + return 0; +} + +int main(void) +{ + int t; + c42: + init(); + c41: + t = comp_fir_complexe(t1, t2, t3, t4, t5, t6, 16); + c40: + return t; +} + + diff --git a/tests/clight/fir_complexe.Cminor.expected b/tests/clight/fir_complexe.Cminor.expected new file mode 100644 index 0000000..ada3b21 --- /dev/null +++ b/tests/clight/fir_complexe.Cminor.expected @@ -0,0 +1,553 @@ + +var "t1" {[64]} +var "t2" {[64]} +var "t3" {[64]} +var "t4" {[64]} +var "t5" {[64]} +var "t6" {[64]} + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"init" () : void { + + stack 0; + + var i; + + c9: + c8: + i = 0; + block { + loop { + if (!(/* c7 */ i < 16)) { + exit 0; + } + else { + } + block { + c5: + int32["t1" + (i * 4)] = 2; + c4: + int32["t2" + (i * 4)] = 2; + c3: + int32["t3" + (i * 4)] = 2; + c2: + int32["t4" + (i * 4)] = 2; + c1: + int32["t5" + (i * 4)] = 2; + c0: + int32["t6" + (i * 4)] = 2; + } + c6: + i = i + 1; + } + } + +} + + +"comp_fir_complexe" (in_re, in_im, c_re, c_im, out_re, out_im, size) : int -> int -> int -> int -> int -> int -> int -> int { + + stack 128; + + var res_im, ii, tmp_x_im, tmp_re, j, i, res_re, tmp_im, tmp_x_re, adx; + + c39: + c38: + ii = 0; + block { + loop { + if (!(/* c37 */ ii < 16)) { + exit 0; + } + else { + } + block { + c35: + int32[&0 + (ii * 4)] = 0; + c34: + int32[&64 + (ii * 4)] = 0; + } + c36: + ii = ii + 1; + } + } + c33: + adx = 0; + c32: + res_re = 0; + c31: + res_im = 0; + c30: + c29: + j = 0; + block { + loop { + if (!(/* c28 */ j < size)) { + exit 0; + } + else { + } + block { + c26: + int32[&0 + (adx * 4)] = int32[in_re + (j * 4)]; + c25: + int32[&64 + (adx * 4)] = int32[in_im + (j * 4)]; + c24: + c23: + i = 0; + block { + loop { + if (!(/* c22 */ i < 16)) { + exit 0; + } + else { + } + block { + c20: + tmp_x_re = int32[&0 + (adx * 4)]; + c19: + tmp_x_im = int32[&64 + (adx * 4)]; + c18: + tmp_re = ((tmp_x_re * int32[c_re + (i * 4)]) - (tmp_x_im * int32[c_im + (i * 4)])) >> 4; + c17: + tmp_im = ((tmp_x_re * int32[c_im + (i * 4)]) + (tmp_x_im * int32[c_re + (i * 4)])) >> 4; + c16: + res_re = res_re + tmp_re; + c15: + res_im = res_im + tmp_im; + c14: + adx = (adx + 1) % 16; + } + c21: + i = i + 1; + } + } + c13: + adx = (adx + 1) % 16; + c12: + int32[out_re + (j * 4)] = res_re; + c11: + int32[out_im + (j * 4)] = res_im; + } + c27: + j = j + 1; + } + } + c10: + return 0; + +} + + +"main" () : int { + + stack 0; + + var t; + + c42: + "init"() : void; + c41: + t = "comp_fir_complexe"("t1", "t2", "t3", "t4", "t5", "t6", 16) : int -> int -> int -> int -> int -> int -> int -> int; + c40: + return t; + +} + + diff --git a/tests/clight/fir_complexe.ERTL.expected b/tests/clight/fir_complexe.ERTL.expected new file mode 100644 index 0000000..3f271b2 --- /dev/null +++ b/tests/clight/fir_complexe.ERTL.expected @@ -0,0 +1,911 @@ +program + +globals 384 + +procedure init(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39 +entry init97 +init97 : newframe --> init96 +init96 : move %39, $ra --> init95 +init95 : move %38, $s7 --> init94 +init94 : move %37, $s6 --> init93 +init93 : move %36, $s5 --> init92 +init92 : move %35, $s4 --> init91 +init91 : move %34, $s3 --> init90 +init90 : move %33, $s2 --> init89 +init89 : move %32, $s1 --> init88 +init88 : move %31, $s0 --> init87 +init87 : li %0, 0 --> init86 +init86 : li %1, 0 --> init85 +init85 : li %2, 0 --> init84 +init84 : li %3, 0 --> init83 +init83 : li %4, 0 --> init82 +init82 : li %5, 0 --> init81 +init81 : li %6, 0 --> init80 +init80 : li %7, 0 --> init79 +init79 : li %8, 0 --> init78 +init78 : li %9, 0 --> init77 +init77 : li %10, 0 --> init76 +init76 : li %11, 0 --> init75 +init75 : li %12, 0 --> init74 +init74 : li %13, 0 --> init73 +init73 : li %14, 0 --> init72 +init72 : li %15, 0 --> init71 +init71 : li %16, 0 --> init70 +init70 : li %17, 0 --> init69 +init69 : li %18, 0 --> init68 +init68 : li %19, 0 --> init67 +init67 : li %20, 0 --> init66 +init66 : li %21, 0 --> init65 +init65 : li %22, 0 --> init64 +init64 : li %23, 0 --> init63 +init63 : li %24, 0 --> init62 +init62 : li %25, 0 --> init61 +init61 : li %26, 0 --> init60 +init60 : li %27, 0 --> init59 +init59 : li %28, 0 --> init58 +init58 : li %29, 0 --> init57 +init57 : li %30, 0 --> init43 +init43 : emit c9 --> init42 +init42 : emit c8 --> init41 +init41 : li %0, 0 --> init1 +init1 : j --> init40 +init40 : li %21, 0 --> init39 +init39 : emit c7 --> init38 +init38 : li %23, 16 --> init37 +init37 : slt %22, %0, %23 --> init36 +init36 : li %29, 0 --> init54 +init54 : seq %20, %22, %29 --> init35 +init35 : beq %20, %21 --> init34, init0 +init0 : j --> init108 +init108: move $ra, %39 --> init107 +init107: move $s7, %38 --> init106 +init106: move $s6, %37 --> init105 +init105: move $s5, %36 --> init104 +init104: move $s4, %35 --> init103 +init103: move $s3, %34 --> init102 +init102: move $s2, %33 --> init101 +init101: move $s1, %32 --> init100 +init100: move $s0, %31 --> init99 +init99 : delframe --> init98 +init98 : jr $ra +init34 : emit c5 --> init33 +init33 : li %17, 2 --> init32 +init32 : li %19, 4 --> init31 +init31 : mulo %18, %0, %19 --> init30 +init30 : move %28, $gp --> init113 +init113: move %28, %28 --> init53 +init53 : add %28, %28, %18 --> init52 +init52 : sw %17, 0(%28) --> init29 +init29 : emit c4 --> init28 +init28 : li %14, 2 --> init27 +init27 : li %16, 4 --> init26 +init26 : mulo %15, %0, %16 --> init25 +init25 : move %27, $gp --> init112 +init112: move %27, %27 --> init51 +init51 : add %27, %27, %15 --> init50 +init50 : sw %14, 64(%27) --> init24 +init24 : emit c3 --> init23 +init23 : li %11, 2 --> init22 +init22 : li %13, 4 --> init21 +init21 : mulo %12, %0, %13 --> init20 +init20 : move %26, $gp --> init111 +init111: move %26, %26 --> init49 +init49 : add %26, %26, %12 --> init48 +init48 : sw %11, 128(%26) --> init19 +init19 : emit c2 --> init18 +init18 : li %8, 2 --> init17 +init17 : li %10, 4 --> init16 +init16 : mulo %9, %0, %10 --> init15 +init15 : move %25, $gp --> init110 +init110: move %25, %25 --> init47 +init47 : add %25, %25, %9 --> init46 +init46 : sw %8, 192(%25) --> init14 +init14 : emit c1 --> init13 +init13 : li %5, 2 --> init12 +init12 : li %7, 4 --> init11 +init11 : mulo %6, %0, %7 --> init10 +init10 : move %24, $gp --> init109 +init109: move %24, %24 --> init45 +init45 : add %24, %24, %6 --> init44 +init44 : sw %5, 256(%24) --> init9 +init9 : emit c0 --> init8 +init8 : li %2, 2 --> init7 +init7 : li %4, 4 --> init6 +init6 : mulo %3, %0, %4 --> init5 +init5 : move %30, $gp --> init114 +init114: move %30, %30 --> init56 +init56 : add %30, %30, %3 --> init55 +init55 : sw %2, 320(%30) --> init4 +init4 : emit c6 --> init3 +init3 : li %1, 1 --> init2 +init2 : add %0, %0, %1 --> init1 + +procedure comp_fir_complexe(7) +stacksize 128 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106, %107, %108, %109, %110, %111, + %112, %113, %114, %115 +entry comp_fir_complexe265 +comp_fir_complexe265: newframe --> comp_fir_complexe264 +comp_fir_complexe264: move %115, $ra --> comp_fir_complexe263 +comp_fir_complexe263: move %114, $s7 --> comp_fir_complexe262 +comp_fir_complexe262: move %113, $s6 --> comp_fir_complexe261 +comp_fir_complexe261: move %112, $s5 --> comp_fir_complexe260 +comp_fir_complexe260: move %111, $s4 --> comp_fir_complexe259 +comp_fir_complexe259: move %110, $s3 --> comp_fir_complexe258 +comp_fir_complexe258: move %109, $s2 --> comp_fir_complexe257 +comp_fir_complexe257: move %108, $s1 --> comp_fir_complexe256 +comp_fir_complexe256: move %107, $s0 --> comp_fir_complexe255 +comp_fir_complexe255: move %0, $a0 --> comp_fir_complexe254 +comp_fir_complexe254: move %1, $a1 --> comp_fir_complexe253 +comp_fir_complexe253: move %2, $a2 --> comp_fir_complexe252 +comp_fir_complexe252: move %3, $a3 --> comp_fir_complexe251 +comp_fir_complexe251: gets %4, in(8) --> comp_fir_complexe250 +comp_fir_complexe250: gets %5, in(4) --> comp_fir_complexe249 +comp_fir_complexe249: gets %6, in(0) --> comp_fir_complexe248 +comp_fir_complexe248: li %7, 0 --> comp_fir_complexe247 +comp_fir_complexe247: li %8, 0 --> comp_fir_complexe246 +comp_fir_complexe246: li %9, 0 --> comp_fir_complexe245 +comp_fir_complexe245: li %10, 0 --> comp_fir_complexe244 +comp_fir_complexe244: li %11, 0 --> comp_fir_complexe243 +comp_fir_complexe243: li %12, 0 --> comp_fir_complexe242 +comp_fir_complexe242: li %13, 0 --> comp_fir_complexe241 +comp_fir_complexe241: li %14, 0 --> comp_fir_complexe240 +comp_fir_complexe240: li %15, 0 --> comp_fir_complexe239 +comp_fir_complexe239: li %16, 0 --> comp_fir_complexe238 +comp_fir_complexe238: li %18, 0 --> comp_fir_complexe237 +comp_fir_complexe237: li %19, 0 --> comp_fir_complexe236 +comp_fir_complexe236: li %20, 0 --> comp_fir_complexe235 +comp_fir_complexe235: li %21, 0 --> comp_fir_complexe234 +comp_fir_complexe234: li %22, 0 --> comp_fir_complexe233 +comp_fir_complexe233: li %23, 0 --> comp_fir_complexe232 +comp_fir_complexe232: li %24, 0 --> comp_fir_complexe231 +comp_fir_complexe231: li %25, 0 --> comp_fir_complexe230 +comp_fir_complexe230: li %26, 0 --> comp_fir_complexe229 +comp_fir_complexe229: li %27, 0 --> comp_fir_complexe228 +comp_fir_complexe228: li %28, 0 --> comp_fir_complexe227 +comp_fir_complexe227: li %29, 0 --> comp_fir_complexe226 +comp_fir_complexe226: li %30, 0 --> comp_fir_complexe225 +comp_fir_complexe225: li %31, 0 --> comp_fir_complexe224 +comp_fir_complexe224: li %32, 0 --> comp_fir_complexe223 +comp_fir_complexe223: li %33, 0 --> comp_fir_complexe222 +comp_fir_complexe222: li %34, 0 --> comp_fir_complexe221 +comp_fir_complexe221: li %35, 0 --> comp_fir_complexe220 +comp_fir_complexe220: li %36, 0 --> comp_fir_complexe219 +comp_fir_complexe219: li %37, 0 --> comp_fir_complexe218 +comp_fir_complexe218: li %38, 0 --> comp_fir_complexe217 +comp_fir_complexe217: li %39, 0 --> comp_fir_complexe216 +comp_fir_complexe216: li %40, 0 --> comp_fir_complexe215 +comp_fir_complexe215: li %41, 0 --> comp_fir_complexe214 +comp_fir_complexe214: li %42, 0 --> comp_fir_complexe213 +comp_fir_complexe213: li %43, 0 --> comp_fir_complexe212 +comp_fir_complexe212: li %44, 0 --> comp_fir_complexe211 +comp_fir_complexe211: li %45, 0 --> comp_fir_complexe210 +comp_fir_complexe210: li %46, 0 --> comp_fir_complexe209 +comp_fir_complexe209: li %47, 0 --> comp_fir_complexe208 +comp_fir_complexe208: li %48, 0 --> comp_fir_complexe207 +comp_fir_complexe207: li %49, 0 --> comp_fir_complexe206 +comp_fir_complexe206: li %50, 0 --> comp_fir_complexe205 +comp_fir_complexe205: li %51, 0 --> comp_fir_complexe204 +comp_fir_complexe204: li %52, 0 --> comp_fir_complexe203 +comp_fir_complexe203: li %53, 0 --> comp_fir_complexe202 +comp_fir_complexe202: li %54, 0 --> comp_fir_complexe201 +comp_fir_complexe201: li %55, 0 --> comp_fir_complexe200 +comp_fir_complexe200: li %56, 0 --> comp_fir_complexe199 +comp_fir_complexe199: li %57, 0 --> comp_fir_complexe198 +comp_fir_complexe198: li %58, 0 --> comp_fir_complexe197 +comp_fir_complexe197: li %59, 0 --> comp_fir_complexe196 +comp_fir_complexe196: li %60, 0 --> comp_fir_complexe195 +comp_fir_complexe195: li %61, 0 --> comp_fir_complexe194 +comp_fir_complexe194: li %62, 0 --> comp_fir_complexe193 +comp_fir_complexe193: li %63, 0 --> comp_fir_complexe192 +comp_fir_complexe192: li %64, 0 --> comp_fir_complexe191 +comp_fir_complexe191: li %65, 0 --> comp_fir_complexe190 +comp_fir_complexe190: li %66, 0 --> comp_fir_complexe189 +comp_fir_complexe189: li %67, 0 --> comp_fir_complexe188 +comp_fir_complexe188: li %68, 0 --> comp_fir_complexe187 +comp_fir_complexe187: li %69, 0 --> comp_fir_complexe186 +comp_fir_complexe186: li %70, 0 --> comp_fir_complexe185 +comp_fir_complexe185: li %71, 0 --> comp_fir_complexe184 +comp_fir_complexe184: li %72, 0 --> comp_fir_complexe183 +comp_fir_complexe183: li %73, 0 --> comp_fir_complexe182 +comp_fir_complexe182: li %74, 0 --> comp_fir_complexe181 +comp_fir_complexe181: li %75, 0 --> comp_fir_complexe180 +comp_fir_complexe180: li %76, 0 --> comp_fir_complexe179 +comp_fir_complexe179: li %77, 0 --> comp_fir_complexe178 +comp_fir_complexe178: li %78, 0 --> comp_fir_complexe177 +comp_fir_complexe177: li %79, 0 --> comp_fir_complexe176 +comp_fir_complexe176: li %80, 0 --> comp_fir_complexe175 +comp_fir_complexe175: li %81, 0 --> comp_fir_complexe174 +comp_fir_complexe174: li %82, 0 --> comp_fir_complexe173 +comp_fir_complexe173: li %83, 0 --> comp_fir_complexe172 +comp_fir_complexe172: li %84, 0 --> comp_fir_complexe171 +comp_fir_complexe171: li %85, 0 --> comp_fir_complexe170 +comp_fir_complexe170: li %86, 0 --> comp_fir_complexe169 +comp_fir_complexe169: li %87, 0 --> comp_fir_complexe168 +comp_fir_complexe168: li %88, 0 --> comp_fir_complexe167 +comp_fir_complexe167: li %89, 0 --> comp_fir_complexe166 +comp_fir_complexe166: li %90, 0 --> comp_fir_complexe165 +comp_fir_complexe165: li %91, 0 --> comp_fir_complexe164 +comp_fir_complexe164: li %92, 0 --> comp_fir_complexe163 +comp_fir_complexe163: li %93, 0 --> comp_fir_complexe162 +comp_fir_complexe162: li %94, 0 --> comp_fir_complexe161 +comp_fir_complexe161: li %95, 0 --> comp_fir_complexe160 +comp_fir_complexe160: li %96, 0 --> comp_fir_complexe159 +comp_fir_complexe159: li %97, 0 --> comp_fir_complexe158 +comp_fir_complexe158: li %98, 0 --> comp_fir_complexe157 +comp_fir_complexe157: li %99, 0 --> comp_fir_complexe156 +comp_fir_complexe156: li %100, 0 --> comp_fir_complexe155 +comp_fir_complexe155: li %101, 0 --> comp_fir_complexe154 +comp_fir_complexe154: li %102, 0 --> comp_fir_complexe153 +comp_fir_complexe153: li %103, 0 --> comp_fir_complexe152 +comp_fir_complexe152: li %104, 0 --> comp_fir_complexe151 +comp_fir_complexe151: li %105, 0 --> comp_fir_complexe150 +comp_fir_complexe150: li %106, 0 --> comp_fir_complexe130 +comp_fir_complexe130: emit c39 --> comp_fir_complexe129 +comp_fir_complexe129: emit c38 --> comp_fir_complexe128 +comp_fir_complexe128: li %8, 0 --> comp_fir_complexe106 +comp_fir_complexe106: j --> comp_fir_complexe127 +comp_fir_complexe127: li %85, 0 --> comp_fir_complexe126 +comp_fir_complexe126: emit c37 --> comp_fir_complexe125 +comp_fir_complexe125: li %87, 16 --> comp_fir_complexe124 +comp_fir_complexe124: slt %86, %8, %87 --> comp_fir_complexe123 +comp_fir_complexe123: li %91, 0 --> comp_fir_complexe134 +comp_fir_complexe134: seq %84, %86, %91 --> comp_fir_complexe122 +comp_fir_complexe122: beq %84, %85 --> comp_fir_complexe121, comp_fir_complexe105 +comp_fir_complexe105: emit c33 --> comp_fir_complexe104 +comp_fir_complexe104: li %16, 0 --> comp_fir_complexe103 +comp_fir_complexe103: emit c32 --> comp_fir_complexe102 +comp_fir_complexe102: li %13, 0 --> comp_fir_complexe101 +comp_fir_complexe101: emit c31 --> comp_fir_complexe100 +comp_fir_complexe100: li %7, 0 --> comp_fir_complexe99 +comp_fir_complexe99 : emit c30 --> comp_fir_complexe98 +comp_fir_complexe98 : emit c29 --> comp_fir_complexe97 +comp_fir_complexe97 : li %11, 0 --> comp_fir_complexe3 +comp_fir_complexe3 : j --> comp_fir_complexe96 +comp_fir_complexe96 : li %73, 0 --> comp_fir_complexe95 +comp_fir_complexe95 : emit c28 --> comp_fir_complexe94 +comp_fir_complexe94 : slt %74, %11, %6 --> comp_fir_complexe93 +comp_fir_complexe93 : li %106, 0 --> comp_fir_complexe149 +comp_fir_complexe149: seq %72, %74, %106 --> comp_fir_complexe92 +comp_fir_complexe92 : beq %72, %73 --> comp_fir_complexe91, comp_fir_complexe2 +comp_fir_complexe2 : emit c10 --> comp_fir_complexe1 +comp_fir_complexe1 : li %17, 0 --> comp_fir_complexe0 +comp_fir_complexe0 : j --> comp_fir_complexe277 +comp_fir_complexe277: move $v0, %17 --> comp_fir_complexe276 +comp_fir_complexe276: move $ra, %115 --> comp_fir_complexe275 +comp_fir_complexe275: move $s7, %114 --> comp_fir_complexe274 +comp_fir_complexe274: move $s6, %113 --> comp_fir_complexe273 +comp_fir_complexe273: move $s5, %112 --> comp_fir_complexe272 +comp_fir_complexe272: move $s4, %111 --> comp_fir_complexe271 +comp_fir_complexe271: move $s3, %110 --> comp_fir_complexe270 +comp_fir_complexe270: move $s2, %109 --> comp_fir_complexe269 +comp_fir_complexe269: move $s1, %108 --> comp_fir_complexe268 +comp_fir_complexe268: move $s0, %107 --> comp_fir_complexe267 +comp_fir_complexe267: delframe --> comp_fir_complexe266 +comp_fir_complexe266: jr $ra (xmits $v0) +comp_fir_complexe91 : emit c26 --> comp_fir_complexe90 +comp_fir_complexe90 : li %71, 4 --> comp_fir_complexe89 +comp_fir_complexe89 : mulo %70, %11, %71 --> comp_fir_complexe88 +comp_fir_complexe88 : add %105, %0, %70 --> comp_fir_complexe148 +comp_fir_complexe148: lw %66, 0(%105) --> comp_fir_complexe87 +comp_fir_complexe87 : move %67, $sp --> comp_fir_complexe291 +comp_fir_complexe291: move %67, %67 --> comp_fir_complexe86 +comp_fir_complexe86 : li %69, 4 --> comp_fir_complexe85 +comp_fir_complexe85 : mulo %68, %16, %69 --> comp_fir_complexe84 +comp_fir_complexe84 : add %104, %67, %68 --> comp_fir_complexe147 +comp_fir_complexe147: sw %66, 0(%104) --> comp_fir_complexe83 +comp_fir_complexe83 : emit c25 --> comp_fir_complexe82 +comp_fir_complexe82 : li %65, 4 --> comp_fir_complexe81 +comp_fir_complexe81 : mulo %64, %11, %65 --> comp_fir_complexe80 +comp_fir_complexe80 : add %103, %1, %64 --> comp_fir_complexe146 +comp_fir_complexe146: lw %60, 0(%103) --> comp_fir_complexe79 +comp_fir_complexe79 : move %61, $sp --> comp_fir_complexe290 +comp_fir_complexe290: addi %61, %61, 64 --> comp_fir_complexe78 +comp_fir_complexe78 : li %63, 4 --> comp_fir_complexe77 +comp_fir_complexe77 : mulo %62, %16, %63 --> comp_fir_complexe76 +comp_fir_complexe76 : add %102, %61, %62 --> comp_fir_complexe145 +comp_fir_complexe145: sw %60, 0(%102) --> comp_fir_complexe75 +comp_fir_complexe75 : emit c24 --> comp_fir_complexe74 +comp_fir_complexe74 : emit c23 --> comp_fir_complexe73 +comp_fir_complexe73 : li %12, 0 --> comp_fir_complexe20 +comp_fir_complexe20 : j --> comp_fir_complexe72 +comp_fir_complexe72 : li %57, 0 --> comp_fir_complexe71 +comp_fir_complexe71 : emit c22 --> comp_fir_complexe70 +comp_fir_complexe70 : li %59, 16 --> comp_fir_complexe69 +comp_fir_complexe69 : slt %58, %12, %59 --> comp_fir_complexe68 +comp_fir_complexe68 : li %100, 0 --> comp_fir_complexe143 +comp_fir_complexe143: seq %56, %58, %100 --> comp_fir_complexe67 +comp_fir_complexe67 : beq %56, %57 --> comp_fir_complexe66, comp_fir_complexe19 +comp_fir_complexe19 : emit c13 --> comp_fir_complexe18 +comp_fir_complexe18 : li %25, 1 --> comp_fir_complexe17 +comp_fir_complexe17 : add %23, %16, %25 --> comp_fir_complexe16 +comp_fir_complexe16 : li %24, 16 --> comp_fir_complexe15 +comp_fir_complexe15 : la %92, mod --> comp_fir_complexe135 +comp_fir_complexe135: j --> comp_fir_complexe283 +comp_fir_complexe283: move $a0, %23 --> comp_fir_complexe282 +comp_fir_complexe282: move $a1, %24 --> comp_fir_complexe281 +comp_fir_complexe281: call %92(2) --> comp_fir_complexe280 +comp_fir_complexe280: move %16, $v0 --> comp_fir_complexe14 +comp_fir_complexe14 : emit c12 --> comp_fir_complexe13 +comp_fir_complexe13 : li %22, 4 --> comp_fir_complexe12 +comp_fir_complexe12 : mulo %21, %11, %22 --> comp_fir_complexe11 +comp_fir_complexe11 : add %88, %4, %21 --> comp_fir_complexe131 +comp_fir_complexe131: sw %13, 0(%88) --> comp_fir_complexe10 +comp_fir_complexe10 : emit c11 --> comp_fir_complexe9 +comp_fir_complexe9 : li %20, 4 --> comp_fir_complexe8 +comp_fir_complexe8 : mulo %19, %11, %20 --> comp_fir_complexe7 +comp_fir_complexe7 : add %101, %5, %19 --> comp_fir_complexe144 +comp_fir_complexe144: sw %7, 0(%101) --> comp_fir_complexe6 +comp_fir_complexe6 : emit c27 --> comp_fir_complexe5 +comp_fir_complexe5 : li %18, 1 --> comp_fir_complexe4 +comp_fir_complexe4 : add %11, %11, %18 --> comp_fir_complexe3 +comp_fir_complexe66 : emit c20 --> comp_fir_complexe65 +comp_fir_complexe65 : move %53, $sp --> comp_fir_complexe289 +comp_fir_complexe289: move %53, %53 --> comp_fir_complexe64 +comp_fir_complexe64 : li %55, 4 --> comp_fir_complexe63 +comp_fir_complexe63 : mulo %54, %16, %55 --> comp_fir_complexe62 +comp_fir_complexe62 : add %99, %53, %54 --> comp_fir_complexe142 +comp_fir_complexe142: lw %15, 0(%99) --> comp_fir_complexe61 +comp_fir_complexe61 : emit c19 --> comp_fir_complexe60 +comp_fir_complexe60 : move %50, $sp --> comp_fir_complexe288 +comp_fir_complexe288: addi %50, %50, 64 --> comp_fir_complexe59 +comp_fir_complexe59 : li %52, 4 --> comp_fir_complexe58 +comp_fir_complexe58 : mulo %51, %16, %52 --> comp_fir_complexe57 +comp_fir_complexe57 : add %98, %50, %51 --> comp_fir_complexe141 +comp_fir_complexe141: lw %9, 0(%98) --> comp_fir_complexe56 +comp_fir_complexe56 : emit c18 --> comp_fir_complexe55 +comp_fir_complexe55 : li %49, 4 --> comp_fir_complexe54 +comp_fir_complexe54 : mulo %48, %12, %49 --> comp_fir_complexe53 +comp_fir_complexe53 : add %97, %2, %48 --> comp_fir_complexe140 +comp_fir_complexe140: lw %47, 0(%97) --> comp_fir_complexe52 +comp_fir_complexe52 : mulo %42, %15, %47 --> comp_fir_complexe51 +comp_fir_complexe51 : li %46, 4 --> comp_fir_complexe50 +comp_fir_complexe50 : mulo %45, %12, %46 --> comp_fir_complexe49 +comp_fir_complexe49 : add %96, %3, %45 --> comp_fir_complexe139 +comp_fir_complexe139: lw %44, 0(%96) --> comp_fir_complexe48 +comp_fir_complexe48 : mulo %43, %9, %44 --> comp_fir_complexe47 +comp_fir_complexe47 : sub %40, %42, %43 --> comp_fir_complexe46 +comp_fir_complexe46 : li %41, 4 --> comp_fir_complexe45 +comp_fir_complexe45 : srav %10, %40, %41 --> comp_fir_complexe44 +comp_fir_complexe44 : emit c17 --> comp_fir_complexe43 +comp_fir_complexe43 : li %39, 4 --> comp_fir_complexe42 +comp_fir_complexe42 : mulo %38, %12, %39 --> comp_fir_complexe41 +comp_fir_complexe41 : add %95, %3, %38 --> comp_fir_complexe138 +comp_fir_complexe138: lw %37, 0(%95) --> comp_fir_complexe40 +comp_fir_complexe40 : mulo %32, %15, %37 --> comp_fir_complexe39 +comp_fir_complexe39 : li %36, 4 --> comp_fir_complexe38 +comp_fir_complexe38 : mulo %35, %12, %36 --> comp_fir_complexe37 +comp_fir_complexe37 : add %94, %2, %35 --> comp_fir_complexe137 +comp_fir_complexe137: lw %34, 0(%94) --> comp_fir_complexe36 +comp_fir_complexe36 : mulo %33, %9, %34 --> comp_fir_complexe35 +comp_fir_complexe35 : add %30, %32, %33 --> comp_fir_complexe34 +comp_fir_complexe34 : li %31, 4 --> comp_fir_complexe33 +comp_fir_complexe33 : srav %14, %30, %31 --> comp_fir_complexe32 +comp_fir_complexe32 : emit c16 --> comp_fir_complexe31 +comp_fir_complexe31 : add %13, %13, %10 --> comp_fir_complexe30 +comp_fir_complexe30 : emit c15 --> comp_fir_complexe29 +comp_fir_complexe29 : add %7, %7, %14 --> comp_fir_complexe28 +comp_fir_complexe28 : emit c14 --> comp_fir_complexe27 +comp_fir_complexe27 : li %29, 1 --> comp_fir_complexe26 +comp_fir_complexe26 : add %27, %16, %29 --> comp_fir_complexe25 +comp_fir_complexe25 : li %28, 16 --> comp_fir_complexe24 +comp_fir_complexe24 : la %93, mod --> comp_fir_complexe136 +comp_fir_complexe136: j --> comp_fir_complexe287 +comp_fir_complexe287: move $a0, %27 --> comp_fir_complexe286 +comp_fir_complexe286: move $a1, %28 --> comp_fir_complexe285 +comp_fir_complexe285: call %93(2) --> comp_fir_complexe284 +comp_fir_complexe284: move %16, $v0 --> comp_fir_complexe23 +comp_fir_complexe23 : emit c21 --> comp_fir_complexe22 +comp_fir_complexe22 : li %26, 1 --> comp_fir_complexe21 +comp_fir_complexe21 : add %12, %12, %26 --> comp_fir_complexe20 +comp_fir_complexe121: emit c35 --> comp_fir_complexe120 +comp_fir_complexe120: li %80, 0 --> comp_fir_complexe119 +comp_fir_complexe119: move %81, $sp --> comp_fir_complexe279 +comp_fir_complexe279: move %81, %81 --> comp_fir_complexe118 +comp_fir_complexe118: li %83, 4 --> comp_fir_complexe117 +comp_fir_complexe117: mulo %82, %8, %83 --> comp_fir_complexe116 +comp_fir_complexe116: add %90, %81, %82 --> comp_fir_complexe133 +comp_fir_complexe133: sw %80, 0(%90) --> comp_fir_complexe115 +comp_fir_complexe115: emit c34 --> comp_fir_complexe114 +comp_fir_complexe114: li %76, 0 --> comp_fir_complexe113 +comp_fir_complexe113: move %77, $sp --> comp_fir_complexe278 +comp_fir_complexe278: addi %77, %77, 64 --> comp_fir_complexe112 +comp_fir_complexe112: li %79, 4 --> comp_fir_complexe111 +comp_fir_complexe111: mulo %78, %8, %79 --> comp_fir_complexe110 +comp_fir_complexe110: add %89, %77, %78 --> comp_fir_complexe132 +comp_fir_complexe132: sw %76, 0(%89) --> comp_fir_complexe109 +comp_fir_complexe109: emit c36 --> comp_fir_complexe108 +comp_fir_complexe108: li %75, 1 --> comp_fir_complexe107 +comp_fir_complexe107: add %8, %8, %75 --> comp_fir_complexe106 + +procedure _main(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20 +entry main36 +main36: newframe --> main35 +main35: move %20, $ra --> main34 +main34: move %19, $s7 --> main33 +main33: move %18, $s6 --> main32 +main32: move %17, $s5 --> main31 +main31: move %16, $s4 --> main30 +main30: move %15, $s3 --> main29 +main29: move %14, $s2 --> main28 +main28: move %13, $s1 --> main27 +main27: move %12, $s0 --> main26 +main26: li %0, 0 --> main25 +main25: li %2, 0 --> main24 +main24: li %3, 0 --> main23 +main23: li %4, 0 --> main22 +main22: li %5, 0 --> main21 +main21: li %6, 0 --> main20 +main20: li %7, 0 --> main19 +main19: li %8, 0 --> main18 +main18: li %9, 0 --> main17 +main17: li %10, 0 --> main16 +main16: li %11, 0 --> main13 +main13: emit c42 --> main12 +main12: la %10, init --> main14 +main14: j --> main51 +main51: call %10(0) --> main50 +main50: move %9, $v0 --> main11 +main11: emit c41 --> main10 +main10: move %2, $gp --> main49 +main49: move %2, %2 --> main9 +main9 : move %3, $gp --> main65 +main65: addi %3, %3, 64 --> main8 +main8 : move %4, $gp --> main64 +main64: addi %4, %4, 128 --> main7 +main7 : move %5, $gp --> main63 +main63: addi %5, %5, 192 --> main6 +main6 : move %6, $gp --> main62 +main62: addi %6, %6, 256 --> main5 +main5 : move %7, $gp --> main61 +main61: addi %7, %7, 320 --> main4 +main4 : li %8, 16 --> main3 +main3 : la %11, comp_fir_complexe --> main15 +main15: j --> main60 +main60: move $a0, %2 --> main59 +main59: move $a1, %3 --> main58 +main58: move $a2, %4 --> main57 +main57: move $a3, %5 --> main56 +main56: sets out(8), %6 --> main55 +main55: sets out(4), %7 --> main54 +main54: sets out(0), %8 --> main53 +main53: call %11(7) --> main52 +main52: move %0, $v0 --> main2 +main2 : emit c40 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main48 +main48: move $v0, %1 --> main47 +main47: move $ra, %20 --> main46 +main46: move $s7, %19 --> main45 +main45: move $s6, %18 --> main44 +main44: move $s5, %17 --> main43 +main43: move $s4, %16 --> main42 +main42: move $s3, %15 --> main41 +main41: move $s2, %14 --> main40 +main40: move $s1, %13 --> main39 +main39: move $s0, %12 --> main38 +main38: delframe --> main37 +main37: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir_complexe.LIN.expected b/tests/clight/fir_complexe.LIN.expected new file mode 100644 index 0000000..cfe676e --- /dev/null +++ b/tests/clight/fir_complexe.LIN.expected @@ -0,0 +1,683 @@ +program + +globals 384 + +procedure init(0) +var 0 +init97: +newframe +c9: +c8: +li $a2, 0 +init40: +li $a0, 0 +c7: +li $v0, 16 +slt $v0, $a2, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, init34 +delframe +jr $ra +init34: +c5: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 0($v0) +c4: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 64($v0) +c3: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 128($v0) +c2: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 192($v0) +c1: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 256($v0) +c0: +li $a1, 2 +li $v0, 4 +mulo $a0, $a2, $v0 +move $v0, $gp +add $v0, $v0, $a0 +sw $a1, 320($v0) +c6: +li $v0, 1 +add $a2, $a2, $v0 +j init40 + +procedure comp_fir_complexe(7) +var 188 +comp_fir_complexe265: +newframe +sw $ra, 172($sp) +sw $s7, 168($sp) +sw $s6, 164($sp) +sw $s5, 160($sp) +sw $s4, 156($sp) +sw $s3, 152($sp) +sw $s2, 148($sp) +sw $s1, 144($sp) +sw $s0, 140($sp) +sw $a0, 128($sp) +sw $a1, 132($sp) +move $s6, $a2 +move $s5, $a3 +lw $v1, 176($sp) +sw $v1, 136($sp) +lw $s7, 180($sp) +lw $s4, 184($sp) +c39: +c38: +li $a1, 0 +comp_fir_complexe127: +li $a0, 0 +c37: +li $v0, 16 +slt $v0, $a1, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, comp_fir_complexe121 +c33: +li $v0, 0 +c32: +li $s0, 0 +c31: +li $s3, 0 +c30: +c29: +li $s2, 0 +comp_fir_complexe96: +li $a1, 0 +c28: +slt $a0, $s2, $s4 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir_complexe91 +c10: +li $v0, 0 +lw $ra, 172($sp) +lw $s7, 168($sp) +lw $s6, 164($sp) +lw $s5, 160($sp) +lw $s4, 156($sp) +lw $s3, 152($sp) +lw $s2, 148($sp) +lw $s1, 144($sp) +lw $s0, 140($sp) +delframe +jr $ra +comp_fir_complexe91: +c26: +li $a0, 4 +mulo $a0, $s2, $a0 +lw $v1, 128($sp) +add $a0, $v1, $a0 +lw $a2, 0($a0) +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +sw $a2, 0($a0) +c25: +li $a0, 4 +mulo $a0, $s2, $a0 +lw $v1, 132($sp) +add $a0, $v1, $a0 +lw $a2, 0($a0) +move $a1, $sp +addi $a1, $a1, 64 +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +sw $a2, 0($a0) +c24: +c23: +li $s1, 0 +comp_fir_complexe72: +li $a1, 0 +c22: +li $a0, 16 +slt $a0, $s1, $a0 +seq $a0, $a0, $zero +beq $a0, $a1, comp_fir_complexe66 +c13: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +call $v0 +c12: +li $a0, 4 +mulo $a0, $s2, $a0 +lw $v1, 136($sp) +add $a0, $v1, $a0 +sw $s0, 0($a0) +c11: +li $a0, 4 +mulo $a0, $s2, $a0 +add $a0, $s7, $a0 +sw $s3, 0($a0) +c27: +li $a0, 1 +add $s2, $s2, $a0 +j comp_fir_complexe96 +comp_fir_complexe66: +c20: +move $a1, $sp +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +lw $a2, 0($a0) +c19: +move $a1, $sp +addi $a1, $a1, 64 +li $a0, 4 +mulo $a0, $v0, $a0 +add $a0, $a1, $a0 +lw $a3, 0($a0) +c18: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s6, $a0 +lw $a0, 0($a0) +mulo $a1, $a2, $a0 +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s5, $a0 +lw $a0, 0($a0) +mulo $a0, $a3, $a0 +sub $a1, $a1, $a0 +li $a0, 4 +srav $a1, $a1, $a0 +c17: +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s5, $a0 +lw $a0, 0($a0) +mulo $a2, $a2, $a0 +li $a0, 4 +mulo $a0, $s1, $a0 +add $a0, $s6, $a0 +lw $a0, 0($a0) +mulo $a0, $a3, $a0 +add $a2, $a2, $a0 +li $a0, 4 +srav $a0, $a2, $a0 +c16: +add $s0, $s0, $a1 +c15: +add $s3, $s3, $a0 +c14: +li $a0, 1 +add $a0, $v0, $a0 +li $a1, 16 +la $v0, mod +call $v0 +c21: +li $a0, 1 +add $s1, $s1, $a0 +j comp_fir_complexe72 +comp_fir_complexe121: +c35: +move $a0, $sp +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $zero, 0($v0) +c34: +move $a0, $sp +addi $a0, $a0, 64 +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $zero, 0($v0) +c36: +li $v0, 1 +add $a1, $a1, $v0 +j comp_fir_complexe127 + +procedure _main(0) +var 4 +main36: +newframe +sw $ra, 0($sp) +c42: +la $v0, init +call $v0 +c41: +move $a0, $gp +move $a1, $gp +addi $a1, $a1, 64 +move $a2, $gp +addi $a2, $a2, 128 +move $a3, $gp +addi $a3, $a3, 192 +move $v0, $gp +addi $v0, $v0, 256 +addi $gp, $gp, 320 +li $t1, 16 +la $t0, comp_fir_complexe +sw $v0, -12($sp) +sw $gp, -8($sp) +sw $t1, -4($sp) +call $t0 +c40: +lw $ra, 0($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir_complexe.LTL.expected b/tests/clight/fir_complexe.LTL.expected new file mode 100644 index 0000000..96a7c23 --- /dev/null +++ b/tests/clight/fir_complexe.LTL.expected @@ -0,0 +1,889 @@ +program + +globals 384 + +procedure init(0) +var 0 +entry init97 +init97 : newframe --> init96 +init96 : j --> init95 +init95 : j --> init94 +init94 : j --> init93 +init93 : j --> init92 +init92 : j --> init91 +init91 : j --> init90 +init90 : j --> init89 +init89 : j --> init88 +init88 : j --> init87 +init87 : j --> init86 +init86 : j --> init85 +init85 : j --> init84 +init84 : j --> init83 +init83 : j --> init82 +init82 : j --> init81 +init81 : j --> init80 +init80 : j --> init79 +init79 : j --> init78 +init78 : j --> init77 +init77 : j --> init76 +init76 : j --> init75 +init75 : j --> init74 +init74 : j --> init73 +init73 : j --> init72 +init72 : j --> init71 +init71 : j --> init70 +init70 : j --> init69 +init69 : j --> init68 +init68 : j --> init67 +init67 : j --> init66 +init66 : j --> init65 +init65 : j --> init64 +init64 : j --> init63 +init63 : j --> init62 +init62 : j --> init61 +init61 : j --> init60 +init60 : j --> init59 +init59 : j --> init58 +init58 : j --> init57 +init57 : j --> init43 +init43 : emit c9 --> init42 +init42 : emit c8 --> init41 +init41 : li $a2, 0 --> init1 +init1 : j --> init40 +init40 : li $a0, 0 --> init39 +init39 : emit c7 --> init38 +init38 : li $v0, 16 --> init37 +init37 : slt $v0, $a2, $v0 --> init36 +init36 : j --> init54 +init54 : seq $v0, $v0, $zero --> init35 +init35 : beq $v0, $a0 --> init34, init0 +init0 : j --> init108 +init108: j --> init107 +init107: j --> init106 +init106: j --> init105 +init105: j --> init104 +init104: j --> init103 +init103: j --> init102 +init102: j --> init101 +init101: j --> init100 +init100: j --> init99 +init99 : delframe --> init98 +init98 : jr $ra +init34 : emit c5 --> init33 +init33 : li $a1, 2 --> init32 +init32 : li $v0, 4 --> init31 +init31 : mulo $a0, $a2, $v0 --> init30 +init30 : move $v0, $gp --> init113 +init113: j --> init53 +init53 : add $v0, $v0, $a0 --> init52 +init52 : lw $a1, 0($v0) --> init29 +init29 : emit c4 --> init28 +init28 : li $a1, 2 --> init27 +init27 : li $v0, 4 --> init26 +init26 : mulo $a0, $a2, $v0 --> init25 +init25 : move $v0, $gp --> init112 +init112: j --> init51 +init51 : add $v0, $v0, $a0 --> init50 +init50 : lw $a1, 64($v0) --> init24 +init24 : emit c3 --> init23 +init23 : li $a1, 2 --> init22 +init22 : li $v0, 4 --> init21 +init21 : mulo $a0, $a2, $v0 --> init20 +init20 : move $v0, $gp --> init111 +init111: j --> init49 +init49 : add $v0, $v0, $a0 --> init48 +init48 : lw $a1, 128($v0) --> init19 +init19 : emit c2 --> init18 +init18 : li $a1, 2 --> init17 +init17 : li $v0, 4 --> init16 +init16 : mulo $a0, $a2, $v0 --> init15 +init15 : move $v0, $gp --> init110 +init110: j --> init47 +init47 : add $v0, $v0, $a0 --> init46 +init46 : lw $a1, 192($v0) --> init14 +init14 : emit c1 --> init13 +init13 : li $a1, 2 --> init12 +init12 : li $v0, 4 --> init11 +init11 : mulo $a0, $a2, $v0 --> init10 +init10 : move $v0, $gp --> init109 +init109: j --> init45 +init45 : add $v0, $v0, $a0 --> init44 +init44 : lw $a1, 256($v0) --> init9 +init9 : emit c0 --> init8 +init8 : li $a1, 2 --> init7 +init7 : li $v0, 4 --> init6 +init6 : mulo $a0, $a2, $v0 --> init5 +init5 : move $v0, $gp --> init114 +init114: j --> init56 +init56 : add $v0, $v0, $a0 --> init55 +init55 : lw $a1, 320($v0) --> init4 +init4 : emit c6 --> init3 +init3 : li $v0, 1 --> init2 +init2 : add $a2, $a2, $v0 --> init1 + +procedure comp_fir_complexe(7) +var 188 +entry comp_fir_complexe265 +comp_fir_complexe265: newframe --> comp_fir_complexe264 +comp_fir_complexe264: lw $ra, 172($sp) --> comp_fir_complexe263 +comp_fir_complexe263: lw $s7, 168($sp) --> comp_fir_complexe262 +comp_fir_complexe262: lw $s6, 164($sp) --> comp_fir_complexe261 +comp_fir_complexe261: lw $s5, 160($sp) --> comp_fir_complexe260 +comp_fir_complexe260: lw $s4, 156($sp) --> comp_fir_complexe259 +comp_fir_complexe259: lw $s3, 152($sp) --> comp_fir_complexe258 +comp_fir_complexe258: lw $s2, 148($sp) --> comp_fir_complexe257 +comp_fir_complexe257: lw $s1, 144($sp) --> comp_fir_complexe256 +comp_fir_complexe256: lw $s0, 140($sp) --> comp_fir_complexe255 +comp_fir_complexe255: lw $a0, 128($sp) --> comp_fir_complexe254 +comp_fir_complexe254: lw $a1, 132($sp) --> comp_fir_complexe253 +comp_fir_complexe253: move $s6, $a2 --> comp_fir_complexe252 +comp_fir_complexe252: move $s5, $a3 --> comp_fir_complexe251 +comp_fir_complexe251: lw $v1, 176($sp) --> comp_fir_complexe293 +comp_fir_complexe293: lw $v1, 136($sp) --> comp_fir_complexe250 +comp_fir_complexe250: lw $s7, 180($sp) --> comp_fir_complexe249 +comp_fir_complexe249: lw $s4, 184($sp) --> comp_fir_complexe248 +comp_fir_complexe248: j --> comp_fir_complexe247 +comp_fir_complexe247: j --> comp_fir_complexe246 +comp_fir_complexe246: j --> comp_fir_complexe245 +comp_fir_complexe245: j --> comp_fir_complexe244 +comp_fir_complexe244: j --> comp_fir_complexe243 +comp_fir_complexe243: j --> comp_fir_complexe242 +comp_fir_complexe242: j --> comp_fir_complexe241 +comp_fir_complexe241: j --> comp_fir_complexe240 +comp_fir_complexe240: j --> comp_fir_complexe239 +comp_fir_complexe239: j --> comp_fir_complexe238 +comp_fir_complexe238: j --> comp_fir_complexe237 +comp_fir_complexe237: j --> comp_fir_complexe236 +comp_fir_complexe236: j --> comp_fir_complexe235 +comp_fir_complexe235: j --> comp_fir_complexe234 +comp_fir_complexe234: j --> comp_fir_complexe233 +comp_fir_complexe233: j --> comp_fir_complexe232 +comp_fir_complexe232: j --> comp_fir_complexe231 +comp_fir_complexe231: j --> comp_fir_complexe230 +comp_fir_complexe230: j --> comp_fir_complexe229 +comp_fir_complexe229: j --> comp_fir_complexe228 +comp_fir_complexe228: j --> comp_fir_complexe227 +comp_fir_complexe227: j --> comp_fir_complexe226 +comp_fir_complexe226: j --> comp_fir_complexe225 +comp_fir_complexe225: j --> comp_fir_complexe224 +comp_fir_complexe224: j --> comp_fir_complexe223 +comp_fir_complexe223: j --> comp_fir_complexe222 +comp_fir_complexe222: j --> comp_fir_complexe221 +comp_fir_complexe221: j --> comp_fir_complexe220 +comp_fir_complexe220: j --> comp_fir_complexe219 +comp_fir_complexe219: j --> comp_fir_complexe218 +comp_fir_complexe218: j --> comp_fir_complexe217 +comp_fir_complexe217: j --> comp_fir_complexe216 +comp_fir_complexe216: j --> comp_fir_complexe215 +comp_fir_complexe215: j --> comp_fir_complexe214 +comp_fir_complexe214: j --> comp_fir_complexe213 +comp_fir_complexe213: j --> comp_fir_complexe212 +comp_fir_complexe212: j --> comp_fir_complexe211 +comp_fir_complexe211: j --> comp_fir_complexe210 +comp_fir_complexe210: j --> comp_fir_complexe209 +comp_fir_complexe209: j --> comp_fir_complexe208 +comp_fir_complexe208: j --> comp_fir_complexe207 +comp_fir_complexe207: j --> comp_fir_complexe206 +comp_fir_complexe206: j --> comp_fir_complexe205 +comp_fir_complexe205: j --> comp_fir_complexe204 +comp_fir_complexe204: j --> comp_fir_complexe203 +comp_fir_complexe203: j --> comp_fir_complexe202 +comp_fir_complexe202: j --> comp_fir_complexe201 +comp_fir_complexe201: j --> comp_fir_complexe200 +comp_fir_complexe200: j --> comp_fir_complexe199 +comp_fir_complexe199: j --> comp_fir_complexe198 +comp_fir_complexe198: j --> comp_fir_complexe197 +comp_fir_complexe197: j --> comp_fir_complexe196 +comp_fir_complexe196: j --> comp_fir_complexe195 +comp_fir_complexe195: j --> comp_fir_complexe194 +comp_fir_complexe194: j --> comp_fir_complexe193 +comp_fir_complexe193: j --> comp_fir_complexe192 +comp_fir_complexe192: j --> comp_fir_complexe191 +comp_fir_complexe191: j --> comp_fir_complexe190 +comp_fir_complexe190: j --> comp_fir_complexe189 +comp_fir_complexe189: j --> comp_fir_complexe188 +comp_fir_complexe188: j --> comp_fir_complexe187 +comp_fir_complexe187: j --> comp_fir_complexe186 +comp_fir_complexe186: j --> comp_fir_complexe185 +comp_fir_complexe185: j --> comp_fir_complexe184 +comp_fir_complexe184: j --> comp_fir_complexe183 +comp_fir_complexe183: j --> comp_fir_complexe182 +comp_fir_complexe182: j --> comp_fir_complexe181 +comp_fir_complexe181: j --> comp_fir_complexe180 +comp_fir_complexe180: j --> comp_fir_complexe179 +comp_fir_complexe179: j --> comp_fir_complexe178 +comp_fir_complexe178: j --> comp_fir_complexe177 +comp_fir_complexe177: j --> comp_fir_complexe176 +comp_fir_complexe176: j --> comp_fir_complexe175 +comp_fir_complexe175: j --> comp_fir_complexe174 +comp_fir_complexe174: j --> comp_fir_complexe173 +comp_fir_complexe173: j --> comp_fir_complexe172 +comp_fir_complexe172: j --> comp_fir_complexe171 +comp_fir_complexe171: j --> comp_fir_complexe170 +comp_fir_complexe170: j --> comp_fir_complexe169 +comp_fir_complexe169: j --> comp_fir_complexe168 +comp_fir_complexe168: j --> comp_fir_complexe167 +comp_fir_complexe167: j --> comp_fir_complexe166 +comp_fir_complexe166: j --> comp_fir_complexe165 +comp_fir_complexe165: j --> comp_fir_complexe164 +comp_fir_complexe164: j --> comp_fir_complexe163 +comp_fir_complexe163: j --> comp_fir_complexe162 +comp_fir_complexe162: j --> comp_fir_complexe161 +comp_fir_complexe161: j --> comp_fir_complexe160 +comp_fir_complexe160: j --> comp_fir_complexe159 +comp_fir_complexe159: j --> comp_fir_complexe158 +comp_fir_complexe158: j --> comp_fir_complexe157 +comp_fir_complexe157: j --> comp_fir_complexe156 +comp_fir_complexe156: j --> comp_fir_complexe155 +comp_fir_complexe155: j --> comp_fir_complexe154 +comp_fir_complexe154: j --> comp_fir_complexe153 +comp_fir_complexe153: j --> comp_fir_complexe152 +comp_fir_complexe152: j --> comp_fir_complexe151 +comp_fir_complexe151: j --> comp_fir_complexe150 +comp_fir_complexe150: j --> comp_fir_complexe130 +comp_fir_complexe130: emit c39 --> comp_fir_complexe129 +comp_fir_complexe129: emit c38 --> comp_fir_complexe128 +comp_fir_complexe128: li $a1, 0 --> comp_fir_complexe106 +comp_fir_complexe106: j --> comp_fir_complexe127 +comp_fir_complexe127: li $a0, 0 --> comp_fir_complexe126 +comp_fir_complexe126: emit c37 --> comp_fir_complexe125 +comp_fir_complexe125: li $v0, 16 --> comp_fir_complexe124 +comp_fir_complexe124: slt $v0, $a1, $v0 --> comp_fir_complexe123 +comp_fir_complexe123: j --> comp_fir_complexe134 +comp_fir_complexe134: seq $v0, $v0, $zero --> comp_fir_complexe122 +comp_fir_complexe122: beq $v0, $a0 --> comp_fir_complexe121, comp_fir_complexe105 +comp_fir_complexe105: emit c33 --> comp_fir_complexe104 +comp_fir_complexe104: li $v0, 0 --> comp_fir_complexe103 +comp_fir_complexe103: emit c32 --> comp_fir_complexe102 +comp_fir_complexe102: li $s0, 0 --> comp_fir_complexe101 +comp_fir_complexe101: emit c31 --> comp_fir_complexe100 +comp_fir_complexe100: li $s3, 0 --> comp_fir_complexe99 +comp_fir_complexe99 : emit c30 --> comp_fir_complexe98 +comp_fir_complexe98 : emit c29 --> comp_fir_complexe97 +comp_fir_complexe97 : li $s2, 0 --> comp_fir_complexe3 +comp_fir_complexe3 : j --> comp_fir_complexe96 +comp_fir_complexe96 : li $a1, 0 --> comp_fir_complexe95 +comp_fir_complexe95 : emit c28 --> comp_fir_complexe94 +comp_fir_complexe94 : slt $a0, $s2, $s4 --> comp_fir_complexe93 +comp_fir_complexe93 : j --> comp_fir_complexe149 +comp_fir_complexe149: seq $a0, $a0, $zero --> comp_fir_complexe92 +comp_fir_complexe92 : beq $a0, $a1 --> comp_fir_complexe91, comp_fir_complexe2 +comp_fir_complexe2 : emit c10 --> comp_fir_complexe1 +comp_fir_complexe1 : li $v0, 0 --> comp_fir_complexe0 +comp_fir_complexe0 : j --> comp_fir_complexe277 +comp_fir_complexe277: j --> comp_fir_complexe276 +comp_fir_complexe276: lw $ra, 172($sp) --> comp_fir_complexe275 +comp_fir_complexe275: lw $s7, 168($sp) --> comp_fir_complexe274 +comp_fir_complexe274: lw $s6, 164($sp) --> comp_fir_complexe273 +comp_fir_complexe273: lw $s5, 160($sp) --> comp_fir_complexe272 +comp_fir_complexe272: lw $s4, 156($sp) --> comp_fir_complexe271 +comp_fir_complexe271: lw $s3, 152($sp) --> comp_fir_complexe270 +comp_fir_complexe270: lw $s2, 148($sp) --> comp_fir_complexe269 +comp_fir_complexe269: lw $s1, 144($sp) --> comp_fir_complexe268 +comp_fir_complexe268: lw $s0, 140($sp) --> comp_fir_complexe267 +comp_fir_complexe267: delframe --> comp_fir_complexe266 +comp_fir_complexe266: jr $ra +comp_fir_complexe91 : emit c26 --> comp_fir_complexe90 +comp_fir_complexe90 : li $a0, 4 --> comp_fir_complexe89 +comp_fir_complexe89 : mulo $a0, $s2, $a0 --> comp_fir_complexe88 +comp_fir_complexe88 : lw $v1, 128($sp) --> comp_fir_complexe295 +comp_fir_complexe295: add $a0, $v1, $a0 --> comp_fir_complexe148 +comp_fir_complexe148: lw $a2, 0($a0) --> comp_fir_complexe87 +comp_fir_complexe87 : move $a1, $sp --> comp_fir_complexe291 +comp_fir_complexe291: j --> comp_fir_complexe86 +comp_fir_complexe86 : li $a0, 4 --> comp_fir_complexe85 +comp_fir_complexe85 : mulo $a0, $v0, $a0 --> comp_fir_complexe84 +comp_fir_complexe84 : add $a0, $a1, $a0 --> comp_fir_complexe147 +comp_fir_complexe147: lw $a2, 0($a0) --> comp_fir_complexe83 +comp_fir_complexe83 : emit c25 --> comp_fir_complexe82 +comp_fir_complexe82 : li $a0, 4 --> comp_fir_complexe81 +comp_fir_complexe81 : mulo $a0, $s2, $a0 --> comp_fir_complexe80 +comp_fir_complexe80 : lw $v1, 132($sp) --> comp_fir_complexe294 +comp_fir_complexe294: add $a0, $v1, $a0 --> comp_fir_complexe146 +comp_fir_complexe146: lw $a2, 0($a0) --> comp_fir_complexe79 +comp_fir_complexe79 : move $a1, $sp --> comp_fir_complexe290 +comp_fir_complexe290: addi $a1, $a1, 64 --> comp_fir_complexe78 +comp_fir_complexe78 : li $a0, 4 --> comp_fir_complexe77 +comp_fir_complexe77 : mulo $a0, $v0, $a0 --> comp_fir_complexe76 +comp_fir_complexe76 : add $a0, $a1, $a0 --> comp_fir_complexe145 +comp_fir_complexe145: lw $a2, 0($a0) --> comp_fir_complexe75 +comp_fir_complexe75 : emit c24 --> comp_fir_complexe74 +comp_fir_complexe74 : emit c23 --> comp_fir_complexe73 +comp_fir_complexe73 : li $s1, 0 --> comp_fir_complexe20 +comp_fir_complexe20 : j --> comp_fir_complexe72 +comp_fir_complexe72 : li $a1, 0 --> comp_fir_complexe71 +comp_fir_complexe71 : emit c22 --> comp_fir_complexe70 +comp_fir_complexe70 : li $a0, 16 --> comp_fir_complexe69 +comp_fir_complexe69 : slt $a0, $s1, $a0 --> comp_fir_complexe68 +comp_fir_complexe68 : j --> comp_fir_complexe143 +comp_fir_complexe143: seq $a0, $a0, $zero --> comp_fir_complexe67 +comp_fir_complexe67 : beq $a0, $a1 --> comp_fir_complexe66, comp_fir_complexe19 +comp_fir_complexe19 : emit c13 --> comp_fir_complexe18 +comp_fir_complexe18 : li $a0, 1 --> comp_fir_complexe17 +comp_fir_complexe17 : add $a0, $v0, $a0 --> comp_fir_complexe16 +comp_fir_complexe16 : li $a1, 16 --> comp_fir_complexe15 +comp_fir_complexe15 : la $v0, mod --> comp_fir_complexe135 +comp_fir_complexe135: j --> comp_fir_complexe283 +comp_fir_complexe283: j --> comp_fir_complexe282 +comp_fir_complexe282: j --> comp_fir_complexe281 +comp_fir_complexe281: call $v0 --> comp_fir_complexe280 +comp_fir_complexe280: j --> comp_fir_complexe14 +comp_fir_complexe14 : emit c12 --> comp_fir_complexe13 +comp_fir_complexe13 : li $a0, 4 --> comp_fir_complexe12 +comp_fir_complexe12 : mulo $a0, $s2, $a0 --> comp_fir_complexe11 +comp_fir_complexe11 : lw $v1, 136($sp) --> comp_fir_complexe292 +comp_fir_complexe292: add $a0, $v1, $a0 --> comp_fir_complexe131 +comp_fir_complexe131: lw $s0, 0($a0) --> comp_fir_complexe10 +comp_fir_complexe10 : emit c11 --> comp_fir_complexe9 +comp_fir_complexe9 : li $a0, 4 --> comp_fir_complexe8 +comp_fir_complexe8 : mulo $a0, $s2, $a0 --> comp_fir_complexe7 +comp_fir_complexe7 : add $a0, $s7, $a0 --> comp_fir_complexe144 +comp_fir_complexe144: lw $s3, 0($a0) --> comp_fir_complexe6 +comp_fir_complexe6 : emit c27 --> comp_fir_complexe5 +comp_fir_complexe5 : li $a0, 1 --> comp_fir_complexe4 +comp_fir_complexe4 : add $s2, $s2, $a0 --> comp_fir_complexe3 +comp_fir_complexe66 : emit c20 --> comp_fir_complexe65 +comp_fir_complexe65 : move $a1, $sp --> comp_fir_complexe289 +comp_fir_complexe289: j --> comp_fir_complexe64 +comp_fir_complexe64 : li $a0, 4 --> comp_fir_complexe63 +comp_fir_complexe63 : mulo $a0, $v0, $a0 --> comp_fir_complexe62 +comp_fir_complexe62 : add $a0, $a1, $a0 --> comp_fir_complexe142 +comp_fir_complexe142: lw $a2, 0($a0) --> comp_fir_complexe61 +comp_fir_complexe61 : emit c19 --> comp_fir_complexe60 +comp_fir_complexe60 : move $a1, $sp --> comp_fir_complexe288 +comp_fir_complexe288: addi $a1, $a1, 64 --> comp_fir_complexe59 +comp_fir_complexe59 : li $a0, 4 --> comp_fir_complexe58 +comp_fir_complexe58 : mulo $a0, $v0, $a0 --> comp_fir_complexe57 +comp_fir_complexe57 : add $a0, $a1, $a0 --> comp_fir_complexe141 +comp_fir_complexe141: lw $a3, 0($a0) --> comp_fir_complexe56 +comp_fir_complexe56 : emit c18 --> comp_fir_complexe55 +comp_fir_complexe55 : li $a0, 4 --> comp_fir_complexe54 +comp_fir_complexe54 : mulo $a0, $s1, $a0 --> comp_fir_complexe53 +comp_fir_complexe53 : add $a0, $s6, $a0 --> comp_fir_complexe140 +comp_fir_complexe140: lw $a0, 0($a0) --> comp_fir_complexe52 +comp_fir_complexe52 : mulo $a1, $a2, $a0 --> comp_fir_complexe51 +comp_fir_complexe51 : li $a0, 4 --> comp_fir_complexe50 +comp_fir_complexe50 : mulo $a0, $s1, $a0 --> comp_fir_complexe49 +comp_fir_complexe49 : add $a0, $s5, $a0 --> comp_fir_complexe139 +comp_fir_complexe139: lw $a0, 0($a0) --> comp_fir_complexe48 +comp_fir_complexe48 : mulo $a0, $a3, $a0 --> comp_fir_complexe47 +comp_fir_complexe47 : sub $a1, $a1, $a0 --> comp_fir_complexe46 +comp_fir_complexe46 : li $a0, 4 --> comp_fir_complexe45 +comp_fir_complexe45 : srav $a1, $a1, $a0 --> comp_fir_complexe44 +comp_fir_complexe44 : emit c17 --> comp_fir_complexe43 +comp_fir_complexe43 : li $a0, 4 --> comp_fir_complexe42 +comp_fir_complexe42 : mulo $a0, $s1, $a0 --> comp_fir_complexe41 +comp_fir_complexe41 : add $a0, $s5, $a0 --> comp_fir_complexe138 +comp_fir_complexe138: lw $a0, 0($a0) --> comp_fir_complexe40 +comp_fir_complexe40 : mulo $a2, $a2, $a0 --> comp_fir_complexe39 +comp_fir_complexe39 : li $a0, 4 --> comp_fir_complexe38 +comp_fir_complexe38 : mulo $a0, $s1, $a0 --> comp_fir_complexe37 +comp_fir_complexe37 : add $a0, $s6, $a0 --> comp_fir_complexe137 +comp_fir_complexe137: lw $a0, 0($a0) --> comp_fir_complexe36 +comp_fir_complexe36 : mulo $a0, $a3, $a0 --> comp_fir_complexe35 +comp_fir_complexe35 : add $a2, $a2, $a0 --> comp_fir_complexe34 +comp_fir_complexe34 : li $a0, 4 --> comp_fir_complexe33 +comp_fir_complexe33 : srav $a0, $a2, $a0 --> comp_fir_complexe32 +comp_fir_complexe32 : emit c16 --> comp_fir_complexe31 +comp_fir_complexe31 : add $s0, $s0, $a1 --> comp_fir_complexe30 +comp_fir_complexe30 : emit c15 --> comp_fir_complexe29 +comp_fir_complexe29 : add $s3, $s3, $a0 --> comp_fir_complexe28 +comp_fir_complexe28 : emit c14 --> comp_fir_complexe27 +comp_fir_complexe27 : li $a0, 1 --> comp_fir_complexe26 +comp_fir_complexe26 : add $a0, $v0, $a0 --> comp_fir_complexe25 +comp_fir_complexe25 : li $a1, 16 --> comp_fir_complexe24 +comp_fir_complexe24 : la $v0, mod --> comp_fir_complexe136 +comp_fir_complexe136: j --> comp_fir_complexe287 +comp_fir_complexe287: j --> comp_fir_complexe286 +comp_fir_complexe286: j --> comp_fir_complexe285 +comp_fir_complexe285: call $v0 --> comp_fir_complexe284 +comp_fir_complexe284: j --> comp_fir_complexe23 +comp_fir_complexe23 : emit c21 --> comp_fir_complexe22 +comp_fir_complexe22 : li $a0, 1 --> comp_fir_complexe21 +comp_fir_complexe21 : add $s1, $s1, $a0 --> comp_fir_complexe20 +comp_fir_complexe121: emit c35 --> comp_fir_complexe120 +comp_fir_complexe120: j --> comp_fir_complexe119 +comp_fir_complexe119: move $a0, $sp --> comp_fir_complexe279 +comp_fir_complexe279: j --> comp_fir_complexe118 +comp_fir_complexe118: li $v0, 4 --> comp_fir_complexe117 +comp_fir_complexe117: mulo $v0, $a1, $v0 --> comp_fir_complexe116 +comp_fir_complexe116: add $v0, $a0, $v0 --> comp_fir_complexe133 +comp_fir_complexe133: lw $zero, 0($v0) --> comp_fir_complexe115 +comp_fir_complexe115: emit c34 --> comp_fir_complexe114 +comp_fir_complexe114: j --> comp_fir_complexe113 +comp_fir_complexe113: move $a0, $sp --> comp_fir_complexe278 +comp_fir_complexe278: addi $a0, $a0, 64 --> comp_fir_complexe112 +comp_fir_complexe112: li $v0, 4 --> comp_fir_complexe111 +comp_fir_complexe111: mulo $v0, $a1, $v0 --> comp_fir_complexe110 +comp_fir_complexe110: add $v0, $a0, $v0 --> comp_fir_complexe132 +comp_fir_complexe132: lw $zero, 0($v0) --> comp_fir_complexe109 +comp_fir_complexe109: emit c36 --> comp_fir_complexe108 +comp_fir_complexe108: li $v0, 1 --> comp_fir_complexe107 +comp_fir_complexe107: add $a1, $a1, $v0 --> comp_fir_complexe106 + +procedure _main(0) +var 4 +entry main36 +main36: newframe --> main35 +main35: lw $ra, 0($sp) --> main34 +main34: j --> main33 +main33: j --> main32 +main32: j --> main31 +main31: j --> main30 +main30: j --> main29 +main29: j --> main28 +main28: j --> main27 +main27: j --> main26 +main26: j --> main25 +main25: j --> main24 +main24: j --> main23 +main23: j --> main22 +main22: j --> main21 +main21: j --> main20 +main20: j --> main19 +main19: j --> main18 +main18: j --> main17 +main17: j --> main16 +main16: j --> main13 +main13: emit c42 --> main12 +main12: la $v0, init --> main14 +main14: j --> main51 +main51: call $v0 --> main50 +main50: j --> main11 +main11: emit c41 --> main10 +main10: move $a0, $gp --> main49 +main49: j --> main9 +main9 : move $a1, $gp --> main65 +main65: addi $a1, $a1, 64 --> main8 +main8 : move $a2, $gp --> main64 +main64: addi $a2, $a2, 128 --> main7 +main7 : move $a3, $gp --> main63 +main63: addi $a3, $a3, 192 --> main6 +main6 : move $v0, $gp --> main62 +main62: addi $v0, $v0, 256 --> main5 +main5 : j --> main61 +main61: addi $gp, $gp, 320 --> main4 +main4 : li $t1, 16 --> main3 +main3 : la $t0, comp_fir_complexe --> main15 +main15: j --> main60 +main60: j --> main59 +main59: j --> main58 +main58: j --> main57 +main57: j --> main56 +main56: lw $v0, -12($sp) --> main55 +main55: lw $gp, -8($sp) --> main54 +main54: lw $t1, -4($sp) --> main53 +main53: call $t0 --> main52 +main52: j --> main2 +main2 : emit c40 --> main1 +main1 : j --> main0 +main0 : j --> main48 +main48: j --> main47 +main47: lw $ra, 0($sp) --> main46 +main46: j --> main45 +main45: j --> main44 +main44: j --> main43 +main43: j --> main42 +main42: j --> main41 +main41: j --> main40 +main40: j --> main39 +main39: j --> main38 +main38: delframe --> main37 +main37: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir_complexe.RTL.expected b/tests/clight/fir_complexe.RTL.expected new file mode 100644 index 0000000..5739cf3 --- /dev/null +++ b/tests/clight/fir_complexe.RTL.expected @@ -0,0 +1,799 @@ +program + +globals 384 + +procedure init() +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30 +entry init87 +init87: li %0, 0 --> init86 +init86: li %1, 0 --> init85 +init85: li %2, 0 --> init84 +init84: li %3, 0 --> init83 +init83: li %4, 0 --> init82 +init82: li %5, 0 --> init81 +init81: li %6, 0 --> init80 +init80: li %7, 0 --> init79 +init79: li %8, 0 --> init78 +init78: li %9, 0 --> init77 +init77: li %10, 0 --> init76 +init76: li %11, 0 --> init75 +init75: li %12, 0 --> init74 +init74: li %13, 0 --> init73 +init73: li %14, 0 --> init72 +init72: li %15, 0 --> init71 +init71: li %16, 0 --> init70 +init70: li %17, 0 --> init69 +init69: li %18, 0 --> init68 +init68: li %19, 0 --> init67 +init67: li %20, 0 --> init66 +init66: li %21, 0 --> init65 +init65: li %22, 0 --> init64 +init64: li %23, 0 --> init63 +init63: li %24, 0 --> init62 +init62: li %25, 0 --> init61 +init61: li %26, 0 --> init60 +init60: li %27, 0 --> init59 +init59: li %28, 0 --> init58 +init58: li %29, 0 --> init57 +init57: li %30, 0 --> init43 +init43: emit c9 --> init42 +init42: emit c8 --> init41 +init41: li %0, 0 --> init1 +init1 : j --> init40 +init40: li %21, 0 --> init39 +init39: emit c7 --> init38 +init38: li %23, 16 --> init37 +init37: slt %22, %0, %23 --> init36 +init36: li %29, 0 --> init54 +init54: seq %20, %22, %29 --> init35 +init35: beq %20, %21 --> init34, init0 +init0 : return +init34: emit c5 --> init33 +init33: li %17, 2 --> init32 +init32: li %19, 4 --> init31 +init31: mulo %18, %0, %19 --> init30 +init30: addi %28, GLOBALS, 0 --> init53 +init53: add %28, %28, %18 --> init52 +init52: sw %17, 0(%28) --> init29 +init29: emit c4 --> init28 +init28: li %14, 2 --> init27 +init27: li %16, 4 --> init26 +init26: mulo %15, %0, %16 --> init25 +init25: addi %27, GLOBALS, 0 --> init51 +init51: add %27, %27, %15 --> init50 +init50: sw %14, 64(%27) --> init24 +init24: emit c3 --> init23 +init23: li %11, 2 --> init22 +init22: li %13, 4 --> init21 +init21: mulo %12, %0, %13 --> init20 +init20: addi %26, GLOBALS, 0 --> init49 +init49: add %26, %26, %12 --> init48 +init48: sw %11, 128(%26) --> init19 +init19: emit c2 --> init18 +init18: li %8, 2 --> init17 +init17: li %10, 4 --> init16 +init16: mulo %9, %0, %10 --> init15 +init15: addi %25, GLOBALS, 0 --> init47 +init47: add %25, %25, %9 --> init46 +init46: sw %8, 192(%25) --> init14 +init14: emit c1 --> init13 +init13: li %5, 2 --> init12 +init12: li %7, 4 --> init11 +init11: mulo %6, %0, %7 --> init10 +init10: addi %24, GLOBALS, 0 --> init45 +init45: add %24, %24, %6 --> init44 +init44: sw %5, 256(%24) --> init9 +init9 : emit c0 --> init8 +init8 : li %2, 2 --> init7 +init7 : li %4, 4 --> init6 +init6 : mulo %3, %0, %4 --> init5 +init5 : addi %30, GLOBALS, 0 --> init56 +init56: add %30, %30, %3 --> init55 +init55: sw %2, 320(%30) --> init4 +init4 : emit c6 --> init3 +init3 : li %1, 1 --> init2 +init2 : add %0, %0, %1 --> init1 + +function comp_fir_complexe(%0; %1; %2; %3; %4; %5; %6) : %17 +stacksize 128 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87, %88, %89, %90, + %91, %92, %93, %94, %95, %96, %97, + %98, %99, %100, %101, %102, %103, %104, + %105, %106 +entry comp_fir_complexe248 +comp_fir_complexe248: li %7, 0 --> comp_fir_complexe247 +comp_fir_complexe247: li %8, 0 --> comp_fir_complexe246 +comp_fir_complexe246: li %9, 0 --> comp_fir_complexe245 +comp_fir_complexe245: li %10, 0 --> comp_fir_complexe244 +comp_fir_complexe244: li %11, 0 --> comp_fir_complexe243 +comp_fir_complexe243: li %12, 0 --> comp_fir_complexe242 +comp_fir_complexe242: li %13, 0 --> comp_fir_complexe241 +comp_fir_complexe241: li %14, 0 --> comp_fir_complexe240 +comp_fir_complexe240: li %15, 0 --> comp_fir_complexe239 +comp_fir_complexe239: li %16, 0 --> comp_fir_complexe238 +comp_fir_complexe238: li %18, 0 --> comp_fir_complexe237 +comp_fir_complexe237: li %19, 0 --> comp_fir_complexe236 +comp_fir_complexe236: li %20, 0 --> comp_fir_complexe235 +comp_fir_complexe235: li %21, 0 --> comp_fir_complexe234 +comp_fir_complexe234: li %22, 0 --> comp_fir_complexe233 +comp_fir_complexe233: li %23, 0 --> comp_fir_complexe232 +comp_fir_complexe232: li %24, 0 --> comp_fir_complexe231 +comp_fir_complexe231: li %25, 0 --> comp_fir_complexe230 +comp_fir_complexe230: li %26, 0 --> comp_fir_complexe229 +comp_fir_complexe229: li %27, 0 --> comp_fir_complexe228 +comp_fir_complexe228: li %28, 0 --> comp_fir_complexe227 +comp_fir_complexe227: li %29, 0 --> comp_fir_complexe226 +comp_fir_complexe226: li %30, 0 --> comp_fir_complexe225 +comp_fir_complexe225: li %31, 0 --> comp_fir_complexe224 +comp_fir_complexe224: li %32, 0 --> comp_fir_complexe223 +comp_fir_complexe223: li %33, 0 --> comp_fir_complexe222 +comp_fir_complexe222: li %34, 0 --> comp_fir_complexe221 +comp_fir_complexe221: li %35, 0 --> comp_fir_complexe220 +comp_fir_complexe220: li %36, 0 --> comp_fir_complexe219 +comp_fir_complexe219: li %37, 0 --> comp_fir_complexe218 +comp_fir_complexe218: li %38, 0 --> comp_fir_complexe217 +comp_fir_complexe217: li %39, 0 --> comp_fir_complexe216 +comp_fir_complexe216: li %40, 0 --> comp_fir_complexe215 +comp_fir_complexe215: li %41, 0 --> comp_fir_complexe214 +comp_fir_complexe214: li %42, 0 --> comp_fir_complexe213 +comp_fir_complexe213: li %43, 0 --> comp_fir_complexe212 +comp_fir_complexe212: li %44, 0 --> comp_fir_complexe211 +comp_fir_complexe211: li %45, 0 --> comp_fir_complexe210 +comp_fir_complexe210: li %46, 0 --> comp_fir_complexe209 +comp_fir_complexe209: li %47, 0 --> comp_fir_complexe208 +comp_fir_complexe208: li %48, 0 --> comp_fir_complexe207 +comp_fir_complexe207: li %49, 0 --> comp_fir_complexe206 +comp_fir_complexe206: li %50, 0 --> comp_fir_complexe205 +comp_fir_complexe205: li %51, 0 --> comp_fir_complexe204 +comp_fir_complexe204: li %52, 0 --> comp_fir_complexe203 +comp_fir_complexe203: li %53, 0 --> comp_fir_complexe202 +comp_fir_complexe202: li %54, 0 --> comp_fir_complexe201 +comp_fir_complexe201: li %55, 0 --> comp_fir_complexe200 +comp_fir_complexe200: li %56, 0 --> comp_fir_complexe199 +comp_fir_complexe199: li %57, 0 --> comp_fir_complexe198 +comp_fir_complexe198: li %58, 0 --> comp_fir_complexe197 +comp_fir_complexe197: li %59, 0 --> comp_fir_complexe196 +comp_fir_complexe196: li %60, 0 --> comp_fir_complexe195 +comp_fir_complexe195: li %61, 0 --> comp_fir_complexe194 +comp_fir_complexe194: li %62, 0 --> comp_fir_complexe193 +comp_fir_complexe193: li %63, 0 --> comp_fir_complexe192 +comp_fir_complexe192: li %64, 0 --> comp_fir_complexe191 +comp_fir_complexe191: li %65, 0 --> comp_fir_complexe190 +comp_fir_complexe190: li %66, 0 --> comp_fir_complexe189 +comp_fir_complexe189: li %67, 0 --> comp_fir_complexe188 +comp_fir_complexe188: li %68, 0 --> comp_fir_complexe187 +comp_fir_complexe187: li %69, 0 --> comp_fir_complexe186 +comp_fir_complexe186: li %70, 0 --> comp_fir_complexe185 +comp_fir_complexe185: li %71, 0 --> comp_fir_complexe184 +comp_fir_complexe184: li %72, 0 --> comp_fir_complexe183 +comp_fir_complexe183: li %73, 0 --> comp_fir_complexe182 +comp_fir_complexe182: li %74, 0 --> comp_fir_complexe181 +comp_fir_complexe181: li %75, 0 --> comp_fir_complexe180 +comp_fir_complexe180: li %76, 0 --> comp_fir_complexe179 +comp_fir_complexe179: li %77, 0 --> comp_fir_complexe178 +comp_fir_complexe178: li %78, 0 --> comp_fir_complexe177 +comp_fir_complexe177: li %79, 0 --> comp_fir_complexe176 +comp_fir_complexe176: li %80, 0 --> comp_fir_complexe175 +comp_fir_complexe175: li %81, 0 --> comp_fir_complexe174 +comp_fir_complexe174: li %82, 0 --> comp_fir_complexe173 +comp_fir_complexe173: li %83, 0 --> comp_fir_complexe172 +comp_fir_complexe172: li %84, 0 --> comp_fir_complexe171 +comp_fir_complexe171: li %85, 0 --> comp_fir_complexe170 +comp_fir_complexe170: li %86, 0 --> comp_fir_complexe169 +comp_fir_complexe169: li %87, 0 --> comp_fir_complexe168 +comp_fir_complexe168: li %88, 0 --> comp_fir_complexe167 +comp_fir_complexe167: li %89, 0 --> comp_fir_complexe166 +comp_fir_complexe166: li %90, 0 --> comp_fir_complexe165 +comp_fir_complexe165: li %91, 0 --> comp_fir_complexe164 +comp_fir_complexe164: li %92, 0 --> comp_fir_complexe163 +comp_fir_complexe163: li %93, 0 --> comp_fir_complexe162 +comp_fir_complexe162: li %94, 0 --> comp_fir_complexe161 +comp_fir_complexe161: li %95, 0 --> comp_fir_complexe160 +comp_fir_complexe160: li %96, 0 --> comp_fir_complexe159 +comp_fir_complexe159: li %97, 0 --> comp_fir_complexe158 +comp_fir_complexe158: li %98, 0 --> comp_fir_complexe157 +comp_fir_complexe157: li %99, 0 --> comp_fir_complexe156 +comp_fir_complexe156: li %100, 0 --> comp_fir_complexe155 +comp_fir_complexe155: li %101, 0 --> comp_fir_complexe154 +comp_fir_complexe154: li %102, 0 --> comp_fir_complexe153 +comp_fir_complexe153: li %103, 0 --> comp_fir_complexe152 +comp_fir_complexe152: li %104, 0 --> comp_fir_complexe151 +comp_fir_complexe151: li %105, 0 --> comp_fir_complexe150 +comp_fir_complexe150: li %106, 0 --> comp_fir_complexe130 +comp_fir_complexe130: emit c39 --> comp_fir_complexe129 +comp_fir_complexe129: emit c38 --> comp_fir_complexe128 +comp_fir_complexe128: li %8, 0 --> comp_fir_complexe106 +comp_fir_complexe106: j --> comp_fir_complexe127 +comp_fir_complexe127: li %85, 0 --> comp_fir_complexe126 +comp_fir_complexe126: emit c37 --> comp_fir_complexe125 +comp_fir_complexe125: li %87, 16 --> comp_fir_complexe124 +comp_fir_complexe124: slt %86, %8, %87 --> comp_fir_complexe123 +comp_fir_complexe123: li %91, 0 --> comp_fir_complexe134 +comp_fir_complexe134: seq %84, %86, %91 --> comp_fir_complexe122 +comp_fir_complexe122: beq %84, %85 --> comp_fir_complexe121, comp_fir_complexe105 +comp_fir_complexe105: emit c33 --> comp_fir_complexe104 +comp_fir_complexe104: li %16, 0 --> comp_fir_complexe103 +comp_fir_complexe103: emit c32 --> comp_fir_complexe102 +comp_fir_complexe102: li %13, 0 --> comp_fir_complexe101 +comp_fir_complexe101: emit c31 --> comp_fir_complexe100 +comp_fir_complexe100: li %7, 0 --> comp_fir_complexe99 +comp_fir_complexe99 : emit c30 --> comp_fir_complexe98 +comp_fir_complexe98 : emit c29 --> comp_fir_complexe97 +comp_fir_complexe97 : li %11, 0 --> comp_fir_complexe3 +comp_fir_complexe3 : j --> comp_fir_complexe96 +comp_fir_complexe96 : li %73, 0 --> comp_fir_complexe95 +comp_fir_complexe95 : emit c28 --> comp_fir_complexe94 +comp_fir_complexe94 : slt %74, %11, %6 --> comp_fir_complexe93 +comp_fir_complexe93 : li %106, 0 --> comp_fir_complexe149 +comp_fir_complexe149: seq %72, %74, %106 --> comp_fir_complexe92 +comp_fir_complexe92 : beq %72, %73 --> comp_fir_complexe91, comp_fir_complexe2 +comp_fir_complexe2 : emit c10 --> comp_fir_complexe1 +comp_fir_complexe1 : li %17, 0 --> comp_fir_complexe0 +comp_fir_complexe0 : return %17 +comp_fir_complexe91 : emit c26 --> comp_fir_complexe90 +comp_fir_complexe90 : li %71, 4 --> comp_fir_complexe89 +comp_fir_complexe89 : mulo %70, %11, %71 --> comp_fir_complexe88 +comp_fir_complexe88 : add %105, %0, %70 --> comp_fir_complexe148 +comp_fir_complexe148: lw %66, 0(%105) --> comp_fir_complexe87 +comp_fir_complexe87 : addi %67, STACK, 0 --> comp_fir_complexe86 +comp_fir_complexe86 : li %69, 4 --> comp_fir_complexe85 +comp_fir_complexe85 : mulo %68, %16, %69 --> comp_fir_complexe84 +comp_fir_complexe84 : add %104, %67, %68 --> comp_fir_complexe147 +comp_fir_complexe147: sw %66, 0(%104) --> comp_fir_complexe83 +comp_fir_complexe83 : emit c25 --> comp_fir_complexe82 +comp_fir_complexe82 : li %65, 4 --> comp_fir_complexe81 +comp_fir_complexe81 : mulo %64, %11, %65 --> comp_fir_complexe80 +comp_fir_complexe80 : add %103, %1, %64 --> comp_fir_complexe146 +comp_fir_complexe146: lw %60, 0(%103) --> comp_fir_complexe79 +comp_fir_complexe79 : addi %61, STACK, 64 --> comp_fir_complexe78 +comp_fir_complexe78 : li %63, 4 --> comp_fir_complexe77 +comp_fir_complexe77 : mulo %62, %16, %63 --> comp_fir_complexe76 +comp_fir_complexe76 : add %102, %61, %62 --> comp_fir_complexe145 +comp_fir_complexe145: sw %60, 0(%102) --> comp_fir_complexe75 +comp_fir_complexe75 : emit c24 --> comp_fir_complexe74 +comp_fir_complexe74 : emit c23 --> comp_fir_complexe73 +comp_fir_complexe73 : li %12, 0 --> comp_fir_complexe20 +comp_fir_complexe20 : j --> comp_fir_complexe72 +comp_fir_complexe72 : li %57, 0 --> comp_fir_complexe71 +comp_fir_complexe71 : emit c22 --> comp_fir_complexe70 +comp_fir_complexe70 : li %59, 16 --> comp_fir_complexe69 +comp_fir_complexe69 : slt %58, %12, %59 --> comp_fir_complexe68 +comp_fir_complexe68 : li %100, 0 --> comp_fir_complexe143 +comp_fir_complexe143: seq %56, %58, %100 --> comp_fir_complexe67 +comp_fir_complexe67 : beq %56, %57 --> comp_fir_complexe66, comp_fir_complexe19 +comp_fir_complexe19 : emit c13 --> comp_fir_complexe18 +comp_fir_complexe18 : li %25, 1 --> comp_fir_complexe17 +comp_fir_complexe17 : add %23, %16, %25 --> comp_fir_complexe16 +comp_fir_complexe16 : li %24, 16 --> comp_fir_complexe15 +comp_fir_complexe15 : la %92, mod --> comp_fir_complexe135 +comp_fir_complexe135: call %16, %92(%23, %24) --> comp_fir_complexe14 +comp_fir_complexe14 : emit c12 --> comp_fir_complexe13 +comp_fir_complexe13 : li %22, 4 --> comp_fir_complexe12 +comp_fir_complexe12 : mulo %21, %11, %22 --> comp_fir_complexe11 +comp_fir_complexe11 : add %88, %4, %21 --> comp_fir_complexe131 +comp_fir_complexe131: sw %13, 0(%88) --> comp_fir_complexe10 +comp_fir_complexe10 : emit c11 --> comp_fir_complexe9 +comp_fir_complexe9 : li %20, 4 --> comp_fir_complexe8 +comp_fir_complexe8 : mulo %19, %11, %20 --> comp_fir_complexe7 +comp_fir_complexe7 : add %101, %5, %19 --> comp_fir_complexe144 +comp_fir_complexe144: sw %7, 0(%101) --> comp_fir_complexe6 +comp_fir_complexe6 : emit c27 --> comp_fir_complexe5 +comp_fir_complexe5 : li %18, 1 --> comp_fir_complexe4 +comp_fir_complexe4 : add %11, %11, %18 --> comp_fir_complexe3 +comp_fir_complexe66 : emit c20 --> comp_fir_complexe65 +comp_fir_complexe65 : addi %53, STACK, 0 --> comp_fir_complexe64 +comp_fir_complexe64 : li %55, 4 --> comp_fir_complexe63 +comp_fir_complexe63 : mulo %54, %16, %55 --> comp_fir_complexe62 +comp_fir_complexe62 : add %99, %53, %54 --> comp_fir_complexe142 +comp_fir_complexe142: lw %15, 0(%99) --> comp_fir_complexe61 +comp_fir_complexe61 : emit c19 --> comp_fir_complexe60 +comp_fir_complexe60 : addi %50, STACK, 64 --> comp_fir_complexe59 +comp_fir_complexe59 : li %52, 4 --> comp_fir_complexe58 +comp_fir_complexe58 : mulo %51, %16, %52 --> comp_fir_complexe57 +comp_fir_complexe57 : add %98, %50, %51 --> comp_fir_complexe141 +comp_fir_complexe141: lw %9, 0(%98) --> comp_fir_complexe56 +comp_fir_complexe56 : emit c18 --> comp_fir_complexe55 +comp_fir_complexe55 : li %49, 4 --> comp_fir_complexe54 +comp_fir_complexe54 : mulo %48, %12, %49 --> comp_fir_complexe53 +comp_fir_complexe53 : add %97, %2, %48 --> comp_fir_complexe140 +comp_fir_complexe140: lw %47, 0(%97) --> comp_fir_complexe52 +comp_fir_complexe52 : mulo %42, %15, %47 --> comp_fir_complexe51 +comp_fir_complexe51 : li %46, 4 --> comp_fir_complexe50 +comp_fir_complexe50 : mulo %45, %12, %46 --> comp_fir_complexe49 +comp_fir_complexe49 : add %96, %3, %45 --> comp_fir_complexe139 +comp_fir_complexe139: lw %44, 0(%96) --> comp_fir_complexe48 +comp_fir_complexe48 : mulo %43, %9, %44 --> comp_fir_complexe47 +comp_fir_complexe47 : sub %40, %42, %43 --> comp_fir_complexe46 +comp_fir_complexe46 : li %41, 4 --> comp_fir_complexe45 +comp_fir_complexe45 : srav %10, %40, %41 --> comp_fir_complexe44 +comp_fir_complexe44 : emit c17 --> comp_fir_complexe43 +comp_fir_complexe43 : li %39, 4 --> comp_fir_complexe42 +comp_fir_complexe42 : mulo %38, %12, %39 --> comp_fir_complexe41 +comp_fir_complexe41 : add %95, %3, %38 --> comp_fir_complexe138 +comp_fir_complexe138: lw %37, 0(%95) --> comp_fir_complexe40 +comp_fir_complexe40 : mulo %32, %15, %37 --> comp_fir_complexe39 +comp_fir_complexe39 : li %36, 4 --> comp_fir_complexe38 +comp_fir_complexe38 : mulo %35, %12, %36 --> comp_fir_complexe37 +comp_fir_complexe37 : add %94, %2, %35 --> comp_fir_complexe137 +comp_fir_complexe137: lw %34, 0(%94) --> comp_fir_complexe36 +comp_fir_complexe36 : mulo %33, %9, %34 --> comp_fir_complexe35 +comp_fir_complexe35 : add %30, %32, %33 --> comp_fir_complexe34 +comp_fir_complexe34 : li %31, 4 --> comp_fir_complexe33 +comp_fir_complexe33 : srav %14, %30, %31 --> comp_fir_complexe32 +comp_fir_complexe32 : emit c16 --> comp_fir_complexe31 +comp_fir_complexe31 : add %13, %13, %10 --> comp_fir_complexe30 +comp_fir_complexe30 : emit c15 --> comp_fir_complexe29 +comp_fir_complexe29 : add %7, %7, %14 --> comp_fir_complexe28 +comp_fir_complexe28 : emit c14 --> comp_fir_complexe27 +comp_fir_complexe27 : li %29, 1 --> comp_fir_complexe26 +comp_fir_complexe26 : add %27, %16, %29 --> comp_fir_complexe25 +comp_fir_complexe25 : li %28, 16 --> comp_fir_complexe24 +comp_fir_complexe24 : la %93, mod --> comp_fir_complexe136 +comp_fir_complexe136: call %16, %93(%27, %28) --> comp_fir_complexe23 +comp_fir_complexe23 : emit c21 --> comp_fir_complexe22 +comp_fir_complexe22 : li %26, 1 --> comp_fir_complexe21 +comp_fir_complexe21 : add %12, %12, %26 --> comp_fir_complexe20 +comp_fir_complexe121: emit c35 --> comp_fir_complexe120 +comp_fir_complexe120: li %80, 0 --> comp_fir_complexe119 +comp_fir_complexe119: addi %81, STACK, 0 --> comp_fir_complexe118 +comp_fir_complexe118: li %83, 4 --> comp_fir_complexe117 +comp_fir_complexe117: mulo %82, %8, %83 --> comp_fir_complexe116 +comp_fir_complexe116: add %90, %81, %82 --> comp_fir_complexe133 +comp_fir_complexe133: sw %80, 0(%90) --> comp_fir_complexe115 +comp_fir_complexe115: emit c34 --> comp_fir_complexe114 +comp_fir_complexe114: li %76, 0 --> comp_fir_complexe113 +comp_fir_complexe113: addi %77, STACK, 64 --> comp_fir_complexe112 +comp_fir_complexe112: li %79, 4 --> comp_fir_complexe111 +comp_fir_complexe111: mulo %78, %8, %79 --> comp_fir_complexe110 +comp_fir_complexe110: add %89, %77, %78 --> comp_fir_complexe132 +comp_fir_complexe132: sw %76, 0(%89) --> comp_fir_complexe109 +comp_fir_complexe109: emit c36 --> comp_fir_complexe108 +comp_fir_complexe108: li %75, 1 --> comp_fir_complexe107 +comp_fir_complexe107: add %8, %8, %75 --> comp_fir_complexe106 + +function _main() : %1 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11 +entry main26 +main26: li %0, 0 --> main25 +main25: li %2, 0 --> main24 +main24: li %3, 0 --> main23 +main23: li %4, 0 --> main22 +main22: li %5, 0 --> main21 +main21: li %6, 0 --> main20 +main20: li %7, 0 --> main19 +main19: li %8, 0 --> main18 +main18: li %9, 0 --> main17 +main17: li %10, 0 --> main16 +main16: li %11, 0 --> main13 +main13: emit c42 --> main12 +main12: la %10, init --> main14 +main14: call %9, %10() --> main11 +main11: emit c41 --> main10 +main10: addi %2, GLOBALS, 0 --> main9 +main9 : addi %3, GLOBALS, 64 --> main8 +main8 : addi %4, GLOBALS, 128 --> main7 +main7 : addi %5, GLOBALS, 192 --> main6 +main6 : addi %6, GLOBALS, 256 --> main5 +main5 : addi %7, GLOBALS, 320 --> main4 +main4 : li %8, 16 --> main3 +main3 : la %11, comp_fir_complexe --> main15 +main15: call %0, %11(%2, %3, %4, %5, %6, %7, %8) --> main2 +main2 : emit c40 --> main1 +main1 : move %1, %0 --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/fir_complexe.RTLabs.expected b/tests/clight/fir_complexe.RTLabs.expected new file mode 100644 index 0000000..7182483 --- /dev/null +++ b/tests/clight/fir_complexe.RTLabs.expected @@ -0,0 +1,623 @@ +program: (main function is "main") + + + globals: + "t1" = {[64]} + "t2" = {[64]} + "t3" = {[64]} + "t4" = {[64]} + "t5" = {[64]} + "t6" = {[64]} + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "init"(): void + locals: %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23 + stacksize: 0 + entry: init43 + exit: init0 + + init9: emit c0 --> init8 + init8: imm_int 2, %2, --> init7 + init7: imm_int 4, %4, --> init6 + init6: mul %3, %0, %4 --> init5 + init5: store int32, add, 0("t6"), %3, %2 --> init4 + init43: emit c9 --> init42 + init42: emit c8 --> init41 + init41: imm_int 0, %0, --> init1 + init40: imm_int 0, %21, --> init39 + init4: emit c6 --> init3 + init39: emit c7 --> init38 + init38: imm_int 16, %23, --> init37 + init37: lt %22, %0, %23 --> init36 + init36: notbool %20, %22 --> init35 + init35: eq %20, %21 --> init34, init0 + init34: emit c5 --> init33 + init33: imm_int 2, %17, --> init32 + init32: imm_int 4, %19, --> init31 + init31: mul %18, %0, %19 --> init30 + init30: store int32, add, 0("t1"), %18, %17 --> init29 + init3: imm_int 1, %1, --> init2 + init29: emit c4 --> init28 + init28: imm_int 2, %14, --> init27 + init27: imm_int 4, %16, --> init26 + init26: mul %15, %0, %16 --> init25 + init25: store int32, add, 0("t2"), %15, %14 --> init24 + init24: emit c3 --> init23 + init23: imm_int 2, %11, --> init22 + init22: imm_int 4, %13, --> init21 + init21: mul %12, %0, %13 --> init20 + init20: store int32, add, 0("t3"), %12, %11 --> init19 + init2: add %0, %0, %1 --> init1 + init19: emit c2 --> init18 + init18: imm_int 2, %8, --> init17 + init17: imm_int 4, %10, --> init16 + init16: mul %9, %0, %10 --> init15 + init15: store int32, add, 0("t4"), %9, %8 --> init14 + init14: emit c1 --> init13 + init13: imm_int 2, %5, --> init12 + init12: imm_int 4, %7, --> init11 + init11: mul %6, %0, %7 --> init10 + init10: store int32, add, 0("t5"), %6, %5 --> init9 + init1: --> init40 + init0: return + + + "comp_fir_complexe"(%0, %1, %2, %3, %4, %5, %6): int -> int -> int -> int -> int -> int -> int -> int + locals: %17, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75, %76, %77, %78, %79, %80, %81, %82, %83, %84, %85, %86, %87 + result: %17 + stacksize: 128 + entry: comp_fir_complexe130 + exit: comp_fir_complexe0 + + comp_fir_complexe99: emit c30 --> comp_fir_complexe98 + comp_fir_complexe98: emit c29 --> comp_fir_complexe97 + comp_fir_complexe97: imm_int 0, %11, --> comp_fir_complexe3 + comp_fir_complexe96: imm_int 0, %73, --> comp_fir_complexe95 + comp_fir_complexe95: emit c28 --> comp_fir_complexe94 + comp_fir_complexe94: lt %74, %11, %6 --> comp_fir_complexe93 + comp_fir_complexe93: notbool %72, %74 --> comp_fir_complexe92 + comp_fir_complexe92: eq %72, %73 --> comp_fir_complexe91, comp_fir_complexe2 + comp_fir_complexe91: emit c26 --> comp_fir_complexe90 + comp_fir_complexe90: imm_int 4, %71, --> comp_fir_complexe89 + comp_fir_complexe9: imm_int 4, %20, --> comp_fir_complexe8 + comp_fir_complexe89: mul %70, %11, %71 --> comp_fir_complexe88 + comp_fir_complexe88: load int32, add, %0, %70, %66 --> comp_fir_complexe87 + comp_fir_complexe87: imm_addr 0($sp), %67, --> comp_fir_complexe86 + comp_fir_complexe86: imm_int 4, %69, --> comp_fir_complexe85 + comp_fir_complexe85: mul %68, %16, %69 --> comp_fir_complexe84 + comp_fir_complexe84: store int32, add, %67, %68, %66 --> comp_fir_complexe83 + comp_fir_complexe83: emit c25 --> comp_fir_complexe82 + comp_fir_complexe82: imm_int 4, %65, --> comp_fir_complexe81 + comp_fir_complexe81: mul %64, %11, %65 --> comp_fir_complexe80 + comp_fir_complexe80: load int32, add, %1, %64, %60 --> comp_fir_complexe79 + comp_fir_complexe8: mul %19, %11, %20 --> comp_fir_complexe7 + comp_fir_complexe79: imm_addr 64($sp), %61, --> comp_fir_complexe78 + comp_fir_complexe78: imm_int 4, %63, --> comp_fir_complexe77 + comp_fir_complexe77: mul %62, %16, %63 --> comp_fir_complexe76 + comp_fir_complexe76: store int32, add, %61, %62, %60 --> comp_fir_complexe75 + comp_fir_complexe75: emit c24 --> comp_fir_complexe74 + comp_fir_complexe74: emit c23 --> comp_fir_complexe73 + comp_fir_complexe73: imm_int 0, %12, --> comp_fir_complexe20 + comp_fir_complexe72: imm_int 0, %57, --> comp_fir_complexe71 + comp_fir_complexe71: emit c22 --> comp_fir_complexe70 + comp_fir_complexe70: imm_int 16, %59, --> comp_fir_complexe69 + comp_fir_complexe7: store int32, add, %5, %19, %7 --> comp_fir_complexe6 + comp_fir_complexe69: lt %58, %12, %59 --> comp_fir_complexe68 + comp_fir_complexe68: notbool %56, %58 --> comp_fir_complexe67 + comp_fir_complexe67: eq %56, %57 --> comp_fir_complexe66, comp_fir_complexe19 + comp_fir_complexe66: emit c20 --> comp_fir_complexe65 + comp_fir_complexe65: imm_addr 0($sp), %53, --> comp_fir_complexe64 + comp_fir_complexe64: imm_int 4, %55, --> comp_fir_complexe63 + comp_fir_complexe63: mul %54, %16, %55 --> comp_fir_complexe62 + comp_fir_complexe62: load int32, add, %53, %54, %15 --> comp_fir_complexe61 + comp_fir_complexe61: emit c19 --> comp_fir_complexe60 + comp_fir_complexe60: imm_addr 64($sp), %50, --> comp_fir_complexe59 + comp_fir_complexe6: emit c27 --> comp_fir_complexe5 + comp_fir_complexe59: imm_int 4, %52, --> comp_fir_complexe58 + comp_fir_complexe58: mul %51, %16, %52 --> comp_fir_complexe57 + comp_fir_complexe57: load int32, add, %50, %51, %9 --> comp_fir_complexe56 + comp_fir_complexe56: emit c18 --> comp_fir_complexe55 + comp_fir_complexe55: imm_int 4, %49, --> comp_fir_complexe54 + comp_fir_complexe54: mul %48, %12, %49 --> comp_fir_complexe53 + comp_fir_complexe53: load int32, add, %2, %48, %47 --> comp_fir_complexe52 + comp_fir_complexe52: mul %42, %15, %47 --> comp_fir_complexe51 + comp_fir_complexe51: imm_int 4, %46, --> comp_fir_complexe50 + comp_fir_complexe50: mul %45, %12, %46 --> comp_fir_complexe49 + comp_fir_complexe5: imm_int 1, %18, --> comp_fir_complexe4 + comp_fir_complexe49: load int32, add, %3, %45, %44 --> comp_fir_complexe48 + comp_fir_complexe48: mul %43, %9, %44 --> comp_fir_complexe47 + comp_fir_complexe47: sub %40, %42, %43 --> comp_fir_complexe46 + comp_fir_complexe46: imm_int 4, %41, --> comp_fir_complexe45 + comp_fir_complexe45: shr %10, %40, %41 --> comp_fir_complexe44 + comp_fir_complexe44: emit c17 --> comp_fir_complexe43 + comp_fir_complexe43: imm_int 4, %39, --> comp_fir_complexe42 + comp_fir_complexe42: mul %38, %12, %39 --> comp_fir_complexe41 + comp_fir_complexe41: load int32, add, %3, %38, %37 --> comp_fir_complexe40 + comp_fir_complexe40: mul %32, %15, %37 --> comp_fir_complexe39 + comp_fir_complexe4: add %11, %11, %18 --> comp_fir_complexe3 + comp_fir_complexe39: imm_int 4, %36, --> comp_fir_complexe38 + comp_fir_complexe38: mul %35, %12, %36 --> comp_fir_complexe37 + comp_fir_complexe37: load int32, add, %2, %35, %34 --> comp_fir_complexe36 + comp_fir_complexe36: mul %33, %9, %34 --> comp_fir_complexe35 + comp_fir_complexe35: add %30, %32, %33 --> comp_fir_complexe34 + comp_fir_complexe34: imm_int 4, %31, --> comp_fir_complexe33 + comp_fir_complexe33: shr %14, %30, %31 --> comp_fir_complexe32 + comp_fir_complexe32: emit c16 --> comp_fir_complexe31 + comp_fir_complexe31: add %13, %13, %10 --> comp_fir_complexe30 + comp_fir_complexe30: emit c15 --> comp_fir_complexe29 + comp_fir_complexe3: --> comp_fir_complexe96 + comp_fir_complexe29: add %7, %7, %14 --> comp_fir_complexe28 + comp_fir_complexe28: emit c14 --> comp_fir_complexe27 + comp_fir_complexe27: imm_int 1, %29, --> comp_fir_complexe26 + comp_fir_complexe26: add %27, %16, %29 --> comp_fir_complexe25 + comp_fir_complexe25: imm_int 16, %28, --> comp_fir_complexe24 + comp_fir_complexe24: mod %16, %27, %28 --> comp_fir_complexe23 + comp_fir_complexe23: emit c21 --> comp_fir_complexe22 + comp_fir_complexe22: imm_int 1, %26, --> comp_fir_complexe21 + comp_fir_complexe21: add %12, %12, %26 --> comp_fir_complexe20 + comp_fir_complexe20: --> comp_fir_complexe72 + comp_fir_complexe2: emit c10 --> comp_fir_complexe1 + comp_fir_complexe19: emit c13 --> comp_fir_complexe18 + comp_fir_complexe18: imm_int 1, %25, --> comp_fir_complexe17 + comp_fir_complexe17: add %23, %16, %25 --> comp_fir_complexe16 + comp_fir_complexe16: imm_int 16, %24, --> comp_fir_complexe15 + comp_fir_complexe15: mod %16, %23, %24 --> comp_fir_complexe14 + comp_fir_complexe14: emit c12 --> comp_fir_complexe13 + comp_fir_complexe130: emit c39 --> comp_fir_complexe129 + comp_fir_complexe13: imm_int 4, %22, --> comp_fir_complexe12 + comp_fir_complexe129: emit c38 --> comp_fir_complexe128 + comp_fir_complexe128: imm_int 0, %8, --> comp_fir_complexe106 + comp_fir_complexe127: imm_int 0, %85, --> comp_fir_complexe126 + comp_fir_complexe126: emit c37 --> comp_fir_complexe125 + comp_fir_complexe125: imm_int 16, %87, --> comp_fir_complexe124 + comp_fir_complexe124: lt %86, %8, %87 --> comp_fir_complexe123 + comp_fir_complexe123: notbool %84, %86 --> comp_fir_complexe122 + comp_fir_complexe122: eq %84, %85 --> comp_fir_complexe121, comp_fir_complexe105 + comp_fir_complexe121: emit c35 --> comp_fir_complexe120 + comp_fir_complexe120: imm_int 0, %80, --> comp_fir_complexe119 + comp_fir_complexe12: mul %21, %11, %22 --> comp_fir_complexe11 + comp_fir_complexe119: imm_addr 0($sp), %81, --> comp_fir_complexe118 + comp_fir_complexe118: imm_int 4, %83, --> comp_fir_complexe117 + comp_fir_complexe117: mul %82, %8, %83 --> comp_fir_complexe116 + comp_fir_complexe116: store int32, add, %81, %82, %80 --> comp_fir_complexe115 + comp_fir_complexe115: emit c34 --> comp_fir_complexe114 + comp_fir_complexe114: imm_int 0, %76, --> comp_fir_complexe113 + comp_fir_complexe113: imm_addr 64($sp), %77, --> comp_fir_complexe112 + comp_fir_complexe112: imm_int 4, %79, --> comp_fir_complexe111 + comp_fir_complexe111: mul %78, %8, %79 --> comp_fir_complexe110 + comp_fir_complexe110: store int32, add, %77, %78, %76 --> comp_fir_complexe109 + comp_fir_complexe11: store int32, add, %4, %21, %13 --> comp_fir_complexe10 + comp_fir_complexe109: emit c36 --> comp_fir_complexe108 + comp_fir_complexe108: imm_int 1, %75, --> comp_fir_complexe107 + comp_fir_complexe107: add %8, %8, %75 --> comp_fir_complexe106 + comp_fir_complexe106: --> comp_fir_complexe127 + comp_fir_complexe105: emit c33 --> comp_fir_complexe104 + comp_fir_complexe104: imm_int 0, %16, --> comp_fir_complexe103 + comp_fir_complexe103: emit c32 --> comp_fir_complexe102 + comp_fir_complexe102: imm_int 0, %13, --> comp_fir_complexe101 + comp_fir_complexe101: emit c31 --> comp_fir_complexe100 + comp_fir_complexe100: imm_int 0, %7, --> comp_fir_complexe99 + comp_fir_complexe10: emit c11 --> comp_fir_complexe9 + comp_fir_complexe1: imm_int 0, %17, --> comp_fir_complexe0 + comp_fir_complexe0: return %17 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9 + result: %1 + stacksize: 0 + entry: main13 + exit: main0 + + main9: imm_addr "t2", %3, --> main8 + main8: imm_addr "t3", %4, --> main7 + main7: imm_addr "t4", %5, --> main6 + main6: imm_addr "t5", %6, --> main5 + main5: imm_addr "t6", %7, --> main4 + main4: imm_int 16, %8, --> main3 + main3: call "comp_fir_complexe", %2, %3, %4, %5, %6, %7, %8, %0: int -> int -> int -> int -> int -> int -> int -> int --> main2 + main2: emit c40 --> main1 + main13: emit c42 --> main12 + main12: call "init", , %9: void --> main11 + main11: emit c41 --> main10 + main10: imm_addr "t1", %2, --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/fir_complexe.c b/tests/clight/fir_complexe.c new file mode 100644 index 0000000..bf34ffa --- /dev/null +++ b/tests/clight/fir_complexe.c @@ -0,0 +1,52 @@ +int t1[16]; +int t2[16]; +int t3[16]; +int t4[16]; +int t5[16]; +int t6[16]; + +void init(){ + int i; + for(i=0;i<16;i++){ + t1[i] = 2; + t2[i] = 2; + t3[i] = 2; + t4[i] = 2; + t5[i] = 2; + t6[i] = 2; + } +} + +int comp_fir_complexe(int in_re[], int in_im[], int c_re[], int c_im[], int out_re[], int out_im[], int size) { + int i,j,res_re,res_im,tmp_im,tmp_re,tmp_x_re,tmp_x_im; + int x_re[16]; + int x_im[16]; + int ii; + for(ii=0;ii<16;ii++){x_re[ii]=0;x_im[ii]=0;} + int adx = 0; + res_re = 0; res_im = 0; + for (j=0;j>4; + tmp_im = (tmp_x_re*c_im[i]+tmp_x_im*c_re[i])>>4; + res_re = res_re + tmp_re; + res_im = res_im + tmp_im; + adx=(adx+1)%16; + } + + adx=(adx+1)%16; + + out_re[j]=res_re; + out_im[j]=res_im; + } + return 0; +} +int main(){ + init(); + return comp_fir_complexe(t1,t2,t3,t4,t5,t6,16); +} diff --git a/tests/clight/fir_complexe.c.expected b/tests/clight/fir_complexe.c.expected new file mode 100644 index 0000000..bf34ffa --- /dev/null +++ b/tests/clight/fir_complexe.c.expected @@ -0,0 +1,52 @@ +int t1[16]; +int t2[16]; +int t3[16]; +int t4[16]; +int t5[16]; +int t6[16]; + +void init(){ + int i; + for(i=0;i<16;i++){ + t1[i] = 2; + t2[i] = 2; + t3[i] = 2; + t4[i] = 2; + t5[i] = 2; + t6[i] = 2; + } +} + +int comp_fir_complexe(int in_re[], int in_im[], int c_re[], int c_im[], int out_re[], int out_im[], int size) { + int i,j,res_re,res_im,tmp_im,tmp_re,tmp_x_re,tmp_x_im; + int x_re[16]; + int x_im[16]; + int ii; + for(ii=0;ii<16;ii++){x_re[ii]=0;x_im[ii]=0;} + int adx = 0; + res_re = 0; res_im = 0; + for (j=0;j>4; + tmp_im = (tmp_x_re*c_im[i]+tmp_x_im*c_re[i])>>4; + res_re = res_re + tmp_re; + res_im = res_im + tmp_im; + adx=(adx+1)%16; + } + + adx=(adx+1)%16; + + out_re[j]=res_re; + out_im[j]=res_im; + } + return 0; +} +int main(){ + init(); + return comp_fir_complexe(t1,t2,t3,t4,t5,t6,16); +} diff --git a/tests/clight/fir_complexe.log.expected b/tests/clight/fir_complexe.log.expected new file mode 100644 index 0000000..77a2ddb --- /dev/null +++ b/tests/clight/fir_complexe.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Store mode not supported. diff --git a/tests/clight/for.ASM.expected b/tests/clight/for.ASM.expected new file mode 100644 index 0000000..752c092 --- /dev/null +++ b/tests/clight/for.ASM.expected @@ -0,0 +1,708 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main85 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin for_loopParalAsync +for_loopParalAsync94: +c29: +li $v0, 0 +c28: +li $a2, 0 +c27: +li $a0, 3 +add $a2, $a2, $a0 +c26: +li $a0, 2 +mulo $a2, $a2, $a0 +c25: +li $a0, 3 +div $a2, $a2, $a0 +c24: +li $a0, 8 +add $a2, $a2, $a0 +c23: +c22: +li $a1, 0 +for_loopParalAsync37: +li $a3, 0 +c21: +li $a0, 20 +slt $a0, $a1, $a0 +seq $a0, $a0, $zero +beq $a0, $a3, for_loopParalAsync31 +c16: +c15: +li $a1, 1 +for_loopParalAsync16: +li $a3, 0 +c14: +slt $a0, $a1, $a2 +seq $a0, $a0, $zero +beq $a0, $a3, for_loopParalAsync11 +c10: +jr $ra +for_loopParalAsync11: +c12: +c11: +c13: +li $a0, 1 +add $a1, $a1, $a0 +j for_loopParalAsync16 +for_loopParalAsync31: +c19: +li $a0, 1 +add $v0, $v0, $a0 +c18: +c17: +c20: +li $a0, 1 +add $a1, $a1, $a0 +j for_loopParalAsync37 +# end for_loopParalAsync + + +# begin for_incrParam +for_incrParam49: +c86: +add $a3, $a0, $a1 +c85: +c84: +c83: +li $v0, 4 +sub $v0, $a3, $v0 +for_incrParam15: +li $t0, 0 +c82: +li $a2, 6 +add $a2, $a1, $a2 +slt $a2, $v0, $a2 +seq $a2, $a2, $zero +beq $a2, $t0, for_incrParam8 +c79: +jr $ra +for_incrParam8: +c80: +add $v0, $v0, $a3 +add $v0, $v0, $a0 +c81: +add $v0, $v0, $a0 +j for_incrParam15 +# end for_incrParam + + +# begin for_incr +for_incr44: +c78: +li $v0, 0 +c77: +c76: +li $a2, 3 +add $a2, $a0, $a2 +for_incr15: +li $a3, 0 +c75: +li $a0, 2 +mulo $a0, $a1, $a0 +sle $a0, $a2, $a0 +seq $a0, $a0, $zero +beq $a0, $a3, for_incr8 +c72: +jr $ra +for_incr8: +c73: +sub $v0, $v0, $a2 +c74: +li $a0, 1 +add $a2, $a2, $a0 +j for_incr15 +# end for_incr + + +# begin for_imbriq +for_imbriq64: +addi $sp, $sp, -24 +sw $ra, 20($sp) +sw $s4, 16($sp) +sw $s3, 12($sp) +sw $s2, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +move $s4, $a0 +move $s3, $a1 +c71: +li $s0, 0 +c70: +c69: +li $s1, 0 +for_imbriq29: +li $a0, 0 +c68: +li $v0, 23 +slt $v0, $s1, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, for_imbriq23 +c59: +move $v0, $s0 +lw $ra, 20($sp) +lw $s4, 16($sp) +lw $s3, 12($sp) +lw $s2, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +addi $sp, $sp, 24 +jr $ra +for_imbriq23: +c66: +li $v0, 0 +c65: +c64: +li $s2, 1 +for_imbriq18: +li $a1, 0 +c63: +li $a0, 12 +slt $a0, $s2, $a0 +seq $a0, $a0, $zero +beq $a0, $a1, for_imbriq12 +c67: +add $s1, $s1, $s4 +j for_imbriq29 +for_imbriq12: +c61: +add $s0, $s0, $v0 +c60: +la $a2, mod +move $a0, $v0 +move $a1, $s2 +jalr $a2 +c62: +add $s2, $s2, $s3 +j for_imbriq18 +# end for_imbriq + + +# begin for_fortSimple +for_fortSimple41: +c58: +li $t0, 0 +c57: +c56: +move $a3, $a0 +for_fortSimple14: +li $t1, 0 +c55: +slt $v0, $a3, $a1 +seq $v0, $v0, $zero +beq $v0, $t1, for_fortSimple9 +c52: +add $v0, $t0, $a0 +c51: +jr $ra +for_fortSimple9: +c53: +add $t0, $t0, $a3 +c54: +add $a3, $a3, $a2 +j for_fortSimple14 +# end for_fortSimple + + +# begin for_forfor +for_forfor44: +c94: +c93: +li $a1, 0 +c92: +li $v0, 0 +for_forfor18: +li $a2, 0 +c91: +li $a0, 10 +slt $a0, $a1, $a0 +seq $a0, $a0, $zero +beq $a0, $a2, for_forfor12 +c87: +jr $ra +for_forfor12: +c89: +li $a0, 1 +add $v0, $v0, $a0 +c88: +li $a0, 1 +add $v0, $v0, $a0 +c90: +li $a0, 1 +add $a1, $a1, $a0 +j for_forfor18 +# end for_forfor + + +# begin for_ex +for_ex43: +c50: +li $v0, 0 +c49: +c48: +li $a3, 3 +add $a3, $a0, $a3 +for_ex14: +li $t0, 0 +c47: +li $a0, 2 +mulo $a0, $a1, $a0 +sle $a0, $a3, $a0 +seq $a0, $a0, $zero +beq $a0, $t0, for_ex7 +c44: +jr $ra +for_ex7: +c45: +sub $v0, $v0, $a3 +c46: +add $a3, $a3, $a2 +j for_ex14 +# end for_ex + + +# begin for_double +for_double64: +c43: +li $a1, 0 +c42: +li $a2, 0 +c41: +c40: +li $a3, 0 +for_double29: +li $t0, 0 +c39: +li $v0, 12 +slt $v0, $a3, $v0 +seq $v0, $v0, $zero +beq $v0, $t0, for_double23 +c36: +c35: +li $a3, 0 +for_double15: +li $t0, 0 +c34: +li $v0, 5 +slt $v0, $a3, $v0 +seq $v0, $v0, $zero +beq $v0, $t0, for_double9 +c31: +mulo $v0, $a1, $a2 +c30: +jr $ra +for_double9: +c32: +add $a2, $a2, $a3 +c33: +add $a3, $a3, $a0 +j for_double15 +for_double23: +c37: +add $a1, $a1, $a3 +c38: +add $a3, $a3, $a0 +j for_double29 +# end for_double + + +# begin for_2 +for_253: +c9: +li $a2, 0 +c8: +li $v0, 2 +mulo $v0, $a0, $v0 +c7: +li $a3, 4 +mulo $a0, $a0, $a3 +c6: +li $a3, 1 +add $a1, $a1, $a3 +c5: +c4: +for_213: +li $t0, 0 +c3: +slt $a3, $v0, $a0 +seq $a3, $a3, $zero +beq $a3, $t0, for_28 +c0: +li $v0, 1 +add $v0, $a2, $v0 +jr $ra +for_28: +c1: +add $a2, $a2, $v0 +c2: +add $v0, $v0, $a1 +j for_213 +# end for_2 + + +# begin _main +main85: +addi $sp, $sp, -4 +sw $ra, 0($sp) +c104: +li $a0, 3 +li $a1, 1 +la $v0, for_253 +jalr $v0 +c103: +li $a0, 1 +li $a1, 2 +li $a2, 3 +la $v0, for_loopParalAsync94 +jalr $v0 +c102: +li $a0, 1 +la $v0, for_double64 +jalr $v0 +c101: +li $a0, 2 +li $a1, 10 +li $a2, 1 +la $v0, for_ex43 +jalr $v0 +c100: +li $a0, 2 +li $a1, 10 +li $a2, 1 +la $v0, for_fortSimple41 +jalr $v0 +c99: +li $a0, 2 +li $a1, 3 +la $v0, for_imbriq64 +jalr $v0 +c98: +li $a0, 2 +li $a1, 3 +la $v0, for_incr44 +jalr $v0 +c97: +li $a0, 2 +li $a1, 3 +la $v0, for_incrParam49 +jalr $v0 +c96: +la $v0, for_forfor44 +jalr $v0 +c95: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end _main diff --git a/tests/clight/for.Clight.expected b/tests/clight/for.Clight.expected new file mode 100644 index 0000000..aaa00f2 --- /dev/null +++ b/tests/clight/for.Clight.expected @@ -0,0 +1,502 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int for_2(int a, int b) +{ + int i; + int min; + int max; + int pas; + int resul; + c9: + resul = 0; + c8: + min = a * 2; + c7: + max = a * 4; + c6: + pas = b + 1; + c5: + for (({ c4: i = min; }); (/* c3 */ i < max); ({ c2: i = i + pas; })) { + c1: + resul = resul + i; + } + c0: + return resul + 1; +} + +int for_loopParalAsync(int a, int b, int c) +{ + int i; + int j; + int x; + int y; + int z; + c29: + x = 0; + c28: + a = 0; + c27: + a = a + 3; + c26: + a = a * 2; + c25: + a = a / 3; + c24: + a = a + 8; + c23: + for (({ c22: i = 0; }); (/* c21 */ i < 20); ({ c20: i = i + 1; })) { + c19: + x = x + 1; + c18: + b = b + 2; + c17: + y = b / x; + } + c16: + for (({ c15: j = 1; }); (/* c14 */ j < a); ({ c13: j = j + 1; })) { + c12: + c = c * 2; + c11: + z = c / j; + } + c10: + return x; +} + +int for_double(int pas) +{ + int i; + int j; + int result; + int a; + int b; + c43: + a = 0; + c42: + b = 0; + c41: + for (({ c40: i = 0; }); (/* c39 */ i < 12); ({ c38: i = i + pas; })) { + c37: + a = a + i; + } + c36: + for (({ c35: j = 0; }); (/* c34 */ j < 5); ({ c33: j = j + pas; })) { + c32: + b = b + j; + } + c31: + result = a * b; + c30: + return result; +} + +int for_ex(int b, int e, int pas) +{ + int i; + int res; + c50: + res = 0; + c49: + for (({ c48: + i = b + 3; }); + (/* c47 */ + i <= e * 2); + ({ c46: + i = i + pas; })) { + c45: + res = res - i; + } + c44: + return res; +} + +int for_fortSimple(int a, int b, int pas) +{ + int res; + int i; + int sortie; + int c; + c58: + res = 0; + c57: + for (({ c56: i = a; }); (/* c55 */ i < b); ({ c54: i = i + pas; })) { + c53: + res = res + i; + } + c52: + sortie = res + a; + c51: + return sortie; +} + +int for_imbriq(int pas1, int pas2) +{ + int i; + int j; + int a; + int b; + c71: + a = 0; + c70: + for (({ c69: i = 0; }); (/* c68 */ i < 23); ({ c67: i = i + pas1; })) { + c66: + b = 0; + c65: + for (({ c64: j = 1; }); (/* c63 */ j < 12); ({ c62: j = j + pas2; })) { + c61: + a = a + b; + c60: + b = b % j; + } + } + c59: + return a; +} + +int for_incr(int b, int e) +{ + int i; + int res; + c78: + res = 0; + c77: + for (({ c76: + i = b + 3; }); + (/* c75 */ + i <= e * 2); + ({ c74: + i = i + 1; })) { + c73: + res = res - i; + } + c72: + return res; +} + +int for_incrParam(int a, int b) +{ + int i; + int z; + int c; + c86: + z = a + b; + c85: + c = 3 * z; + c84: + for (({ c83: i = z - 4; }); (/* c82 */ i < b + 6); ({ c81: i = i + a; })) { + c80: + i = (i + z) + a; + } + c79: + return i; +} + +int for_forfor(void) +{ + int i; + int j; + c94: + for (({ c93: + i = 0; }), ({ c92: + j = 0; }); + (/* c91 */ + i < 10); + ({ c90: + i = i + 1; })) { + c89: + j = j + 1; + c88: + j = j + 1; + } + c87: + return j; +} + +int main(void) +{ + int a; + c104: + a = for_2(3, 1); + c103: + a = for_loopParalAsync(1, 2, 3); + c102: + a = for_double(1); + c101: + a = for_ex(2, 10, 1); + c100: + a = for_fortSimple(2, 10, 1); + c99: + a = for_imbriq(2, 3); + c98: + a = for_incr(2, 3); + c97: + a = for_incrParam(2, 3); + c96: + a = for_forfor(); + c95: + return a; +} + + diff --git a/tests/clight/for.Cminor.expected b/tests/clight/for.Cminor.expected new file mode 100644 index 0000000..c202f77 --- /dev/null +++ b/tests/clight/for.Cminor.expected @@ -0,0 +1,805 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"for_2" (a, b) : int -> int -> int { + + stack 0; + + var max, pas, i, resul, min; + + c9: + resul = 0; + c8: + min = a * 2; + c7: + max = a * 4; + c6: + pas = b + 1; + c5: + c4: + i = min; + block { + loop { + if (!(/* c3 */ i < max)) { + exit 0; + } + else { + } + block { + c1: + resul = resul + i; + } + c2: + i = i + pas; + } + } + c0: + return resul + 1; + +} + + +"for_loopParalAsync" (a, b, c) : int -> int -> int -> int { + + stack 0; + + var z, y, x, j, i; + + c29: + x = 0; + c28: + a = 0; + c27: + a = a + 3; + c26: + a = a * 2; + c25: + a = a / 3; + c24: + a = a + 8; + c23: + c22: + i = 0; + block { + loop { + if (!(/* c21 */ i < 20)) { + exit 0; + } + else { + } + block { + c19: + x = x + 1; + c18: + b = b + 2; + c17: + y = b / x; + } + c20: + i = i + 1; + } + } + c16: + c15: + j = 1; + block { + loop { + if (!(/* c14 */ j < a)) { + exit 0; + } + else { + } + block { + c12: + c = c * 2; + c11: + z = c / j; + } + c13: + j = j + 1; + } + } + c10: + return x; + +} + + +"for_double" (pas) : int -> int { + + stack 0; + + var j, i, result, b, a; + + c43: + a = 0; + c42: + b = 0; + c41: + c40: + i = 0; + block { + loop { + if (!(/* c39 */ i < 12)) { + exit 0; + } + else { + } + block { + c37: + a = a + i; + } + c38: + i = i + pas; + } + } + c36: + c35: + j = 0; + block { + loop { + if (!(/* c34 */ j < 5)) { + exit 0; + } + else { + } + block { + c32: + b = b + j; + } + c33: + j = j + pas; + } + } + c31: + result = a * b; + c30: + return result; + +} + + +"for_ex" (b, e, pas) : int -> int -> int -> int { + + stack 0; + + var res, i; + + c50: + res = 0; + c49: + c48: + i = b + 3; + block { + loop { + if (!(/* c47 */ i <= (e * 2))) { + exit 0; + } + else { + } + block { + c45: + res = res - i; + } + c46: + i = i + pas; + } + } + c44: + return res; + +} + + +"for_fortSimple" (a, b, pas) : int -> int -> int -> int { + + stack 0; + + var res, sortie, i, c; + + c58: + res = 0; + c57: + c56: + i = a; + block { + loop { + if (!(/* c55 */ i < b)) { + exit 0; + } + else { + } + block { + c53: + res = res + i; + } + c54: + i = i + pas; + } + } + c52: + sortie = res + a; + c51: + return sortie; + +} + + +"for_imbriq" (pas1, pas2) : int -> int -> int { + + stack 0; + + var j, i, b, a; + + c71: + a = 0; + c70: + c69: + i = 0; + block { + loop { + if (!(/* c68 */ i < 23)) { + exit 0; + } + else { + } + block { + c66: + b = 0; + c65: + c64: + j = 1; + block { + loop { + if (!(/* c63 */ j < 12)) { + exit 0; + } + else { + } + block { + c61: + a = a + b; + c60: + b = b % j; + } + c62: + j = j + pas2; + } + } + } + c67: + i = i + pas1; + } + } + c59: + return a; + +} + + +"for_incr" (b, e) : int -> int -> int { + + stack 0; + + var res, i; + + c78: + res = 0; + c77: + c76: + i = b + 3; + block { + loop { + if (!(/* c75 */ i <= (e * 2))) { + exit 0; + } + else { + } + block { + c73: + res = res - i; + } + c74: + i = i + 1; + } + } + c72: + return res; + +} + + +"for_incrParam" (a, b) : int -> int -> int { + + stack 0; + + var z, i, c; + + c86: + z = a + b; + c85: + c = 3 * z; + c84: + c83: + i = z - 4; + block { + loop { + if (!(/* c82 */ i < (b + 6))) { + exit 0; + } + else { + } + block { + c80: + i = (i + z) + a; + } + c81: + i = i + a; + } + } + c79: + return i; + +} + + +"for_forfor" () : int { + + stack 0; + + var j, i; + + c94: + c93: + i = 0; + c92: + j = 0; + block { + loop { + if (!(/* c91 */ i < 10)) { + exit 0; + } + else { + } + block { + c89: + j = j + 1; + c88: + j = j + 1; + } + c90: + i = i + 1; + } + } + c87: + return j; + +} + + +"main" () : int { + + stack 0; + + var a; + + c104: + a = "for_2"(3, 1) : int -> int -> int; + c103: + a = "for_loopParalAsync"(1, 2, 3) : int -> int -> int -> int; + c102: + a = "for_double"(1) : int -> int; + c101: + a = "for_ex"(2, 10, 1) : int -> int -> int -> int; + c100: + a = "for_fortSimple"(2, 10, 1) : int -> int -> int -> int; + c99: + a = "for_imbriq"(2, 3) : int -> int -> int; + c98: + a = "for_incr"(2, 3) : int -> int -> int; + c97: + a = "for_incrParam"(2, 3) : int -> int -> int; + c96: + a = "for_forfor"() : int; + c95: + return a; + +} + + diff --git a/tests/clight/for.ERTL.expected b/tests/clight/for.ERTL.expected new file mode 100644 index 0000000..7a1b592 --- /dev/null +++ b/tests/clight/for.ERTL.expected @@ -0,0 +1,1233 @@ +program + +globals 0 + +procedure for_loopParalAsync(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35 +entry for_loopParalAsync94 +for_loopParalAsync94 : newframe --> for_loopParalAsync93 +for_loopParalAsync93 : move %35, $ra --> for_loopParalAsync92 +for_loopParalAsync92 : move %34, $s7 --> for_loopParalAsync91 +for_loopParalAsync91 : move %33, $s6 --> for_loopParalAsync90 +for_loopParalAsync90 : move %32, $s5 --> for_loopParalAsync89 +for_loopParalAsync89 : move %31, $s4 --> for_loopParalAsync88 +for_loopParalAsync88 : move %30, $s3 --> for_loopParalAsync87 +for_loopParalAsync87 : move %29, $s2 --> for_loopParalAsync86 +for_loopParalAsync86 : move %28, $s1 --> for_loopParalAsync85 +for_loopParalAsync85 : move %27, $s0 --> for_loopParalAsync84 +for_loopParalAsync84 : move %0, $a0 --> for_loopParalAsync83 +for_loopParalAsync83 : move %1, $a1 --> for_loopParalAsync82 +for_loopParalAsync82 : move %2, $a2 --> for_loopParalAsync81 +for_loopParalAsync81 : li %3, 0 --> for_loopParalAsync80 +for_loopParalAsync80 : li %4, 0 --> for_loopParalAsync79 +for_loopParalAsync79 : li %5, 0 --> for_loopParalAsync78 +for_loopParalAsync78 : li %6, 0 --> for_loopParalAsync77 +for_loopParalAsync77 : li %7, 0 --> for_loopParalAsync76 +for_loopParalAsync76 : li %9, 0 --> for_loopParalAsync75 +for_loopParalAsync75 : li %10, 0 --> for_loopParalAsync74 +for_loopParalAsync74 : li %11, 0 --> for_loopParalAsync73 +for_loopParalAsync73 : li %12, 0 --> for_loopParalAsync72 +for_loopParalAsync72 : li %13, 0 --> for_loopParalAsync71 +for_loopParalAsync71 : li %14, 0 --> for_loopParalAsync70 +for_loopParalAsync70 : li %15, 0 --> for_loopParalAsync69 +for_loopParalAsync69 : li %16, 0 --> for_loopParalAsync68 +for_loopParalAsync68 : li %17, 0 --> for_loopParalAsync67 +for_loopParalAsync67 : li %18, 0 --> for_loopParalAsync66 +for_loopParalAsync66 : li %19, 0 --> for_loopParalAsync65 +for_loopParalAsync65 : li %20, 0 --> for_loopParalAsync64 +for_loopParalAsync64 : li %21, 0 --> for_loopParalAsync63 +for_loopParalAsync63 : li %22, 0 --> for_loopParalAsync62 +for_loopParalAsync62 : li %23, 0 --> for_loopParalAsync61 +for_loopParalAsync61 : li %24, 0 --> for_loopParalAsync60 +for_loopParalAsync60 : li %25, 0 --> for_loopParalAsync59 +for_loopParalAsync59 : li %26, 0 --> for_loopParalAsync56 +for_loopParalAsync56 : emit c29 --> for_loopParalAsync55 +for_loopParalAsync55 : li %5, 0 --> for_loopParalAsync54 +for_loopParalAsync54 : emit c28 --> for_loopParalAsync53 +for_loopParalAsync53 : li %0, 0 --> for_loopParalAsync52 +for_loopParalAsync52 : emit c27 --> for_loopParalAsync51 +for_loopParalAsync51 : li %24, 3 --> for_loopParalAsync50 +for_loopParalAsync50 : add %0, %0, %24 --> for_loopParalAsync49 +for_loopParalAsync49 : emit c26 --> for_loopParalAsync48 +for_loopParalAsync48 : li %23, 2 --> for_loopParalAsync47 +for_loopParalAsync47 : mulo %0, %0, %23 --> for_loopParalAsync46 +for_loopParalAsync46 : emit c25 --> for_loopParalAsync45 +for_loopParalAsync45 : li %22, 3 --> for_loopParalAsync44 +for_loopParalAsync44 : div %0, %0, %22 --> for_loopParalAsync43 +for_loopParalAsync43 : emit c24 --> for_loopParalAsync42 +for_loopParalAsync42 : li %21, 8 --> for_loopParalAsync41 +for_loopParalAsync41 : add %0, %0, %21 --> for_loopParalAsync40 +for_loopParalAsync40 : emit c23 --> for_loopParalAsync39 +for_loopParalAsync39 : emit c22 --> for_loopParalAsync38 +for_loopParalAsync38 : li %7, 0 --> for_loopParalAsync20 +for_loopParalAsync20 : j --> for_loopParalAsync37 +for_loopParalAsync37 : li %18, 0 --> for_loopParalAsync36 +for_loopParalAsync36 : emit c21 --> for_loopParalAsync35 +for_loopParalAsync35 : li %20, 20 --> for_loopParalAsync34 +for_loopParalAsync34 : slt %19, %7, %20 --> for_loopParalAsync33 +for_loopParalAsync33 : li %26, 0 --> for_loopParalAsync58 +for_loopParalAsync58 : seq %17, %19, %26 --> for_loopParalAsync32 +for_loopParalAsync32 : beq %17, %18 --> for_loopParalAsync31, for_loopParalAsync19 +for_loopParalAsync19 : emit c16 --> for_loopParalAsync18 +for_loopParalAsync18 : emit c15 --> for_loopParalAsync17 +for_loopParalAsync17 : li %6, 1 --> for_loopParalAsync3 +for_loopParalAsync3 : j --> for_loopParalAsync16 +for_loopParalAsync16 : li %12, 0 --> for_loopParalAsync15 +for_loopParalAsync15 : emit c14 --> for_loopParalAsync14 +for_loopParalAsync14 : slt %13, %6, %0 --> for_loopParalAsync13 +for_loopParalAsync13 : li %25, 0 --> for_loopParalAsync57 +for_loopParalAsync57 : seq %11, %13, %25 --> for_loopParalAsync12 +for_loopParalAsync12 : beq %11, %12 --> for_loopParalAsync11, for_loopParalAsync2 +for_loopParalAsync2 : emit c10 --> for_loopParalAsync1 +for_loopParalAsync1 : move %8, %5 --> for_loopParalAsync0 +for_loopParalAsync0 : j --> for_loopParalAsync106 +for_loopParalAsync106: move $v0, %8 --> for_loopParalAsync105 +for_loopParalAsync105: move $ra, %35 --> for_loopParalAsync104 +for_loopParalAsync104: move $s7, %34 --> for_loopParalAsync103 +for_loopParalAsync103: move $s6, %33 --> for_loopParalAsync102 +for_loopParalAsync102: move $s5, %32 --> for_loopParalAsync101 +for_loopParalAsync101: move $s4, %31 --> for_loopParalAsync100 +for_loopParalAsync100: move $s3, %30 --> for_loopParalAsync99 +for_loopParalAsync99 : move $s2, %29 --> for_loopParalAsync98 +for_loopParalAsync98 : move $s1, %28 --> for_loopParalAsync97 +for_loopParalAsync97 : move $s0, %27 --> for_loopParalAsync96 +for_loopParalAsync96 : delframe --> for_loopParalAsync95 +for_loopParalAsync95 : jr $ra (xmits $v0) +for_loopParalAsync11 : emit c12 --> for_loopParalAsync10 +for_loopParalAsync10 : li %10, 2 --> for_loopParalAsync9 +for_loopParalAsync9 : mulo %2, %2, %10 --> for_loopParalAsync8 +for_loopParalAsync8 : emit c11 --> for_loopParalAsync7 +for_loopParalAsync7 : div %3, %2, %6 --> for_loopParalAsync6 +for_loopParalAsync6 : emit c13 --> for_loopParalAsync5 +for_loopParalAsync5 : li %9, 1 --> for_loopParalAsync4 +for_loopParalAsync4 : add %6, %6, %9 --> for_loopParalAsync3 +for_loopParalAsync31 : emit c19 --> for_loopParalAsync30 +for_loopParalAsync30 : li %16, 1 --> for_loopParalAsync29 +for_loopParalAsync29 : add %5, %5, %16 --> for_loopParalAsync28 +for_loopParalAsync28 : emit c18 --> for_loopParalAsync27 +for_loopParalAsync27 : li %15, 2 --> for_loopParalAsync26 +for_loopParalAsync26 : add %1, %1, %15 --> for_loopParalAsync25 +for_loopParalAsync25 : emit c17 --> for_loopParalAsync24 +for_loopParalAsync24 : div %4, %1, %5 --> for_loopParalAsync23 +for_loopParalAsync23 : emit c20 --> for_loopParalAsync22 +for_loopParalAsync22 : li %14, 1 --> for_loopParalAsync21 +for_loopParalAsync21 : add %7, %7, %14 --> for_loopParalAsync20 + +procedure for_incrParam(2) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23 +entry for_incrParam49 +for_incrParam49: newframe --> for_incrParam48 +for_incrParam48: move %23, $ra --> for_incrParam47 +for_incrParam47: move %22, $s7 --> for_incrParam46 +for_incrParam46: move %21, $s6 --> for_incrParam45 +for_incrParam45: move %20, $s5 --> for_incrParam44 +for_incrParam44: move %19, $s4 --> for_incrParam43 +for_incrParam43: move %18, $s3 --> for_incrParam42 +for_incrParam42: move %17, $s2 --> for_incrParam41 +for_incrParam41: move %16, $s1 --> for_incrParam40 +for_incrParam40: move %15, $s0 --> for_incrParam39 +for_incrParam39: move %0, $a0 --> for_incrParam38 +for_incrParam38: move %1, $a1 --> for_incrParam37 +for_incrParam37: li %2, 0 --> for_incrParam36 +for_incrParam36: li %3, 0 --> for_incrParam35 +for_incrParam35: li %4, 0 --> for_incrParam34 +for_incrParam34: li %6, 0 --> for_incrParam33 +for_incrParam33: li %7, 0 --> for_incrParam32 +for_incrParam32: li %8, 0 --> for_incrParam31 +for_incrParam31: li %9, 0 --> for_incrParam30 +for_incrParam30: li %10, 0 --> for_incrParam29 +for_incrParam29: li %11, 0 --> for_incrParam28 +for_incrParam28: li %12, 0 --> for_incrParam27 +for_incrParam27: li %13, 0 --> for_incrParam26 +for_incrParam26: li %14, 0 --> for_incrParam24 +for_incrParam24: emit c86 --> for_incrParam23 +for_incrParam23: add %2, %0, %1 --> for_incrParam22 +for_incrParam22: emit c85 --> for_incrParam21 +for_incrParam21: li %13, 3 --> for_incrParam20 +for_incrParam20: mulo %4, %13, %2 --> for_incrParam19 +for_incrParam19: emit c84 --> for_incrParam18 +for_incrParam18: emit c83 --> for_incrParam17 +for_incrParam17: li %12, 4 --> for_incrParam16 +for_incrParam16: sub %3, %2, %12 --> for_incrParam3 +for_incrParam3 : j --> for_incrParam15 +for_incrParam15: li %8, 0 --> for_incrParam14 +for_incrParam14: emit c82 --> for_incrParam13 +for_incrParam13: li %11, 6 --> for_incrParam12 +for_incrParam12: add %10, %1, %11 --> for_incrParam11 +for_incrParam11: slt %9, %3, %10 --> for_incrParam10 +for_incrParam10: li %14, 0 --> for_incrParam25 +for_incrParam25: seq %7, %9, %14 --> for_incrParam9 +for_incrParam9 : beq %7, %8 --> for_incrParam8, for_incrParam2 +for_incrParam2 : emit c79 --> for_incrParam1 +for_incrParam1 : move %5, %3 --> for_incrParam0 +for_incrParam0 : j --> for_incrParam61 +for_incrParam61: move $v0, %5 --> for_incrParam60 +for_incrParam60: move $ra, %23 --> for_incrParam59 +for_incrParam59: move $s7, %22 --> for_incrParam58 +for_incrParam58: move $s6, %21 --> for_incrParam57 +for_incrParam57: move $s5, %20 --> for_incrParam56 +for_incrParam56: move $s4, %19 --> for_incrParam55 +for_incrParam55: move $s3, %18 --> for_incrParam54 +for_incrParam54: move $s2, %17 --> for_incrParam53 +for_incrParam53: move $s1, %16 --> for_incrParam52 +for_incrParam52: move $s0, %15 --> for_incrParam51 +for_incrParam51: delframe --> for_incrParam50 +for_incrParam50: jr $ra (xmits $v0) +for_incrParam8 : emit c80 --> for_incrParam7 +for_incrParam7 : add %6, %3, %2 --> for_incrParam6 +for_incrParam6 : add %3, %6, %0 --> for_incrParam5 +for_incrParam5 : emit c81 --> for_incrParam4 +for_incrParam4 : add %3, %3, %0 --> for_incrParam3 + +procedure for_incr(2) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21 +entry for_incr44 +for_incr44: newframe --> for_incr43 +for_incr43: move %21, $ra --> for_incr42 +for_incr42: move %20, $s7 --> for_incr41 +for_incr41: move %19, $s6 --> for_incr40 +for_incr40: move %18, $s5 --> for_incr39 +for_incr39: move %17, $s4 --> for_incr38 +for_incr38: move %16, $s3 --> for_incr37 +for_incr37: move %15, $s2 --> for_incr36 +for_incr36: move %14, $s1 --> for_incr35 +for_incr35: move %13, $s0 --> for_incr34 +for_incr34: move %0, $a0 --> for_incr33 +for_incr33: move %1, $a1 --> for_incr32 +for_incr32: li %2, 0 --> for_incr31 +for_incr31: li %3, 0 --> for_incr30 +for_incr30: li %5, 0 --> for_incr29 +for_incr29: li %6, 0 --> for_incr28 +for_incr28: li %7, 0 --> for_incr27 +for_incr27: li %8, 0 --> for_incr26 +for_incr26: li %9, 0 --> for_incr25 +for_incr25: li %10, 0 --> for_incr24 +for_incr24: li %11, 0 --> for_incr23 +for_incr23: li %12, 0 --> for_incr21 +for_incr21: emit c78 --> for_incr20 +for_incr20: li %2, 0 --> for_incr19 +for_incr19: emit c77 --> for_incr18 +for_incr18: emit c76 --> for_incr17 +for_incr17: li %11, 3 --> for_incr16 +for_incr16: add %3, %0, %11 --> for_incr3 +for_incr3 : j --> for_incr15 +for_incr15: li %7, 0 --> for_incr14 +for_incr14: emit c75 --> for_incr13 +for_incr13: li %10, 2 --> for_incr12 +for_incr12: mulo %9, %1, %10 --> for_incr11 +for_incr11: sle %8, %3, %9 --> for_incr10 +for_incr10: li %12, 0 --> for_incr22 +for_incr22: seq %6, %8, %12 --> for_incr9 +for_incr9 : beq %6, %7 --> for_incr8, for_incr2 +for_incr2 : emit c72 --> for_incr1 +for_incr1 : move %4, %2 --> for_incr0 +for_incr0 : j --> for_incr56 +for_incr56: move $v0, %4 --> for_incr55 +for_incr55: move $ra, %21 --> for_incr54 +for_incr54: move $s7, %20 --> for_incr53 +for_incr53: move $s6, %19 --> for_incr52 +for_incr52: move $s5, %18 --> for_incr51 +for_incr51: move $s4, %17 --> for_incr50 +for_incr50: move $s3, %16 --> for_incr49 +for_incr49: move $s2, %15 --> for_incr48 +for_incr48: move $s1, %14 --> for_incr47 +for_incr47: move $s0, %13 --> for_incr46 +for_incr46: delframe --> for_incr45 +for_incr45: jr $ra (xmits $v0) +for_incr8 : emit c73 --> for_incr7 +for_incr7 : sub %2, %2, %3 --> for_incr6 +for_incr6 : emit c74 --> for_incr5 +for_incr5 : li %5, 1 --> for_incr4 +for_incr4 : add %3, %3, %5 --> for_incr3 + +procedure for_imbriq(2) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26 +entry for_imbriq64 +for_imbriq64: newframe --> for_imbriq63 +for_imbriq63: move %26, $ra --> for_imbriq62 +for_imbriq62: move %25, $s7 --> for_imbriq61 +for_imbriq61: move %24, $s6 --> for_imbriq60 +for_imbriq60: move %23, $s5 --> for_imbriq59 +for_imbriq59: move %22, $s4 --> for_imbriq58 +for_imbriq58: move %21, $s3 --> for_imbriq57 +for_imbriq57: move %20, $s2 --> for_imbriq56 +for_imbriq56: move %19, $s1 --> for_imbriq55 +for_imbriq55: move %18, $s0 --> for_imbriq54 +for_imbriq54: move %0, $a0 --> for_imbriq53 +for_imbriq53: move %1, $a1 --> for_imbriq52 +for_imbriq52: li %2, 0 --> for_imbriq51 +for_imbriq51: li %3, 0 --> for_imbriq50 +for_imbriq50: li %4, 0 --> for_imbriq49 +for_imbriq49: li %5, 0 --> for_imbriq48 +for_imbriq48: li %7, 0 --> for_imbriq47 +for_imbriq47: li %8, 0 --> for_imbriq46 +for_imbriq46: li %9, 0 --> for_imbriq45 +for_imbriq45: li %10, 0 --> for_imbriq44 +for_imbriq44: li %11, 0 --> for_imbriq43 +for_imbriq43: li %12, 0 --> for_imbriq42 +for_imbriq42: li %13, 0 --> for_imbriq41 +for_imbriq41: li %14, 0 --> for_imbriq40 +for_imbriq40: li %15, 0 --> for_imbriq39 +for_imbriq39: li %16, 0 --> for_imbriq38 +for_imbriq38: li %17, 0 --> for_imbriq34 +for_imbriq34: emit c71 --> for_imbriq33 +for_imbriq33: li %5, 0 --> for_imbriq32 +for_imbriq32: emit c70 --> for_imbriq31 +for_imbriq31: emit c69 --> for_imbriq30 +for_imbriq30: li %3, 0 --> for_imbriq3 +for_imbriq3 : j --> for_imbriq29 +for_imbriq29: li %12, 0 --> for_imbriq28 +for_imbriq28: emit c68 --> for_imbriq27 +for_imbriq27: li %14, 23 --> for_imbriq26 +for_imbriq26: slt %13, %3, %14 --> for_imbriq25 +for_imbriq25: li %16, 0 --> for_imbriq36 +for_imbriq36: seq %11, %13, %16 --> for_imbriq24 +for_imbriq24: beq %11, %12 --> for_imbriq23, for_imbriq2 +for_imbriq2 : emit c59 --> for_imbriq1 +for_imbriq1 : move %6, %5 --> for_imbriq0 +for_imbriq0 : j --> for_imbriq76 +for_imbriq76: move $v0, %6 --> for_imbriq75 +for_imbriq75: move $ra, %26 --> for_imbriq74 +for_imbriq74: move $s7, %25 --> for_imbriq73 +for_imbriq73: move $s6, %24 --> for_imbriq72 +for_imbriq72: move $s5, %23 --> for_imbriq71 +for_imbriq71: move $s4, %22 --> for_imbriq70 +for_imbriq70: move $s3, %21 --> for_imbriq69 +for_imbriq69: move $s2, %20 --> for_imbriq68 +for_imbriq68: move $s1, %19 --> for_imbriq67 +for_imbriq67: move $s0, %18 --> for_imbriq66 +for_imbriq66: delframe --> for_imbriq65 +for_imbriq65: jr $ra (xmits $v0) +for_imbriq23: emit c66 --> for_imbriq22 +for_imbriq22: li %4, 0 --> for_imbriq21 +for_imbriq21: emit c65 --> for_imbriq20 +for_imbriq20: emit c64 --> for_imbriq19 +for_imbriq19: li %2, 1 --> for_imbriq6 +for_imbriq6 : j --> for_imbriq18 +for_imbriq18: li %8, 0 --> for_imbriq17 +for_imbriq17: emit c63 --> for_imbriq16 +for_imbriq16: li %10, 12 --> for_imbriq15 +for_imbriq15: slt %9, %2, %10 --> for_imbriq14 +for_imbriq14: li %15, 0 --> for_imbriq35 +for_imbriq35: seq %7, %9, %15 --> for_imbriq13 +for_imbriq13: beq %7, %8 --> for_imbriq12, for_imbriq5 +for_imbriq5 : emit c67 --> for_imbriq4 +for_imbriq4 : add %3, %3, %0 --> for_imbriq3 +for_imbriq12: emit c61 --> for_imbriq11 +for_imbriq11: add %5, %5, %4 --> for_imbriq10 +for_imbriq10: emit c60 --> for_imbriq9 +for_imbriq9 : la %17, mod --> for_imbriq37 +for_imbriq37: j --> for_imbriq80 +for_imbriq80: move $a0, %4 --> for_imbriq79 +for_imbriq79: move $a1, %2 --> for_imbriq78 +for_imbriq78: call %17(2) --> for_imbriq77 +for_imbriq77: move %4, $v0 --> for_imbriq8 +for_imbriq8 : emit c62 --> for_imbriq7 +for_imbriq7 : add %2, %2, %1 --> for_imbriq6 + +procedure for_fortSimple(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20 +entry for_fortSimple41 +for_fortSimple41: newframe --> for_fortSimple40 +for_fortSimple40: move %20, $ra --> for_fortSimple39 +for_fortSimple39: move %19, $s7 --> for_fortSimple38 +for_fortSimple38: move %18, $s6 --> for_fortSimple37 +for_fortSimple37: move %17, $s5 --> for_fortSimple36 +for_fortSimple36: move %16, $s4 --> for_fortSimple35 +for_fortSimple35: move %15, $s3 --> for_fortSimple34 +for_fortSimple34: move %14, $s2 --> for_fortSimple33 +for_fortSimple33: move %13, $s1 --> for_fortSimple32 +for_fortSimple32: move %12, $s0 --> for_fortSimple31 +for_fortSimple31: move %0, $a0 --> for_fortSimple30 +for_fortSimple30: move %1, $a1 --> for_fortSimple29 +for_fortSimple29: move %2, $a2 --> for_fortSimple28 +for_fortSimple28: li %3, 0 --> for_fortSimple27 +for_fortSimple27: li %4, 0 --> for_fortSimple26 +for_fortSimple26: li %5, 0 --> for_fortSimple25 +for_fortSimple25: li %6, 0 --> for_fortSimple24 +for_fortSimple24: li %8, 0 --> for_fortSimple23 +for_fortSimple23: li %9, 0 --> for_fortSimple22 +for_fortSimple22: li %10, 0 --> for_fortSimple21 +for_fortSimple21: li %11, 0 --> for_fortSimple19 +for_fortSimple19: emit c58 --> for_fortSimple18 +for_fortSimple18: li %3, 0 --> for_fortSimple17 +for_fortSimple17: emit c57 --> for_fortSimple16 +for_fortSimple16: emit c56 --> for_fortSimple15 +for_fortSimple15: move %5, %0 --> for_fortSimple5 +for_fortSimple5 : j --> for_fortSimple14 +for_fortSimple14: li %9, 0 --> for_fortSimple13 +for_fortSimple13: emit c55 --> for_fortSimple12 +for_fortSimple12: slt %10, %5, %1 --> for_fortSimple11 +for_fortSimple11: li %11, 0 --> for_fortSimple20 +for_fortSimple20: seq %8, %10, %11 --> for_fortSimple10 +for_fortSimple10: beq %8, %9 --> for_fortSimple9, for_fortSimple4 +for_fortSimple4 : emit c52 --> for_fortSimple3 +for_fortSimple3 : add %4, %3, %0 --> for_fortSimple2 +for_fortSimple2 : emit c51 --> for_fortSimple1 +for_fortSimple1 : move %7, %4 --> for_fortSimple0 +for_fortSimple0 : j --> for_fortSimple53 +for_fortSimple53: move $v0, %7 --> for_fortSimple52 +for_fortSimple52: move $ra, %20 --> for_fortSimple51 +for_fortSimple51: move $s7, %19 --> for_fortSimple50 +for_fortSimple50: move $s6, %18 --> for_fortSimple49 +for_fortSimple49: move $s5, %17 --> for_fortSimple48 +for_fortSimple48: move $s4, %16 --> for_fortSimple47 +for_fortSimple47: move $s3, %15 --> for_fortSimple46 +for_fortSimple46: move $s2, %14 --> for_fortSimple45 +for_fortSimple45: move $s1, %13 --> for_fortSimple44 +for_fortSimple44: move $s0, %12 --> for_fortSimple43 +for_fortSimple43: delframe --> for_fortSimple42 +for_fortSimple42: jr $ra (xmits $v0) +for_fortSimple9 : emit c53 --> for_fortSimple8 +for_fortSimple8 : add %3, %3, %5 --> for_fortSimple7 +for_fortSimple7 : emit c54 --> for_fortSimple6 +for_fortSimple6 : add %5, %5, %2 --> for_fortSimple5 + +procedure for_forfor(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19 +entry for_forfor44 +for_forfor44: newframe --> for_forfor43 +for_forfor43: move %19, $ra --> for_forfor42 +for_forfor42: move %18, $s7 --> for_forfor41 +for_forfor41: move %17, $s6 --> for_forfor40 +for_forfor40: move %16, $s5 --> for_forfor39 +for_forfor39: move %15, $s4 --> for_forfor38 +for_forfor38: move %14, $s3 --> for_forfor37 +for_forfor37: move %13, $s2 --> for_forfor36 +for_forfor36: move %12, $s1 --> for_forfor35 +for_forfor35: move %11, $s0 --> for_forfor34 +for_forfor34: li %0, 0 --> for_forfor33 +for_forfor33: li %1, 0 --> for_forfor32 +for_forfor32: li %3, 0 --> for_forfor31 +for_forfor31: li %4, 0 --> for_forfor30 +for_forfor30: li %5, 0 --> for_forfor29 +for_forfor29: li %6, 0 --> for_forfor28 +for_forfor28: li %7, 0 --> for_forfor27 +for_forfor27: li %8, 0 --> for_forfor26 +for_forfor26: li %9, 0 --> for_forfor25 +for_forfor25: li %10, 0 --> for_forfor23 +for_forfor23: emit c94 --> for_forfor22 +for_forfor22: emit c93 --> for_forfor21 +for_forfor21: li %1, 0 --> for_forfor20 +for_forfor20: emit c92 --> for_forfor19 +for_forfor19: li %0, 0 --> for_forfor3 +for_forfor3 : j --> for_forfor18 +for_forfor18: li %7, 0 --> for_forfor17 +for_forfor17: emit c91 --> for_forfor16 +for_forfor16: li %9, 10 --> for_forfor15 +for_forfor15: slt %8, %1, %9 --> for_forfor14 +for_forfor14: li %10, 0 --> for_forfor24 +for_forfor24: seq %6, %8, %10 --> for_forfor13 +for_forfor13: beq %6, %7 --> for_forfor12, for_forfor2 +for_forfor2 : emit c87 --> for_forfor1 +for_forfor1 : move %2, %0 --> for_forfor0 +for_forfor0 : j --> for_forfor56 +for_forfor56: move $v0, %2 --> for_forfor55 +for_forfor55: move $ra, %19 --> for_forfor54 +for_forfor54: move $s7, %18 --> for_forfor53 +for_forfor53: move $s6, %17 --> for_forfor52 +for_forfor52: move $s5, %16 --> for_forfor51 +for_forfor51: move $s4, %15 --> for_forfor50 +for_forfor50: move $s3, %14 --> for_forfor49 +for_forfor49: move $s2, %13 --> for_forfor48 +for_forfor48: move $s1, %12 --> for_forfor47 +for_forfor47: move $s0, %11 --> for_forfor46 +for_forfor46: delframe --> for_forfor45 +for_forfor45: jr $ra (xmits $v0) +for_forfor12: emit c89 --> for_forfor11 +for_forfor11: li %5, 1 --> for_forfor10 +for_forfor10: add %0, %0, %5 --> for_forfor9 +for_forfor9 : emit c88 --> for_forfor8 +for_forfor8 : li %4, 1 --> for_forfor7 +for_forfor7 : add %0, %0, %4 --> for_forfor6 +for_forfor6 : emit c90 --> for_forfor5 +for_forfor5 : li %3, 1 --> for_forfor4 +for_forfor4 : add %1, %1, %3 --> for_forfor3 + +procedure for_ex(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21 +entry for_ex43 +for_ex43: newframe --> for_ex42 +for_ex42: move %21, $ra --> for_ex41 +for_ex41: move %20, $s7 --> for_ex40 +for_ex40: move %19, $s6 --> for_ex39 +for_ex39: move %18, $s5 --> for_ex38 +for_ex38: move %17, $s4 --> for_ex37 +for_ex37: move %16, $s3 --> for_ex36 +for_ex36: move %15, $s2 --> for_ex35 +for_ex35: move %14, $s1 --> for_ex34 +for_ex34: move %13, $s0 --> for_ex33 +for_ex33: move %0, $a0 --> for_ex32 +for_ex32: move %1, $a1 --> for_ex31 +for_ex31: move %2, $a2 --> for_ex30 +for_ex30: li %3, 0 --> for_ex29 +for_ex29: li %4, 0 --> for_ex28 +for_ex28: li %6, 0 --> for_ex27 +for_ex27: li %7, 0 --> for_ex26 +for_ex26: li %8, 0 --> for_ex25 +for_ex25: li %9, 0 --> for_ex24 +for_ex24: li %10, 0 --> for_ex23 +for_ex23: li %11, 0 --> for_ex22 +for_ex22: li %12, 0 --> for_ex20 +for_ex20: emit c50 --> for_ex19 +for_ex19: li %3, 0 --> for_ex18 +for_ex18: emit c49 --> for_ex17 +for_ex17: emit c48 --> for_ex16 +for_ex16: li %11, 3 --> for_ex15 +for_ex15: add %4, %0, %11 --> for_ex3 +for_ex3 : j --> for_ex14 +for_ex14: li %7, 0 --> for_ex13 +for_ex13: emit c47 --> for_ex12 +for_ex12: li %10, 2 --> for_ex11 +for_ex11: mulo %9, %1, %10 --> for_ex10 +for_ex10: sle %8, %4, %9 --> for_ex9 +for_ex9 : li %12, 0 --> for_ex21 +for_ex21: seq %6, %8, %12 --> for_ex8 +for_ex8 : beq %6, %7 --> for_ex7, for_ex2 +for_ex2 : emit c44 --> for_ex1 +for_ex1 : move %5, %3 --> for_ex0 +for_ex0 : j --> for_ex55 +for_ex55: move $v0, %5 --> for_ex54 +for_ex54: move $ra, %21 --> for_ex53 +for_ex53: move $s7, %20 --> for_ex52 +for_ex52: move $s6, %19 --> for_ex51 +for_ex51: move $s5, %18 --> for_ex50 +for_ex50: move $s4, %17 --> for_ex49 +for_ex49: move $s3, %16 --> for_ex48 +for_ex48: move $s2, %15 --> for_ex47 +for_ex47: move $s1, %14 --> for_ex46 +for_ex46: move $s0, %13 --> for_ex45 +for_ex45: delframe --> for_ex44 +for_ex44: jr $ra (xmits $v0) +for_ex7 : emit c45 --> for_ex6 +for_ex6 : sub %3, %3, %4 --> for_ex5 +for_ex5 : emit c46 --> for_ex4 +for_ex4 : add %4, %4, %2 --> for_ex3 + +procedure for_double(1) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25 +entry for_double64 +for_double64: newframe --> for_double63 +for_double63: move %25, $ra --> for_double62 +for_double62: move %24, $s7 --> for_double61 +for_double61: move %23, $s6 --> for_double60 +for_double60: move %22, $s5 --> for_double59 +for_double59: move %21, $s4 --> for_double58 +for_double58: move %20, $s3 --> for_double57 +for_double57: move %19, $s2 --> for_double56 +for_double56: move %18, $s1 --> for_double55 +for_double55: move %17, $s0 --> for_double54 +for_double54: move %0, $a0 --> for_double53 +for_double53: li %1, 0 --> for_double52 +for_double52: li %2, 0 --> for_double51 +for_double51: li %3, 0 --> for_double50 +for_double50: li %4, 0 --> for_double49 +for_double49: li %5, 0 --> for_double48 +for_double48: li %7, 0 --> for_double47 +for_double47: li %8, 0 --> for_double46 +for_double46: li %9, 0 --> for_double45 +for_double45: li %10, 0 --> for_double44 +for_double44: li %11, 0 --> for_double43 +for_double43: li %12, 0 --> for_double42 +for_double42: li %13, 0 --> for_double41 +for_double41: li %14, 0 --> for_double40 +for_double40: li %15, 0 --> for_double39 +for_double39: li %16, 0 --> for_double36 +for_double36: emit c43 --> for_double35 +for_double35: li %5, 0 --> for_double34 +for_double34: emit c42 --> for_double33 +for_double33: li %4, 0 --> for_double32 +for_double32: emit c41 --> for_double31 +for_double31: emit c40 --> for_double30 +for_double30: li %2, 0 --> for_double19 +for_double19: j --> for_double29 +for_double29: li %12, 0 --> for_double28 +for_double28: emit c39 --> for_double27 +for_double27: li %14, 12 --> for_double26 +for_double26: slt %13, %2, %14 --> for_double25 +for_double25: li %16, 0 --> for_double38 +for_double38: seq %11, %13, %16 --> for_double24 +for_double24: beq %11, %12 --> for_double23, for_double18 +for_double18: emit c36 --> for_double17 +for_double17: emit c35 --> for_double16 +for_double16: li %1, 0 --> for_double5 +for_double5 : j --> for_double15 +for_double15: li %8, 0 --> for_double14 +for_double14: emit c34 --> for_double13 +for_double13: li %10, 5 --> for_double12 +for_double12: slt %9, %1, %10 --> for_double11 +for_double11: li %15, 0 --> for_double37 +for_double37: seq %7, %9, %15 --> for_double10 +for_double10: beq %7, %8 --> for_double9, for_double4 +for_double4 : emit c31 --> for_double3 +for_double3 : mulo %3, %5, %4 --> for_double2 +for_double2 : emit c30 --> for_double1 +for_double1 : move %6, %3 --> for_double0 +for_double0 : j --> for_double76 +for_double76: move $v0, %6 --> for_double75 +for_double75: move $ra, %25 --> for_double74 +for_double74: move $s7, %24 --> for_double73 +for_double73: move $s6, %23 --> for_double72 +for_double72: move $s5, %22 --> for_double71 +for_double71: move $s4, %21 --> for_double70 +for_double70: move $s3, %20 --> for_double69 +for_double69: move $s2, %19 --> for_double68 +for_double68: move $s1, %18 --> for_double67 +for_double67: move $s0, %17 --> for_double66 +for_double66: delframe --> for_double65 +for_double65: jr $ra (xmits $v0) +for_double9 : emit c32 --> for_double8 +for_double8 : add %4, %4, %1 --> for_double7 +for_double7 : emit c33 --> for_double6 +for_double6 : add %1, %1, %0 --> for_double5 +for_double23: emit c37 --> for_double22 +for_double22: add %5, %5, %2 --> for_double21 +for_double21: emit c38 --> for_double20 +for_double20: add %2, %2, %0 --> for_double19 + +procedure for_2(2) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24 +entry for_253 +for_253: newframe --> for_252 +for_252: move %24, $ra --> for_251 +for_251: move %23, $s7 --> for_250 +for_250: move %22, $s6 --> for_249 +for_249: move %21, $s5 --> for_248 +for_248: move %20, $s4 --> for_247 +for_247: move %19, $s3 --> for_246 +for_246: move %18, $s2 --> for_245 +for_245: move %17, $s1 --> for_244 +for_244: move %16, $s0 --> for_243 +for_243: move %0, $a0 --> for_242 +for_242: move %1, $a1 --> for_241 +for_241: li %2, 0 --> for_240 +for_240: li %3, 0 --> for_239 +for_239: li %4, 0 --> for_238 +for_238: li %5, 0 --> for_237 +for_237: li %6, 0 --> for_236 +for_236: li %8, 0 --> for_235 +for_235: li %9, 0 --> for_234 +for_234: li %10, 0 --> for_233 +for_233: li %11, 0 --> for_232 +for_232: li %12, 0 --> for_231 +for_231: li %13, 0 --> for_230 +for_230: li %14, 0 --> for_229 +for_229: li %15, 0 --> for_227 +for_227: emit c9 --> for_226 +for_226: li %5, 0 --> for_225 +for_225: emit c8 --> for_224 +for_224: li %14, 2 --> for_223 +for_223: mulo %6, %0, %14 --> for_222 +for_222: emit c7 --> for_221 +for_221: li %13, 4 --> for_220 +for_220: mulo %2, %0, %13 --> for_219 +for_219: emit c6 --> for_218 +for_218: li %12, 1 --> for_217 +for_217: add %3, %1, %12 --> for_216 +for_216: emit c5 --> for_215 +for_215: emit c4 --> for_214 +for_214: move %4, %6 --> for_24 +for_24 : j --> for_213 +for_213: li %10, 0 --> for_212 +for_212: emit c3 --> for_211 +for_211: slt %11, %4, %2 --> for_210 +for_210: li %15, 0 --> for_228 +for_228: seq %9, %11, %15 --> for_29 +for_29 : beq %9, %10 --> for_28, for_23 +for_23 : emit c0 --> for_22 +for_22 : li %8, 1 --> for_21 +for_21 : add %7, %5, %8 --> for_20 +for_20 : j --> for_265 +for_265: move $v0, %7 --> for_264 +for_264: move $ra, %24 --> for_263 +for_263: move $s7, %23 --> for_262 +for_262: move $s6, %22 --> for_261 +for_261: move $s5, %21 --> for_260 +for_260: move $s4, %20 --> for_259 +for_259: move $s3, %19 --> for_258 +for_258: move $s2, %18 --> for_257 +for_257: move $s1, %17 --> for_256 +for_256: move $s0, %16 --> for_255 +for_255: delframe --> for_254 +for_254: jr $ra (xmits $v0) +for_28 : emit c1 --> for_27 +for_27 : add %5, %5, %4 --> for_26 +for_26 : emit c2 --> for_25 +for_25 : add %4, %4, %3 --> for_24 + +procedure _main(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37 +entry main85 +main85 : newframe --> main84 +main84 : move %37, $ra --> main83 +main83 : move %36, $s7 --> main82 +main82 : move %35, $s6 --> main81 +main81 : move %34, $s5 --> main80 +main80 : move %33, $s4 --> main79 +main79 : move %32, $s3 --> main78 +main78 : move %31, $s2 --> main77 +main77 : move %30, $s1 --> main76 +main76 : move %29, $s0 --> main75 +main75 : li %0, 0 --> main74 +main74 : li %2, 0 --> main73 +main73 : li %3, 0 --> main72 +main72 : li %4, 0 --> main71 +main71 : li %5, 0 --> main70 +main70 : li %6, 0 --> main69 +main69 : li %7, 0 --> main68 +main68 : li %8, 0 --> main67 +main67 : li %9, 0 --> main66 +main66 : li %10, 0 --> main65 +main65 : li %11, 0 --> main64 +main64 : li %12, 0 --> main63 +main63 : li %13, 0 --> main62 +main62 : li %14, 0 --> main61 +main61 : li %15, 0 --> main60 +main60 : li %16, 0 --> main59 +main59 : li %17, 0 --> main58 +main58 : li %18, 0 --> main57 +main57 : li %19, 0 --> main56 +main56 : li %20, 0 --> main55 +main55 : li %21, 0 --> main54 +main54 : li %22, 0 --> main53 +main53 : li %23, 0 --> main52 +main52 : li %24, 0 --> main51 +main51 : li %25, 0 --> main50 +main50 : li %26, 0 --> main49 +main49 : li %27, 0 --> main48 +main48 : li %28, 0 --> main38 +main38 : emit c104 --> main37 +main37 : li %18, 3 --> main36 +main36 : li %19, 1 --> main35 +main35 : la %26, for_2 --> main45 +main45 : j --> main125 +main125: move $a0, %18 --> main124 +main124: move $a1, %19 --> main123 +main123: call %26(2) --> main122 +main122: move %0, $v0 --> main34 +main34 : emit c103 --> main33 +main33 : li %15, 1 --> main32 +main32 : li %16, 2 --> main31 +main31 : li %17, 3 --> main30 +main30 : la %25, for_loopParalAsync --> main44 +main44 : j --> main121 +main121: move $a0, %15 --> main120 +main120: move $a1, %16 --> main119 +main119: move $a2, %17 --> main118 +main118: call %25(3) --> main117 +main117: move %0, $v0 --> main29 +main29 : emit c102 --> main28 +main28 : li %14, 1 --> main27 +main27 : la %23, for_double --> main42 +main42 : j --> main114 +main114: move $a0, %14 --> main113 +main113: call %23(1) --> main112 +main112: move %0, $v0 --> main26 +main26 : emit c101 --> main25 +main25 : li %11, 2 --> main24 +main24 : li %12, 10 --> main23 +main23 : li %13, 1 --> main22 +main22 : la %22, for_ex --> main41 +main41 : j --> main111 +main111: move $a0, %11 --> main110 +main110: move $a1, %12 --> main109 +main109: move $a2, %13 --> main108 +main108: call %22(3) --> main107 +main107: move %0, $v0 --> main21 +main21 : emit c100 --> main20 +main20 : li %8, 2 --> main19 +main19 : li %9, 10 --> main18 +main18 : li %10, 1 --> main17 +main17 : la %21, for_fortSimple --> main40 +main40 : j --> main106 +main106: move $a0, %8 --> main105 +main105: move $a1, %9 --> main104 +main104: move $a2, %10 --> main103 +main103: call %21(3) --> main102 +main102: move %0, $v0 --> main16 +main16 : emit c99 --> main15 +main15 : li %6, 2 --> main14 +main14 : li %7, 3 --> main13 +main13 : la %20, for_imbriq --> main39 +main39 : j --> main101 +main101: move $a0, %6 --> main100 +main100: move $a1, %7 --> main99 +main99 : call %20(2) --> main98 +main98 : move %0, $v0 --> main12 +main12 : emit c98 --> main11 +main11 : li %4, 2 --> main10 +main10 : li %5, 3 --> main9 +main9 : la %28, for_incr --> main47 +main47 : j --> main133 +main133: move $a0, %4 --> main132 +main132: move $a1, %5 --> main131 +main131: call %28(2) --> main130 +main130: move %0, $v0 --> main8 +main8 : emit c97 --> main7 +main7 : li %2, 2 --> main6 +main6 : li %3, 3 --> main5 +main5 : la %27, for_incrParam --> main46 +main46 : j --> main129 +main129: move $a0, %2 --> main128 +main128: move $a1, %3 --> main127 +main127: call %27(2) --> main126 +main126: move %0, $v0 --> main4 +main4 : emit c96 --> main3 +main3 : la %24, for_forfor --> main43 +main43 : j --> main116 +main116: call %24(0) --> main115 +main115: move %0, $v0 --> main2 +main2 : emit c95 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main97 +main97 : move $v0, %1 --> main96 +main96 : move $ra, %37 --> main95 +main95 : move $s7, %36 --> main94 +main94 : move $s6, %35 --> main93 +main93 : move $s5, %34 --> main92 +main92 : move $s4, %33 --> main91 +main91 : move $s3, %32 --> main90 +main90 : move $s2, %31 --> main89 +main89 : move $s1, %30 --> main88 +main88 : move $s0, %29 --> main87 +main87 : delframe --> main86 +main86 : jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/for.LIN.expected b/tests/clight/for.LIN.expected new file mode 100644 index 0000000..052ea26 --- /dev/null +++ b/tests/clight/for.LIN.expected @@ -0,0 +1,803 @@ +program + +globals 0 + +procedure for_loopParalAsync(3) +var 0 +for_loopParalAsync94: +newframe +c29: +li $v0, 0 +c28: +li $a2, 0 +c27: +li $a0, 3 +add $a2, $a2, $a0 +c26: +li $a0, 2 +mulo $a2, $a2, $a0 +c25: +li $a0, 3 +div $a2, $a2, $a0 +c24: +li $a0, 8 +add $a2, $a2, $a0 +c23: +c22: +li $a1, 0 +for_loopParalAsync37: +li $a3, 0 +c21: +li $a0, 20 +slt $a0, $a1, $a0 +seq $a0, $a0, $zero +beq $a0, $a3, for_loopParalAsync31 +c16: +c15: +li $a1, 1 +for_loopParalAsync16: +li $a3, 0 +c14: +slt $a0, $a1, $a2 +seq $a0, $a0, $zero +beq $a0, $a3, for_loopParalAsync11 +c10: +delframe +jr $ra +for_loopParalAsync11: +c12: +c11: +c13: +li $a0, 1 +add $a1, $a1, $a0 +j for_loopParalAsync16 +for_loopParalAsync31: +c19: +li $a0, 1 +add $v0, $v0, $a0 +c18: +c17: +c20: +li $a0, 1 +add $a1, $a1, $a0 +j for_loopParalAsync37 + +procedure for_incrParam(2) +var 0 +for_incrParam49: +newframe +c86: +add $a3, $a0, $a1 +c85: +c84: +c83: +li $v0, 4 +sub $v0, $a3, $v0 +for_incrParam15: +li $t0, 0 +c82: +li $a2, 6 +add $a2, $a1, $a2 +slt $a2, $v0, $a2 +seq $a2, $a2, $zero +beq $a2, $t0, for_incrParam8 +c79: +delframe +jr $ra +for_incrParam8: +c80: +add $v0, $v0, $a3 +add $v0, $v0, $a0 +c81: +add $v0, $v0, $a0 +j for_incrParam15 + +procedure for_incr(2) +var 0 +for_incr44: +newframe +c78: +li $v0, 0 +c77: +c76: +li $a2, 3 +add $a2, $a0, $a2 +for_incr15: +li $a3, 0 +c75: +li $a0, 2 +mulo $a0, $a1, $a0 +sle $a0, $a2, $a0 +seq $a0, $a0, $zero +beq $a0, $a3, for_incr8 +c72: +delframe +jr $ra +for_incr8: +c73: +sub $v0, $v0, $a2 +c74: +li $a0, 1 +add $a2, $a2, $a0 +j for_incr15 + +procedure for_imbriq(2) +var 24 +for_imbriq64: +newframe +sw $ra, 20($sp) +sw $s4, 16($sp) +sw $s3, 12($sp) +sw $s2, 8($sp) +sw $s1, 4($sp) +sw $s0, 0($sp) +move $s4, $a0 +move $s3, $a1 +c71: +li $s0, 0 +c70: +c69: +li $s1, 0 +for_imbriq29: +li $a0, 0 +c68: +li $v0, 23 +slt $v0, $s1, $v0 +seq $v0, $v0, $zero +beq $v0, $a0, for_imbriq23 +c59: +move $v0, $s0 +lw $ra, 20($sp) +lw $s4, 16($sp) +lw $s3, 12($sp) +lw $s2, 8($sp) +lw $s1, 4($sp) +lw $s0, 0($sp) +delframe +jr $ra +for_imbriq23: +c66: +li $v0, 0 +c65: +c64: +li $s2, 1 +for_imbriq18: +li $a1, 0 +c63: +li $a0, 12 +slt $a0, $s2, $a0 +seq $a0, $a0, $zero +beq $a0, $a1, for_imbriq12 +c67: +add $s1, $s1, $s4 +j for_imbriq29 +for_imbriq12: +c61: +add $s0, $s0, $v0 +c60: +la $a2, mod +move $a0, $v0 +move $a1, $s2 +call $a2 +c62: +add $s2, $s2, $s3 +j for_imbriq18 + +procedure for_fortSimple(3) +var 0 +for_fortSimple41: +newframe +c58: +li $t0, 0 +c57: +c56: +move $a3, $a0 +for_fortSimple14: +li $t1, 0 +c55: +slt $v0, $a3, $a1 +seq $v0, $v0, $zero +beq $v0, $t1, for_fortSimple9 +c52: +add $v0, $t0, $a0 +c51: +delframe +jr $ra +for_fortSimple9: +c53: +add $t0, $t0, $a3 +c54: +add $a3, $a3, $a2 +j for_fortSimple14 + +procedure for_forfor(0) +var 0 +for_forfor44: +newframe +c94: +c93: +li $a1, 0 +c92: +li $v0, 0 +for_forfor18: +li $a2, 0 +c91: +li $a0, 10 +slt $a0, $a1, $a0 +seq $a0, $a0, $zero +beq $a0, $a2, for_forfor12 +c87: +delframe +jr $ra +for_forfor12: +c89: +li $a0, 1 +add $v0, $v0, $a0 +c88: +li $a0, 1 +add $v0, $v0, $a0 +c90: +li $a0, 1 +add $a1, $a1, $a0 +j for_forfor18 + +procedure for_ex(3) +var 0 +for_ex43: +newframe +c50: +li $v0, 0 +c49: +c48: +li $a3, 3 +add $a3, $a0, $a3 +for_ex14: +li $t0, 0 +c47: +li $a0, 2 +mulo $a0, $a1, $a0 +sle $a0, $a3, $a0 +seq $a0, $a0, $zero +beq $a0, $t0, for_ex7 +c44: +delframe +jr $ra +for_ex7: +c45: +sub $v0, $v0, $a3 +c46: +add $a3, $a3, $a2 +j for_ex14 + +procedure for_double(1) +var 0 +for_double64: +newframe +c43: +li $a1, 0 +c42: +li $a2, 0 +c41: +c40: +li $a3, 0 +for_double29: +li $t0, 0 +c39: +li $v0, 12 +slt $v0, $a3, $v0 +seq $v0, $v0, $zero +beq $v0, $t0, for_double23 +c36: +c35: +li $a3, 0 +for_double15: +li $t0, 0 +c34: +li $v0, 5 +slt $v0, $a3, $v0 +seq $v0, $v0, $zero +beq $v0, $t0, for_double9 +c31: +mulo $v0, $a1, $a2 +c30: +delframe +jr $ra +for_double9: +c32: +add $a2, $a2, $a3 +c33: +add $a3, $a3, $a0 +j for_double15 +for_double23: +c37: +add $a1, $a1, $a3 +c38: +add $a3, $a3, $a0 +j for_double29 + +procedure for_2(2) +var 0 +for_253: +newframe +c9: +li $a2, 0 +c8: +li $v0, 2 +mulo $v0, $a0, $v0 +c7: +li $a3, 4 +mulo $a0, $a0, $a3 +c6: +li $a3, 1 +add $a1, $a1, $a3 +c5: +c4: +for_213: +li $t0, 0 +c3: +slt $a3, $v0, $a0 +seq $a3, $a3, $zero +beq $a3, $t0, for_28 +c0: +li $v0, 1 +add $v0, $a2, $v0 +delframe +jr $ra +for_28: +c1: +add $a2, $a2, $v0 +c2: +add $v0, $v0, $a1 +j for_213 + +procedure _main(0) +var 4 +main85: +newframe +sw $ra, 0($sp) +c104: +li $a0, 3 +li $a1, 1 +la $v0, for_2 +call $v0 +c103: +li $a0, 1 +li $a1, 2 +li $a2, 3 +la $v0, for_loopParalAsync +call $v0 +c102: +li $a0, 1 +la $v0, for_double +call $v0 +c101: +li $a0, 2 +li $a1, 10 +li $a2, 1 +la $v0, for_ex +call $v0 +c100: +li $a0, 2 +li $a1, 10 +li $a2, 1 +la $v0, for_fortSimple +call $v0 +c99: +li $a0, 2 +li $a1, 3 +la $v0, for_imbriq +call $v0 +c98: +li $a0, 2 +li $a1, 3 +la $v0, for_incr +call $v0 +c97: +li $a0, 2 +li $a1, 3 +la $v0, for_incrParam +call $v0 +c96: +la $v0, for_forfor +call $v0 +c95: +lw $ra, 0($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/for.LTL.expected b/tests/clight/for.LTL.expected new file mode 100644 index 0000000..f39cca0 --- /dev/null +++ b/tests/clight/for.LTL.expected @@ -0,0 +1,1191 @@ +program + +globals 0 + +procedure for_loopParalAsync(3) +var 0 +entry for_loopParalAsync94 +for_loopParalAsync94 : newframe --> for_loopParalAsync93 +for_loopParalAsync93 : j --> for_loopParalAsync92 +for_loopParalAsync92 : j --> for_loopParalAsync91 +for_loopParalAsync91 : j --> for_loopParalAsync90 +for_loopParalAsync90 : j --> for_loopParalAsync89 +for_loopParalAsync89 : j --> for_loopParalAsync88 +for_loopParalAsync88 : j --> for_loopParalAsync87 +for_loopParalAsync87 : j --> for_loopParalAsync86 +for_loopParalAsync86 : j --> for_loopParalAsync85 +for_loopParalAsync85 : j --> for_loopParalAsync84 +for_loopParalAsync84 : j --> for_loopParalAsync83 +for_loopParalAsync83 : j --> for_loopParalAsync82 +for_loopParalAsync82 : j --> for_loopParalAsync81 +for_loopParalAsync81 : j --> for_loopParalAsync80 +for_loopParalAsync80 : j --> for_loopParalAsync79 +for_loopParalAsync79 : j --> for_loopParalAsync78 +for_loopParalAsync78 : j --> for_loopParalAsync77 +for_loopParalAsync77 : j --> for_loopParalAsync76 +for_loopParalAsync76 : j --> for_loopParalAsync75 +for_loopParalAsync75 : j --> for_loopParalAsync74 +for_loopParalAsync74 : j --> for_loopParalAsync73 +for_loopParalAsync73 : j --> for_loopParalAsync72 +for_loopParalAsync72 : j --> for_loopParalAsync71 +for_loopParalAsync71 : j --> for_loopParalAsync70 +for_loopParalAsync70 : j --> for_loopParalAsync69 +for_loopParalAsync69 : j --> for_loopParalAsync68 +for_loopParalAsync68 : j --> for_loopParalAsync67 +for_loopParalAsync67 : j --> for_loopParalAsync66 +for_loopParalAsync66 : j --> for_loopParalAsync65 +for_loopParalAsync65 : j --> for_loopParalAsync64 +for_loopParalAsync64 : j --> for_loopParalAsync63 +for_loopParalAsync63 : j --> for_loopParalAsync62 +for_loopParalAsync62 : j --> for_loopParalAsync61 +for_loopParalAsync61 : j --> for_loopParalAsync60 +for_loopParalAsync60 : j --> for_loopParalAsync59 +for_loopParalAsync59 : j --> for_loopParalAsync56 +for_loopParalAsync56 : emit c29 --> for_loopParalAsync55 +for_loopParalAsync55 : li $v0, 0 --> for_loopParalAsync54 +for_loopParalAsync54 : emit c28 --> for_loopParalAsync53 +for_loopParalAsync53 : li $a2, 0 --> for_loopParalAsync52 +for_loopParalAsync52 : emit c27 --> for_loopParalAsync51 +for_loopParalAsync51 : li $a0, 3 --> for_loopParalAsync50 +for_loopParalAsync50 : add $a2, $a2, $a0 --> for_loopParalAsync49 +for_loopParalAsync49 : emit c26 --> for_loopParalAsync48 +for_loopParalAsync48 : li $a0, 2 --> for_loopParalAsync47 +for_loopParalAsync47 : mulo $a2, $a2, $a0 --> for_loopParalAsync46 +for_loopParalAsync46 : emit c25 --> for_loopParalAsync45 +for_loopParalAsync45 : li $a0, 3 --> for_loopParalAsync44 +for_loopParalAsync44 : div $a2, $a2, $a0 --> for_loopParalAsync43 +for_loopParalAsync43 : emit c24 --> for_loopParalAsync42 +for_loopParalAsync42 : li $a0, 8 --> for_loopParalAsync41 +for_loopParalAsync41 : add $a2, $a2, $a0 --> for_loopParalAsync40 +for_loopParalAsync40 : emit c23 --> for_loopParalAsync39 +for_loopParalAsync39 : emit c22 --> for_loopParalAsync38 +for_loopParalAsync38 : li $a1, 0 --> for_loopParalAsync20 +for_loopParalAsync20 : j --> for_loopParalAsync37 +for_loopParalAsync37 : li $a3, 0 --> for_loopParalAsync36 +for_loopParalAsync36 : emit c21 --> for_loopParalAsync35 +for_loopParalAsync35 : li $a0, 20 --> for_loopParalAsync34 +for_loopParalAsync34 : slt $a0, $a1, $a0 --> for_loopParalAsync33 +for_loopParalAsync33 : j --> for_loopParalAsync58 +for_loopParalAsync58 : seq $a0, $a0, $zero --> for_loopParalAsync32 +for_loopParalAsync32 : beq $a0, $a3 --> for_loopParalAsync31, for_loopParalAsync19 +for_loopParalAsync19 : emit c16 --> for_loopParalAsync18 +for_loopParalAsync18 : emit c15 --> for_loopParalAsync17 +for_loopParalAsync17 : li $a1, 1 --> for_loopParalAsync3 +for_loopParalAsync3 : j --> for_loopParalAsync16 +for_loopParalAsync16 : li $a3, 0 --> for_loopParalAsync15 +for_loopParalAsync15 : emit c14 --> for_loopParalAsync14 +for_loopParalAsync14 : slt $a0, $a1, $a2 --> for_loopParalAsync13 +for_loopParalAsync13 : j --> for_loopParalAsync57 +for_loopParalAsync57 : seq $a0, $a0, $zero --> for_loopParalAsync12 +for_loopParalAsync12 : beq $a0, $a3 --> for_loopParalAsync11, for_loopParalAsync2 +for_loopParalAsync2 : emit c10 --> for_loopParalAsync1 +for_loopParalAsync1 : j --> for_loopParalAsync0 +for_loopParalAsync0 : j --> for_loopParalAsync106 +for_loopParalAsync106: j --> for_loopParalAsync105 +for_loopParalAsync105: j --> for_loopParalAsync104 +for_loopParalAsync104: j --> for_loopParalAsync103 +for_loopParalAsync103: j --> for_loopParalAsync102 +for_loopParalAsync102: j --> for_loopParalAsync101 +for_loopParalAsync101: j --> for_loopParalAsync100 +for_loopParalAsync100: j --> for_loopParalAsync99 +for_loopParalAsync99 : j --> for_loopParalAsync98 +for_loopParalAsync98 : j --> for_loopParalAsync97 +for_loopParalAsync97 : j --> for_loopParalAsync96 +for_loopParalAsync96 : delframe --> for_loopParalAsync95 +for_loopParalAsync95 : jr $ra +for_loopParalAsync11 : emit c12 --> for_loopParalAsync10 +for_loopParalAsync10 : j --> for_loopParalAsync9 +for_loopParalAsync9 : j --> for_loopParalAsync8 +for_loopParalAsync8 : emit c11 --> for_loopParalAsync7 +for_loopParalAsync7 : j --> for_loopParalAsync6 +for_loopParalAsync6 : emit c13 --> for_loopParalAsync5 +for_loopParalAsync5 : li $a0, 1 --> for_loopParalAsync4 +for_loopParalAsync4 : add $a1, $a1, $a0 --> for_loopParalAsync3 +for_loopParalAsync31 : emit c19 --> for_loopParalAsync30 +for_loopParalAsync30 : li $a0, 1 --> for_loopParalAsync29 +for_loopParalAsync29 : add $v0, $v0, $a0 --> for_loopParalAsync28 +for_loopParalAsync28 : emit c18 --> for_loopParalAsync27 +for_loopParalAsync27 : j --> for_loopParalAsync26 +for_loopParalAsync26 : j --> for_loopParalAsync25 +for_loopParalAsync25 : emit c17 --> for_loopParalAsync24 +for_loopParalAsync24 : j --> for_loopParalAsync23 +for_loopParalAsync23 : emit c20 --> for_loopParalAsync22 +for_loopParalAsync22 : li $a0, 1 --> for_loopParalAsync21 +for_loopParalAsync21 : add $a1, $a1, $a0 --> for_loopParalAsync20 + +procedure for_incrParam(2) +var 0 +entry for_incrParam49 +for_incrParam49: newframe --> for_incrParam48 +for_incrParam48: j --> for_incrParam47 +for_incrParam47: j --> for_incrParam46 +for_incrParam46: j --> for_incrParam45 +for_incrParam45: j --> for_incrParam44 +for_incrParam44: j --> for_incrParam43 +for_incrParam43: j --> for_incrParam42 +for_incrParam42: j --> for_incrParam41 +for_incrParam41: j --> for_incrParam40 +for_incrParam40: j --> for_incrParam39 +for_incrParam39: j --> for_incrParam38 +for_incrParam38: j --> for_incrParam37 +for_incrParam37: j --> for_incrParam36 +for_incrParam36: j --> for_incrParam35 +for_incrParam35: j --> for_incrParam34 +for_incrParam34: j --> for_incrParam33 +for_incrParam33: j --> for_incrParam32 +for_incrParam32: j --> for_incrParam31 +for_incrParam31: j --> for_incrParam30 +for_incrParam30: j --> for_incrParam29 +for_incrParam29: j --> for_incrParam28 +for_incrParam28: j --> for_incrParam27 +for_incrParam27: j --> for_incrParam26 +for_incrParam26: j --> for_incrParam24 +for_incrParam24: emit c86 --> for_incrParam23 +for_incrParam23: add $a3, $a0, $a1 --> for_incrParam22 +for_incrParam22: emit c85 --> for_incrParam21 +for_incrParam21: j --> for_incrParam20 +for_incrParam20: j --> for_incrParam19 +for_incrParam19: emit c84 --> for_incrParam18 +for_incrParam18: emit c83 --> for_incrParam17 +for_incrParam17: li $v0, 4 --> for_incrParam16 +for_incrParam16: sub $v0, $a3, $v0 --> for_incrParam3 +for_incrParam3 : j --> for_incrParam15 +for_incrParam15: li $t0, 0 --> for_incrParam14 +for_incrParam14: emit c82 --> for_incrParam13 +for_incrParam13: li $a2, 6 --> for_incrParam12 +for_incrParam12: add $a2, $a1, $a2 --> for_incrParam11 +for_incrParam11: slt $a2, $v0, $a2 --> for_incrParam10 +for_incrParam10: j --> for_incrParam25 +for_incrParam25: seq $a2, $a2, $zero --> for_incrParam9 +for_incrParam9 : beq $a2, $t0 --> for_incrParam8, for_incrParam2 +for_incrParam2 : emit c79 --> for_incrParam1 +for_incrParam1 : j --> for_incrParam0 +for_incrParam0 : j --> for_incrParam61 +for_incrParam61: j --> for_incrParam60 +for_incrParam60: j --> for_incrParam59 +for_incrParam59: j --> for_incrParam58 +for_incrParam58: j --> for_incrParam57 +for_incrParam57: j --> for_incrParam56 +for_incrParam56: j --> for_incrParam55 +for_incrParam55: j --> for_incrParam54 +for_incrParam54: j --> for_incrParam53 +for_incrParam53: j --> for_incrParam52 +for_incrParam52: j --> for_incrParam51 +for_incrParam51: delframe --> for_incrParam50 +for_incrParam50: jr $ra +for_incrParam8 : emit c80 --> for_incrParam7 +for_incrParam7 : add $v0, $v0, $a3 --> for_incrParam6 +for_incrParam6 : add $v0, $v0, $a0 --> for_incrParam5 +for_incrParam5 : emit c81 --> for_incrParam4 +for_incrParam4 : add $v0, $v0, $a0 --> for_incrParam3 + +procedure for_incr(2) +var 0 +entry for_incr44 +for_incr44: newframe --> for_incr43 +for_incr43: j --> for_incr42 +for_incr42: j --> for_incr41 +for_incr41: j --> for_incr40 +for_incr40: j --> for_incr39 +for_incr39: j --> for_incr38 +for_incr38: j --> for_incr37 +for_incr37: j --> for_incr36 +for_incr36: j --> for_incr35 +for_incr35: j --> for_incr34 +for_incr34: j --> for_incr33 +for_incr33: j --> for_incr32 +for_incr32: j --> for_incr31 +for_incr31: j --> for_incr30 +for_incr30: j --> for_incr29 +for_incr29: j --> for_incr28 +for_incr28: j --> for_incr27 +for_incr27: j --> for_incr26 +for_incr26: j --> for_incr25 +for_incr25: j --> for_incr24 +for_incr24: j --> for_incr23 +for_incr23: j --> for_incr21 +for_incr21: emit c78 --> for_incr20 +for_incr20: li $v0, 0 --> for_incr19 +for_incr19: emit c77 --> for_incr18 +for_incr18: emit c76 --> for_incr17 +for_incr17: li $a2, 3 --> for_incr16 +for_incr16: add $a2, $a0, $a2 --> for_incr3 +for_incr3 : j --> for_incr15 +for_incr15: li $a3, 0 --> for_incr14 +for_incr14: emit c75 --> for_incr13 +for_incr13: li $a0, 2 --> for_incr12 +for_incr12: mulo $a0, $a1, $a0 --> for_incr11 +for_incr11: sle $a0, $a2, $a0 --> for_incr10 +for_incr10: j --> for_incr22 +for_incr22: seq $a0, $a0, $zero --> for_incr9 +for_incr9 : beq $a0, $a3 --> for_incr8, for_incr2 +for_incr2 : emit c72 --> for_incr1 +for_incr1 : j --> for_incr0 +for_incr0 : j --> for_incr56 +for_incr56: j --> for_incr55 +for_incr55: j --> for_incr54 +for_incr54: j --> for_incr53 +for_incr53: j --> for_incr52 +for_incr52: j --> for_incr51 +for_incr51: j --> for_incr50 +for_incr50: j --> for_incr49 +for_incr49: j --> for_incr48 +for_incr48: j --> for_incr47 +for_incr47: j --> for_incr46 +for_incr46: delframe --> for_incr45 +for_incr45: jr $ra +for_incr8 : emit c73 --> for_incr7 +for_incr7 : sub $v0, $v0, $a2 --> for_incr6 +for_incr6 : emit c74 --> for_incr5 +for_incr5 : li $a0, 1 --> for_incr4 +for_incr4 : add $a2, $a2, $a0 --> for_incr3 + +procedure for_imbriq(2) +var 24 +entry for_imbriq64 +for_imbriq64: newframe --> for_imbriq63 +for_imbriq63: lw $ra, 20($sp) --> for_imbriq62 +for_imbriq62: j --> for_imbriq61 +for_imbriq61: j --> for_imbriq60 +for_imbriq60: j --> for_imbriq59 +for_imbriq59: lw $s4, 16($sp) --> for_imbriq58 +for_imbriq58: lw $s3, 12($sp) --> for_imbriq57 +for_imbriq57: lw $s2, 8($sp) --> for_imbriq56 +for_imbriq56: lw $s1, 4($sp) --> for_imbriq55 +for_imbriq55: lw $s0, 0($sp) --> for_imbriq54 +for_imbriq54: move $s4, $a0 --> for_imbriq53 +for_imbriq53: move $s3, $a1 --> for_imbriq52 +for_imbriq52: j --> for_imbriq51 +for_imbriq51: j --> for_imbriq50 +for_imbriq50: j --> for_imbriq49 +for_imbriq49: j --> for_imbriq48 +for_imbriq48: j --> for_imbriq47 +for_imbriq47: j --> for_imbriq46 +for_imbriq46: j --> for_imbriq45 +for_imbriq45: j --> for_imbriq44 +for_imbriq44: j --> for_imbriq43 +for_imbriq43: j --> for_imbriq42 +for_imbriq42: j --> for_imbriq41 +for_imbriq41: j --> for_imbriq40 +for_imbriq40: j --> for_imbriq39 +for_imbriq39: j --> for_imbriq38 +for_imbriq38: j --> for_imbriq34 +for_imbriq34: emit c71 --> for_imbriq33 +for_imbriq33: li $s0, 0 --> for_imbriq32 +for_imbriq32: emit c70 --> for_imbriq31 +for_imbriq31: emit c69 --> for_imbriq30 +for_imbriq30: li $s1, 0 --> for_imbriq3 +for_imbriq3 : j --> for_imbriq29 +for_imbriq29: li $a0, 0 --> for_imbriq28 +for_imbriq28: emit c68 --> for_imbriq27 +for_imbriq27: li $v0, 23 --> for_imbriq26 +for_imbriq26: slt $v0, $s1, $v0 --> for_imbriq25 +for_imbriq25: j --> for_imbriq36 +for_imbriq36: seq $v0, $v0, $zero --> for_imbriq24 +for_imbriq24: beq $v0, $a0 --> for_imbriq23, for_imbriq2 +for_imbriq2 : emit c59 --> for_imbriq1 +for_imbriq1 : j --> for_imbriq0 +for_imbriq0 : j --> for_imbriq76 +for_imbriq76: move $v0, $s0 --> for_imbriq75 +for_imbriq75: lw $ra, 20($sp) --> for_imbriq74 +for_imbriq74: j --> for_imbriq73 +for_imbriq73: j --> for_imbriq72 +for_imbriq72: j --> for_imbriq71 +for_imbriq71: lw $s4, 16($sp) --> for_imbriq70 +for_imbriq70: lw $s3, 12($sp) --> for_imbriq69 +for_imbriq69: lw $s2, 8($sp) --> for_imbriq68 +for_imbriq68: lw $s1, 4($sp) --> for_imbriq67 +for_imbriq67: lw $s0, 0($sp) --> for_imbriq66 +for_imbriq66: delframe --> for_imbriq65 +for_imbriq65: jr $ra +for_imbriq23: emit c66 --> for_imbriq22 +for_imbriq22: li $v0, 0 --> for_imbriq21 +for_imbriq21: emit c65 --> for_imbriq20 +for_imbriq20: emit c64 --> for_imbriq19 +for_imbriq19: li $s2, 1 --> for_imbriq6 +for_imbriq6 : j --> for_imbriq18 +for_imbriq18: li $a1, 0 --> for_imbriq17 +for_imbriq17: emit c63 --> for_imbriq16 +for_imbriq16: li $a0, 12 --> for_imbriq15 +for_imbriq15: slt $a0, $s2, $a0 --> for_imbriq14 +for_imbriq14: j --> for_imbriq35 +for_imbriq35: seq $a0, $a0, $zero --> for_imbriq13 +for_imbriq13: beq $a0, $a1 --> for_imbriq12, for_imbriq5 +for_imbriq5 : emit c67 --> for_imbriq4 +for_imbriq4 : add $s1, $s1, $s4 --> for_imbriq3 +for_imbriq12: emit c61 --> for_imbriq11 +for_imbriq11: add $s0, $s0, $v0 --> for_imbriq10 +for_imbriq10: emit c60 --> for_imbriq9 +for_imbriq9 : la $a2, mod --> for_imbriq37 +for_imbriq37: j --> for_imbriq80 +for_imbriq80: move $a0, $v0 --> for_imbriq79 +for_imbriq79: move $a1, $s2 --> for_imbriq78 +for_imbriq78: call $a2 --> for_imbriq77 +for_imbriq77: j --> for_imbriq8 +for_imbriq8 : emit c62 --> for_imbriq7 +for_imbriq7 : add $s2, $s2, $s3 --> for_imbriq6 + +procedure for_fortSimple(3) +var 0 +entry for_fortSimple41 +for_fortSimple41: newframe --> for_fortSimple40 +for_fortSimple40: j --> for_fortSimple39 +for_fortSimple39: j --> for_fortSimple38 +for_fortSimple38: j --> for_fortSimple37 +for_fortSimple37: j --> for_fortSimple36 +for_fortSimple36: j --> for_fortSimple35 +for_fortSimple35: j --> for_fortSimple34 +for_fortSimple34: j --> for_fortSimple33 +for_fortSimple33: j --> for_fortSimple32 +for_fortSimple32: j --> for_fortSimple31 +for_fortSimple31: j --> for_fortSimple30 +for_fortSimple30: j --> for_fortSimple29 +for_fortSimple29: j --> for_fortSimple28 +for_fortSimple28: j --> for_fortSimple27 +for_fortSimple27: j --> for_fortSimple26 +for_fortSimple26: j --> for_fortSimple25 +for_fortSimple25: j --> for_fortSimple24 +for_fortSimple24: j --> for_fortSimple23 +for_fortSimple23: j --> for_fortSimple22 +for_fortSimple22: j --> for_fortSimple21 +for_fortSimple21: j --> for_fortSimple19 +for_fortSimple19: emit c58 --> for_fortSimple18 +for_fortSimple18: li $t0, 0 --> for_fortSimple17 +for_fortSimple17: emit c57 --> for_fortSimple16 +for_fortSimple16: emit c56 --> for_fortSimple15 +for_fortSimple15: move $a3, $a0 --> for_fortSimple5 +for_fortSimple5 : j --> for_fortSimple14 +for_fortSimple14: li $t1, 0 --> for_fortSimple13 +for_fortSimple13: emit c55 --> for_fortSimple12 +for_fortSimple12: slt $v0, $a3, $a1 --> for_fortSimple11 +for_fortSimple11: j --> for_fortSimple20 +for_fortSimple20: seq $v0, $v0, $zero --> for_fortSimple10 +for_fortSimple10: beq $v0, $t1 --> for_fortSimple9, for_fortSimple4 +for_fortSimple4 : emit c52 --> for_fortSimple3 +for_fortSimple3 : add $v0, $t0, $a0 --> for_fortSimple2 +for_fortSimple2 : emit c51 --> for_fortSimple1 +for_fortSimple1 : j --> for_fortSimple0 +for_fortSimple0 : j --> for_fortSimple53 +for_fortSimple53: j --> for_fortSimple52 +for_fortSimple52: j --> for_fortSimple51 +for_fortSimple51: j --> for_fortSimple50 +for_fortSimple50: j --> for_fortSimple49 +for_fortSimple49: j --> for_fortSimple48 +for_fortSimple48: j --> for_fortSimple47 +for_fortSimple47: j --> for_fortSimple46 +for_fortSimple46: j --> for_fortSimple45 +for_fortSimple45: j --> for_fortSimple44 +for_fortSimple44: j --> for_fortSimple43 +for_fortSimple43: delframe --> for_fortSimple42 +for_fortSimple42: jr $ra +for_fortSimple9 : emit c53 --> for_fortSimple8 +for_fortSimple8 : add $t0, $t0, $a3 --> for_fortSimple7 +for_fortSimple7 : emit c54 --> for_fortSimple6 +for_fortSimple6 : add $a3, $a3, $a2 --> for_fortSimple5 + +procedure for_forfor(0) +var 0 +entry for_forfor44 +for_forfor44: newframe --> for_forfor43 +for_forfor43: j --> for_forfor42 +for_forfor42: j --> for_forfor41 +for_forfor41: j --> for_forfor40 +for_forfor40: j --> for_forfor39 +for_forfor39: j --> for_forfor38 +for_forfor38: j --> for_forfor37 +for_forfor37: j --> for_forfor36 +for_forfor36: j --> for_forfor35 +for_forfor35: j --> for_forfor34 +for_forfor34: j --> for_forfor33 +for_forfor33: j --> for_forfor32 +for_forfor32: j --> for_forfor31 +for_forfor31: j --> for_forfor30 +for_forfor30: j --> for_forfor29 +for_forfor29: j --> for_forfor28 +for_forfor28: j --> for_forfor27 +for_forfor27: j --> for_forfor26 +for_forfor26: j --> for_forfor25 +for_forfor25: j --> for_forfor23 +for_forfor23: emit c94 --> for_forfor22 +for_forfor22: emit c93 --> for_forfor21 +for_forfor21: li $a1, 0 --> for_forfor20 +for_forfor20: emit c92 --> for_forfor19 +for_forfor19: li $v0, 0 --> for_forfor3 +for_forfor3 : j --> for_forfor18 +for_forfor18: li $a2, 0 --> for_forfor17 +for_forfor17: emit c91 --> for_forfor16 +for_forfor16: li $a0, 10 --> for_forfor15 +for_forfor15: slt $a0, $a1, $a0 --> for_forfor14 +for_forfor14: j --> for_forfor24 +for_forfor24: seq $a0, $a0, $zero --> for_forfor13 +for_forfor13: beq $a0, $a2 --> for_forfor12, for_forfor2 +for_forfor2 : emit c87 --> for_forfor1 +for_forfor1 : j --> for_forfor0 +for_forfor0 : j --> for_forfor56 +for_forfor56: j --> for_forfor55 +for_forfor55: j --> for_forfor54 +for_forfor54: j --> for_forfor53 +for_forfor53: j --> for_forfor52 +for_forfor52: j --> for_forfor51 +for_forfor51: j --> for_forfor50 +for_forfor50: j --> for_forfor49 +for_forfor49: j --> for_forfor48 +for_forfor48: j --> for_forfor47 +for_forfor47: j --> for_forfor46 +for_forfor46: delframe --> for_forfor45 +for_forfor45: jr $ra +for_forfor12: emit c89 --> for_forfor11 +for_forfor11: li $a0, 1 --> for_forfor10 +for_forfor10: add $v0, $v0, $a0 --> for_forfor9 +for_forfor9 : emit c88 --> for_forfor8 +for_forfor8 : li $a0, 1 --> for_forfor7 +for_forfor7 : add $v0, $v0, $a0 --> for_forfor6 +for_forfor6 : emit c90 --> for_forfor5 +for_forfor5 : li $a0, 1 --> for_forfor4 +for_forfor4 : add $a1, $a1, $a0 --> for_forfor3 + +procedure for_ex(3) +var 0 +entry for_ex43 +for_ex43: newframe --> for_ex42 +for_ex42: j --> for_ex41 +for_ex41: j --> for_ex40 +for_ex40: j --> for_ex39 +for_ex39: j --> for_ex38 +for_ex38: j --> for_ex37 +for_ex37: j --> for_ex36 +for_ex36: j --> for_ex35 +for_ex35: j --> for_ex34 +for_ex34: j --> for_ex33 +for_ex33: j --> for_ex32 +for_ex32: j --> for_ex31 +for_ex31: j --> for_ex30 +for_ex30: j --> for_ex29 +for_ex29: j --> for_ex28 +for_ex28: j --> for_ex27 +for_ex27: j --> for_ex26 +for_ex26: j --> for_ex25 +for_ex25: j --> for_ex24 +for_ex24: j --> for_ex23 +for_ex23: j --> for_ex22 +for_ex22: j --> for_ex20 +for_ex20: emit c50 --> for_ex19 +for_ex19: li $v0, 0 --> for_ex18 +for_ex18: emit c49 --> for_ex17 +for_ex17: emit c48 --> for_ex16 +for_ex16: li $a3, 3 --> for_ex15 +for_ex15: add $a3, $a0, $a3 --> for_ex3 +for_ex3 : j --> for_ex14 +for_ex14: li $t0, 0 --> for_ex13 +for_ex13: emit c47 --> for_ex12 +for_ex12: li $a0, 2 --> for_ex11 +for_ex11: mulo $a0, $a1, $a0 --> for_ex10 +for_ex10: sle $a0, $a3, $a0 --> for_ex9 +for_ex9 : j --> for_ex21 +for_ex21: seq $a0, $a0, $zero --> for_ex8 +for_ex8 : beq $a0, $t0 --> for_ex7, for_ex2 +for_ex2 : emit c44 --> for_ex1 +for_ex1 : j --> for_ex0 +for_ex0 : j --> for_ex55 +for_ex55: j --> for_ex54 +for_ex54: j --> for_ex53 +for_ex53: j --> for_ex52 +for_ex52: j --> for_ex51 +for_ex51: j --> for_ex50 +for_ex50: j --> for_ex49 +for_ex49: j --> for_ex48 +for_ex48: j --> for_ex47 +for_ex47: j --> for_ex46 +for_ex46: j --> for_ex45 +for_ex45: delframe --> for_ex44 +for_ex44: jr $ra +for_ex7 : emit c45 --> for_ex6 +for_ex6 : sub $v0, $v0, $a3 --> for_ex5 +for_ex5 : emit c46 --> for_ex4 +for_ex4 : add $a3, $a3, $a2 --> for_ex3 + +procedure for_double(1) +var 0 +entry for_double64 +for_double64: newframe --> for_double63 +for_double63: j --> for_double62 +for_double62: j --> for_double61 +for_double61: j --> for_double60 +for_double60: j --> for_double59 +for_double59: j --> for_double58 +for_double58: j --> for_double57 +for_double57: j --> for_double56 +for_double56: j --> for_double55 +for_double55: j --> for_double54 +for_double54: j --> for_double53 +for_double53: j --> for_double52 +for_double52: j --> for_double51 +for_double51: j --> for_double50 +for_double50: j --> for_double49 +for_double49: j --> for_double48 +for_double48: j --> for_double47 +for_double47: j --> for_double46 +for_double46: j --> for_double45 +for_double45: j --> for_double44 +for_double44: j --> for_double43 +for_double43: j --> for_double42 +for_double42: j --> for_double41 +for_double41: j --> for_double40 +for_double40: j --> for_double39 +for_double39: j --> for_double36 +for_double36: emit c43 --> for_double35 +for_double35: li $a1, 0 --> for_double34 +for_double34: emit c42 --> for_double33 +for_double33: li $a2, 0 --> for_double32 +for_double32: emit c41 --> for_double31 +for_double31: emit c40 --> for_double30 +for_double30: li $a3, 0 --> for_double19 +for_double19: j --> for_double29 +for_double29: li $t0, 0 --> for_double28 +for_double28: emit c39 --> for_double27 +for_double27: li $v0, 12 --> for_double26 +for_double26: slt $v0, $a3, $v0 --> for_double25 +for_double25: j --> for_double38 +for_double38: seq $v0, $v0, $zero --> for_double24 +for_double24: beq $v0, $t0 --> for_double23, for_double18 +for_double18: emit c36 --> for_double17 +for_double17: emit c35 --> for_double16 +for_double16: li $a3, 0 --> for_double5 +for_double5 : j --> for_double15 +for_double15: li $t0, 0 --> for_double14 +for_double14: emit c34 --> for_double13 +for_double13: li $v0, 5 --> for_double12 +for_double12: slt $v0, $a3, $v0 --> for_double11 +for_double11: j --> for_double37 +for_double37: seq $v0, $v0, $zero --> for_double10 +for_double10: beq $v0, $t0 --> for_double9, for_double4 +for_double4 : emit c31 --> for_double3 +for_double3 : mulo $v0, $a1, $a2 --> for_double2 +for_double2 : emit c30 --> for_double1 +for_double1 : j --> for_double0 +for_double0 : j --> for_double76 +for_double76: j --> for_double75 +for_double75: j --> for_double74 +for_double74: j --> for_double73 +for_double73: j --> for_double72 +for_double72: j --> for_double71 +for_double71: j --> for_double70 +for_double70: j --> for_double69 +for_double69: j --> for_double68 +for_double68: j --> for_double67 +for_double67: j --> for_double66 +for_double66: delframe --> for_double65 +for_double65: jr $ra +for_double9 : emit c32 --> for_double8 +for_double8 : add $a2, $a2, $a3 --> for_double7 +for_double7 : emit c33 --> for_double6 +for_double6 : add $a3, $a3, $a0 --> for_double5 +for_double23: emit c37 --> for_double22 +for_double22: add $a1, $a1, $a3 --> for_double21 +for_double21: emit c38 --> for_double20 +for_double20: add $a3, $a3, $a0 --> for_double19 + +procedure for_2(2) +var 0 +entry for_253 +for_253: newframe --> for_252 +for_252: j --> for_251 +for_251: j --> for_250 +for_250: j --> for_249 +for_249: j --> for_248 +for_248: j --> for_247 +for_247: j --> for_246 +for_246: j --> for_245 +for_245: j --> for_244 +for_244: j --> for_243 +for_243: j --> for_242 +for_242: j --> for_241 +for_241: j --> for_240 +for_240: j --> for_239 +for_239: j --> for_238 +for_238: j --> for_237 +for_237: j --> for_236 +for_236: j --> for_235 +for_235: j --> for_234 +for_234: j --> for_233 +for_233: j --> for_232 +for_232: j --> for_231 +for_231: j --> for_230 +for_230: j --> for_229 +for_229: j --> for_227 +for_227: emit c9 --> for_226 +for_226: li $a2, 0 --> for_225 +for_225: emit c8 --> for_224 +for_224: li $v0, 2 --> for_223 +for_223: mulo $v0, $a0, $v0 --> for_222 +for_222: emit c7 --> for_221 +for_221: li $a3, 4 --> for_220 +for_220: mulo $a0, $a0, $a3 --> for_219 +for_219: emit c6 --> for_218 +for_218: li $a3, 1 --> for_217 +for_217: add $a1, $a1, $a3 --> for_216 +for_216: emit c5 --> for_215 +for_215: emit c4 --> for_214 +for_214: j --> for_24 +for_24 : j --> for_213 +for_213: li $t0, 0 --> for_212 +for_212: emit c3 --> for_211 +for_211: slt $a3, $v0, $a0 --> for_210 +for_210: j --> for_228 +for_228: seq $a3, $a3, $zero --> for_29 +for_29 : beq $a3, $t0 --> for_28, for_23 +for_23 : emit c0 --> for_22 +for_22 : li $v0, 1 --> for_21 +for_21 : add $v0, $a2, $v0 --> for_20 +for_20 : j --> for_265 +for_265: j --> for_264 +for_264: j --> for_263 +for_263: j --> for_262 +for_262: j --> for_261 +for_261: j --> for_260 +for_260: j --> for_259 +for_259: j --> for_258 +for_258: j --> for_257 +for_257: j --> for_256 +for_256: j --> for_255 +for_255: delframe --> for_254 +for_254: jr $ra +for_28 : emit c1 --> for_27 +for_27 : add $a2, $a2, $v0 --> for_26 +for_26 : emit c2 --> for_25 +for_25 : add $v0, $v0, $a1 --> for_24 + +procedure _main(0) +var 4 +entry main85 +main85 : newframe --> main84 +main84 : lw $ra, 0($sp) --> main83 +main83 : j --> main82 +main82 : j --> main81 +main81 : j --> main80 +main80 : j --> main79 +main79 : j --> main78 +main78 : j --> main77 +main77 : j --> main76 +main76 : j --> main75 +main75 : j --> main74 +main74 : j --> main73 +main73 : j --> main72 +main72 : j --> main71 +main71 : j --> main70 +main70 : j --> main69 +main69 : j --> main68 +main68 : j --> main67 +main67 : j --> main66 +main66 : j --> main65 +main65 : j --> main64 +main64 : j --> main63 +main63 : j --> main62 +main62 : j --> main61 +main61 : j --> main60 +main60 : j --> main59 +main59 : j --> main58 +main58 : j --> main57 +main57 : j --> main56 +main56 : j --> main55 +main55 : j --> main54 +main54 : j --> main53 +main53 : j --> main52 +main52 : j --> main51 +main51 : j --> main50 +main50 : j --> main49 +main49 : j --> main48 +main48 : j --> main38 +main38 : emit c104 --> main37 +main37 : li $a0, 3 --> main36 +main36 : li $a1, 1 --> main35 +main35 : la $v0, for_2 --> main45 +main45 : j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: call $v0 --> main122 +main122: j --> main34 +main34 : emit c103 --> main33 +main33 : li $a0, 1 --> main32 +main32 : li $a1, 2 --> main31 +main31 : li $a2, 3 --> main30 +main30 : la $v0, for_loopParalAsync --> main44 +main44 : j --> main121 +main121: j --> main120 +main120: j --> main119 +main119: j --> main118 +main118: call $v0 --> main117 +main117: j --> main29 +main29 : emit c102 --> main28 +main28 : li $a0, 1 --> main27 +main27 : la $v0, for_double --> main42 +main42 : j --> main114 +main114: j --> main113 +main113: call $v0 --> main112 +main112: j --> main26 +main26 : emit c101 --> main25 +main25 : li $a0, 2 --> main24 +main24 : li $a1, 10 --> main23 +main23 : li $a2, 1 --> main22 +main22 : la $v0, for_ex --> main41 +main41 : j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: j --> main108 +main108: call $v0 --> main107 +main107: j --> main21 +main21 : emit c100 --> main20 +main20 : li $a0, 2 --> main19 +main19 : li $a1, 10 --> main18 +main18 : li $a2, 1 --> main17 +main17 : la $v0, for_fortSimple --> main40 +main40 : j --> main106 +main106: j --> main105 +main105: j --> main104 +main104: j --> main103 +main103: call $v0 --> main102 +main102: j --> main16 +main16 : emit c99 --> main15 +main15 : li $a0, 2 --> main14 +main14 : li $a1, 3 --> main13 +main13 : la $v0, for_imbriq --> main39 +main39 : j --> main101 +main101: j --> main100 +main100: j --> main99 +main99 : call $v0 --> main98 +main98 : j --> main12 +main12 : emit c98 --> main11 +main11 : li $a0, 2 --> main10 +main10 : li $a1, 3 --> main9 +main9 : la $v0, for_incr --> main47 +main47 : j --> main133 +main133: j --> main132 +main132: j --> main131 +main131: call $v0 --> main130 +main130: j --> main8 +main8 : emit c97 --> main7 +main7 : li $a0, 2 --> main6 +main6 : li $a1, 3 --> main5 +main5 : la $v0, for_incrParam --> main46 +main46 : j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: call $v0 --> main126 +main126: j --> main4 +main4 : emit c96 --> main3 +main3 : la $v0, for_forfor --> main43 +main43 : j --> main116 +main116: call $v0 --> main115 +main115: j --> main2 +main2 : emit c95 --> main1 +main1 : j --> main0 +main0 : j --> main97 +main97 : j --> main96 +main96 : lw $ra, 0($sp) --> main95 +main95 : j --> main94 +main94 : j --> main93 +main93 : j --> main92 +main92 : j --> main91 +main91 : j --> main90 +main90 : j --> main89 +main89 : j --> main88 +main88 : j --> main87 +main87 : delframe --> main86 +main86 : jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/for.RTL.expected b/tests/clight/for.RTL.expected new file mode 100644 index 0000000..7f4f51a --- /dev/null +++ b/tests/clight/for.RTL.expected @@ -0,0 +1,942 @@ +program + +globals 0 + +function for_loopParalAsync(%0; %1; %2) : %8 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26 +entry for_loopParalAsync81 +for_loopParalAsync81: li %3, 0 --> for_loopParalAsync80 +for_loopParalAsync80: li %4, 0 --> for_loopParalAsync79 +for_loopParalAsync79: li %5, 0 --> for_loopParalAsync78 +for_loopParalAsync78: li %6, 0 --> for_loopParalAsync77 +for_loopParalAsync77: li %7, 0 --> for_loopParalAsync76 +for_loopParalAsync76: li %9, 0 --> for_loopParalAsync75 +for_loopParalAsync75: li %10, 0 --> for_loopParalAsync74 +for_loopParalAsync74: li %11, 0 --> for_loopParalAsync73 +for_loopParalAsync73: li %12, 0 --> for_loopParalAsync72 +for_loopParalAsync72: li %13, 0 --> for_loopParalAsync71 +for_loopParalAsync71: li %14, 0 --> for_loopParalAsync70 +for_loopParalAsync70: li %15, 0 --> for_loopParalAsync69 +for_loopParalAsync69: li %16, 0 --> for_loopParalAsync68 +for_loopParalAsync68: li %17, 0 --> for_loopParalAsync67 +for_loopParalAsync67: li %18, 0 --> for_loopParalAsync66 +for_loopParalAsync66: li %19, 0 --> for_loopParalAsync65 +for_loopParalAsync65: li %20, 0 --> for_loopParalAsync64 +for_loopParalAsync64: li %21, 0 --> for_loopParalAsync63 +for_loopParalAsync63: li %22, 0 --> for_loopParalAsync62 +for_loopParalAsync62: li %23, 0 --> for_loopParalAsync61 +for_loopParalAsync61: li %24, 0 --> for_loopParalAsync60 +for_loopParalAsync60: li %25, 0 --> for_loopParalAsync59 +for_loopParalAsync59: li %26, 0 --> for_loopParalAsync56 +for_loopParalAsync56: emit c29 --> for_loopParalAsync55 +for_loopParalAsync55: li %5, 0 --> for_loopParalAsync54 +for_loopParalAsync54: emit c28 --> for_loopParalAsync53 +for_loopParalAsync53: li %0, 0 --> for_loopParalAsync52 +for_loopParalAsync52: emit c27 --> for_loopParalAsync51 +for_loopParalAsync51: li %24, 3 --> for_loopParalAsync50 +for_loopParalAsync50: add %0, %0, %24 --> for_loopParalAsync49 +for_loopParalAsync49: emit c26 --> for_loopParalAsync48 +for_loopParalAsync48: li %23, 2 --> for_loopParalAsync47 +for_loopParalAsync47: mulo %0, %0, %23 --> for_loopParalAsync46 +for_loopParalAsync46: emit c25 --> for_loopParalAsync45 +for_loopParalAsync45: li %22, 3 --> for_loopParalAsync44 +for_loopParalAsync44: div %0, %0, %22 --> for_loopParalAsync43 +for_loopParalAsync43: emit c24 --> for_loopParalAsync42 +for_loopParalAsync42: li %21, 8 --> for_loopParalAsync41 +for_loopParalAsync41: add %0, %0, %21 --> for_loopParalAsync40 +for_loopParalAsync40: emit c23 --> for_loopParalAsync39 +for_loopParalAsync39: emit c22 --> for_loopParalAsync38 +for_loopParalAsync38: li %7, 0 --> for_loopParalAsync20 +for_loopParalAsync20: j --> for_loopParalAsync37 +for_loopParalAsync37: li %18, 0 --> for_loopParalAsync36 +for_loopParalAsync36: emit c21 --> for_loopParalAsync35 +for_loopParalAsync35: li %20, 20 --> for_loopParalAsync34 +for_loopParalAsync34: slt %19, %7, %20 --> for_loopParalAsync33 +for_loopParalAsync33: li %26, 0 --> for_loopParalAsync58 +for_loopParalAsync58: seq %17, %19, %26 --> for_loopParalAsync32 +for_loopParalAsync32: beq %17, %18 --> for_loopParalAsync31, for_loopParalAsync19 +for_loopParalAsync19: emit c16 --> for_loopParalAsync18 +for_loopParalAsync18: emit c15 --> for_loopParalAsync17 +for_loopParalAsync17: li %6, 1 --> for_loopParalAsync3 +for_loopParalAsync3 : j --> for_loopParalAsync16 +for_loopParalAsync16: li %12, 0 --> for_loopParalAsync15 +for_loopParalAsync15: emit c14 --> for_loopParalAsync14 +for_loopParalAsync14: slt %13, %6, %0 --> for_loopParalAsync13 +for_loopParalAsync13: li %25, 0 --> for_loopParalAsync57 +for_loopParalAsync57: seq %11, %13, %25 --> for_loopParalAsync12 +for_loopParalAsync12: beq %11, %12 --> for_loopParalAsync11, for_loopParalAsync2 +for_loopParalAsync2 : emit c10 --> for_loopParalAsync1 +for_loopParalAsync1 : move %8, %5 --> for_loopParalAsync0 +for_loopParalAsync0 : return %8 +for_loopParalAsync11: emit c12 --> for_loopParalAsync10 +for_loopParalAsync10: li %10, 2 --> for_loopParalAsync9 +for_loopParalAsync9 : mulo %2, %2, %10 --> for_loopParalAsync8 +for_loopParalAsync8 : emit c11 --> for_loopParalAsync7 +for_loopParalAsync7 : div %3, %2, %6 --> for_loopParalAsync6 +for_loopParalAsync6 : emit c13 --> for_loopParalAsync5 +for_loopParalAsync5 : li %9, 1 --> for_loopParalAsync4 +for_loopParalAsync4 : add %6, %6, %9 --> for_loopParalAsync3 +for_loopParalAsync31: emit c19 --> for_loopParalAsync30 +for_loopParalAsync30: li %16, 1 --> for_loopParalAsync29 +for_loopParalAsync29: add %5, %5, %16 --> for_loopParalAsync28 +for_loopParalAsync28: emit c18 --> for_loopParalAsync27 +for_loopParalAsync27: li %15, 2 --> for_loopParalAsync26 +for_loopParalAsync26: add %1, %1, %15 --> for_loopParalAsync25 +for_loopParalAsync25: emit c17 --> for_loopParalAsync24 +for_loopParalAsync24: div %4, %1, %5 --> for_loopParalAsync23 +for_loopParalAsync23: emit c20 --> for_loopParalAsync22 +for_loopParalAsync22: li %14, 1 --> for_loopParalAsync21 +for_loopParalAsync21: add %7, %7, %14 --> for_loopParalAsync20 + +function for_incrParam(%0; %1) : %5 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14 +entry for_incrParam37 +for_incrParam37: li %2, 0 --> for_incrParam36 +for_incrParam36: li %3, 0 --> for_incrParam35 +for_incrParam35: li %4, 0 --> for_incrParam34 +for_incrParam34: li %6, 0 --> for_incrParam33 +for_incrParam33: li %7, 0 --> for_incrParam32 +for_incrParam32: li %8, 0 --> for_incrParam31 +for_incrParam31: li %9, 0 --> for_incrParam30 +for_incrParam30: li %10, 0 --> for_incrParam29 +for_incrParam29: li %11, 0 --> for_incrParam28 +for_incrParam28: li %12, 0 --> for_incrParam27 +for_incrParam27: li %13, 0 --> for_incrParam26 +for_incrParam26: li %14, 0 --> for_incrParam24 +for_incrParam24: emit c86 --> for_incrParam23 +for_incrParam23: add %2, %0, %1 --> for_incrParam22 +for_incrParam22: emit c85 --> for_incrParam21 +for_incrParam21: li %13, 3 --> for_incrParam20 +for_incrParam20: mulo %4, %13, %2 --> for_incrParam19 +for_incrParam19: emit c84 --> for_incrParam18 +for_incrParam18: emit c83 --> for_incrParam17 +for_incrParam17: li %12, 4 --> for_incrParam16 +for_incrParam16: sub %3, %2, %12 --> for_incrParam3 +for_incrParam3 : j --> for_incrParam15 +for_incrParam15: li %8, 0 --> for_incrParam14 +for_incrParam14: emit c82 --> for_incrParam13 +for_incrParam13: li %11, 6 --> for_incrParam12 +for_incrParam12: add %10, %1, %11 --> for_incrParam11 +for_incrParam11: slt %9, %3, %10 --> for_incrParam10 +for_incrParam10: li %14, 0 --> for_incrParam25 +for_incrParam25: seq %7, %9, %14 --> for_incrParam9 +for_incrParam9 : beq %7, %8 --> for_incrParam8, for_incrParam2 +for_incrParam2 : emit c79 --> for_incrParam1 +for_incrParam1 : move %5, %3 --> for_incrParam0 +for_incrParam0 : return %5 +for_incrParam8 : emit c80 --> for_incrParam7 +for_incrParam7 : add %6, %3, %2 --> for_incrParam6 +for_incrParam6 : add %3, %6, %0 --> for_incrParam5 +for_incrParam5 : emit c81 --> for_incrParam4 +for_incrParam4 : add %3, %3, %0 --> for_incrParam3 + +function for_incr(%0; %1) : %4 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12 +entry for_incr32 +for_incr32: li %2, 0 --> for_incr31 +for_incr31: li %3, 0 --> for_incr30 +for_incr30: li %5, 0 --> for_incr29 +for_incr29: li %6, 0 --> for_incr28 +for_incr28: li %7, 0 --> for_incr27 +for_incr27: li %8, 0 --> for_incr26 +for_incr26: li %9, 0 --> for_incr25 +for_incr25: li %10, 0 --> for_incr24 +for_incr24: li %11, 0 --> for_incr23 +for_incr23: li %12, 0 --> for_incr21 +for_incr21: emit c78 --> for_incr20 +for_incr20: li %2, 0 --> for_incr19 +for_incr19: emit c77 --> for_incr18 +for_incr18: emit c76 --> for_incr17 +for_incr17: li %11, 3 --> for_incr16 +for_incr16: add %3, %0, %11 --> for_incr3 +for_incr3 : j --> for_incr15 +for_incr15: li %7, 0 --> for_incr14 +for_incr14: emit c75 --> for_incr13 +for_incr13: li %10, 2 --> for_incr12 +for_incr12: mulo %9, %1, %10 --> for_incr11 +for_incr11: sle %8, %3, %9 --> for_incr10 +for_incr10: li %12, 0 --> for_incr22 +for_incr22: seq %6, %8, %12 --> for_incr9 +for_incr9 : beq %6, %7 --> for_incr8, for_incr2 +for_incr2 : emit c72 --> for_incr1 +for_incr1 : move %4, %2 --> for_incr0 +for_incr0 : return %4 +for_incr8 : emit c73 --> for_incr7 +for_incr7 : sub %2, %2, %3 --> for_incr6 +for_incr6 : emit c74 --> for_incr5 +for_incr5 : li %5, 1 --> for_incr4 +for_incr4 : add %3, %3, %5 --> for_incr3 + +function for_imbriq(%0; %1) : %6 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17 +entry for_imbriq52 +for_imbriq52: li %2, 0 --> for_imbriq51 +for_imbriq51: li %3, 0 --> for_imbriq50 +for_imbriq50: li %4, 0 --> for_imbriq49 +for_imbriq49: li %5, 0 --> for_imbriq48 +for_imbriq48: li %7, 0 --> for_imbriq47 +for_imbriq47: li %8, 0 --> for_imbriq46 +for_imbriq46: li %9, 0 --> for_imbriq45 +for_imbriq45: li %10, 0 --> for_imbriq44 +for_imbriq44: li %11, 0 --> for_imbriq43 +for_imbriq43: li %12, 0 --> for_imbriq42 +for_imbriq42: li %13, 0 --> for_imbriq41 +for_imbriq41: li %14, 0 --> for_imbriq40 +for_imbriq40: li %15, 0 --> for_imbriq39 +for_imbriq39: li %16, 0 --> for_imbriq38 +for_imbriq38: li %17, 0 --> for_imbriq34 +for_imbriq34: emit c71 --> for_imbriq33 +for_imbriq33: li %5, 0 --> for_imbriq32 +for_imbriq32: emit c70 --> for_imbriq31 +for_imbriq31: emit c69 --> for_imbriq30 +for_imbriq30: li %3, 0 --> for_imbriq3 +for_imbriq3 : j --> for_imbriq29 +for_imbriq29: li %12, 0 --> for_imbriq28 +for_imbriq28: emit c68 --> for_imbriq27 +for_imbriq27: li %14, 23 --> for_imbriq26 +for_imbriq26: slt %13, %3, %14 --> for_imbriq25 +for_imbriq25: li %16, 0 --> for_imbriq36 +for_imbriq36: seq %11, %13, %16 --> for_imbriq24 +for_imbriq24: beq %11, %12 --> for_imbriq23, for_imbriq2 +for_imbriq2 : emit c59 --> for_imbriq1 +for_imbriq1 : move %6, %5 --> for_imbriq0 +for_imbriq0 : return %6 +for_imbriq23: emit c66 --> for_imbriq22 +for_imbriq22: li %4, 0 --> for_imbriq21 +for_imbriq21: emit c65 --> for_imbriq20 +for_imbriq20: emit c64 --> for_imbriq19 +for_imbriq19: li %2, 1 --> for_imbriq6 +for_imbriq6 : j --> for_imbriq18 +for_imbriq18: li %8, 0 --> for_imbriq17 +for_imbriq17: emit c63 --> for_imbriq16 +for_imbriq16: li %10, 12 --> for_imbriq15 +for_imbriq15: slt %9, %2, %10 --> for_imbriq14 +for_imbriq14: li %15, 0 --> for_imbriq35 +for_imbriq35: seq %7, %9, %15 --> for_imbriq13 +for_imbriq13: beq %7, %8 --> for_imbriq12, for_imbriq5 +for_imbriq5 : emit c67 --> for_imbriq4 +for_imbriq4 : add %3, %3, %0 --> for_imbriq3 +for_imbriq12: emit c61 --> for_imbriq11 +for_imbriq11: add %5, %5, %4 --> for_imbriq10 +for_imbriq10: emit c60 --> for_imbriq9 +for_imbriq9 : la %17, mod --> for_imbriq37 +for_imbriq37: call %4, %17(%4, %2) --> for_imbriq8 +for_imbriq8 : emit c62 --> for_imbriq7 +for_imbriq7 : add %2, %2, %1 --> for_imbriq6 + +function for_fortSimple(%0; %1; %2) : %7 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11 +entry for_fortSimple28 +for_fortSimple28: li %3, 0 --> for_fortSimple27 +for_fortSimple27: li %4, 0 --> for_fortSimple26 +for_fortSimple26: li %5, 0 --> for_fortSimple25 +for_fortSimple25: li %6, 0 --> for_fortSimple24 +for_fortSimple24: li %8, 0 --> for_fortSimple23 +for_fortSimple23: li %9, 0 --> for_fortSimple22 +for_fortSimple22: li %10, 0 --> for_fortSimple21 +for_fortSimple21: li %11, 0 --> for_fortSimple19 +for_fortSimple19: emit c58 --> for_fortSimple18 +for_fortSimple18: li %3, 0 --> for_fortSimple17 +for_fortSimple17: emit c57 --> for_fortSimple16 +for_fortSimple16: emit c56 --> for_fortSimple15 +for_fortSimple15: move %5, %0 --> for_fortSimple5 +for_fortSimple5 : j --> for_fortSimple14 +for_fortSimple14: li %9, 0 --> for_fortSimple13 +for_fortSimple13: emit c55 --> for_fortSimple12 +for_fortSimple12: slt %10, %5, %1 --> for_fortSimple11 +for_fortSimple11: li %11, 0 --> for_fortSimple20 +for_fortSimple20: seq %8, %10, %11 --> for_fortSimple10 +for_fortSimple10: beq %8, %9 --> for_fortSimple9, for_fortSimple4 +for_fortSimple4 : emit c52 --> for_fortSimple3 +for_fortSimple3 : add %4, %3, %0 --> for_fortSimple2 +for_fortSimple2 : emit c51 --> for_fortSimple1 +for_fortSimple1 : move %7, %4 --> for_fortSimple0 +for_fortSimple0 : return %7 +for_fortSimple9 : emit c53 --> for_fortSimple8 +for_fortSimple8 : add %3, %3, %5 --> for_fortSimple7 +for_fortSimple7 : emit c54 --> for_fortSimple6 +for_fortSimple6 : add %5, %5, %2 --> for_fortSimple5 + +function for_forfor() : %2 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10 +entry for_forfor34 +for_forfor34: li %0, 0 --> for_forfor33 +for_forfor33: li %1, 0 --> for_forfor32 +for_forfor32: li %3, 0 --> for_forfor31 +for_forfor31: li %4, 0 --> for_forfor30 +for_forfor30: li %5, 0 --> for_forfor29 +for_forfor29: li %6, 0 --> for_forfor28 +for_forfor28: li %7, 0 --> for_forfor27 +for_forfor27: li %8, 0 --> for_forfor26 +for_forfor26: li %9, 0 --> for_forfor25 +for_forfor25: li %10, 0 --> for_forfor23 +for_forfor23: emit c94 --> for_forfor22 +for_forfor22: emit c93 --> for_forfor21 +for_forfor21: li %1, 0 --> for_forfor20 +for_forfor20: emit c92 --> for_forfor19 +for_forfor19: li %0, 0 --> for_forfor3 +for_forfor3 : j --> for_forfor18 +for_forfor18: li %7, 0 --> for_forfor17 +for_forfor17: emit c91 --> for_forfor16 +for_forfor16: li %9, 10 --> for_forfor15 +for_forfor15: slt %8, %1, %9 --> for_forfor14 +for_forfor14: li %10, 0 --> for_forfor24 +for_forfor24: seq %6, %8, %10 --> for_forfor13 +for_forfor13: beq %6, %7 --> for_forfor12, for_forfor2 +for_forfor2 : emit c87 --> for_forfor1 +for_forfor1 : move %2, %0 --> for_forfor0 +for_forfor0 : return %2 +for_forfor12: emit c89 --> for_forfor11 +for_forfor11: li %5, 1 --> for_forfor10 +for_forfor10: add %0, %0, %5 --> for_forfor9 +for_forfor9 : emit c88 --> for_forfor8 +for_forfor8 : li %4, 1 --> for_forfor7 +for_forfor7 : add %0, %0, %4 --> for_forfor6 +for_forfor6 : emit c90 --> for_forfor5 +for_forfor5 : li %3, 1 --> for_forfor4 +for_forfor4 : add %1, %1, %3 --> for_forfor3 + +function for_ex(%0; %1; %2) : %5 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12 +entry for_ex30 +for_ex30: li %3, 0 --> for_ex29 +for_ex29: li %4, 0 --> for_ex28 +for_ex28: li %6, 0 --> for_ex27 +for_ex27: li %7, 0 --> for_ex26 +for_ex26: li %8, 0 --> for_ex25 +for_ex25: li %9, 0 --> for_ex24 +for_ex24: li %10, 0 --> for_ex23 +for_ex23: li %11, 0 --> for_ex22 +for_ex22: li %12, 0 --> for_ex20 +for_ex20: emit c50 --> for_ex19 +for_ex19: li %3, 0 --> for_ex18 +for_ex18: emit c49 --> for_ex17 +for_ex17: emit c48 --> for_ex16 +for_ex16: li %11, 3 --> for_ex15 +for_ex15: add %4, %0, %11 --> for_ex3 +for_ex3 : j --> for_ex14 +for_ex14: li %7, 0 --> for_ex13 +for_ex13: emit c47 --> for_ex12 +for_ex12: li %10, 2 --> for_ex11 +for_ex11: mulo %9, %1, %10 --> for_ex10 +for_ex10: sle %8, %4, %9 --> for_ex9 +for_ex9 : li %12, 0 --> for_ex21 +for_ex21: seq %6, %8, %12 --> for_ex8 +for_ex8 : beq %6, %7 --> for_ex7, for_ex2 +for_ex2 : emit c44 --> for_ex1 +for_ex1 : move %5, %3 --> for_ex0 +for_ex0 : return %5 +for_ex7 : emit c45 --> for_ex6 +for_ex6 : sub %3, %3, %4 --> for_ex5 +for_ex5 : emit c46 --> for_ex4 +for_ex4 : add %4, %4, %2 --> for_ex3 + +function for_double(%0) : %6 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16 +entry for_double53 +for_double53: li %1, 0 --> for_double52 +for_double52: li %2, 0 --> for_double51 +for_double51: li %3, 0 --> for_double50 +for_double50: li %4, 0 --> for_double49 +for_double49: li %5, 0 --> for_double48 +for_double48: li %7, 0 --> for_double47 +for_double47: li %8, 0 --> for_double46 +for_double46: li %9, 0 --> for_double45 +for_double45: li %10, 0 --> for_double44 +for_double44: li %11, 0 --> for_double43 +for_double43: li %12, 0 --> for_double42 +for_double42: li %13, 0 --> for_double41 +for_double41: li %14, 0 --> for_double40 +for_double40: li %15, 0 --> for_double39 +for_double39: li %16, 0 --> for_double36 +for_double36: emit c43 --> for_double35 +for_double35: li %5, 0 --> for_double34 +for_double34: emit c42 --> for_double33 +for_double33: li %4, 0 --> for_double32 +for_double32: emit c41 --> for_double31 +for_double31: emit c40 --> for_double30 +for_double30: li %2, 0 --> for_double19 +for_double19: j --> for_double29 +for_double29: li %12, 0 --> for_double28 +for_double28: emit c39 --> for_double27 +for_double27: li %14, 12 --> for_double26 +for_double26: slt %13, %2, %14 --> for_double25 +for_double25: li %16, 0 --> for_double38 +for_double38: seq %11, %13, %16 --> for_double24 +for_double24: beq %11, %12 --> for_double23, for_double18 +for_double18: emit c36 --> for_double17 +for_double17: emit c35 --> for_double16 +for_double16: li %1, 0 --> for_double5 +for_double5 : j --> for_double15 +for_double15: li %8, 0 --> for_double14 +for_double14: emit c34 --> for_double13 +for_double13: li %10, 5 --> for_double12 +for_double12: slt %9, %1, %10 --> for_double11 +for_double11: li %15, 0 --> for_double37 +for_double37: seq %7, %9, %15 --> for_double10 +for_double10: beq %7, %8 --> for_double9, for_double4 +for_double4 : emit c31 --> for_double3 +for_double3 : mulo %3, %5, %4 --> for_double2 +for_double2 : emit c30 --> for_double1 +for_double1 : move %6, %3 --> for_double0 +for_double0 : return %6 +for_double9 : emit c32 --> for_double8 +for_double8 : add %4, %4, %1 --> for_double7 +for_double7 : emit c33 --> for_double6 +for_double6 : add %1, %1, %0 --> for_double5 +for_double23: emit c37 --> for_double22 +for_double22: add %5, %5, %2 --> for_double21 +for_double21: emit c38 --> for_double20 +for_double20: add %2, %2, %0 --> for_double19 + +function for_2(%0; %1) : %7 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15 +entry for_241 +for_241: li %2, 0 --> for_240 +for_240: li %3, 0 --> for_239 +for_239: li %4, 0 --> for_238 +for_238: li %5, 0 --> for_237 +for_237: li %6, 0 --> for_236 +for_236: li %8, 0 --> for_235 +for_235: li %9, 0 --> for_234 +for_234: li %10, 0 --> for_233 +for_233: li %11, 0 --> for_232 +for_232: li %12, 0 --> for_231 +for_231: li %13, 0 --> for_230 +for_230: li %14, 0 --> for_229 +for_229: li %15, 0 --> for_227 +for_227: emit c9 --> for_226 +for_226: li %5, 0 --> for_225 +for_225: emit c8 --> for_224 +for_224: li %14, 2 --> for_223 +for_223: mulo %6, %0, %14 --> for_222 +for_222: emit c7 --> for_221 +for_221: li %13, 4 --> for_220 +for_220: mulo %2, %0, %13 --> for_219 +for_219: emit c6 --> for_218 +for_218: li %12, 1 --> for_217 +for_217: add %3, %1, %12 --> for_216 +for_216: emit c5 --> for_215 +for_215: emit c4 --> for_214 +for_214: move %4, %6 --> for_24 +for_24 : j --> for_213 +for_213: li %10, 0 --> for_212 +for_212: emit c3 --> for_211 +for_211: slt %11, %4, %2 --> for_210 +for_210: li %15, 0 --> for_228 +for_228: seq %9, %11, %15 --> for_29 +for_29 : beq %9, %10 --> for_28, for_23 +for_23 : emit c0 --> for_22 +for_22 : li %8, 1 --> for_21 +for_21 : add %7, %5, %8 --> for_20 +for_20 : return %7 +for_28 : emit c1 --> for_27 +for_27 : add %5, %5, %4 --> for_26 +for_26 : emit c2 --> for_25 +for_25 : add %4, %4, %3 --> for_24 + +function _main() : %1 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28 +entry main75 +main75: li %0, 0 --> main74 +main74: li %2, 0 --> main73 +main73: li %3, 0 --> main72 +main72: li %4, 0 --> main71 +main71: li %5, 0 --> main70 +main70: li %6, 0 --> main69 +main69: li %7, 0 --> main68 +main68: li %8, 0 --> main67 +main67: li %9, 0 --> main66 +main66: li %10, 0 --> main65 +main65: li %11, 0 --> main64 +main64: li %12, 0 --> main63 +main63: li %13, 0 --> main62 +main62: li %14, 0 --> main61 +main61: li %15, 0 --> main60 +main60: li %16, 0 --> main59 +main59: li %17, 0 --> main58 +main58: li %18, 0 --> main57 +main57: li %19, 0 --> main56 +main56: li %20, 0 --> main55 +main55: li %21, 0 --> main54 +main54: li %22, 0 --> main53 +main53: li %23, 0 --> main52 +main52: li %24, 0 --> main51 +main51: li %25, 0 --> main50 +main50: li %26, 0 --> main49 +main49: li %27, 0 --> main48 +main48: li %28, 0 --> main38 +main38: emit c104 --> main37 +main37: li %18, 3 --> main36 +main36: li %19, 1 --> main35 +main35: la %26, for_2 --> main45 +main45: call %0, %26(%18, %19) --> main34 +main34: emit c103 --> main33 +main33: li %15, 1 --> main32 +main32: li %16, 2 --> main31 +main31: li %17, 3 --> main30 +main30: la %25, for_loopParalAsync --> main44 +main44: call %0, %25(%15, %16, %17) --> main29 +main29: emit c102 --> main28 +main28: li %14, 1 --> main27 +main27: la %23, for_double --> main42 +main42: call %0, %23(%14) --> main26 +main26: emit c101 --> main25 +main25: li %11, 2 --> main24 +main24: li %12, 10 --> main23 +main23: li %13, 1 --> main22 +main22: la %22, for_ex --> main41 +main41: call %0, %22(%11, %12, %13) --> main21 +main21: emit c100 --> main20 +main20: li %8, 2 --> main19 +main19: li %9, 10 --> main18 +main18: li %10, 1 --> main17 +main17: la %21, for_fortSimple --> main40 +main40: call %0, %21(%8, %9, %10) --> main16 +main16: emit c99 --> main15 +main15: li %6, 2 --> main14 +main14: li %7, 3 --> main13 +main13: la %20, for_imbriq --> main39 +main39: call %0, %20(%6, %7) --> main12 +main12: emit c98 --> main11 +main11: li %4, 2 --> main10 +main10: li %5, 3 --> main9 +main9 : la %28, for_incr --> main47 +main47: call %0, %28(%4, %5) --> main8 +main8 : emit c97 --> main7 +main7 : li %2, 2 --> main6 +main6 : li %3, 3 --> main5 +main5 : la %27, for_incrParam --> main46 +main46: call %0, %27(%2, %3) --> main4 +main4 : emit c96 --> main3 +main3 : la %24, for_forfor --> main43 +main43: call %0, %24() --> main2 +main2 : emit c95 --> main1 +main1 : move %1, %0 --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/for.RTLabs.expected b/tests/clight/for.RTLabs.expected new file mode 100644 index 0000000..5ccbcd5 --- /dev/null +++ b/tests/clight/for.RTLabs.expected @@ -0,0 +1,800 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "for_2"(%0, %1): int -> int -> int + locals: %7, %2, %3, %4, %5, %6, %8, %9, %10, %11, %12, %13, %14 + result: %7 + stacksize: 0 + entry: for_227 + exit: for_20 + + for_29: eq %9, %10 --> for_28, for_23 + for_28: emit c1 --> for_27 + for_27: add %5, %5, %4 --> for_26 + for_26: emit c2 --> for_25 + for_25: add %4, %4, %3 --> for_24 + for_24: --> for_213 + for_23: emit c0 --> for_22 + for_227: emit c9 --> for_226 + for_226: imm_int 0, %5, --> for_225 + for_225: emit c8 --> for_224 + for_224: imm_int 2, %14, --> for_223 + for_223: mul %6, %0, %14 --> for_222 + for_222: emit c7 --> for_221 + for_221: imm_int 4, %13, --> for_220 + for_220: mul %2, %0, %13 --> for_219 + for_22: imm_int 1, %8, --> for_21 + for_219: emit c6 --> for_218 + for_218: imm_int 1, %12, --> for_217 + for_217: add %3, %1, %12 --> for_216 + for_216: emit c5 --> for_215 + for_215: emit c4 --> for_214 + for_214: mov %4, %6 --> for_24 + for_213: imm_int 0, %10, --> for_212 + for_212: emit c3 --> for_211 + for_211: lt %11, %4, %2 --> for_210 + for_210: notbool %9, %11 --> for_29 + for_21: add %7, %5, %8 --> for_20 + for_20: return %7 + + + "for_loopParalAsync"(%0, %1, %2): int -> int -> int -> int + locals: %8, %3, %4, %5, %6, %7, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24 + result: %8 + stacksize: 0 + entry: for_loopParalAsync56 + exit: for_loopParalAsync0 + + for_loopParalAsync9: mul %2, %2, %10 --> for_loopParalAsync8 + for_loopParalAsync8: emit c11 --> for_loopParalAsync7 + for_loopParalAsync7: div %3, %2, %6 --> for_loopParalAsync6 + for_loopParalAsync6: emit c13 --> for_loopParalAsync5 + for_loopParalAsync56: emit c29 --> for_loopParalAsync55 + for_loopParalAsync55: imm_int 0, %5, --> for_loopParalAsync54 + for_loopParalAsync54: emit c28 --> for_loopParalAsync53 + for_loopParalAsync53: imm_int 0, %0, --> for_loopParalAsync52 + for_loopParalAsync52: emit c27 --> for_loopParalAsync51 + for_loopParalAsync51: imm_int 3, %24, --> for_loopParalAsync50 + for_loopParalAsync50: add %0, %0, %24 --> for_loopParalAsync49 + for_loopParalAsync5: imm_int 1, %9, --> for_loopParalAsync4 + for_loopParalAsync49: emit c26 --> for_loopParalAsync48 + for_loopParalAsync48: imm_int 2, %23, --> for_loopParalAsync47 + for_loopParalAsync47: mul %0, %0, %23 --> for_loopParalAsync46 + for_loopParalAsync46: emit c25 --> for_loopParalAsync45 + for_loopParalAsync45: imm_int 3, %22, --> for_loopParalAsync44 + for_loopParalAsync44: div %0, %0, %22 --> for_loopParalAsync43 + for_loopParalAsync43: emit c24 --> for_loopParalAsync42 + for_loopParalAsync42: imm_int 8, %21, --> for_loopParalAsync41 + for_loopParalAsync41: add %0, %0, %21 --> for_loopParalAsync40 + for_loopParalAsync40: emit c23 --> for_loopParalAsync39 + for_loopParalAsync4: add %6, %6, %9 --> for_loopParalAsync3 + for_loopParalAsync39: emit c22 --> for_loopParalAsync38 + for_loopParalAsync38: imm_int 0, %7, --> for_loopParalAsync20 + for_loopParalAsync37: imm_int 0, %18, --> for_loopParalAsync36 + for_loopParalAsync36: emit c21 --> for_loopParalAsync35 + for_loopParalAsync35: imm_int 20, %20, --> for_loopParalAsync34 + for_loopParalAsync34: lt %19, %7, %20 --> for_loopParalAsync33 + for_loopParalAsync33: notbool %17, %19 --> for_loopParalAsync32 + for_loopParalAsync32: eq %17, %18 --> for_loopParalAsync31, for_loopParalAsync19 + for_loopParalAsync31: emit c19 --> for_loopParalAsync30 + for_loopParalAsync30: imm_int 1, %16, --> for_loopParalAsync29 + for_loopParalAsync3: --> for_loopParalAsync16 + for_loopParalAsync29: add %5, %5, %16 --> for_loopParalAsync28 + for_loopParalAsync28: emit c18 --> for_loopParalAsync27 + for_loopParalAsync27: imm_int 2, %15, --> for_loopParalAsync26 + for_loopParalAsync26: add %1, %1, %15 --> for_loopParalAsync25 + for_loopParalAsync25: emit c17 --> for_loopParalAsync24 + for_loopParalAsync24: div %4, %1, %5 --> for_loopParalAsync23 + for_loopParalAsync23: emit c20 --> for_loopParalAsync22 + for_loopParalAsync22: imm_int 1, %14, --> for_loopParalAsync21 + for_loopParalAsync21: add %7, %7, %14 --> for_loopParalAsync20 + for_loopParalAsync20: --> for_loopParalAsync37 + for_loopParalAsync2: emit c10 --> for_loopParalAsync1 + for_loopParalAsync19: emit c16 --> for_loopParalAsync18 + for_loopParalAsync18: emit c15 --> for_loopParalAsync17 + for_loopParalAsync17: imm_int 1, %6, --> for_loopParalAsync3 + for_loopParalAsync16: imm_int 0, %12, --> for_loopParalAsync15 + for_loopParalAsync15: emit c14 --> for_loopParalAsync14 + for_loopParalAsync14: lt %13, %6, %0 --> for_loopParalAsync13 + for_loopParalAsync13: notbool %11, %13 --> for_loopParalAsync12 + for_loopParalAsync12: eq %11, %12 --> for_loopParalAsync11, for_loopParalAsync2 + for_loopParalAsync11: emit c12 --> for_loopParalAsync10 + for_loopParalAsync10: imm_int 2, %10, --> for_loopParalAsync9 + for_loopParalAsync1: mov %8, %5 --> for_loopParalAsync0 + for_loopParalAsync0: return %8 + + + "for_double"(%0): int -> int + locals: %6, %1, %2, %3, %4, %5, %7, %8, %9, %10, %11, %12, %13, %14 + result: %6 + stacksize: 0 + entry: for_double36 + exit: for_double0 + + for_double9: emit c32 --> for_double8 + for_double8: add %4, %4, %1 --> for_double7 + for_double7: emit c33 --> for_double6 + for_double6: add %1, %1, %0 --> for_double5 + for_double5: --> for_double15 + for_double4: emit c31 --> for_double3 + for_double36: emit c43 --> for_double35 + for_double35: imm_int 0, %5, --> for_double34 + for_double34: emit c42 --> for_double33 + for_double33: imm_int 0, %4, --> for_double32 + for_double32: emit c41 --> for_double31 + for_double31: emit c40 --> for_double30 + for_double30: imm_int 0, %2, --> for_double19 + for_double3: mul %3, %5, %4 --> for_double2 + for_double29: imm_int 0, %12, --> for_double28 + for_double28: emit c39 --> for_double27 + for_double27: imm_int 12, %14, --> for_double26 + for_double26: lt %13, %2, %14 --> for_double25 + for_double25: notbool %11, %13 --> for_double24 + for_double24: eq %11, %12 --> for_double23, for_double18 + for_double23: emit c37 --> for_double22 + for_double22: add %5, %5, %2 --> for_double21 + for_double21: emit c38 --> for_double20 + for_double20: add %2, %2, %0 --> for_double19 + for_double2: emit c30 --> for_double1 + for_double19: --> for_double29 + for_double18: emit c36 --> for_double17 + for_double17: emit c35 --> for_double16 + for_double16: imm_int 0, %1, --> for_double5 + for_double15: imm_int 0, %8, --> for_double14 + for_double14: emit c34 --> for_double13 + for_double13: imm_int 5, %10, --> for_double12 + for_double12: lt %9, %1, %10 --> for_double11 + for_double11: notbool %7, %9 --> for_double10 + for_double10: eq %7, %8 --> for_double9, for_double4 + for_double1: mov %6, %3 --> for_double0 + for_double0: return %6 + + + "for_ex"(%0, %1, %2): int -> int -> int -> int + locals: %5, %3, %4, %6, %7, %8, %9, %10, %11 + result: %5 + stacksize: 0 + entry: for_ex20 + exit: for_ex0 + + for_ex9: notbool %6, %8 --> for_ex8 + for_ex8: eq %6, %7 --> for_ex7, for_ex2 + for_ex7: emit c45 --> for_ex6 + for_ex6: sub %3, %3, %4 --> for_ex5 + for_ex5: emit c46 --> for_ex4 + for_ex4: add %4, %4, %2 --> for_ex3 + for_ex3: --> for_ex14 + for_ex20: emit c50 --> for_ex19 + for_ex2: emit c44 --> for_ex1 + for_ex19: imm_int 0, %3, --> for_ex18 + for_ex18: emit c49 --> for_ex17 + for_ex17: emit c48 --> for_ex16 + for_ex16: imm_int 3, %11, --> for_ex15 + for_ex15: add %4, %0, %11 --> for_ex3 + for_ex14: imm_int 0, %7, --> for_ex13 + for_ex13: emit c47 --> for_ex12 + for_ex12: imm_int 2, %10, --> for_ex11 + for_ex11: mul %9, %1, %10 --> for_ex10 + for_ex10: le %8, %4, %9 --> for_ex9 + for_ex1: mov %5, %3 --> for_ex0 + for_ex0: return %5 + + + "for_fortSimple"(%0, %1, %2): int -> int -> int -> int + locals: %7, %3, %4, %5, %6, %8, %9, %10 + result: %7 + stacksize: 0 + entry: for_fortSimple19 + exit: for_fortSimple0 + + for_fortSimple9: emit c53 --> for_fortSimple8 + for_fortSimple8: add %3, %3, %5 --> for_fortSimple7 + for_fortSimple7: emit c54 --> for_fortSimple6 + for_fortSimple6: add %5, %5, %2 --> for_fortSimple5 + for_fortSimple5: --> for_fortSimple14 + for_fortSimple4: emit c52 --> for_fortSimple3 + for_fortSimple3: add %4, %3, %0 --> for_fortSimple2 + for_fortSimple2: emit c51 --> for_fortSimple1 + for_fortSimple19: emit c58 --> for_fortSimple18 + for_fortSimple18: imm_int 0, %3, --> for_fortSimple17 + for_fortSimple17: emit c57 --> for_fortSimple16 + for_fortSimple16: emit c56 --> for_fortSimple15 + for_fortSimple15: mov %5, %0 --> for_fortSimple5 + for_fortSimple14: imm_int 0, %9, --> for_fortSimple13 + for_fortSimple13: emit c55 --> for_fortSimple12 + for_fortSimple12: lt %10, %5, %1 --> for_fortSimple11 + for_fortSimple11: notbool %8, %10 --> for_fortSimple10 + for_fortSimple10: eq %8, %9 --> for_fortSimple9, for_fortSimple4 + for_fortSimple1: mov %7, %4 --> for_fortSimple0 + for_fortSimple0: return %7 + + + "for_imbriq"(%0, %1): int -> int -> int + locals: %6, %2, %3, %4, %5, %7, %8, %9, %10, %11, %12, %13, %14 + result: %6 + stacksize: 0 + entry: for_imbriq34 + exit: for_imbriq0 + + for_imbriq9: mod %4, %4, %2 --> for_imbriq8 + for_imbriq8: emit c62 --> for_imbriq7 + for_imbriq7: add %2, %2, %1 --> for_imbriq6 + for_imbriq6: --> for_imbriq18 + for_imbriq5: emit c67 --> for_imbriq4 + for_imbriq4: add %3, %3, %0 --> for_imbriq3 + for_imbriq34: emit c71 --> for_imbriq33 + for_imbriq33: imm_int 0, %5, --> for_imbriq32 + for_imbriq32: emit c70 --> for_imbriq31 + for_imbriq31: emit c69 --> for_imbriq30 + for_imbriq30: imm_int 0, %3, --> for_imbriq3 + for_imbriq3: --> for_imbriq29 + for_imbriq29: imm_int 0, %12, --> for_imbriq28 + for_imbriq28: emit c68 --> for_imbriq27 + for_imbriq27: imm_int 23, %14, --> for_imbriq26 + for_imbriq26: lt %13, %3, %14 --> for_imbriq25 + for_imbriq25: notbool %11, %13 --> for_imbriq24 + for_imbriq24: eq %11, %12 --> for_imbriq23, for_imbriq2 + for_imbriq23: emit c66 --> for_imbriq22 + for_imbriq22: imm_int 0, %4, --> for_imbriq21 + for_imbriq21: emit c65 --> for_imbriq20 + for_imbriq20: emit c64 --> for_imbriq19 + for_imbriq2: emit c59 --> for_imbriq1 + for_imbriq19: imm_int 1, %2, --> for_imbriq6 + for_imbriq18: imm_int 0, %8, --> for_imbriq17 + for_imbriq17: emit c63 --> for_imbriq16 + for_imbriq16: imm_int 12, %10, --> for_imbriq15 + for_imbriq15: lt %9, %2, %10 --> for_imbriq14 + for_imbriq14: notbool %7, %9 --> for_imbriq13 + for_imbriq13: eq %7, %8 --> for_imbriq12, for_imbriq5 + for_imbriq12: emit c61 --> for_imbriq11 + for_imbriq11: add %5, %5, %4 --> for_imbriq10 + for_imbriq10: emit c60 --> for_imbriq9 + for_imbriq1: mov %6, %5 --> for_imbriq0 + for_imbriq0: return %6 + + + "for_incr"(%0, %1): int -> int -> int + locals: %4, %2, %3, %5, %6, %7, %8, %9, %10, %11 + result: %4 + stacksize: 0 + entry: for_incr21 + exit: for_incr0 + + for_incr9: eq %6, %7 --> for_incr8, for_incr2 + for_incr8: emit c73 --> for_incr7 + for_incr7: sub %2, %2, %3 --> for_incr6 + for_incr6: emit c74 --> for_incr5 + for_incr5: imm_int 1, %5, --> for_incr4 + for_incr4: add %3, %3, %5 --> for_incr3 + for_incr3: --> for_incr15 + for_incr21: emit c78 --> for_incr20 + for_incr20: imm_int 0, %2, --> for_incr19 + for_incr2: emit c72 --> for_incr1 + for_incr19: emit c77 --> for_incr18 + for_incr18: emit c76 --> for_incr17 + for_incr17: imm_int 3, %11, --> for_incr16 + for_incr16: add %3, %0, %11 --> for_incr3 + for_incr15: imm_int 0, %7, --> for_incr14 + for_incr14: emit c75 --> for_incr13 + for_incr13: imm_int 2, %10, --> for_incr12 + for_incr12: mul %9, %1, %10 --> for_incr11 + for_incr11: le %8, %3, %9 --> for_incr10 + for_incr10: notbool %6, %8 --> for_incr9 + for_incr1: mov %4, %2 --> for_incr0 + for_incr0: return %4 + + + "for_incrParam"(%0, %1): int -> int -> int + locals: %5, %2, %3, %4, %6, %7, %8, %9, %10, %11, %12, %13 + result: %5 + stacksize: 0 + entry: for_incrParam24 + exit: for_incrParam0 + + for_incrParam9: eq %7, %8 --> for_incrParam8, for_incrParam2 + for_incrParam8: emit c80 --> for_incrParam7 + for_incrParam7: add %6, %3, %2 --> for_incrParam6 + for_incrParam6: add %3, %6, %0 --> for_incrParam5 + for_incrParam5: emit c81 --> for_incrParam4 + for_incrParam4: add %3, %3, %0 --> for_incrParam3 + for_incrParam3: --> for_incrParam15 + for_incrParam24: emit c86 --> for_incrParam23 + for_incrParam23: add %2, %0, %1 --> for_incrParam22 + for_incrParam22: emit c85 --> for_incrParam21 + for_incrParam21: imm_int 3, %13, --> for_incrParam20 + for_incrParam20: mul %4, %13, %2 --> for_incrParam19 + for_incrParam2: emit c79 --> for_incrParam1 + for_incrParam19: emit c84 --> for_incrParam18 + for_incrParam18: emit c83 --> for_incrParam17 + for_incrParam17: imm_int 4, %12, --> for_incrParam16 + for_incrParam16: sub %3, %2, %12 --> for_incrParam3 + for_incrParam15: imm_int 0, %8, --> for_incrParam14 + for_incrParam14: emit c82 --> for_incrParam13 + for_incrParam13: imm_int 6, %11, --> for_incrParam12 + for_incrParam12: add %10, %1, %11 --> for_incrParam11 + for_incrParam11: lt %9, %3, %10 --> for_incrParam10 + for_incrParam10: notbool %7, %9 --> for_incrParam9 + for_incrParam1: mov %5, %3 --> for_incrParam0 + for_incrParam0: return %5 + + + "for_forfor"(): int + locals: %2, %0, %1, %3, %4, %5, %6, %7, %8, %9 + result: %2 + stacksize: 0 + entry: for_forfor23 + exit: for_forfor0 + + for_forfor9: emit c88 --> for_forfor8 + for_forfor8: imm_int 1, %4, --> for_forfor7 + for_forfor7: add %0, %0, %4 --> for_forfor6 + for_forfor6: emit c90 --> for_forfor5 + for_forfor5: imm_int 1, %3, --> for_forfor4 + for_forfor4: add %1, %1, %3 --> for_forfor3 + for_forfor3: --> for_forfor18 + for_forfor23: emit c94 --> for_forfor22 + for_forfor22: emit c93 --> for_forfor21 + for_forfor21: imm_int 0, %1, --> for_forfor20 + for_forfor20: emit c92 --> for_forfor19 + for_forfor2: emit c87 --> for_forfor1 + for_forfor19: imm_int 0, %0, --> for_forfor3 + for_forfor18: imm_int 0, %7, --> for_forfor17 + for_forfor17: emit c91 --> for_forfor16 + for_forfor16: imm_int 10, %9, --> for_forfor15 + for_forfor15: lt %8, %1, %9 --> for_forfor14 + for_forfor14: notbool %6, %8 --> for_forfor13 + for_forfor13: eq %6, %7 --> for_forfor12, for_forfor2 + for_forfor12: emit c89 --> for_forfor11 + for_forfor11: imm_int 1, %5, --> for_forfor10 + for_forfor10: add %0, %0, %5 --> for_forfor9 + for_forfor1: mov %2, %0 --> for_forfor0 + for_forfor0: return %2 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19 + result: %1 + stacksize: 0 + entry: main38 + exit: main0 + + main9: call "for_incr", %4, %5, %0: int -> int -> int --> main8 + main8: emit c97 --> main7 + main7: imm_int 2, %2, --> main6 + main6: imm_int 3, %3, --> main5 + main5: call "for_incrParam", %2, %3, %0: int -> int -> int --> main4 + main4: emit c96 --> main3 + main38: emit c104 --> main37 + main37: imm_int 3, %18, --> main36 + main36: imm_int 1, %19, --> main35 + main35: call "for_2", %18, %19, %0: int -> int -> int --> main34 + main34: emit c103 --> main33 + main33: imm_int 1, %15, --> main32 + main32: imm_int 2, %16, --> main31 + main31: imm_int 3, %17, --> main30 + main30: call "for_loopParalAsync", %15, %16, %17, %0: int -> int -> int -> int --> main29 + main3: call "for_forfor", , %0: int --> main2 + main29: emit c102 --> main28 + main28: imm_int 1, %14, --> main27 + main27: call "for_double", %14, %0: int -> int --> main26 + main26: emit c101 --> main25 + main25: imm_int 2, %11, --> main24 + main24: imm_int 10, %12, --> main23 + main23: imm_int 1, %13, --> main22 + main22: call "for_ex", %11, %12, %13, %0: int -> int -> int -> int --> main21 + main21: emit c100 --> main20 + main20: imm_int 2, %8, --> main19 + main2: emit c95 --> main1 + main19: imm_int 10, %9, --> main18 + main18: imm_int 1, %10, --> main17 + main17: call "for_fortSimple", %8, %9, %10, %0: int -> int -> int -> int --> main16 + main16: emit c99 --> main15 + main15: imm_int 2, %6, --> main14 + main14: imm_int 3, %7, --> main13 + main13: call "for_imbriq", %6, %7, %0: int -> int -> int --> main12 + main12: emit c98 --> main11 + main11: imm_int 2, %4, --> main10 + main10: imm_int 3, %5, --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/for.c b/tests/clight/for.c new file mode 100644 index 0000000..2cf9d3c --- /dev/null +++ b/tests/clight/for.c @@ -0,0 +1,116 @@ +int for_2(int a,int b){ + int i,min,max,pas,resul; + resul = 0; + min = a*2; + max = a*4; + pas=b+1; + for(i=min;i b) { + c38: + min = b; + } else { + c37: + min = a; + } + c36: + return min; +} + +int if_prog(int j, int i) +{ + int a; + int b; + c44: + a = i + j; + c43: + if (a < 0) { + c42: + b = 2; + } else { + c41: + b = 3; + } + c40: + return b; +} + +int if_sansElse(int a, int b) +{ + int c; + c48: + c = 0; + c47: + if (a < b) { + c46: + c = a; + } + c45: + return c; +} + +int if_test(int a, int b, int x, int y) +{ + int c; + int d; + int v; + int w; + int z; + c61: + c = 0; + c60: + d = 0; + c59: + v = 0; + c58: + w = 0; + c57: + z = 0; + c56: + if (a < b) { + c55: + c = a + b; + } + c54: + if (x < y) { + c53: + z = x + y; + c52: + w = z + x; + } + c51: + d = c + 1; + c50: + v = c + w; + c49: + return c; +} + +int if_ual(int op, int a, int b) +{ + int result; + c74: + if (op == 0) { + c73: + result = a + b; + } else { + c72: + if (op == 1) { + c71: + result = a - b; + } else { + c70: + if (op == 2) { + c69: + result = (/* c68 */ a) && (/* c67 */ b); + } else { + c66: + if (op == 3) { + c65: + result = (/* c64 */ a) || (/* c63 */ b); + } + } + } + } + c62: + return result; +} + +int main(void) +{ + int a; + c84: + a = if_jian(1, 2, 3, 4, 5, 6, 7, 8, 9); + c83: + a = if_exSimple(1, 2); + c82: + a = if_imbriq1(1, 2, 3); + c81: + a = if_imbriq2(1, 2, 3); + c80: + a = if_min(1, 2); + c79: + a = if_prog(1, 2); + c78: + a = if_sansElse(1, 2); + c77: + a = if_test(1, 2, 3, 4); + c76: + a = if_ual(1, 2, 3); + c75: + return a; +} + + diff --git a/tests/clight/ifthenelse.Cminor.expected b/tests/clight/ifthenelse.Cminor.expected new file mode 100644 index 0000000..07ef1c5 --- /dev/null +++ b/tests/clight/ifthenelse.Cminor.expected @@ -0,0 +1,711 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"if_jian" (a, b, c, d, e, f, g, x, y) : int -> int -> int -> int -> int -> int -> int -> int -> int -> int { + + stack 0; + + var u, v, t1, t2, t3, t4, t5; + + c15: + t1 = (a + b) < c; + c14: + t2 = d + e; + c13: + t3 = c + 1; + c12: + if (y == 1) { + c11: + if (t1) { + c10: + u = t3 + d; + } + else { + c9: + if (!x) { + c8: + u = t2 + d; + } + else { + } + } + c7: + if ((/* c6 */ !t1) ? ((/* c5 */ x) ? 1 : 0) : 0) { + c4: + v = t2 + e; + } + else { + } + } + else { + c3: + t4 = t3 + e; + c2: + t5 = t4 + f; + c1: + u = t5 + g; + } + c0: + return u; + +} + + +"if_exSimple" (a, b) : int -> int -> int { + + stack 0; + + var g, e, f; + + c23: + if (a < b) { + c22: + e = a + b; + c21: + e = 2 * e; + c20: + g = e; + } + else { + c19: + f = 2 * b; + c18: + f = f + a; + c17: + g = f + b; + } + c16: + return g; + +} + + +"if_imbriq1" (a, b, c) : int -> int -> int -> int { + + stack 0; + + var result; + + c29: + if (a < b) { + c28: + if (b < c) { + c27: + result = b; + } + else { + c26: + result = c; + } + } + else { + c25: + result = a; + } + c24: + return result; + +} + + +"if_imbriq2" (a, b, c) : int -> int -> int -> int { + + stack 0; + + var result; + + c35: + if (a < b) { + c34: + if (b < c) { + c33: + result = b; + } + else { + c32: + result = 47; + } + } + else { + c31: + result = a; + } + c30: + return result; + +} + + +"if_min" (a, b) : int -> int -> int { + + stack 0; + + var min; + + c39: + if (a > b) { + c38: + min = b; + } + else { + c37: + min = a; + } + c36: + return min; + +} + + +"if_prog" (j, i) : int -> int -> int { + + stack 0; + + var a, b; + + c44: + a = i + j; + c43: + if (a < 0) { + c42: + b = 2; + } + else { + c41: + b = 3; + } + c40: + return b; + +} + + +"if_sansElse" (a, b) : int -> int -> int { + + stack 0; + + var c; + + c48: + c = 0; + c47: + if (a < b) { + c46: + c = a; + } + else { + } + c45: + return c; + +} + + +"if_test" (a, b, x, y) : int -> int -> int -> int -> int { + + stack 0; + + var c, d, v, w, z; + + c61: + c = 0; + c60: + d = 0; + c59: + v = 0; + c58: + w = 0; + c57: + z = 0; + c56: + if (a < b) { + c55: + c = a + b; + } + else { + } + c54: + if (x < y) { + c53: + z = x + y; + c52: + w = z + x; + } + else { + } + c51: + d = c + 1; + c50: + v = c + w; + c49: + return c; + +} + + +"if_ual" (op, a, b) : int -> int -> int -> int { + + stack 0; + + var result; + + c74: + if (op == 0) { + c73: + result = a + b; + } + else { + c72: + if (op == 1) { + c71: + result = a - b; + } + else { + c70: + if (op == 2) { + c69: + result = (/* c68 */ a) ? ((/* c67 */ b) ? 1 : 0) : 0; + } + else { + c66: + if (op == 3) { + c65: + result = (/* c64 */ a) ? 1 : ((/* c63 */ b) ? 1 : 0); + } + else { + } + } + } + } + c62: + return result; + +} + + +"main" () : int { + + stack 0; + + var a; + + c84: + a = "if_jian"(1, 2, 3, 4, 5, 6, 7, 8, 9) : int -> int -> int -> int -> int -> int -> int -> int -> int -> int; + c83: + a = "if_exSimple"(1, 2) : int -> int -> int; + c82: + a = "if_imbriq1"(1, 2, 3) : int -> int -> int -> int; + c81: + a = "if_imbriq2"(1, 2, 3) : int -> int -> int -> int; + c80: + a = "if_min"(1, 2) : int -> int -> int; + c79: + a = "if_prog"(1, 2) : int -> int -> int; + c78: + a = "if_sansElse"(1, 2) : int -> int -> int; + c77: + a = "if_test"(1, 2, 3, 4) : int -> int -> int -> int -> int; + c76: + a = "if_ual"(1, 2, 3) : int -> int -> int -> int; + c75: + return a; + +} + + diff --git a/tests/clight/ifthenelse.ERTL.expected b/tests/clight/ifthenelse.ERTL.expected new file mode 100644 index 0000000..490602f --- /dev/null +++ b/tests/clight/ifthenelse.ERTL.expected @@ -0,0 +1,760 @@ +program + +globals 0 + +procedure if_ual(3) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33 +entry if_ual84 +if_ual84: newframe --> if_ual83 +if_ual83: move %33, $ra --> if_ual82 +if_ual82: move %32, $s7 --> if_ual81 +if_ual81: move %31, $s6 --> if_ual80 +if_ual80: move %30, $s5 --> if_ual79 +if_ual79: move %29, $s4 --> if_ual78 +if_ual78: move %28, $s3 --> if_ual77 +if_ual77: move %27, $s2 --> if_ual76 +if_ual76: move %26, $s1 --> if_ual75 +if_ual75: move %25, $s0 --> if_ual74 +if_ual74: move %0, $a0 --> if_ual73 +if_ual73: move %1, $a1 --> if_ual72 +if_ual72: move %2, $a2 --> if_ual71 +if_ual71: li %3, 0 --> if_ual70 +if_ual70: li %5, 0 --> if_ual69 +if_ual69: li %6, 0 --> if_ual68 +if_ual68: li %7, 0 --> if_ual67 +if_ual67: li %8, 0 --> if_ual66 +if_ual66: li %9, 0 --> if_ual65 +if_ual65: li %10, 0 --> if_ual64 +if_ual64: li %11, 0 --> if_ual63 +if_ual63: li %12, 0 --> if_ual62 +if_ual62: li %13, 0 --> if_ual61 +if_ual61: li %14, 0 --> if_ual60 +if_ual60: li %15, 0 --> if_ual59 +if_ual59: li %16, 0 --> if_ual58 +if_ual58: li %17, 0 --> if_ual57 +if_ual57: li %18, 0 --> if_ual56 +if_ual56: li %19, 0 --> if_ual55 +if_ual55: li %20, 0 --> if_ual54 +if_ual54: li %21, 0 --> if_ual53 +if_ual53: li %22, 0 --> if_ual52 +if_ual52: li %23, 0 --> if_ual51 +if_ual51: li %24, 0 --> if_ual50 +if_ual50: emit c74 --> if_ual49 +if_ual49: li %23, 0 --> if_ual48 +if_ual48: li %24, 0 --> if_ual47 +if_ual47: seq %22, %0, %24 --> if_ual46 +if_ual46: beq %22, %23 --> if_ual43, if_ual45 +if_ual45: emit c73 --> if_ual44 +if_ual44: addu %3, %1, %2 --> if_ual2 +if_ual2 : emit c62 --> if_ual1 +if_ual1 : move %4, %3 --> if_ual0 +if_ual0 : j --> if_ual96 +if_ual96: move $v0, %4 --> if_ual95 +if_ual95: move $ra, %33 --> if_ual94 +if_ual94: move $s7, %32 --> if_ual93 +if_ual93: move $s6, %31 --> if_ual92 +if_ual92: move $s5, %30 --> if_ual91 +if_ual91: move $s4, %29 --> if_ual90 +if_ual90: move $s3, %28 --> if_ual89 +if_ual89: move $s2, %27 --> if_ual88 +if_ual88: move $s1, %26 --> if_ual87 +if_ual87: move $s0, %25 --> if_ual86 +if_ual86: delframe --> if_ual85 +if_ual85: jr $ra (xmits $v0) +if_ual43: emit c72 --> if_ual42 +if_ual42: li %20, 0 --> if_ual41 +if_ual41: li %21, 1 --> if_ual40 +if_ual40: seq %19, %0, %21 --> if_ual39 +if_ual39: beq %19, %20 --> if_ual36, if_ual38 +if_ual38: emit c71 --> if_ual37 +if_ual37: subu %3, %1, %2 --> if_ual2 +if_ual36: emit c70 --> if_ual35 +if_ual35: li %17, 0 --> if_ual34 +if_ual34: li %18, 2 --> if_ual33 +if_ual33: seq %16, %0, %18 --> if_ual32 +if_ual32: beq %16, %17 --> if_ual19, if_ual31 +if_ual31: emit c69 --> if_ual30 +if_ual30: li %15, 0 --> if_ual29 +if_ual29: emit c68 --> if_ual28 +if_ual28: move %14, %1 --> if_ual27 +if_ual27: beq %14, %15 --> if_ual20, if_ual26 +if_ual26: li %13, 0 --> if_ual25 +if_ual25: emit c67 --> if_ual24 +if_ual24: move %12, %2 --> if_ual23 +if_ual23: beq %12, %13 --> if_ual21, if_ual22 +if_ual22: li %3, 1 --> if_ual2 +if_ual21: li %3, 0 --> if_ual2 +if_ual20: li %3, 0 --> if_ual2 +if_ual19: emit c66 --> if_ual18 +if_ual18: li %10, 0 --> if_ual17 +if_ual17: li %11, 3 --> if_ual16 +if_ual16: seq %9, %0, %11 --> if_ual15 +if_ual15: beq %9, %10 --> if_ual2, if_ual14 +if_ual14: emit c65 --> if_ual13 +if_ual13: li %8, 0 --> if_ual12 +if_ual12: emit c64 --> if_ual11 +if_ual11: move %7, %1 --> if_ual10 +if_ual10: beq %7, %8 --> if_ual8, if_ual9 +if_ual9 : li %3, 1 --> if_ual2 +if_ual8 : li %6, 0 --> if_ual7 +if_ual7 : emit c63 --> if_ual6 +if_ual6 : move %5, %2 --> if_ual5 +if_ual5 : beq %5, %6 --> if_ual3, if_ual4 +if_ual4 : li %3, 1 --> if_ual2 +if_ual3 : li %3, 0 --> if_ual2 + +procedure if_test(4) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23 +entry if_test55 +if_test55: newframe --> if_test54 +if_test54: move %23, $ra --> if_test53 +if_test53: move %22, $s7 --> if_test52 +if_test52: move %21, $s6 --> if_test51 +if_test51: move %20, $s5 --> if_test50 +if_test50: move %19, $s4 --> if_test49 +if_test49: move %18, $s3 --> if_test48 +if_test48: move %17, $s2 --> if_test47 +if_test47: move %16, $s1 --> if_test46 +if_test46: move %15, $s0 --> if_test45 +if_test45: move %0, $a0 --> if_test44 +if_test44: move %1, $a1 --> if_test43 +if_test43: move %2, $a2 --> if_test42 +if_test42: move %3, $a3 --> if_test41 +if_test41: li %4, 0 --> if_test40 +if_test40: li %5, 0 --> if_test39 +if_test39: li %6, 0 --> if_test38 +if_test38: li %7, 0 --> if_test37 +if_test37: li %8, 0 --> if_test36 +if_test36: li %10, 0 --> if_test35 +if_test35: li %11, 0 --> if_test34 +if_test34: li %12, 0 --> if_test33 +if_test33: li %13, 0 --> if_test32 +if_test32: li %14, 0 --> if_test31 +if_test31: emit c61 --> if_test30 +if_test30: li %4, 0 --> if_test29 +if_test29: emit c60 --> if_test28 +if_test28: li %5, 0 --> if_test27 +if_test27: emit c59 --> if_test26 +if_test26: li %6, 0 --> if_test25 +if_test25: emit c58 --> if_test24 +if_test24: li %7, 0 --> if_test23 +if_test23: emit c57 --> if_test22 +if_test22: li %8, 0 --> if_test21 +if_test21: emit c56 --> if_test20 +if_test20: li %14, 0 --> if_test19 +if_test19: slt %13, %0, %1 --> if_test18 +if_test18: beq %13, %14 --> if_test15, if_test17 +if_test17: emit c55 --> if_test16 +if_test16: addu %4, %0, %1 --> if_test15 +if_test15: emit c54 --> if_test14 +if_test14: li %12, 0 --> if_test13 +if_test13: slt %11, %2, %3 --> if_test12 +if_test12: beq %11, %12 --> if_test7, if_test11 +if_test11: emit c53 --> if_test10 +if_test10: addu %8, %2, %3 --> if_test9 +if_test9 : emit c52 --> if_test8 +if_test8 : addu %7, %8, %2 --> if_test7 +if_test7 : emit c51 --> if_test6 +if_test6 : li %10, 1 --> if_test5 +if_test5 : addu %5, %4, %10 --> if_test4 +if_test4 : emit c50 --> if_test3 +if_test3 : addu %6, %4, %7 --> if_test2 +if_test2 : emit c49 --> if_test1 +if_test1 : move %9, %4 --> if_test0 +if_test0 : j --> if_test67 +if_test67: move $v0, %9 --> if_test66 +if_test66: move $ra, %23 --> if_test65 +if_test65: move $s7, %22 --> if_test64 +if_test64: move $s6, %21 --> if_test63 +if_test63: move $s5, %20 --> if_test62 +if_test62: move $s4, %19 --> if_test61 +if_test61: move $s3, %18 --> if_test60 +if_test60: move $s2, %17 --> if_test59 +if_test59: move $s1, %16 --> if_test58 +if_test58: move $s0, %15 --> if_test57 +if_test57: delframe --> if_test56 +if_test56: jr $ra (xmits $v0) + +procedure if_sansElse(2) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14 +entry if_sansElse25 +if_sansElse25: newframe --> if_sansElse24 +if_sansElse24: move %14, $ra --> if_sansElse23 +if_sansElse23: move %13, $s7 --> if_sansElse22 +if_sansElse22: move %12, $s6 --> if_sansElse21 +if_sansElse21: move %11, $s5 --> if_sansElse20 +if_sansElse20: move %10, $s4 --> if_sansElse19 +if_sansElse19: move %9, $s3 --> if_sansElse18 +if_sansElse18: move %8, $s2 --> if_sansElse17 +if_sansElse17: move %7, $s1 --> if_sansElse16 +if_sansElse16: move %6, $s0 --> if_sansElse15 +if_sansElse15: move %0, $a0 --> if_sansElse14 +if_sansElse14: move %1, $a1 --> if_sansElse13 +if_sansElse13: li %2, 0 --> if_sansElse12 +if_sansElse12: li %4, 0 --> if_sansElse11 +if_sansElse11: li %5, 0 --> if_sansElse10 +if_sansElse10: emit c48 --> if_sansElse9 +if_sansElse9 : li %2, 0 --> if_sansElse8 +if_sansElse8 : emit c47 --> if_sansElse7 +if_sansElse7 : li %5, 0 --> if_sansElse6 +if_sansElse6 : slt %4, %0, %1 --> if_sansElse5 +if_sansElse5 : beq %4, %5 --> if_sansElse2, if_sansElse4 +if_sansElse4 : emit c46 --> if_sansElse3 +if_sansElse3 : move %2, %0 --> if_sansElse2 +if_sansElse2 : emit c45 --> if_sansElse1 +if_sansElse1 : move %3, %2 --> if_sansElse0 +if_sansElse0 : j --> if_sansElse37 +if_sansElse37: move $v0, %3 --> if_sansElse36 +if_sansElse36: move $ra, %14 --> if_sansElse35 +if_sansElse35: move $s7, %13 --> if_sansElse34 +if_sansElse34: move $s6, %12 --> if_sansElse33 +if_sansElse33: move $s5, %11 --> if_sansElse32 +if_sansElse32: move $s4, %10 --> if_sansElse31 +if_sansElse31: move $s3, %9 --> if_sansElse30 +if_sansElse30: move $s2, %8 --> if_sansElse29 +if_sansElse29: move $s1, %7 --> if_sansElse28 +if_sansElse28: move $s0, %6 --> if_sansElse27 +if_sansElse27: delframe --> if_sansElse26 +if_sansElse26: jr $ra (xmits $v0) + +procedure if_prog(2) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16 +entry if_prog30 +if_prog30: newframe --> if_prog29 +if_prog29: move %16, $ra --> if_prog28 +if_prog28: move %15, $s7 --> if_prog27 +if_prog27: move %14, $s6 --> if_prog26 +if_prog26: move %13, $s5 --> if_prog25 +if_prog25: move %12, $s4 --> if_prog24 +if_prog24: move %11, $s3 --> if_prog23 +if_prog23: move %10, $s2 --> if_prog22 +if_prog22: move %9, $s1 --> if_prog21 +if_prog21: move %8, $s0 --> if_prog20 +if_prog20: move %0, $a0 --> if_prog19 +if_prog19: move %1, $a1 --> if_prog18 +if_prog18: li %2, 0 --> if_prog17 +if_prog17: li %3, 0 --> if_prog16 +if_prog16: li %5, 0 --> if_prog15 +if_prog15: li %6, 0 --> if_prog14 +if_prog14: li %7, 0 --> if_prog13 +if_prog13: emit c44 --> if_prog12 +if_prog12: addu %2, %1, %0 --> if_prog11 +if_prog11: emit c43 --> if_prog10 +if_prog10: li %6, 0 --> if_prog9 +if_prog9 : li %7, 0 --> if_prog8 +if_prog8 : slt %5, %2, %7 --> if_prog7 +if_prog7 : beq %5, %6 --> if_prog4, if_prog6 +if_prog6 : emit c42 --> if_prog5 +if_prog5 : li %3, 2 --> if_prog2 +if_prog2 : emit c40 --> if_prog1 +if_prog1 : move %4, %3 --> if_prog0 +if_prog0 : j --> if_prog42 +if_prog42: move $v0, %4 --> if_prog41 +if_prog41: move $ra, %16 --> if_prog40 +if_prog40: move $s7, %15 --> if_prog39 +if_prog39: move $s6, %14 --> if_prog38 +if_prog38: move $s5, %13 --> if_prog37 +if_prog37: move $s4, %12 --> if_prog36 +if_prog36: move $s3, %11 --> if_prog35 +if_prog35: move $s2, %10 --> if_prog34 +if_prog34: move $s1, %9 --> if_prog33 +if_prog33: move $s0, %8 --> if_prog32 +if_prog32: delframe --> if_prog31 +if_prog31: jr $ra (xmits $v0) +if_prog4 : emit c41 --> if_prog3 +if_prog3 : li %3, 3 --> if_prog2 + +procedure if_min(2) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14 +entry if_min25 +if_min25: newframe --> if_min24 +if_min24: move %14, $ra --> if_min23 +if_min23: move %13, $s7 --> if_min22 +if_min22: move %12, $s6 --> if_min21 +if_min21: move %11, $s5 --> if_min20 +if_min20: move %10, $s4 --> if_min19 +if_min19: move %9, $s3 --> if_min18 +if_min18: move %8, $s2 --> if_min17 +if_min17: move %7, $s1 --> if_min16 +if_min16: move %6, $s0 --> if_min15 +if_min15: move %0, $a0 --> if_min14 +if_min14: move %1, $a1 --> if_min13 +if_min13: li %2, 0 --> if_min12 +if_min12: li %4, 0 --> if_min11 +if_min11: li %5, 0 --> if_min10 +if_min10: emit c39 --> if_min9 +if_min9 : li %5, 0 --> if_min8 +if_min8 : sgt %4, %0, %1 --> if_min7 +if_min7 : beq %4, %5 --> if_min4, if_min6 +if_min6 : emit c38 --> if_min5 +if_min5 : move %2, %1 --> if_min2 +if_min2 : emit c36 --> if_min1 +if_min1 : move %3, %2 --> if_min0 +if_min0 : j --> if_min37 +if_min37: move $v0, %3 --> if_min36 +if_min36: move $ra, %14 --> if_min35 +if_min35: move $s7, %13 --> if_min34 +if_min34: move $s6, %12 --> if_min33 +if_min33: move $s5, %11 --> if_min32 +if_min32: move $s4, %10 --> if_min31 +if_min31: move $s3, %9 --> if_min30 +if_min30: move $s2, %8 --> if_min29 +if_min29: move $s1, %7 --> if_min28 +if_min28: move $s0, %6 --> if_min27 +if_min27: delframe --> if_min26 +if_min26: jr $ra (xmits $v0) +if_min4 : emit c37 --> if_min3 +if_min3 : move %2, %0 --> if_min2 + +procedure if_jian(9) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41 +entry if_jian92 +if_jian92 : newframe --> if_jian91 +if_jian91 : move %41, $ra --> if_jian90 +if_jian90 : move %40, $s7 --> if_jian89 +if_jian89 : move %39, $s6 --> if_jian88 +if_jian88 : move %38, $s5 --> if_jian87 +if_jian87 : move %37, $s4 --> if_jian86 +if_jian86 : move %36, $s3 --> if_jian85 +if_jian85 : move %35, $s2 --> if_jian84 +if_jian84 : move %34, $s1 --> if_jian83 +if_jian83 : move %33, $s0 --> if_jian82 +if_jian82 : move %0, $a0 --> if_jian81 +if_jian81 : move %1, $a1 --> if_jian80 +if_jian80 : move %2, $a2 --> if_jian79 +if_jian79 : move %3, $a3 --> if_jian78 +if_jian78 : gets %4, in(16) --> if_jian77 +if_jian77 : gets %5, in(12) --> if_jian76 +if_jian76 : gets %6, in(8) --> if_jian75 +if_jian75 : gets %7, in(4) --> if_jian74 +if_jian74 : gets %8, in(0) --> if_jian73 +if_jian73 : li %9, 0 --> if_jian72 +if_jian72 : li %10, 0 --> if_jian71 +if_jian71 : li %11, 0 --> if_jian70 +if_jian70 : li %12, 0 --> if_jian69 +if_jian69 : li %13, 0 --> if_jian68 +if_jian68 : li %14, 0 --> if_jian67 +if_jian67 : li %15, 0 --> if_jian66 +if_jian66 : li %17, 0 --> if_jian65 +if_jian65 : li %18, 0 --> if_jian64 +if_jian64 : li %19, 0 --> if_jian63 +if_jian63 : li %20, 0 --> if_jian62 +if_jian62 : li %21, 0 --> if_jian61 +if_jian61 : li %22, 0 --> if_jian60 +if_jian60 : li %23, 0 --> if_jian59 +if_jian59 : li %24, 0 --> if_jian58 +if_jian58 : li %25, 0 --> if_jian57 +if_jian57 : li %26, 0 --> if_jian56 +if_jian56 : li %27, 0 --> if_jian55 +if_jian55 : li %28, 0 --> if_jian54 +if_jian54 : li %29, 0 --> if_jian53 +if_jian53 : li %30, 0 --> if_jian52 +if_jian52 : li %31, 0 --> if_jian51 +if_jian51 : li %32, 0 --> if_jian48 +if_jian48 : emit c15 --> if_jian47 +if_jian47 : addu %30, %0, %1 --> if_jian46 +if_jian46 : slt %11, %30, %2 --> if_jian45 +if_jian45 : emit c14 --> if_jian44 +if_jian44 : addu %12, %3, %4 --> if_jian43 +if_jian43 : emit c13 --> if_jian42 +if_jian42 : li %29, 1 --> if_jian41 +if_jian41 : addu %13, %2, %29 --> if_jian40 +if_jian40 : emit c12 --> if_jian39 +if_jian39 : li %27, 0 --> if_jian38 +if_jian38 : li %28, 1 --> if_jian37 +if_jian37 : seq %26, %8, %28 --> if_jian36 +if_jian36 : beq %26, %27 --> if_jian8, if_jian35 +if_jian35 : emit c11 --> if_jian34 +if_jian34 : li %25, 0 --> if_jian33 +if_jian33 : beq %11, %25 --> if_jian30, if_jian32 +if_jian32 : emit c10 --> if_jian31 +if_jian31 : addu %9, %13, %3 --> if_jian24 +if_jian24 : emit c7 --> if_jian23 +if_jian23 : li %18, 0 --> if_jian22 +if_jian22 : li %22, 0 --> if_jian21 +if_jian21 : emit c6 --> if_jian20 +if_jian20 : li %31, 0 --> if_jian49 +if_jian49 : seq %21, %11, %31 --> if_jian19 +if_jian19 : beq %21, %22 --> if_jian12, if_jian18 +if_jian18 : li %20, 0 --> if_jian17 +if_jian17 : emit c5 --> if_jian16 +if_jian16 : move %19, %7 --> if_jian15 +if_jian15 : beq %19, %20 --> if_jian13, if_jian14 +if_jian14 : li %17, 1 --> if_jian11 +if_jian11 : beq %17, %18 --> if_jian2, if_jian10 +if_jian10 : emit c4 --> if_jian9 +if_jian9 : addu %10, %12, %4 --> if_jian2 +if_jian2 : emit c0 --> if_jian1 +if_jian1 : move %16, %9 --> if_jian0 +if_jian0 : j --> if_jian104 +if_jian104: move $v0, %16 --> if_jian103 +if_jian103: move $ra, %41 --> if_jian102 +if_jian102: move $s7, %40 --> if_jian101 +if_jian101: move $s6, %39 --> if_jian100 +if_jian100: move $s5, %38 --> if_jian99 +if_jian99 : move $s4, %37 --> if_jian98 +if_jian98 : move $s3, %36 --> if_jian97 +if_jian97 : move $s2, %35 --> if_jian96 +if_jian96 : move $s1, %34 --> if_jian95 +if_jian95 : move $s0, %33 --> if_jian94 +if_jian94 : delframe --> if_jian93 +if_jian93 : jr $ra (xmits $v0) +if_jian13 : li %17, 0 --> if_jian11 +if_jian12 : li %17, 0 --> if_jian11 +if_jian30 : emit c9 --> if_jian29 +if_jian29 : li %24, 0 --> if_jian28 +if_jian28 : li %32, 0 --> if_jian50 +if_jian50 : seq %23, %7, %32 --> if_jian27 +if_jian27 : beq %23, %24 --> if_jian24, if_jian26 +if_jian26 : emit c8 --> if_jian25 +if_jian25 : addu %9, %12, %3 --> if_jian24 +if_jian8 : emit c3 --> if_jian7 +if_jian7 : addu %14, %13, %4 --> if_jian6 +if_jian6 : emit c2 --> if_jian5 +if_jian5 : addu %15, %14, %5 --> if_jian4 +if_jian4 : emit c1 --> if_jian3 +if_jian3 : addu %9, %15, %6 --> if_jian2 + +procedure if_imbriq2(3) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17 +entry if_imbriq234 +if_imbriq234: newframe --> if_imbriq233 +if_imbriq233: move %17, $ra --> if_imbriq232 +if_imbriq232: move %16, $s7 --> if_imbriq231 +if_imbriq231: move %15, $s6 --> if_imbriq230 +if_imbriq230: move %14, $s5 --> if_imbriq229 +if_imbriq229: move %13, $s4 --> if_imbriq228 +if_imbriq228: move %12, $s3 --> if_imbriq227 +if_imbriq227: move %11, $s2 --> if_imbriq226 +if_imbriq226: move %10, $s1 --> if_imbriq225 +if_imbriq225: move %9, $s0 --> if_imbriq224 +if_imbriq224: move %0, $a0 --> if_imbriq223 +if_imbriq223: move %1, $a1 --> if_imbriq222 +if_imbriq222: move %2, $a2 --> if_imbriq221 +if_imbriq221: li %3, 0 --> if_imbriq220 +if_imbriq220: li %5, 0 --> if_imbriq219 +if_imbriq219: li %6, 0 --> if_imbriq218 +if_imbriq218: li %7, 0 --> if_imbriq217 +if_imbriq217: li %8, 0 --> if_imbriq216 +if_imbriq216: emit c35 --> if_imbriq215 +if_imbriq215: li %8, 0 --> if_imbriq214 +if_imbriq214: slt %7, %0, %1 --> if_imbriq213 +if_imbriq213: beq %7, %8 --> if_imbriq24, if_imbriq212 +if_imbriq212: emit c34 --> if_imbriq211 +if_imbriq211: li %6, 0 --> if_imbriq210 +if_imbriq210: slt %5, %1, %2 --> if_imbriq29 +if_imbriq29 : beq %5, %6 --> if_imbriq26, if_imbriq28 +if_imbriq28 : emit c33 --> if_imbriq27 +if_imbriq27 : move %3, %1 --> if_imbriq22 +if_imbriq22 : emit c30 --> if_imbriq21 +if_imbriq21 : move %4, %3 --> if_imbriq20 +if_imbriq20 : j --> if_imbriq246 +if_imbriq246: move $v0, %4 --> if_imbriq245 +if_imbriq245: move $ra, %17 --> if_imbriq244 +if_imbriq244: move $s7, %16 --> if_imbriq243 +if_imbriq243: move $s6, %15 --> if_imbriq242 +if_imbriq242: move $s5, %14 --> if_imbriq241 +if_imbriq241: move $s4, %13 --> if_imbriq240 +if_imbriq240: move $s3, %12 --> if_imbriq239 +if_imbriq239: move $s2, %11 --> if_imbriq238 +if_imbriq238: move $s1, %10 --> if_imbriq237 +if_imbriq237: move $s0, %9 --> if_imbriq236 +if_imbriq236: delframe --> if_imbriq235 +if_imbriq235: jr $ra (xmits $v0) +if_imbriq26 : emit c32 --> if_imbriq25 +if_imbriq25 : li %3, 47 --> if_imbriq22 +if_imbriq24 : emit c31 --> if_imbriq23 +if_imbriq23 : move %3, %0 --> if_imbriq22 + +procedure if_imbriq1(3) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17 +entry if_imbriq134 +if_imbriq134: newframe --> if_imbriq133 +if_imbriq133: move %17, $ra --> if_imbriq132 +if_imbriq132: move %16, $s7 --> if_imbriq131 +if_imbriq131: move %15, $s6 --> if_imbriq130 +if_imbriq130: move %14, $s5 --> if_imbriq129 +if_imbriq129: move %13, $s4 --> if_imbriq128 +if_imbriq128: move %12, $s3 --> if_imbriq127 +if_imbriq127: move %11, $s2 --> if_imbriq126 +if_imbriq126: move %10, $s1 --> if_imbriq125 +if_imbriq125: move %9, $s0 --> if_imbriq124 +if_imbriq124: move %0, $a0 --> if_imbriq123 +if_imbriq123: move %1, $a1 --> if_imbriq122 +if_imbriq122: move %2, $a2 --> if_imbriq121 +if_imbriq121: li %3, 0 --> if_imbriq120 +if_imbriq120: li %5, 0 --> if_imbriq119 +if_imbriq119: li %6, 0 --> if_imbriq118 +if_imbriq118: li %7, 0 --> if_imbriq117 +if_imbriq117: li %8, 0 --> if_imbriq116 +if_imbriq116: emit c29 --> if_imbriq115 +if_imbriq115: li %8, 0 --> if_imbriq114 +if_imbriq114: slt %7, %0, %1 --> if_imbriq113 +if_imbriq113: beq %7, %8 --> if_imbriq14, if_imbriq112 +if_imbriq112: emit c28 --> if_imbriq111 +if_imbriq111: li %6, 0 --> if_imbriq110 +if_imbriq110: slt %5, %1, %2 --> if_imbriq19 +if_imbriq19 : beq %5, %6 --> if_imbriq16, if_imbriq18 +if_imbriq18 : emit c27 --> if_imbriq17 +if_imbriq17 : move %3, %1 --> if_imbriq12 +if_imbriq12 : emit c24 --> if_imbriq11 +if_imbriq11 : move %4, %3 --> if_imbriq10 +if_imbriq10 : j --> if_imbriq146 +if_imbriq146: move $v0, %4 --> if_imbriq145 +if_imbriq145: move $ra, %17 --> if_imbriq144 +if_imbriq144: move $s7, %16 --> if_imbriq143 +if_imbriq143: move $s6, %15 --> if_imbriq142 +if_imbriq142: move $s5, %14 --> if_imbriq141 +if_imbriq141: move $s4, %13 --> if_imbriq140 +if_imbriq140: move $s3, %12 --> if_imbriq139 +if_imbriq139: move $s2, %11 --> if_imbriq138 +if_imbriq138: move $s1, %10 --> if_imbriq137 +if_imbriq137: move $s0, %9 --> if_imbriq136 +if_imbriq136: delframe --> if_imbriq135 +if_imbriq135: jr $ra (xmits $v0) +if_imbriq16 : emit c26 --> if_imbriq15 +if_imbriq15 : move %3, %2 --> if_imbriq12 +if_imbriq14 : emit c25 --> if_imbriq13 +if_imbriq13 : move %3, %0 --> if_imbriq12 + +procedure if_exSimple(2) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18 +entry if_exSimple39 +if_exSimple39: newframe --> if_exSimple38 +if_exSimple38: move %18, $ra --> if_exSimple37 +if_exSimple37: move %17, $s7 --> if_exSimple36 +if_exSimple36: move %16, $s6 --> if_exSimple35 +if_exSimple35: move %15, $s5 --> if_exSimple34 +if_exSimple34: move %14, $s4 --> if_exSimple33 +if_exSimple33: move %13, $s3 --> if_exSimple32 +if_exSimple32: move %12, $s2 --> if_exSimple31 +if_exSimple31: move %11, $s1 --> if_exSimple30 +if_exSimple30: move %10, $s0 --> if_exSimple29 +if_exSimple29: move %0, $a0 --> if_exSimple28 +if_exSimple28: move %1, $a1 --> if_exSimple27 +if_exSimple27: li %2, 0 --> if_exSimple26 +if_exSimple26: li %3, 0 --> if_exSimple25 +if_exSimple25: li %4, 0 --> if_exSimple24 +if_exSimple24: li %6, 0 --> if_exSimple23 +if_exSimple23: li %7, 0 --> if_exSimple22 +if_exSimple22: li %8, 0 --> if_exSimple21 +if_exSimple21: li %9, 0 --> if_exSimple20 +if_exSimple20: emit c23 --> if_exSimple19 +if_exSimple19: li %9, 0 --> if_exSimple18 +if_exSimple18: slt %8, %0, %1 --> if_exSimple17 +if_exSimple17: beq %8, %9 --> if_exSimple9, if_exSimple16 +if_exSimple16: emit c22 --> if_exSimple15 +if_exSimple15: addu %3, %0, %1 --> if_exSimple14 +if_exSimple14: emit c21 --> if_exSimple13 +if_exSimple13: li %7, 2 --> if_exSimple12 +if_exSimple12: mul %3, %7, %3 --> if_exSimple11 +if_exSimple11: emit c20 --> if_exSimple10 +if_exSimple10: move %2, %3 --> if_exSimple2 +if_exSimple2 : emit c16 --> if_exSimple1 +if_exSimple1 : move %5, %2 --> if_exSimple0 +if_exSimple0 : j --> if_exSimple51 +if_exSimple51: move $v0, %5 --> if_exSimple50 +if_exSimple50: move $ra, %18 --> if_exSimple49 +if_exSimple49: move $s7, %17 --> if_exSimple48 +if_exSimple48: move $s6, %16 --> if_exSimple47 +if_exSimple47: move $s5, %15 --> if_exSimple46 +if_exSimple46: move $s4, %14 --> if_exSimple45 +if_exSimple45: move $s3, %13 --> if_exSimple44 +if_exSimple44: move $s2, %12 --> if_exSimple43 +if_exSimple43: move $s1, %11 --> if_exSimple42 +if_exSimple42: move $s0, %10 --> if_exSimple41 +if_exSimple41: delframe --> if_exSimple40 +if_exSimple40: jr $ra (xmits $v0) +if_exSimple9 : emit c19 --> if_exSimple8 +if_exSimple8 : li %6, 2 --> if_exSimple7 +if_exSimple7 : mul %4, %6, %1 --> if_exSimple6 +if_exSimple6 : emit c18 --> if_exSimple5 +if_exSimple5 : addu %4, %4, %0 --> if_exSimple4 +if_exSimple4 : emit c17 --> if_exSimple3 +if_exSimple3 : addu %2, %4, %1 --> if_exSimple2 + +procedure _main(0) +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40 +entry main91 +main91 : newframe --> main90 +main90 : move %40, $ra --> main89 +main89 : move %39, $s7 --> main88 +main88 : move %38, $s6 --> main87 +main87 : move %37, $s5 --> main86 +main86 : move %36, $s4 --> main85 +main85 : move %35, $s3 --> main84 +main84 : move %34, $s2 --> main83 +main83 : move %33, $s1 --> main82 +main82 : move %32, $s0 --> main81 +main81 : li %0, 0 --> main80 +main80 : li %2, 0 --> main79 +main79 : li %3, 0 --> main78 +main78 : li %4, 0 --> main77 +main77 : li %5, 0 --> main76 +main76 : li %6, 0 --> main75 +main75 : li %7, 0 --> main74 +main74 : li %8, 0 --> main73 +main73 : li %9, 0 --> main72 +main72 : li %10, 0 --> main71 +main71 : li %11, 0 --> main70 +main70 : li %12, 0 --> main69 +main69 : li %13, 0 --> main68 +main68 : li %14, 0 --> main67 +main67 : li %15, 0 --> main66 +main66 : li %16, 0 --> main65 +main65 : li %17, 0 --> main64 +main64 : li %18, 0 --> main63 +main63 : li %19, 0 --> main62 +main62 : li %20, 0 --> main61 +main61 : li %21, 0 --> main60 +main60 : li %22, 0 --> main59 +main59 : li %23, 0 --> main58 +main58 : li %24, 0 --> main57 +main57 : li %25, 0 --> main56 +main56 : li %26, 0 --> main55 +main55 : li %27, 0 --> main54 +main54 : li %28, 0 --> main53 +main53 : li %29, 0 --> main52 +main52 : li %30, 0 --> main51 +main51 : li %31, 0 --> main50 +main50 : emit c84 --> main49 +main49 : li %23, 1 --> main48 +main48 : li %24, 2 --> main47 +main47 : li %25, 3 --> main46 +main46 : li %26, 4 --> main45 +main45 : li %27, 5 --> main44 +main44 : li %28, 6 --> main43 +main43 : li %29, 7 --> main42 +main42 : li %30, 8 --> main41 +main41 : li %31, 9 --> main40 +main40 : j --> main145 +main145: move $a0, %23 --> main144 +main144: move $a1, %24 --> main143 +main143: move $a2, %25 --> main142 +main142: move $a3, %26 --> main141 +main141: sets out(16), %27 --> main140 +main140: sets out(12), %28 --> main139 +main139: sets out(8), %29 --> main138 +main138: sets out(4), %30 --> main137 +main137: sets out(0), %31 --> main136 +main136: call if_jian(9) --> main135 +main135: move %0, $v0 --> main39 +main39 : emit c83 --> main38 +main38 : li %21, 1 --> main37 +main37 : li %22, 2 --> main36 +main36 : j --> main134 +main134: move $a0, %21 --> main133 +main133: move $a1, %22 --> main132 +main132: call if_exSimple(2) --> main131 +main131: move %0, $v0 --> main35 +main35 : emit c82 --> main34 +main34 : li %18, 1 --> main33 +main33 : li %19, 2 --> main32 +main32 : li %20, 3 --> main31 +main31 : j --> main130 +main130: move $a0, %18 --> main129 +main129: move $a1, %19 --> main128 +main128: move $a2, %20 --> main127 +main127: call if_imbriq1(3) --> main126 +main126: move %0, $v0 --> main30 +main30 : emit c81 --> main29 +main29 : li %15, 1 --> main28 +main28 : li %16, 2 --> main27 +main27 : li %17, 3 --> main26 +main26 : j --> main120 +main120: move $a0, %15 --> main119 +main119: move $a1, %16 --> main118 +main118: move $a2, %17 --> main117 +main117: call if_imbriq2(3) --> main116 +main116: move %0, $v0 --> main25 +main25 : emit c80 --> main24 +main24 : li %13, 1 --> main23 +main23 : li %14, 2 --> main22 +main22 : j --> main115 +main115: move $a0, %13 --> main114 +main114: move $a1, %14 --> main113 +main113: call if_min(2) --> main112 +main112: move %0, $v0 --> main21 +main21 : emit c79 --> main20 +main20 : li %11, 1 --> main19 +main19 : li %12, 2 --> main18 +main18 : j --> main111 +main111: move $a0, %11 --> main110 +main110: move $a1, %12 --> main109 +main109: call if_prog(2) --> main108 +main108: move %0, $v0 --> main17 +main17 : emit c78 --> main16 +main16 : li %9, 1 --> main15 +main15 : li %10, 2 --> main14 +main14 : j --> main107 +main107: move $a0, %9 --> main106 +main106: move $a1, %10 --> main105 +main105: call if_sansElse(2) --> main104 +main104: move %0, $v0 --> main13 +main13 : emit c77 --> main12 +main12 : li %5, 1 --> main11 +main11 : li %6, 2 --> main10 +main10 : li %7, 3 --> main9 +main9 : li %8, 4 --> main8 +main8 : j --> main151 +main151: move $a0, %5 --> main150 +main150: move $a1, %6 --> main149 +main149: move $a2, %7 --> main148 +main148: move $a3, %8 --> main147 +main147: call if_test(4) --> main146 +main146: move %0, $v0 --> main7 +main7 : emit c76 --> main6 +main6 : li %2, 1 --> main5 +main5 : li %3, 2 --> main4 +main4 : li %4, 3 --> main3 +main3 : j --> main125 +main125: move $a0, %2 --> main124 +main124: move $a1, %3 --> main123 +main123: move $a2, %4 --> main122 +main122: call if_ual(3) --> main121 +main121: move %0, $v0 --> main2 +main2 : emit c75 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main103 +main103: move $v0, %1 --> main102 +main102: move $ra, %40 --> main101 +main101: move $s7, %39 --> main100 +main100: move $s6, %38 --> main99 +main99 : move $s5, %37 --> main98 +main98 : move $s4, %36 --> main97 +main97 : move $s3, %35 --> main96 +main96 : move $s2, %34 --> main95 +main95 : move $s1, %33 --> main94 +main94 : move $s0, %32 --> main93 +main93 : delframe --> main92 +main92 : jr $ra (xmits $v0) + diff --git a/tests/clight/ifthenelse.LIN.expected b/tests/clight/ifthenelse.LIN.expected new file mode 100644 index 0000000..003b86d --- /dev/null +++ b/tests/clight/ifthenelse.LIN.expected @@ -0,0 +1,354 @@ +program + +globals 0 + +procedure if_ual(3) +var 0 +if_ual84: +newframe +li $v0, 0 +c74: +li $a3, 0 +seq $a3, $a0, $a3 +beq $a3, $zero, if_ual43 +c73: +addu $v0, $a1, $a2 +if_ual2: +c62: +delframe +jr $ra +if_ual43: +c72: +li $a3, 1 +seq $a3, $a0, $a3 +beq $a3, $zero, if_ual36 +c71: +subu $v0, $a1, $a2 +j if_ual2 +if_ual36: +c70: +li $a3, 2 +seq $a3, $a0, $a3 +beq $a3, $zero, if_ual19 +c69: +c68: +beq $a1, $zero, if_ual20 +c67: +beq $a2, $zero, if_ual21 +li $v0, 1 +j if_ual2 +if_ual21: +li $v0, 0 +j if_ual2 +if_ual20: +li $v0, 0 +j if_ual2 +if_ual19: +c66: +li $a3, 3 +seq $a0, $a0, $a3 +beq $a0, $zero, if_ual2 +c65: +c64: +beq $a1, $zero, if_ual7 +li $v0, 1 +j if_ual2 +if_ual7: +c63: +beq $a2, $zero, if_ual3 +li $v0, 1 +j if_ual2 +if_ual3: +li $v0, 0 +j if_ual2 + +procedure if_test(4) +var 0 +if_test55: +newframe +c61: +li $v0, 0 +c60: +c59: +c58: +c57: +c56: +slt $t0, $a0, $a1 +beq $t0, $zero, if_test15 +c55: +addu $v0, $a0, $a1 +if_test15: +c54: +slt $a0, $a2, $a3 +beq $a0, $zero, if_test7 +c53: +c52: +if_test7: +c51: +c50: +c49: +delframe +jr $ra + +procedure if_sansElse(2) +var 0 +if_sansElse25: +newframe +c48: +li $v0, 0 +c47: +slt $a1, $a0, $a1 +beq $a1, $zero, if_sansElse2 +c46: +move $v0, $a0 +if_sansElse2: +c45: +delframe +jr $ra + +procedure if_prog(2) +var 0 +if_prog30: +newframe +c44: +addu $v0, $a1, $a0 +c43: +li $a0, 0 +slt $v0, $v0, $zero +beq $v0, $a0, if_prog4 +c42: +li $v0, 2 +if_prog2: +c40: +delframe +jr $ra +if_prog4: +c41: +li $v0, 3 +j if_prog2 + +procedure if_min(2) +var 0 +if_min25: +newframe +move $v0, $a1 +c39: +sgt $a1, $a0, $v0 +beq $a1, $zero, if_min4 +c38: +if_min2: +c36: +delframe +jr $ra +if_min4: +c37: +move $v0, $a0 +j if_min2 + +procedure if_jian(9) +var 0 +if_jian92: +newframe +gets $t4, in(16) +gets $t3, in(12) +gets $t2, in(8) +gets $t0, in(4) +gets $t1, in(0) +li $v0, 0 +c15: +addu $a0, $a0, $a1 +slt $t5, $a0, $a2 +c14: +addu $a1, $a3, $t4 +c13: +li $a0, 1 +addu $a2, $a2, $a0 +c12: +li $a0, 1 +seq $a0, $t1, $a0 +beq $a0, $zero, if_jian8 +c11: +beq $t5, $zero, if_jian30 +c10: +addu $v0, $a2, $a3 +if_jian24: +c7: +li $a1, 0 +c6: +li $a0, 0 +seq $a0, $t5, $a0 +beq $a0, $a1, if_jian12 +li $a0, 0 +c5: +beq $t0, $a0, if_jian13 +li $a0, 1 +if_jian11: +beq $a0, $zero, if_jian2 +c4: +if_jian2: +c0: +delframe +jr $ra +if_jian13: +li $a0, 0 +j if_jian11 +if_jian12: +li $a0, 0 +j if_jian11 +if_jian30: +c9: +li $a0, 0 +seq $a0, $t0, $a0 +beq $a0, $zero, if_jian24 +c8: +addu $v0, $a1, $a3 +j if_jian24 +if_jian8: +c3: +addu $v0, $a2, $t4 +c2: +addu $v0, $v0, $t3 +c1: +addu $v0, $v0, $t2 +j if_jian2 + +procedure if_imbriq2(3) +var 0 +if_imbriq234: +newframe +move $v0, $a0 +c35: +slt $a0, $v0, $a1 +beq $a0, $zero, if_imbriq24 +c34: +slt $v0, $a1, $a2 +beq $v0, $zero, if_imbriq26 +c33: +move $v0, $a1 +if_imbriq22: +c30: +delframe +jr $ra +if_imbriq26: +c32: +li $v0, 47 +j if_imbriq22 +if_imbriq24: +c31: +j if_imbriq22 + +procedure if_imbriq1(3) +var 0 +if_imbriq134: +newframe +move $v0, $a2 +c29: +slt $a2, $a0, $a1 +beq $a2, $zero, if_imbriq14 +c28: +slt $a0, $a1, $v0 +beq $a0, $zero, if_imbriq16 +c27: +move $v0, $a1 +if_imbriq12: +c24: +delframe +jr $ra +if_imbriq16: +c26: +j if_imbriq12 +if_imbriq14: +c25: +move $v0, $a0 +j if_imbriq12 + +procedure if_exSimple(2) +var 0 +if_exSimple39: +newframe +c23: +slt $v0, $a0, $a1 +beq $v0, $zero, if_exSimple9 +c22: +addu $v0, $a0, $a1 +c21: +li $a0, 2 +mul $v0, $a0, $v0 +c20: +if_exSimple2: +c16: +delframe +jr $ra +if_exSimple9: +c19: +li $v0, 2 +mul $v0, $v0, $a1 +c18: +addu $v0, $v0, $a0 +c17: +addu $v0, $v0, $a1 +j if_exSimple2 + +procedure _main(0) +var 4 +main91: +newframe +sets local(0), $ra +c84: +li $a0, 1 +li $a1, 2 +li $a2, 3 +li $a3, 4 +li $t3, 5 +li $t2, 6 +li $t1, 7 +li $t0, 8 +li $v0, 9 +sets out(16), $t3 +sets out(12), $t2 +sets out(8), $t1 +sets out(4), $t0 +sets out(0), $v0 +call if_jian +c83: +li $a0, 1 +li $a1, 2 +call if_exSimple +c82: +li $a0, 1 +li $a1, 2 +li $a2, 3 +call if_imbriq1 +c81: +li $a0, 1 +li $a1, 2 +li $a2, 3 +call if_imbriq2 +c80: +li $a0, 1 +li $a1, 2 +call if_min +c79: +li $a0, 1 +li $a1, 2 +call if_prog +c78: +li $a0, 1 +li $a1, 2 +call if_sansElse +c77: +li $a0, 1 +li $a1, 2 +li $a2, 3 +li $a3, 4 +call if_test +c76: +li $a0, 1 +li $a1, 2 +li $a2, 3 +call if_ual +c75: +gets $ra, local(0) +delframe +jr $ra + diff --git a/tests/clight/ifthenelse.LTL.expected b/tests/clight/ifthenelse.LTL.expected new file mode 100644 index 0000000..19f10b9 --- /dev/null +++ b/tests/clight/ifthenelse.LTL.expected @@ -0,0 +1,731 @@ +program + +globals 0 + +procedure if_ual(3) +var 0 +entry if_ual84 +if_ual84: newframe --> if_ual83 +if_ual83: j --> if_ual82 +if_ual82: j --> if_ual81 +if_ual81: j --> if_ual80 +if_ual80: j --> if_ual79 +if_ual79: j --> if_ual78 +if_ual78: j --> if_ual77 +if_ual77: j --> if_ual76 +if_ual76: j --> if_ual75 +if_ual75: j --> if_ual74 +if_ual74: j --> if_ual73 +if_ual73: j --> if_ual72 +if_ual72: j --> if_ual71 +if_ual71: li $v0, 0 --> if_ual70 +if_ual70: j --> if_ual69 +if_ual69: j --> if_ual68 +if_ual68: j --> if_ual67 +if_ual67: j --> if_ual66 +if_ual66: j --> if_ual65 +if_ual65: j --> if_ual64 +if_ual64: j --> if_ual63 +if_ual63: j --> if_ual62 +if_ual62: j --> if_ual61 +if_ual61: j --> if_ual60 +if_ual60: j --> if_ual59 +if_ual59: j --> if_ual58 +if_ual58: j --> if_ual57 +if_ual57: j --> if_ual56 +if_ual56: j --> if_ual55 +if_ual55: j --> if_ual54 +if_ual54: j --> if_ual53 +if_ual53: j --> if_ual52 +if_ual52: j --> if_ual51 +if_ual51: j --> if_ual50 +if_ual50: emit c74 --> if_ual49 +if_ual49: j --> if_ual48 +if_ual48: li $a3, 0 --> if_ual47 +if_ual47: seq $a3, $a0, $a3 --> if_ual46 +if_ual46: beq $a3, $zero --> if_ual43, if_ual45 +if_ual45: emit c73 --> if_ual44 +if_ual44: addu $v0, $a1, $a2 --> if_ual2 +if_ual2 : emit c62 --> if_ual1 +if_ual1 : j --> if_ual0 +if_ual0 : j --> if_ual96 +if_ual96: j --> if_ual95 +if_ual95: j --> if_ual94 +if_ual94: j --> if_ual93 +if_ual93: j --> if_ual92 +if_ual92: j --> if_ual91 +if_ual91: j --> if_ual90 +if_ual90: j --> if_ual89 +if_ual89: j --> if_ual88 +if_ual88: j --> if_ual87 +if_ual87: j --> if_ual86 +if_ual86: delframe --> if_ual85 +if_ual85: jr $ra +if_ual43: emit c72 --> if_ual42 +if_ual42: j --> if_ual41 +if_ual41: li $a3, 1 --> if_ual40 +if_ual40: seq $a3, $a0, $a3 --> if_ual39 +if_ual39: beq $a3, $zero --> if_ual36, if_ual38 +if_ual38: emit c71 --> if_ual37 +if_ual37: subu $v0, $a1, $a2 --> if_ual2 +if_ual36: emit c70 --> if_ual35 +if_ual35: j --> if_ual34 +if_ual34: li $a3, 2 --> if_ual33 +if_ual33: seq $a3, $a0, $a3 --> if_ual32 +if_ual32: beq $a3, $zero --> if_ual19, if_ual31 +if_ual31: emit c69 --> if_ual30 +if_ual30: j --> if_ual29 +if_ual29: emit c68 --> if_ual28 +if_ual28: j --> if_ual27 +if_ual27: beq $a1, $zero --> if_ual20, if_ual26 +if_ual26: j --> if_ual25 +if_ual25: emit c67 --> if_ual24 +if_ual24: j --> if_ual23 +if_ual23: beq $a2, $zero --> if_ual21, if_ual22 +if_ual22: li $v0, 1 --> if_ual2 +if_ual21: li $v0, 0 --> if_ual2 +if_ual20: li $v0, 0 --> if_ual2 +if_ual19: emit c66 --> if_ual18 +if_ual18: j --> if_ual17 +if_ual17: li $a3, 3 --> if_ual16 +if_ual16: seq $a0, $a0, $a3 --> if_ual15 +if_ual15: beq $a0, $zero --> if_ual2, if_ual14 +if_ual14: emit c65 --> if_ual13 +if_ual13: j --> if_ual12 +if_ual12: emit c64 --> if_ual11 +if_ual11: j --> if_ual10 +if_ual10: beq $a1, $zero --> if_ual8, if_ual9 +if_ual9 : li $v0, 1 --> if_ual2 +if_ual8 : j --> if_ual7 +if_ual7 : emit c63 --> if_ual6 +if_ual6 : j --> if_ual5 +if_ual5 : beq $a2, $zero --> if_ual3, if_ual4 +if_ual4 : li $v0, 1 --> if_ual2 +if_ual3 : li $v0, 0 --> if_ual2 + +procedure if_test(4) +var 0 +entry if_test55 +if_test55: newframe --> if_test54 +if_test54: j --> if_test53 +if_test53: j --> if_test52 +if_test52: j --> if_test51 +if_test51: j --> if_test50 +if_test50: j --> if_test49 +if_test49: j --> if_test48 +if_test48: j --> if_test47 +if_test47: j --> if_test46 +if_test46: j --> if_test45 +if_test45: j --> if_test44 +if_test44: j --> if_test43 +if_test43: j --> if_test42 +if_test42: j --> if_test41 +if_test41: j --> if_test40 +if_test40: j --> if_test39 +if_test39: j --> if_test38 +if_test38: j --> if_test37 +if_test37: j --> if_test36 +if_test36: j --> if_test35 +if_test35: j --> if_test34 +if_test34: j --> if_test33 +if_test33: j --> if_test32 +if_test32: j --> if_test31 +if_test31: emit c61 --> if_test30 +if_test30: li $v0, 0 --> if_test29 +if_test29: emit c60 --> if_test28 +if_test28: j --> if_test27 +if_test27: emit c59 --> if_test26 +if_test26: j --> if_test25 +if_test25: emit c58 --> if_test24 +if_test24: j --> if_test23 +if_test23: emit c57 --> if_test22 +if_test22: j --> if_test21 +if_test21: emit c56 --> if_test20 +if_test20: j --> if_test19 +if_test19: slt $t0, $a0, $a1 --> if_test18 +if_test18: beq $t0, $zero --> if_test15, if_test17 +if_test17: emit c55 --> if_test16 +if_test16: addu $v0, $a0, $a1 --> if_test15 +if_test15: emit c54 --> if_test14 +if_test14: j --> if_test13 +if_test13: slt $a0, $a2, $a3 --> if_test12 +if_test12: beq $a0, $zero --> if_test7, if_test11 +if_test11: emit c53 --> if_test10 +if_test10: j --> if_test9 +if_test9 : emit c52 --> if_test8 +if_test8 : j --> if_test7 +if_test7 : emit c51 --> if_test6 +if_test6 : j --> if_test5 +if_test5 : j --> if_test4 +if_test4 : emit c50 --> if_test3 +if_test3 : j --> if_test2 +if_test2 : emit c49 --> if_test1 +if_test1 : j --> if_test0 +if_test0 : j --> if_test67 +if_test67: j --> if_test66 +if_test66: j --> if_test65 +if_test65: j --> if_test64 +if_test64: j --> if_test63 +if_test63: j --> if_test62 +if_test62: j --> if_test61 +if_test61: j --> if_test60 +if_test60: j --> if_test59 +if_test59: j --> if_test58 +if_test58: j --> if_test57 +if_test57: delframe --> if_test56 +if_test56: jr $ra + +procedure if_sansElse(2) +var 0 +entry if_sansElse25 +if_sansElse25: newframe --> if_sansElse24 +if_sansElse24: j --> if_sansElse23 +if_sansElse23: j --> if_sansElse22 +if_sansElse22: j --> if_sansElse21 +if_sansElse21: j --> if_sansElse20 +if_sansElse20: j --> if_sansElse19 +if_sansElse19: j --> if_sansElse18 +if_sansElse18: j --> if_sansElse17 +if_sansElse17: j --> if_sansElse16 +if_sansElse16: j --> if_sansElse15 +if_sansElse15: j --> if_sansElse14 +if_sansElse14: j --> if_sansElse13 +if_sansElse13: j --> if_sansElse12 +if_sansElse12: j --> if_sansElse11 +if_sansElse11: j --> if_sansElse10 +if_sansElse10: emit c48 --> if_sansElse9 +if_sansElse9 : li $v0, 0 --> if_sansElse8 +if_sansElse8 : emit c47 --> if_sansElse7 +if_sansElse7 : j --> if_sansElse6 +if_sansElse6 : slt $a1, $a0, $a1 --> if_sansElse5 +if_sansElse5 : beq $a1, $zero --> if_sansElse2, if_sansElse4 +if_sansElse4 : emit c46 --> if_sansElse3 +if_sansElse3 : move $v0, $a0 --> if_sansElse2 +if_sansElse2 : emit c45 --> if_sansElse1 +if_sansElse1 : j --> if_sansElse0 +if_sansElse0 : j --> if_sansElse37 +if_sansElse37: j --> if_sansElse36 +if_sansElse36: j --> if_sansElse35 +if_sansElse35: j --> if_sansElse34 +if_sansElse34: j --> if_sansElse33 +if_sansElse33: j --> if_sansElse32 +if_sansElse32: j --> if_sansElse31 +if_sansElse31: j --> if_sansElse30 +if_sansElse30: j --> if_sansElse29 +if_sansElse29: j --> if_sansElse28 +if_sansElse28: j --> if_sansElse27 +if_sansElse27: delframe --> if_sansElse26 +if_sansElse26: jr $ra + +procedure if_prog(2) +var 0 +entry if_prog30 +if_prog30: newframe --> if_prog29 +if_prog29: j --> if_prog28 +if_prog28: j --> if_prog27 +if_prog27: j --> if_prog26 +if_prog26: j --> if_prog25 +if_prog25: j --> if_prog24 +if_prog24: j --> if_prog23 +if_prog23: j --> if_prog22 +if_prog22: j --> if_prog21 +if_prog21: j --> if_prog20 +if_prog20: j --> if_prog19 +if_prog19: j --> if_prog18 +if_prog18: j --> if_prog17 +if_prog17: j --> if_prog16 +if_prog16: j --> if_prog15 +if_prog15: j --> if_prog14 +if_prog14: j --> if_prog13 +if_prog13: emit c44 --> if_prog12 +if_prog12: addu $v0, $a1, $a0 --> if_prog11 +if_prog11: emit c43 --> if_prog10 +if_prog10: li $a0, 0 --> if_prog9 +if_prog9 : j --> if_prog8 +if_prog8 : slt $v0, $v0, $zero --> if_prog7 +if_prog7 : beq $v0, $a0 --> if_prog4, if_prog6 +if_prog6 : emit c42 --> if_prog5 +if_prog5 : li $v0, 2 --> if_prog2 +if_prog2 : emit c40 --> if_prog1 +if_prog1 : j --> if_prog0 +if_prog0 : j --> if_prog42 +if_prog42: j --> if_prog41 +if_prog41: j --> if_prog40 +if_prog40: j --> if_prog39 +if_prog39: j --> if_prog38 +if_prog38: j --> if_prog37 +if_prog37: j --> if_prog36 +if_prog36: j --> if_prog35 +if_prog35: j --> if_prog34 +if_prog34: j --> if_prog33 +if_prog33: j --> if_prog32 +if_prog32: delframe --> if_prog31 +if_prog31: jr $ra +if_prog4 : emit c41 --> if_prog3 +if_prog3 : li $v0, 3 --> if_prog2 + +procedure if_min(2) +var 0 +entry if_min25 +if_min25: newframe --> if_min24 +if_min24: j --> if_min23 +if_min23: j --> if_min22 +if_min22: j --> if_min21 +if_min21: j --> if_min20 +if_min20: j --> if_min19 +if_min19: j --> if_min18 +if_min18: j --> if_min17 +if_min17: j --> if_min16 +if_min16: j --> if_min15 +if_min15: j --> if_min14 +if_min14: move $v0, $a1 --> if_min13 +if_min13: j --> if_min12 +if_min12: j --> if_min11 +if_min11: j --> if_min10 +if_min10: emit c39 --> if_min9 +if_min9 : j --> if_min8 +if_min8 : sgt $a1, $a0, $v0 --> if_min7 +if_min7 : beq $a1, $zero --> if_min4, if_min6 +if_min6 : emit c38 --> if_min5 +if_min5 : j --> if_min2 +if_min2 : emit c36 --> if_min1 +if_min1 : j --> if_min0 +if_min0 : j --> if_min37 +if_min37: j --> if_min36 +if_min36: j --> if_min35 +if_min35: j --> if_min34 +if_min34: j --> if_min33 +if_min33: j --> if_min32 +if_min32: j --> if_min31 +if_min31: j --> if_min30 +if_min30: j --> if_min29 +if_min29: j --> if_min28 +if_min28: j --> if_min27 +if_min27: delframe --> if_min26 +if_min26: jr $ra +if_min4 : emit c37 --> if_min3 +if_min3 : move $v0, $a0 --> if_min2 + +procedure if_jian(9) +var 0 +entry if_jian92 +if_jian92 : newframe --> if_jian91 +if_jian91 : j --> if_jian90 +if_jian90 : j --> if_jian89 +if_jian89 : j --> if_jian88 +if_jian88 : j --> if_jian87 +if_jian87 : j --> if_jian86 +if_jian86 : j --> if_jian85 +if_jian85 : j --> if_jian84 +if_jian84 : j --> if_jian83 +if_jian83 : j --> if_jian82 +if_jian82 : j --> if_jian81 +if_jian81 : j --> if_jian80 +if_jian80 : j --> if_jian79 +if_jian79 : j --> if_jian78 +if_jian78 : gets $t4, in(16) --> if_jian77 +if_jian77 : gets $t3, in(12) --> if_jian76 +if_jian76 : gets $t2, in(8) --> if_jian75 +if_jian75 : gets $t0, in(4) --> if_jian74 +if_jian74 : gets $t1, in(0) --> if_jian73 +if_jian73 : li $v0, 0 --> if_jian72 +if_jian72 : j --> if_jian71 +if_jian71 : j --> if_jian70 +if_jian70 : j --> if_jian69 +if_jian69 : j --> if_jian68 +if_jian68 : j --> if_jian67 +if_jian67 : j --> if_jian66 +if_jian66 : j --> if_jian65 +if_jian65 : j --> if_jian64 +if_jian64 : j --> if_jian63 +if_jian63 : j --> if_jian62 +if_jian62 : j --> if_jian61 +if_jian61 : j --> if_jian60 +if_jian60 : j --> if_jian59 +if_jian59 : j --> if_jian58 +if_jian58 : j --> if_jian57 +if_jian57 : j --> if_jian56 +if_jian56 : j --> if_jian55 +if_jian55 : j --> if_jian54 +if_jian54 : j --> if_jian53 +if_jian53 : j --> if_jian52 +if_jian52 : j --> if_jian51 +if_jian51 : j --> if_jian48 +if_jian48 : emit c15 --> if_jian47 +if_jian47 : addu $a0, $a0, $a1 --> if_jian46 +if_jian46 : slt $t5, $a0, $a2 --> if_jian45 +if_jian45 : emit c14 --> if_jian44 +if_jian44 : addu $a1, $a3, $t4 --> if_jian43 +if_jian43 : emit c13 --> if_jian42 +if_jian42 : li $a0, 1 --> if_jian41 +if_jian41 : addu $a2, $a2, $a0 --> if_jian40 +if_jian40 : emit c12 --> if_jian39 +if_jian39 : j --> if_jian38 +if_jian38 : li $a0, 1 --> if_jian37 +if_jian37 : seq $a0, $t1, $a0 --> if_jian36 +if_jian36 : beq $a0, $zero --> if_jian8, if_jian35 +if_jian35 : emit c11 --> if_jian34 +if_jian34 : j --> if_jian33 +if_jian33 : beq $t5, $zero --> if_jian30, if_jian32 +if_jian32 : emit c10 --> if_jian31 +if_jian31 : addu $v0, $a2, $a3 --> if_jian24 +if_jian24 : emit c7 --> if_jian23 +if_jian23 : j --> if_jian22 +if_jian22 : li $a1, 0 --> if_jian21 +if_jian21 : emit c6 --> if_jian20 +if_jian20 : li $a0, 0 --> if_jian49 +if_jian49 : seq $a0, $t5, $a0 --> if_jian19 +if_jian19 : beq $a0, $a1 --> if_jian12, if_jian18 +if_jian18 : li $a0, 0 --> if_jian17 +if_jian17 : emit c5 --> if_jian16 +if_jian16 : j --> if_jian15 +if_jian15 : beq $t0, $a0 --> if_jian13, if_jian14 +if_jian14 : li $a0, 1 --> if_jian11 +if_jian11 : beq $a0, $zero --> if_jian2, if_jian10 +if_jian10 : emit c4 --> if_jian9 +if_jian9 : j --> if_jian2 +if_jian2 : emit c0 --> if_jian1 +if_jian1 : j --> if_jian0 +if_jian0 : j --> if_jian104 +if_jian104: j --> if_jian103 +if_jian103: j --> if_jian102 +if_jian102: j --> if_jian101 +if_jian101: j --> if_jian100 +if_jian100: j --> if_jian99 +if_jian99 : j --> if_jian98 +if_jian98 : j --> if_jian97 +if_jian97 : j --> if_jian96 +if_jian96 : j --> if_jian95 +if_jian95 : j --> if_jian94 +if_jian94 : delframe --> if_jian93 +if_jian93 : jr $ra +if_jian13 : li $a0, 0 --> if_jian11 +if_jian12 : li $a0, 0 --> if_jian11 +if_jian30 : emit c9 --> if_jian29 +if_jian29 : j --> if_jian28 +if_jian28 : li $a0, 0 --> if_jian50 +if_jian50 : seq $a0, $t0, $a0 --> if_jian27 +if_jian27 : beq $a0, $zero --> if_jian24, if_jian26 +if_jian26 : emit c8 --> if_jian25 +if_jian25 : addu $v0, $a1, $a3 --> if_jian24 +if_jian8 : emit c3 --> if_jian7 +if_jian7 : addu $v0, $a2, $t4 --> if_jian6 +if_jian6 : emit c2 --> if_jian5 +if_jian5 : addu $v0, $v0, $t3 --> if_jian4 +if_jian4 : emit c1 --> if_jian3 +if_jian3 : addu $v0, $v0, $t2 --> if_jian2 + +procedure if_imbriq2(3) +var 0 +entry if_imbriq234 +if_imbriq234: newframe --> if_imbriq233 +if_imbriq233: j --> if_imbriq232 +if_imbriq232: j --> if_imbriq231 +if_imbriq231: j --> if_imbriq230 +if_imbriq230: j --> if_imbriq229 +if_imbriq229: j --> if_imbriq228 +if_imbriq228: j --> if_imbriq227 +if_imbriq227: j --> if_imbriq226 +if_imbriq226: j --> if_imbriq225 +if_imbriq225: j --> if_imbriq224 +if_imbriq224: move $v0, $a0 --> if_imbriq223 +if_imbriq223: j --> if_imbriq222 +if_imbriq222: j --> if_imbriq221 +if_imbriq221: j --> if_imbriq220 +if_imbriq220: j --> if_imbriq219 +if_imbriq219: j --> if_imbriq218 +if_imbriq218: j --> if_imbriq217 +if_imbriq217: j --> if_imbriq216 +if_imbriq216: emit c35 --> if_imbriq215 +if_imbriq215: j --> if_imbriq214 +if_imbriq214: slt $a0, $v0, $a1 --> if_imbriq213 +if_imbriq213: beq $a0, $zero --> if_imbriq24, if_imbriq212 +if_imbriq212: emit c34 --> if_imbriq211 +if_imbriq211: j --> if_imbriq210 +if_imbriq210: slt $v0, $a1, $a2 --> if_imbriq29 +if_imbriq29 : beq $v0, $zero --> if_imbriq26, if_imbriq28 +if_imbriq28 : emit c33 --> if_imbriq27 +if_imbriq27 : move $v0, $a1 --> if_imbriq22 +if_imbriq22 : emit c30 --> if_imbriq21 +if_imbriq21 : j --> if_imbriq20 +if_imbriq20 : j --> if_imbriq246 +if_imbriq246: j --> if_imbriq245 +if_imbriq245: j --> if_imbriq244 +if_imbriq244: j --> if_imbriq243 +if_imbriq243: j --> if_imbriq242 +if_imbriq242: j --> if_imbriq241 +if_imbriq241: j --> if_imbriq240 +if_imbriq240: j --> if_imbriq239 +if_imbriq239: j --> if_imbriq238 +if_imbriq238: j --> if_imbriq237 +if_imbriq237: j --> if_imbriq236 +if_imbriq236: delframe --> if_imbriq235 +if_imbriq235: jr $ra +if_imbriq26 : emit c32 --> if_imbriq25 +if_imbriq25 : li $v0, 47 --> if_imbriq22 +if_imbriq24 : emit c31 --> if_imbriq23 +if_imbriq23 : j --> if_imbriq22 + +procedure if_imbriq1(3) +var 0 +entry if_imbriq134 +if_imbriq134: newframe --> if_imbriq133 +if_imbriq133: j --> if_imbriq132 +if_imbriq132: j --> if_imbriq131 +if_imbriq131: j --> if_imbriq130 +if_imbriq130: j --> if_imbriq129 +if_imbriq129: j --> if_imbriq128 +if_imbriq128: j --> if_imbriq127 +if_imbriq127: j --> if_imbriq126 +if_imbriq126: j --> if_imbriq125 +if_imbriq125: j --> if_imbriq124 +if_imbriq124: j --> if_imbriq123 +if_imbriq123: j --> if_imbriq122 +if_imbriq122: move $v0, $a2 --> if_imbriq121 +if_imbriq121: j --> if_imbriq120 +if_imbriq120: j --> if_imbriq119 +if_imbriq119: j --> if_imbriq118 +if_imbriq118: j --> if_imbriq117 +if_imbriq117: j --> if_imbriq116 +if_imbriq116: emit c29 --> if_imbriq115 +if_imbriq115: j --> if_imbriq114 +if_imbriq114: slt $a2, $a0, $a1 --> if_imbriq113 +if_imbriq113: beq $a2, $zero --> if_imbriq14, if_imbriq112 +if_imbriq112: emit c28 --> if_imbriq111 +if_imbriq111: j --> if_imbriq110 +if_imbriq110: slt $a0, $a1, $v0 --> if_imbriq19 +if_imbriq19 : beq $a0, $zero --> if_imbriq16, if_imbriq18 +if_imbriq18 : emit c27 --> if_imbriq17 +if_imbriq17 : move $v0, $a1 --> if_imbriq12 +if_imbriq12 : emit c24 --> if_imbriq11 +if_imbriq11 : j --> if_imbriq10 +if_imbriq10 : j --> if_imbriq146 +if_imbriq146: j --> if_imbriq145 +if_imbriq145: j --> if_imbriq144 +if_imbriq144: j --> if_imbriq143 +if_imbriq143: j --> if_imbriq142 +if_imbriq142: j --> if_imbriq141 +if_imbriq141: j --> if_imbriq140 +if_imbriq140: j --> if_imbriq139 +if_imbriq139: j --> if_imbriq138 +if_imbriq138: j --> if_imbriq137 +if_imbriq137: j --> if_imbriq136 +if_imbriq136: delframe --> if_imbriq135 +if_imbriq135: jr $ra +if_imbriq16 : emit c26 --> if_imbriq15 +if_imbriq15 : j --> if_imbriq12 +if_imbriq14 : emit c25 --> if_imbriq13 +if_imbriq13 : move $v0, $a0 --> if_imbriq12 + +procedure if_exSimple(2) +var 0 +entry if_exSimple39 +if_exSimple39: newframe --> if_exSimple38 +if_exSimple38: j --> if_exSimple37 +if_exSimple37: j --> if_exSimple36 +if_exSimple36: j --> if_exSimple35 +if_exSimple35: j --> if_exSimple34 +if_exSimple34: j --> if_exSimple33 +if_exSimple33: j --> if_exSimple32 +if_exSimple32: j --> if_exSimple31 +if_exSimple31: j --> if_exSimple30 +if_exSimple30: j --> if_exSimple29 +if_exSimple29: j --> if_exSimple28 +if_exSimple28: j --> if_exSimple27 +if_exSimple27: j --> if_exSimple26 +if_exSimple26: j --> if_exSimple25 +if_exSimple25: j --> if_exSimple24 +if_exSimple24: j --> if_exSimple23 +if_exSimple23: j --> if_exSimple22 +if_exSimple22: j --> if_exSimple21 +if_exSimple21: j --> if_exSimple20 +if_exSimple20: emit c23 --> if_exSimple19 +if_exSimple19: j --> if_exSimple18 +if_exSimple18: slt $v0, $a0, $a1 --> if_exSimple17 +if_exSimple17: beq $v0, $zero --> if_exSimple9, if_exSimple16 +if_exSimple16: emit c22 --> if_exSimple15 +if_exSimple15: addu $v0, $a0, $a1 --> if_exSimple14 +if_exSimple14: emit c21 --> if_exSimple13 +if_exSimple13: li $a0, 2 --> if_exSimple12 +if_exSimple12: mul $v0, $a0, $v0 --> if_exSimple11 +if_exSimple11: emit c20 --> if_exSimple10 +if_exSimple10: j --> if_exSimple2 +if_exSimple2 : emit c16 --> if_exSimple1 +if_exSimple1 : j --> if_exSimple0 +if_exSimple0 : j --> if_exSimple51 +if_exSimple51: j --> if_exSimple50 +if_exSimple50: j --> if_exSimple49 +if_exSimple49: j --> if_exSimple48 +if_exSimple48: j --> if_exSimple47 +if_exSimple47: j --> if_exSimple46 +if_exSimple46: j --> if_exSimple45 +if_exSimple45: j --> if_exSimple44 +if_exSimple44: j --> if_exSimple43 +if_exSimple43: j --> if_exSimple42 +if_exSimple42: j --> if_exSimple41 +if_exSimple41: delframe --> if_exSimple40 +if_exSimple40: jr $ra +if_exSimple9 : emit c19 --> if_exSimple8 +if_exSimple8 : li $v0, 2 --> if_exSimple7 +if_exSimple7 : mul $v0, $v0, $a1 --> if_exSimple6 +if_exSimple6 : emit c18 --> if_exSimple5 +if_exSimple5 : addu $v0, $v0, $a0 --> if_exSimple4 +if_exSimple4 : emit c17 --> if_exSimple3 +if_exSimple3 : addu $v0, $v0, $a1 --> if_exSimple2 + +procedure _main(0) +var 4 +entry main91 +main91 : newframe --> main90 +main90 : sets local(0), $ra --> main89 +main89 : j --> main88 +main88 : j --> main87 +main87 : j --> main86 +main86 : j --> main85 +main85 : j --> main84 +main84 : j --> main83 +main83 : j --> main82 +main82 : j --> main81 +main81 : j --> main80 +main80 : j --> main79 +main79 : j --> main78 +main78 : j --> main77 +main77 : j --> main76 +main76 : j --> main75 +main75 : j --> main74 +main74 : j --> main73 +main73 : j --> main72 +main72 : j --> main71 +main71 : j --> main70 +main70 : j --> main69 +main69 : j --> main68 +main68 : j --> main67 +main67 : j --> main66 +main66 : j --> main65 +main65 : j --> main64 +main64 : j --> main63 +main63 : j --> main62 +main62 : j --> main61 +main61 : j --> main60 +main60 : j --> main59 +main59 : j --> main58 +main58 : j --> main57 +main57 : j --> main56 +main56 : j --> main55 +main55 : j --> main54 +main54 : j --> main53 +main53 : j --> main52 +main52 : j --> main51 +main51 : j --> main50 +main50 : emit c84 --> main49 +main49 : li $a0, 1 --> main48 +main48 : li $a1, 2 --> main47 +main47 : li $a2, 3 --> main46 +main46 : li $a3, 4 --> main45 +main45 : li $t3, 5 --> main44 +main44 : li $t2, 6 --> main43 +main43 : li $t1, 7 --> main42 +main42 : li $t0, 8 --> main41 +main41 : li $v0, 9 --> main40 +main40 : j --> main145 +main145: j --> main144 +main144: j --> main143 +main143: j --> main142 +main142: j --> main141 +main141: sets out(16), $t3 --> main140 +main140: sets out(12), $t2 --> main139 +main139: sets out(8), $t1 --> main138 +main138: sets out(4), $t0 --> main137 +main137: sets out(0), $v0 --> main136 +main136: call if_jian --> main135 +main135: j --> main39 +main39 : emit c83 --> main38 +main38 : li $a0, 1 --> main37 +main37 : li $a1, 2 --> main36 +main36 : j --> main134 +main134: j --> main133 +main133: j --> main132 +main132: call if_exSimple --> main131 +main131: j --> main35 +main35 : emit c82 --> main34 +main34 : li $a0, 1 --> main33 +main33 : li $a1, 2 --> main32 +main32 : li $a2, 3 --> main31 +main31 : j --> main130 +main130: j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: call if_imbriq1 --> main126 +main126: j --> main30 +main30 : emit c81 --> main29 +main29 : li $a0, 1 --> main28 +main28 : li $a1, 2 --> main27 +main27 : li $a2, 3 --> main26 +main26 : j --> main120 +main120: j --> main119 +main119: j --> main118 +main118: j --> main117 +main117: call if_imbriq2 --> main116 +main116: j --> main25 +main25 : emit c80 --> main24 +main24 : li $a0, 1 --> main23 +main23 : li $a1, 2 --> main22 +main22 : j --> main115 +main115: j --> main114 +main114: j --> main113 +main113: call if_min --> main112 +main112: j --> main21 +main21 : emit c79 --> main20 +main20 : li $a0, 1 --> main19 +main19 : li $a1, 2 --> main18 +main18 : j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: call if_prog --> main108 +main108: j --> main17 +main17 : emit c78 --> main16 +main16 : li $a0, 1 --> main15 +main15 : li $a1, 2 --> main14 +main14 : j --> main107 +main107: j --> main106 +main106: j --> main105 +main105: call if_sansElse --> main104 +main104: j --> main13 +main13 : emit c77 --> main12 +main12 : li $a0, 1 --> main11 +main11 : li $a1, 2 --> main10 +main10 : li $a2, 3 --> main9 +main9 : li $a3, 4 --> main8 +main8 : j --> main151 +main151: j --> main150 +main150: j --> main149 +main149: j --> main148 +main148: j --> main147 +main147: call if_test --> main146 +main146: j --> main7 +main7 : emit c76 --> main6 +main6 : li $a0, 1 --> main5 +main5 : li $a1, 2 --> main4 +main4 : li $a2, 3 --> main3 +main3 : j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: j --> main122 +main122: call if_ual --> main121 +main121: j --> main2 +main2 : emit c75 --> main1 +main1 : j --> main0 +main0 : j --> main103 +main103: j --> main102 +main102: gets $ra, local(0) --> main101 +main101: j --> main100 +main100: j --> main99 +main99 : j --> main98 +main98 : j --> main97 +main97 : j --> main96 +main96 : j --> main95 +main95 : j --> main94 +main94 : j --> main93 +main93 : delframe --> main92 +main92 : jr $ra + diff --git a/tests/clight/ifthenelse.RTL.expected b/tests/clight/ifthenelse.RTL.expected new file mode 100644 index 0000000..a960db2 --- /dev/null +++ b/tests/clight/ifthenelse.RTL.expected @@ -0,0 +1,450 @@ +program + +globals 0 + +function if_ual(%0; %1; %2) : %4 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24 +entry if_ual71 +exit if_ual0 +if_ual71: li %3, 0 --> if_ual70 +if_ual70: li %5, 0 --> if_ual69 +if_ual69: li %6, 0 --> if_ual68 +if_ual68: li %7, 0 --> if_ual67 +if_ual67: li %8, 0 --> if_ual66 +if_ual66: li %9, 0 --> if_ual65 +if_ual65: li %10, 0 --> if_ual64 +if_ual64: li %11, 0 --> if_ual63 +if_ual63: li %12, 0 --> if_ual62 +if_ual62: li %13, 0 --> if_ual61 +if_ual61: li %14, 0 --> if_ual60 +if_ual60: li %15, 0 --> if_ual59 +if_ual59: li %16, 0 --> if_ual58 +if_ual58: li %17, 0 --> if_ual57 +if_ual57: li %18, 0 --> if_ual56 +if_ual56: li %19, 0 --> if_ual55 +if_ual55: li %20, 0 --> if_ual54 +if_ual54: li %21, 0 --> if_ual53 +if_ual53: li %22, 0 --> if_ual52 +if_ual52: li %23, 0 --> if_ual51 +if_ual51: li %24, 0 --> if_ual50 +if_ual50: emit c74 --> if_ual49 +if_ual49: li %23, 0 --> if_ual48 +if_ual48: li %24, 0 --> if_ual47 +if_ual47: seq %22, %0, %24 --> if_ual46 +if_ual46: beq %22, %23 --> if_ual43, if_ual45 +if_ual45: emit c73 --> if_ual44 +if_ual44: addu %3, %1, %2 --> if_ual2 +if_ual2 : emit c62 --> if_ual1 +if_ual1 : move %4, %3 --> if_ual0 +if_ual43: emit c72 --> if_ual42 +if_ual42: li %20, 0 --> if_ual41 +if_ual41: li %21, 1 --> if_ual40 +if_ual40: seq %19, %0, %21 --> if_ual39 +if_ual39: beq %19, %20 --> if_ual36, if_ual38 +if_ual38: emit c71 --> if_ual37 +if_ual37: subu %3, %1, %2 --> if_ual2 +if_ual36: emit c70 --> if_ual35 +if_ual35: li %17, 0 --> if_ual34 +if_ual34: li %18, 2 --> if_ual33 +if_ual33: seq %16, %0, %18 --> if_ual32 +if_ual32: beq %16, %17 --> if_ual19, if_ual31 +if_ual31: emit c69 --> if_ual30 +if_ual30: li %15, 0 --> if_ual29 +if_ual29: emit c68 --> if_ual28 +if_ual28: move %14, %1 --> if_ual27 +if_ual27: beq %14, %15 --> if_ual20, if_ual26 +if_ual26: li %13, 0 --> if_ual25 +if_ual25: emit c67 --> if_ual24 +if_ual24: move %12, %2 --> if_ual23 +if_ual23: beq %12, %13 --> if_ual21, if_ual22 +if_ual22: li %3, 1 --> if_ual2 +if_ual21: li %3, 0 --> if_ual2 +if_ual20: li %3, 0 --> if_ual2 +if_ual19: emit c66 --> if_ual18 +if_ual18: li %10, 0 --> if_ual17 +if_ual17: li %11, 3 --> if_ual16 +if_ual16: seq %9, %0, %11 --> if_ual15 +if_ual15: beq %9, %10 --> if_ual2, if_ual14 +if_ual14: emit c65 --> if_ual13 +if_ual13: li %8, 0 --> if_ual12 +if_ual12: emit c64 --> if_ual11 +if_ual11: move %7, %1 --> if_ual10 +if_ual10: beq %7, %8 --> if_ual8, if_ual9 +if_ual9 : li %3, 1 --> if_ual2 +if_ual8 : li %6, 0 --> if_ual7 +if_ual7 : emit c63 --> if_ual6 +if_ual6 : move %5, %2 --> if_ual5 +if_ual5 : beq %5, %6 --> if_ual3, if_ual4 +if_ual4 : li %3, 1 --> if_ual2 +if_ual3 : li %3, 0 --> if_ual2 + +function if_test(%0; %1; %2; %3) : %9 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14 +entry if_test41 +exit if_test0 +if_test41: li %4, 0 --> if_test40 +if_test40: li %5, 0 --> if_test39 +if_test39: li %6, 0 --> if_test38 +if_test38: li %7, 0 --> if_test37 +if_test37: li %8, 0 --> if_test36 +if_test36: li %10, 0 --> if_test35 +if_test35: li %11, 0 --> if_test34 +if_test34: li %12, 0 --> if_test33 +if_test33: li %13, 0 --> if_test32 +if_test32: li %14, 0 --> if_test31 +if_test31: emit c61 --> if_test30 +if_test30: li %4, 0 --> if_test29 +if_test29: emit c60 --> if_test28 +if_test28: li %5, 0 --> if_test27 +if_test27: emit c59 --> if_test26 +if_test26: li %6, 0 --> if_test25 +if_test25: emit c58 --> if_test24 +if_test24: li %7, 0 --> if_test23 +if_test23: emit c57 --> if_test22 +if_test22: li %8, 0 --> if_test21 +if_test21: emit c56 --> if_test20 +if_test20: li %14, 0 --> if_test19 +if_test19: slt %13, %0, %1 --> if_test18 +if_test18: beq %13, %14 --> if_test15, if_test17 +if_test17: emit c55 --> if_test16 +if_test16: addu %4, %0, %1 --> if_test15 +if_test15: emit c54 --> if_test14 +if_test14: li %12, 0 --> if_test13 +if_test13: slt %11, %2, %3 --> if_test12 +if_test12: beq %11, %12 --> if_test7, if_test11 +if_test11: emit c53 --> if_test10 +if_test10: addu %8, %2, %3 --> if_test9 +if_test9 : emit c52 --> if_test8 +if_test8 : addu %7, %8, %2 --> if_test7 +if_test7 : emit c51 --> if_test6 +if_test6 : li %10, 1 --> if_test5 +if_test5 : addu %5, %4, %10 --> if_test4 +if_test4 : emit c50 --> if_test3 +if_test3 : addu %6, %4, %7 --> if_test2 +if_test2 : emit c49 --> if_test1 +if_test1 : move %9, %4 --> if_test0 + +function if_sansElse(%0; %1) : %3 +var %0, %1, %2, %3, %4, %5 +entry if_sansElse13 +exit if_sansElse0 +if_sansElse13: li %2, 0 --> if_sansElse12 +if_sansElse12: li %4, 0 --> if_sansElse11 +if_sansElse11: li %5, 0 --> if_sansElse10 +if_sansElse10: emit c48 --> if_sansElse9 +if_sansElse9 : li %2, 0 --> if_sansElse8 +if_sansElse8 : emit c47 --> if_sansElse7 +if_sansElse7 : li %5, 0 --> if_sansElse6 +if_sansElse6 : slt %4, %0, %1 --> if_sansElse5 +if_sansElse5 : beq %4, %5 --> if_sansElse2, if_sansElse4 +if_sansElse4 : emit c46 --> if_sansElse3 +if_sansElse3 : move %2, %0 --> if_sansElse2 +if_sansElse2 : emit c45 --> if_sansElse1 +if_sansElse1 : move %3, %2 --> if_sansElse0 + +function if_prog(%0; %1) : %4 +var %0, %1, %2, %3, %4, %5, %6, + %7 +entry if_prog18 +exit if_prog0 +if_prog18: li %2, 0 --> if_prog17 +if_prog17: li %3, 0 --> if_prog16 +if_prog16: li %5, 0 --> if_prog15 +if_prog15: li %6, 0 --> if_prog14 +if_prog14: li %7, 0 --> if_prog13 +if_prog13: emit c44 --> if_prog12 +if_prog12: addu %2, %1, %0 --> if_prog11 +if_prog11: emit c43 --> if_prog10 +if_prog10: li %6, 0 --> if_prog9 +if_prog9 : li %7, 0 --> if_prog8 +if_prog8 : slt %5, %2, %7 --> if_prog7 +if_prog7 : beq %5, %6 --> if_prog4, if_prog6 +if_prog6 : emit c42 --> if_prog5 +if_prog5 : li %3, 2 --> if_prog2 +if_prog2 : emit c40 --> if_prog1 +if_prog1 : move %4, %3 --> if_prog0 +if_prog4 : emit c41 --> if_prog3 +if_prog3 : li %3, 3 --> if_prog2 + +function if_min(%0; %1) : %3 +var %0, %1, %2, %3, %4, %5 +entry if_min13 +exit if_min0 +if_min13: li %2, 0 --> if_min12 +if_min12: li %4, 0 --> if_min11 +if_min11: li %5, 0 --> if_min10 +if_min10: emit c39 --> if_min9 +if_min9 : li %5, 0 --> if_min8 +if_min8 : sgt %4, %0, %1 --> if_min7 +if_min7 : beq %4, %5 --> if_min4, if_min6 +if_min6 : emit c38 --> if_min5 +if_min5 : move %2, %1 --> if_min2 +if_min2 : emit c36 --> if_min1 +if_min1 : move %3, %2 --> if_min0 +if_min4 : emit c37 --> if_min3 +if_min3 : move %2, %0 --> if_min2 + +function if_jian(%0; %1; %2; %3; %4; %5; %6; %7; %8) : %16 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32 +entry if_jian73 +exit if_jian0 +if_jian73: li %9, 0 --> if_jian72 +if_jian72: li %10, 0 --> if_jian71 +if_jian71: li %11, 0 --> if_jian70 +if_jian70: li %12, 0 --> if_jian69 +if_jian69: li %13, 0 --> if_jian68 +if_jian68: li %14, 0 --> if_jian67 +if_jian67: li %15, 0 --> if_jian66 +if_jian66: li %17, 0 --> if_jian65 +if_jian65: li %18, 0 --> if_jian64 +if_jian64: li %19, 0 --> if_jian63 +if_jian63: li %20, 0 --> if_jian62 +if_jian62: li %21, 0 --> if_jian61 +if_jian61: li %22, 0 --> if_jian60 +if_jian60: li %23, 0 --> if_jian59 +if_jian59: li %24, 0 --> if_jian58 +if_jian58: li %25, 0 --> if_jian57 +if_jian57: li %26, 0 --> if_jian56 +if_jian56: li %27, 0 --> if_jian55 +if_jian55: li %28, 0 --> if_jian54 +if_jian54: li %29, 0 --> if_jian53 +if_jian53: li %30, 0 --> if_jian52 +if_jian52: li %31, 0 --> if_jian51 +if_jian51: li %32, 0 --> if_jian48 +if_jian48: emit c15 --> if_jian47 +if_jian47: addu %30, %0, %1 --> if_jian46 +if_jian46: slt %11, %30, %2 --> if_jian45 +if_jian45: emit c14 --> if_jian44 +if_jian44: addu %12, %3, %4 --> if_jian43 +if_jian43: emit c13 --> if_jian42 +if_jian42: li %29, 1 --> if_jian41 +if_jian41: addu %13, %2, %29 --> if_jian40 +if_jian40: emit c12 --> if_jian39 +if_jian39: li %27, 0 --> if_jian38 +if_jian38: li %28, 1 --> if_jian37 +if_jian37: seq %26, %8, %28 --> if_jian36 +if_jian36: beq %26, %27 --> if_jian8, if_jian35 +if_jian35: emit c11 --> if_jian34 +if_jian34: li %25, 0 --> if_jian33 +if_jian33: beq %11, %25 --> if_jian30, if_jian32 +if_jian32: emit c10 --> if_jian31 +if_jian31: addu %9, %13, %3 --> if_jian24 +if_jian24: emit c7 --> if_jian23 +if_jian23: li %18, 0 --> if_jian22 +if_jian22: li %22, 0 --> if_jian21 +if_jian21: emit c6 --> if_jian20 +if_jian20: li %31, 0 --> if_jian49 +if_jian49: seq %21, %11, %31 --> if_jian19 +if_jian19: beq %21, %22 --> if_jian12, if_jian18 +if_jian18: li %20, 0 --> if_jian17 +if_jian17: emit c5 --> if_jian16 +if_jian16: move %19, %7 --> if_jian15 +if_jian15: beq %19, %20 --> if_jian13, if_jian14 +if_jian14: li %17, 1 --> if_jian11 +if_jian11: beq %17, %18 --> if_jian2, if_jian10 +if_jian10: emit c4 --> if_jian9 +if_jian9 : addu %10, %12, %4 --> if_jian2 +if_jian2 : emit c0 --> if_jian1 +if_jian1 : move %16, %9 --> if_jian0 +if_jian13: li %17, 0 --> if_jian11 +if_jian12: li %17, 0 --> if_jian11 +if_jian30: emit c9 --> if_jian29 +if_jian29: li %24, 0 --> if_jian28 +if_jian28: li %32, 0 --> if_jian50 +if_jian50: seq %23, %7, %32 --> if_jian27 +if_jian27: beq %23, %24 --> if_jian24, if_jian26 +if_jian26: emit c8 --> if_jian25 +if_jian25: addu %9, %12, %3 --> if_jian24 +if_jian8 : emit c3 --> if_jian7 +if_jian7 : addu %14, %13, %4 --> if_jian6 +if_jian6 : emit c2 --> if_jian5 +if_jian5 : addu %15, %14, %5 --> if_jian4 +if_jian4 : emit c1 --> if_jian3 +if_jian3 : addu %9, %15, %6 --> if_jian2 + +function if_imbriq2(%0; %1; %2) : %4 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8 +entry if_imbriq221 +exit if_imbriq20 +if_imbriq221: li %3, 0 --> if_imbriq220 +if_imbriq220: li %5, 0 --> if_imbriq219 +if_imbriq219: li %6, 0 --> if_imbriq218 +if_imbriq218: li %7, 0 --> if_imbriq217 +if_imbriq217: li %8, 0 --> if_imbriq216 +if_imbriq216: emit c35 --> if_imbriq215 +if_imbriq215: li %8, 0 --> if_imbriq214 +if_imbriq214: slt %7, %0, %1 --> if_imbriq213 +if_imbriq213: beq %7, %8 --> if_imbriq24, if_imbriq212 +if_imbriq212: emit c34 --> if_imbriq211 +if_imbriq211: li %6, 0 --> if_imbriq210 +if_imbriq210: slt %5, %1, %2 --> if_imbriq29 +if_imbriq29 : beq %5, %6 --> if_imbriq26, if_imbriq28 +if_imbriq28 : emit c33 --> if_imbriq27 +if_imbriq27 : move %3, %1 --> if_imbriq22 +if_imbriq22 : emit c30 --> if_imbriq21 +if_imbriq21 : move %4, %3 --> if_imbriq20 +if_imbriq26 : emit c32 --> if_imbriq25 +if_imbriq25 : li %3, 47 --> if_imbriq22 +if_imbriq24 : emit c31 --> if_imbriq23 +if_imbriq23 : move %3, %0 --> if_imbriq22 + +function if_imbriq1(%0; %1; %2) : %4 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8 +entry if_imbriq121 +exit if_imbriq10 +if_imbriq121: li %3, 0 --> if_imbriq120 +if_imbriq120: li %5, 0 --> if_imbriq119 +if_imbriq119: li %6, 0 --> if_imbriq118 +if_imbriq118: li %7, 0 --> if_imbriq117 +if_imbriq117: li %8, 0 --> if_imbriq116 +if_imbriq116: emit c29 --> if_imbriq115 +if_imbriq115: li %8, 0 --> if_imbriq114 +if_imbriq114: slt %7, %0, %1 --> if_imbriq113 +if_imbriq113: beq %7, %8 --> if_imbriq14, if_imbriq112 +if_imbriq112: emit c28 --> if_imbriq111 +if_imbriq111: li %6, 0 --> if_imbriq110 +if_imbriq110: slt %5, %1, %2 --> if_imbriq19 +if_imbriq19 : beq %5, %6 --> if_imbriq16, if_imbriq18 +if_imbriq18 : emit c27 --> if_imbriq17 +if_imbriq17 : move %3, %1 --> if_imbriq12 +if_imbriq12 : emit c24 --> if_imbriq11 +if_imbriq11 : move %4, %3 --> if_imbriq10 +if_imbriq16 : emit c26 --> if_imbriq15 +if_imbriq15 : move %3, %2 --> if_imbriq12 +if_imbriq14 : emit c25 --> if_imbriq13 +if_imbriq13 : move %3, %0 --> if_imbriq12 + +function if_exSimple(%0; %1) : %5 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9 +entry if_exSimple27 +exit if_exSimple0 +if_exSimple27: li %2, 0 --> if_exSimple26 +if_exSimple26: li %3, 0 --> if_exSimple25 +if_exSimple25: li %4, 0 --> if_exSimple24 +if_exSimple24: li %6, 0 --> if_exSimple23 +if_exSimple23: li %7, 0 --> if_exSimple22 +if_exSimple22: li %8, 0 --> if_exSimple21 +if_exSimple21: li %9, 0 --> if_exSimple20 +if_exSimple20: emit c23 --> if_exSimple19 +if_exSimple19: li %9, 0 --> if_exSimple18 +if_exSimple18: slt %8, %0, %1 --> if_exSimple17 +if_exSimple17: beq %8, %9 --> if_exSimple9, if_exSimple16 +if_exSimple16: emit c22 --> if_exSimple15 +if_exSimple15: addu %3, %0, %1 --> if_exSimple14 +if_exSimple14: emit c21 --> if_exSimple13 +if_exSimple13: li %7, 2 --> if_exSimple12 +if_exSimple12: mul %3, %7, %3 --> if_exSimple11 +if_exSimple11: emit c20 --> if_exSimple10 +if_exSimple10: move %2, %3 --> if_exSimple2 +if_exSimple2 : emit c16 --> if_exSimple1 +if_exSimple1 : move %5, %2 --> if_exSimple0 +if_exSimple9 : emit c19 --> if_exSimple8 +if_exSimple8 : li %6, 2 --> if_exSimple7 +if_exSimple7 : mul %4, %6, %1 --> if_exSimple6 +if_exSimple6 : emit c18 --> if_exSimple5 +if_exSimple5 : addu %4, %4, %0 --> if_exSimple4 +if_exSimple4 : emit c17 --> if_exSimple3 +if_exSimple3 : addu %2, %4, %1 --> if_exSimple2 + +function _main() : %1 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31 +entry main81 +exit main0 +main81: li %0, 0 --> main80 +main80: li %2, 0 --> main79 +main79: li %3, 0 --> main78 +main78: li %4, 0 --> main77 +main77: li %5, 0 --> main76 +main76: li %6, 0 --> main75 +main75: li %7, 0 --> main74 +main74: li %8, 0 --> main73 +main73: li %9, 0 --> main72 +main72: li %10, 0 --> main71 +main71: li %11, 0 --> main70 +main70: li %12, 0 --> main69 +main69: li %13, 0 --> main68 +main68: li %14, 0 --> main67 +main67: li %15, 0 --> main66 +main66: li %16, 0 --> main65 +main65: li %17, 0 --> main64 +main64: li %18, 0 --> main63 +main63: li %19, 0 --> main62 +main62: li %20, 0 --> main61 +main61: li %21, 0 --> main60 +main60: li %22, 0 --> main59 +main59: li %23, 0 --> main58 +main58: li %24, 0 --> main57 +main57: li %25, 0 --> main56 +main56: li %26, 0 --> main55 +main55: li %27, 0 --> main54 +main54: li %28, 0 --> main53 +main53: li %29, 0 --> main52 +main52: li %30, 0 --> main51 +main51: li %31, 0 --> main50 +main50: emit c84 --> main49 +main49: li %23, 1 --> main48 +main48: li %24, 2 --> main47 +main47: li %25, 3 --> main46 +main46: li %26, 4 --> main45 +main45: li %27, 5 --> main44 +main44: li %28, 6 --> main43 +main43: li %29, 7 --> main42 +main42: li %30, 8 --> main41 +main41: li %31, 9 --> main40 +main40: call %0, if_jian(%23, %24, %25, %26, %27, %28, %29, %30, %31) --> main39 +main39: emit c83 --> main38 +main38: li %21, 1 --> main37 +main37: li %22, 2 --> main36 +main36: call %0, if_exSimple(%21, %22) --> main35 +main35: emit c82 --> main34 +main34: li %18, 1 --> main33 +main33: li %19, 2 --> main32 +main32: li %20, 3 --> main31 +main31: call %0, if_imbriq1(%18, %19, %20) --> main30 +main30: emit c81 --> main29 +main29: li %15, 1 --> main28 +main28: li %16, 2 --> main27 +main27: li %17, 3 --> main26 +main26: call %0, if_imbriq2(%15, %16, %17) --> main25 +main25: emit c80 --> main24 +main24: li %13, 1 --> main23 +main23: li %14, 2 --> main22 +main22: call %0, if_min(%13, %14) --> main21 +main21: emit c79 --> main20 +main20: li %11, 1 --> main19 +main19: li %12, 2 --> main18 +main18: call %0, if_prog(%11, %12) --> main17 +main17: emit c78 --> main16 +main16: li %9, 1 --> main15 +main15: li %10, 2 --> main14 +main14: call %0, if_sansElse(%9, %10) --> main13 +main13: emit c77 --> main12 +main12: li %5, 1 --> main11 +main11: li %6, 2 --> main10 +main10: li %7, 3 --> main9 +main9 : li %8, 4 --> main8 +main8 : call %0, if_test(%5, %6, %7, %8) --> main7 +main7 : emit c76 --> main6 +main6 : li %2, 1 --> main5 +main5 : li %3, 2 --> main4 +main4 : li %4, 3 --> main3 +main3 : call %0, if_ual(%2, %3, %4) --> main2 +main2 : emit c75 --> main1 +main1 : move %1, %0 --> main0 + diff --git a/tests/clight/ifthenelse.RTLabs.expected b/tests/clight/ifthenelse.RTLabs.expected new file mode 100644 index 0000000..c455c3b --- /dev/null +++ b/tests/clight/ifthenelse.RTLabs.expected @@ -0,0 +1,766 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "if_jian"(%0, %1, %2, %3, %4, %5, %6, %7, %8): int -> int -> int -> int -> int -> int -> int -> int -> int -> int + locals: %16, %9, %10, %11, %12, %13, %14, %15, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30 + result: %16 + stacksize: 0 + entry: if_jian48 + exit: if_jian0 + + if_jian9: add %10, %12, %4 --> if_jian2 + if_jian8: emit c3 --> if_jian7 + if_jian7: add %14, %13, %4 --> if_jian6 + if_jian6: emit c2 --> if_jian5 + if_jian5: add %15, %14, %5 --> if_jian4 + if_jian48: emit c15 --> if_jian47 + if_jian47: add %30, %0, %1 --> if_jian46 + if_jian46: lt %11, %30, %2 --> if_jian45 + if_jian45: emit c14 --> if_jian44 + if_jian44: add %12, %3, %4 --> if_jian43 + if_jian43: emit c13 --> if_jian42 + if_jian42: imm_int 1, %29, --> if_jian41 + if_jian41: add %13, %2, %29 --> if_jian40 + if_jian40: emit c12 --> if_jian39 + if_jian4: emit c1 --> if_jian3 + if_jian39: imm_int 0, %27, --> if_jian38 + if_jian38: imm_int 1, %28, --> if_jian37 + if_jian37: eq %26, %8, %28 --> if_jian36 + if_jian36: eq %26, %27 --> if_jian8, if_jian35 + if_jian35: emit c11 --> if_jian34 + if_jian34: imm_int 0, %25, --> if_jian33 + if_jian33: eq %11, %25 --> if_jian30, if_jian32 + if_jian32: emit c10 --> if_jian31 + if_jian31: add %9, %13, %3 --> if_jian24 + if_jian30: emit c9 --> if_jian29 + if_jian3: add %9, %15, %6 --> if_jian2 + if_jian29: imm_int 0, %24, --> if_jian28 + if_jian28: notbool %23, %7 --> if_jian27 + if_jian27: eq %23, %24 --> if_jian24, if_jian26 + if_jian26: emit c8 --> if_jian25 + if_jian25: add %9, %12, %3 --> if_jian24 + if_jian24: emit c7 --> if_jian23 + if_jian23: imm_int 0, %18, --> if_jian22 + if_jian22: imm_int 0, %22, --> if_jian21 + if_jian21: emit c6 --> if_jian20 + if_jian20: notbool %21, %11 --> if_jian19 + if_jian2: emit c0 --> if_jian1 + if_jian19: eq %21, %22 --> if_jian12, if_jian18 + if_jian18: imm_int 0, %20, --> if_jian17 + if_jian17: emit c5 --> if_jian16 + if_jian16: mov %19, %7 --> if_jian15 + if_jian15: eq %19, %20 --> if_jian13, if_jian14 + if_jian14: imm_int 1, %17, --> if_jian11 + if_jian13: imm_int 0, %17, --> if_jian11 + if_jian12: imm_int 0, %17, --> if_jian11 + if_jian11: eq %17, %18 --> if_jian2, if_jian10 + if_jian10: emit c4 --> if_jian9 + if_jian1: mov %16, %9 --> if_jian0 + if_jian0: return %16 + + + "if_exSimple"(%0, %1): int -> int -> int + locals: %5, %2, %3, %4, %6, %7, %8, %9 + result: %5 + stacksize: 0 + entry: if_exSimple20 + exit: if_exSimple0 + + if_exSimple9: emit c19 --> if_exSimple8 + if_exSimple8: imm_int 2, %6, --> if_exSimple7 + if_exSimple7: mul %4, %6, %1 --> if_exSimple6 + if_exSimple6: emit c18 --> if_exSimple5 + if_exSimple5: add %4, %4, %0 --> if_exSimple4 + if_exSimple4: emit c17 --> if_exSimple3 + if_exSimple3: add %2, %4, %1 --> if_exSimple2 + if_exSimple20: emit c23 --> if_exSimple19 + if_exSimple2: emit c16 --> if_exSimple1 + if_exSimple19: imm_int 0, %9, --> if_exSimple18 + if_exSimple18: lt %8, %0, %1 --> if_exSimple17 + if_exSimple17: eq %8, %9 --> if_exSimple9, if_exSimple16 + if_exSimple16: emit c22 --> if_exSimple15 + if_exSimple15: add %3, %0, %1 --> if_exSimple14 + if_exSimple14: emit c21 --> if_exSimple13 + if_exSimple13: imm_int 2, %7, --> if_exSimple12 + if_exSimple12: mul %3, %7, %3 --> if_exSimple11 + if_exSimple11: emit c20 --> if_exSimple10 + if_exSimple10: mov %2, %3 --> if_exSimple2 + if_exSimple1: mov %5, %2 --> if_exSimple0 + if_exSimple0: return %5 + + + "if_imbriq1"(%0, %1, %2): int -> int -> int -> int + locals: %4, %3, %5, %6, %7, %8 + result: %4 + stacksize: 0 + entry: if_imbriq116 + exit: if_imbriq10 + + if_imbriq19: eq %5, %6 --> if_imbriq16, if_imbriq18 + if_imbriq18: emit c27 --> if_imbriq17 + if_imbriq17: mov %3, %1 --> if_imbriq12 + if_imbriq16: emit c26 --> if_imbriq15 + if_imbriq15: mov %3, %2 --> if_imbriq12 + if_imbriq14: emit c25 --> if_imbriq13 + if_imbriq13: mov %3, %0 --> if_imbriq12 + if_imbriq12: emit c24 --> if_imbriq11 + if_imbriq116: emit c29 --> if_imbriq115 + if_imbriq115: imm_int 0, %8, --> if_imbriq114 + if_imbriq114: lt %7, %0, %1 --> if_imbriq113 + if_imbriq113: eq %7, %8 --> if_imbriq14, if_imbriq112 + if_imbriq112: emit c28 --> if_imbriq111 + if_imbriq111: imm_int 0, %6, --> if_imbriq110 + if_imbriq110: lt %5, %1, %2 --> if_imbriq19 + if_imbriq11: mov %4, %3 --> if_imbriq10 + if_imbriq10: return %4 + + + "if_imbriq2"(%0, %1, %2): int -> int -> int -> int + locals: %4, %3, %5, %6, %7, %8 + result: %4 + stacksize: 0 + entry: if_imbriq216 + exit: if_imbriq20 + + if_imbriq29: eq %5, %6 --> if_imbriq26, if_imbriq28 + if_imbriq28: emit c33 --> if_imbriq27 + if_imbriq27: mov %3, %1 --> if_imbriq22 + if_imbriq26: emit c32 --> if_imbriq25 + if_imbriq25: imm_int 47, %3, --> if_imbriq22 + if_imbriq24: emit c31 --> if_imbriq23 + if_imbriq23: mov %3, %0 --> if_imbriq22 + if_imbriq22: emit c30 --> if_imbriq21 + if_imbriq216: emit c35 --> if_imbriq215 + if_imbriq215: imm_int 0, %8, --> if_imbriq214 + if_imbriq214: lt %7, %0, %1 --> if_imbriq213 + if_imbriq213: eq %7, %8 --> if_imbriq24, if_imbriq212 + if_imbriq212: emit c34 --> if_imbriq211 + if_imbriq211: imm_int 0, %6, --> if_imbriq210 + if_imbriq210: lt %5, %1, %2 --> if_imbriq29 + if_imbriq21: mov %4, %3 --> if_imbriq20 + if_imbriq20: return %4 + + + "if_min"(%0, %1): int -> int -> int + locals: %3, %2, %4, %5 + result: %3 + stacksize: 0 + entry: if_min10 + exit: if_min0 + + if_min9: imm_int 0, %5, --> if_min8 + if_min8: gt %4, %0, %1 --> if_min7 + if_min7: eq %4, %5 --> if_min4, if_min6 + if_min6: emit c38 --> if_min5 + if_min5: mov %2, %1 --> if_min2 + if_min4: emit c37 --> if_min3 + if_min3: mov %2, %0 --> if_min2 + if_min2: emit c36 --> if_min1 + if_min10: emit c39 --> if_min9 + if_min1: mov %3, %2 --> if_min0 + if_min0: return %3 + + + "if_prog"(%0, %1): int -> int -> int + locals: %4, %2, %3, %5, %6, %7 + result: %4 + stacksize: 0 + entry: if_prog13 + exit: if_prog0 + + if_prog9: imm_int 0, %7, --> if_prog8 + if_prog8: lt %5, %2, %7 --> if_prog7 + if_prog7: eq %5, %6 --> if_prog4, if_prog6 + if_prog6: emit c42 --> if_prog5 + if_prog5: imm_int 2, %3, --> if_prog2 + if_prog4: emit c41 --> if_prog3 + if_prog3: imm_int 3, %3, --> if_prog2 + if_prog2: emit c40 --> if_prog1 + if_prog13: emit c44 --> if_prog12 + if_prog12: add %2, %1, %0 --> if_prog11 + if_prog11: emit c43 --> if_prog10 + if_prog10: imm_int 0, %6, --> if_prog9 + if_prog1: mov %4, %3 --> if_prog0 + if_prog0: return %4 + + + "if_sansElse"(%0, %1): int -> int -> int + locals: %3, %2, %4, %5 + result: %3 + stacksize: 0 + entry: if_sansElse10 + exit: if_sansElse0 + + if_sansElse9: imm_int 0, %2, --> if_sansElse8 + if_sansElse8: emit c47 --> if_sansElse7 + if_sansElse7: imm_int 0, %5, --> if_sansElse6 + if_sansElse6: lt %4, %0, %1 --> if_sansElse5 + if_sansElse5: eq %4, %5 --> if_sansElse2, if_sansElse4 + if_sansElse4: emit c46 --> if_sansElse3 + if_sansElse3: mov %2, %0 --> if_sansElse2 + if_sansElse2: emit c45 --> if_sansElse1 + if_sansElse10: emit c48 --> if_sansElse9 + if_sansElse1: mov %3, %2 --> if_sansElse0 + if_sansElse0: return %3 + + + "if_test"(%0, %1, %2, %3): int -> int -> int -> int -> int + locals: %9, %4, %5, %6, %7, %8, %10, %11, %12, %13, %14 + result: %9 + stacksize: 0 + entry: if_test31 + exit: if_test0 + + if_test9: emit c52 --> if_test8 + if_test8: add %7, %8, %2 --> if_test7 + if_test7: emit c51 --> if_test6 + if_test6: imm_int 1, %10, --> if_test5 + if_test5: add %5, %4, %10 --> if_test4 + if_test4: emit c50 --> if_test3 + if_test31: emit c61 --> if_test30 + if_test30: imm_int 0, %4, --> if_test29 + if_test3: add %6, %4, %7 --> if_test2 + if_test29: emit c60 --> if_test28 + if_test28: imm_int 0, %5, --> if_test27 + if_test27: emit c59 --> if_test26 + if_test26: imm_int 0, %6, --> if_test25 + if_test25: emit c58 --> if_test24 + if_test24: imm_int 0, %7, --> if_test23 + if_test23: emit c57 --> if_test22 + if_test22: imm_int 0, %8, --> if_test21 + if_test21: emit c56 --> if_test20 + if_test20: imm_int 0, %14, --> if_test19 + if_test2: emit c49 --> if_test1 + if_test19: lt %13, %0, %1 --> if_test18 + if_test18: eq %13, %14 --> if_test15, if_test17 + if_test17: emit c55 --> if_test16 + if_test16: add %4, %0, %1 --> if_test15 + if_test15: emit c54 --> if_test14 + if_test14: imm_int 0, %12, --> if_test13 + if_test13: lt %11, %2, %3 --> if_test12 + if_test12: eq %11, %12 --> if_test7, if_test11 + if_test11: emit c53 --> if_test10 + if_test10: add %8, %2, %3 --> if_test9 + if_test1: mov %9, %4 --> if_test0 + if_test0: return %9 + + + "if_ual"(%0, %1, %2): int -> int -> int -> int + locals: %4, %3, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24 + result: %4 + stacksize: 0 + entry: if_ual50 + exit: if_ual0 + + if_ual9: imm_int 1, %3, --> if_ual2 + if_ual8: imm_int 0, %6, --> if_ual7 + if_ual7: emit c63 --> if_ual6 + if_ual6: mov %5, %2 --> if_ual5 + if_ual50: emit c74 --> if_ual49 + if_ual5: eq %5, %6 --> if_ual3, if_ual4 + if_ual49: imm_int 0, %23, --> if_ual48 + if_ual48: imm_int 0, %24, --> if_ual47 + if_ual47: eq %22, %0, %24 --> if_ual46 + if_ual46: eq %22, %23 --> if_ual43, if_ual45 + if_ual45: emit c73 --> if_ual44 + if_ual44: add %3, %1, %2 --> if_ual2 + if_ual43: emit c72 --> if_ual42 + if_ual42: imm_int 0, %20, --> if_ual41 + if_ual41: imm_int 1, %21, --> if_ual40 + if_ual40: eq %19, %0, %21 --> if_ual39 + if_ual4: imm_int 1, %3, --> if_ual2 + if_ual39: eq %19, %20 --> if_ual36, if_ual38 + if_ual38: emit c71 --> if_ual37 + if_ual37: sub %3, %1, %2 --> if_ual2 + if_ual36: emit c70 --> if_ual35 + if_ual35: imm_int 0, %17, --> if_ual34 + if_ual34: imm_int 2, %18, --> if_ual33 + if_ual33: eq %16, %0, %18 --> if_ual32 + if_ual32: eq %16, %17 --> if_ual19, if_ual31 + if_ual31: emit c69 --> if_ual30 + if_ual30: imm_int 0, %15, --> if_ual29 + if_ual3: imm_int 0, %3, --> if_ual2 + if_ual29: emit c68 --> if_ual28 + if_ual28: mov %14, %1 --> if_ual27 + if_ual27: eq %14, %15 --> if_ual20, if_ual26 + if_ual26: imm_int 0, %13, --> if_ual25 + if_ual25: emit c67 --> if_ual24 + if_ual24: mov %12, %2 --> if_ual23 + if_ual23: eq %12, %13 --> if_ual21, if_ual22 + if_ual22: imm_int 1, %3, --> if_ual2 + if_ual21: imm_int 0, %3, --> if_ual2 + if_ual20: imm_int 0, %3, --> if_ual2 + if_ual2: emit c62 --> if_ual1 + if_ual19: emit c66 --> if_ual18 + if_ual18: imm_int 0, %10, --> if_ual17 + if_ual17: imm_int 3, %11, --> if_ual16 + if_ual16: eq %9, %0, %11 --> if_ual15 + if_ual15: eq %9, %10 --> if_ual2, if_ual14 + if_ual14: emit c65 --> if_ual13 + if_ual13: imm_int 0, %8, --> if_ual12 + if_ual12: emit c64 --> if_ual11 + if_ual11: mov %7, %1 --> if_ual10 + if_ual10: eq %7, %8 --> if_ual8, if_ual9 + if_ual1: mov %4, %3 --> if_ual0 + if_ual0: return %4 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31 + result: %1 + stacksize: 0 + entry: main50 + exit: main0 + + main9: imm_int 4, %8, --> main8 + main8: call "if_test", %5, %6, %7, %8, %0: int -> int -> int -> int -> int --> main7 + main7: emit c76 --> main6 + main6: imm_int 1, %2, --> main5 + main50: emit c84 --> main49 + main5: imm_int 2, %3, --> main4 + main49: imm_int 1, %23, --> main48 + main48: imm_int 2, %24, --> main47 + main47: imm_int 3, %25, --> main46 + main46: imm_int 4, %26, --> main45 + main45: imm_int 5, %27, --> main44 + main44: imm_int 6, %28, --> main43 + main43: imm_int 7, %29, --> main42 + main42: imm_int 8, %30, --> main41 + main41: imm_int 9, %31, --> main40 + main40: call "if_jian", %23, %24, %25, %26, %27, %28, %29, %30, %31, %0: int -> int -> int -> int -> int -> int -> int -> int -> int -> int --> main39 + main4: imm_int 3, %4, --> main3 + main39: emit c83 --> main38 + main38: imm_int 1, %21, --> main37 + main37: imm_int 2, %22, --> main36 + main36: call "if_exSimple", %21, %22, %0: int -> int -> int --> main35 + main35: emit c82 --> main34 + main34: imm_int 1, %18, --> main33 + main33: imm_int 2, %19, --> main32 + main32: imm_int 3, %20, --> main31 + main31: call "if_imbriq1", %18, %19, %20, %0: int -> int -> int -> int --> main30 + main30: emit c81 --> main29 + main3: call "if_ual", %2, %3, %4, %0: int -> int -> int -> int --> main2 + main29: imm_int 1, %15, --> main28 + main28: imm_int 2, %16, --> main27 + main27: imm_int 3, %17, --> main26 + main26: call "if_imbriq2", %15, %16, %17, %0: int -> int -> int -> int --> main25 + main25: emit c80 --> main24 + main24: imm_int 1, %13, --> main23 + main23: imm_int 2, %14, --> main22 + main22: call "if_min", %13, %14, %0: int -> int -> int --> main21 + main21: emit c79 --> main20 + main20: imm_int 1, %11, --> main19 + main2: emit c75 --> main1 + main19: imm_int 2, %12, --> main18 + main18: call "if_prog", %11, %12, %0: int -> int -> int --> main17 + main17: emit c78 --> main16 + main16: imm_int 1, %9, --> main15 + main15: imm_int 2, %10, --> main14 + main14: call "if_sansElse", %9, %10, %0: int -> int -> int --> main13 + main13: emit c77 --> main12 + main12: imm_int 1, %5, --> main11 + main11: imm_int 2, %6, --> main10 + main10: imm_int 3, %7, --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/ifthenelse.c b/tests/clight/ifthenelse.c new file mode 100644 index 0000000..407e15e --- /dev/null +++ b/tests/clight/ifthenelse.c @@ -0,0 +1,154 @@ +int if_jian(int a, int b, int c, int d, int e, int f,int g, int x, int y){ + int u,v; + int t1,t2,t3,t4,t5; + + t1 = (a+b) b) { + min=b; + } + else { + min=a; + } + return min; +} + +int if_prog(int j,int i){ + int a,b; + a=i+j; + if(a<0){ + b=2; + } + else { + b=3; + } + return b; +} + +int if_sansElse (int a, int b) { + int c = 0; + if (a < b) { + c = a; + } + return c; +} + +int if_test(int a, int b, int x, int y) { + int c =0, d=0, v=0, w=0, z = 0; + if (a b) { + min=b; + } + else { + min=a; + } + return min; +} + +int if_prog(int j,int i){ + int a,b; + a=i+j; + if(a<0){ + b=2; + } + else { + b=3; + } + return b; +} + +int if_sansElse (int a, int b) { + int c = 0; + if (a < b) { + c = a; + } + return c; +} + +int if_test(int a, int b, int x, int y) { + int c =0, d=0, v=0, w=0, z = 0; + if (a void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main171 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin tri +tri121: +c12: +c11: +c10: +li $t0, 0 +tri53: +li $a2, 0 +c9: +slt $v0, $t0, $a1 +seq $v0, $v0, $zero +beq $v0, $a2, tri48 +jr $ra +tri48: +c7: +c6: +li $t1, 1 +tri45: +li $a2, 0 +c5: +sub $v0, $a1, $t0 +slt $v0, $t1, $v0 +seq $v0, $v0, $zero +beq $v0, $a2, tri39 +c8: +li $v0, 1 +add $t0, $t0, $v0 +j tri53 +tri39: +c3: +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +li $v0, 1 +sub $a2, $t1, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +slt $v0, $a3, $v0 +beq $v0, $zero, tri8 +c2: +li $v0, 1 +sub $a2, $t1, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $t2, 0($v0) +c1: +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +li $v0, 1 +sub $a2, $t1, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c0: +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a0, $v0 +sw $t2, 0($v0) +tri8: +c4: +li $v0, 1 +add $t1, $t1, $v0 +j tri45 +# end tri + + +# begin _main +main171: +addi $sp, $sp, -44 +sw $ra, 40($sp) +c24: +li $a1, 10 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c23: +li $a2, 9 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c22: +li $a2, 8 +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c21: +li $a2, 7 +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c20: +li $a2, 6 +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c19: +li $a2, 5 +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c18: +li $a2, 4 +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c17: +li $a2, 3 +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c16: +li $a2, 2 +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c15: +li $a2, 1 +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c14: +move $a0, $sp +li $a1, 10 +la $v0, tri121 +jalr $v0 +c13: +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +lw $ra, 40($sp) +addi $sp, $sp, 44 +jr $ra +# end _main diff --git a/tests/clight/testCOMP_tri.Clight.expected b/tests/clight/testCOMP_tri.Clight.expected new file mode 100644 index 0000000..d8a40ee --- /dev/null +++ b/tests/clight/testCOMP_tri.Clight.expected @@ -0,0 +1,318 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +void tri(int *t, int n) +{ + int i; + int j; + int tmp; + c12: + tmp = 0; + c11: + for (({ c10: i = 0; }); (/* c9 */ i < n); ({ c8: i = i + 1; })) { + c7: + for (({ c6: j = 1; }); (/* c5 */ j < n - i); ({ c4: j = j + 1; })) { + c3: + if (t[j] < t[(j - 1)]) { + c2: + tmp = t[(j - 1)]; + c1: + t[(j - 1)] = t[j]; + c0: + t[j] = tmp; + } + } + } +} + +int main(void) +{ + int t[10]; + c24: + t[0] = 10; + c23: + t[1] = 9; + c22: + t[2] = 8; + c21: + t[3] = 7; + c20: + t[4] = 6; + c19: + t[5] = 5; + c18: + t[6] = 4; + c17: + t[7] = 3; + c16: + t[8] = 2; + c15: + t[9] = 1; + c14: + tri(t, 10); + c13: + return t[0]; +} + + diff --git a/tests/clight/testCOMP_tri.Cminor.expected b/tests/clight/testCOMP_tri.Cminor.expected new file mode 100644 index 0000000..7a7a1b2 --- /dev/null +++ b/tests/clight/testCOMP_tri.Cminor.expected @@ -0,0 +1,486 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"tri" (t, n) : int -> int -> void { + + stack 0; + + var tmp, j, i; + + c12: + tmp = 0; + c11: + c10: + i = 0; + block { + loop { + if (!(/* c9 */ i < n)) { + exit 0; + } + else { + } + block { + c7: + c6: + j = 1; + block { + loop { + if (!(/* c5 */ j < (n - i))) { + exit 0; + } + else { + } + block { + c3: + if (int32[t + (j * 4)] < int32[t + ((j - 1) * 4)]) { + c2: + tmp = int32[t + ((j - 1) * 4)]; + c1: + int32[t + ((j - 1) * 4)] = int32[t + (j * 4)]; + c0: + int32[t + (j * 4)] = tmp; + } + else { + } + } + c4: + j = j + 1; + } + } + } + c8: + i = i + 1; + } + } + +} + + +"main" () : int { + + stack 40; + + c24: + int32[&0 + (0 * 4)] = 10; + c23: + int32[&0 + (1 * 4)] = 9; + c22: + int32[&0 + (2 * 4)] = 8; + c21: + int32[&0 + (3 * 4)] = 7; + c20: + int32[&0 + (4 * 4)] = 6; + c19: + int32[&0 + (5 * 4)] = 5; + c18: + int32[&0 + (6 * 4)] = 4; + c17: + int32[&0 + (7 * 4)] = 3; + c16: + int32[&0 + (8 * 4)] = 2; + c15: + int32[&0 + (9 * 4)] = 1; + c14: + "tri"(&0, 10) : int -> int -> void; + c13: + return int32[&0 + (0 * 4)]; + +} + + diff --git a/tests/clight/testCOMP_tri.ERTL.expected b/tests/clight/testCOMP_tri.ERTL.expected new file mode 100644 index 0000000..e6ed203 --- /dev/null +++ b/tests/clight/testCOMP_tri.ERTL.expected @@ -0,0 +1,761 @@ +program + +globals 0 + +procedure tri(2) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53 +entry tri121 +tri121: newframe --> tri120 +tri120: move %53, $ra --> tri119 +tri119: move %52, $s7 --> tri118 +tri118: move %51, $s6 --> tri117 +tri117: move %50, $s5 --> tri116 +tri116: move %49, $s4 --> tri115 +tri115: move %48, $s3 --> tri114 +tri114: move %47, $s2 --> tri113 +tri113: move %46, $s1 --> tri112 +tri112: move %45, $s0 --> tri111 +tri111: move %0, $a0 --> tri110 +tri110: move %1, $a1 --> tri109 +tri109: li %2, 0 --> tri108 +tri108: li %3, 0 --> tri107 +tri107: li %4, 0 --> tri106 +tri106: li %5, 0 --> tri105 +tri105: li %6, 0 --> tri104 +tri104: li %7, 0 --> tri103 +tri103: li %8, 0 --> tri102 +tri102: li %9, 0 --> tri101 +tri101: li %10, 0 --> tri100 +tri100: li %11, 0 --> tri99 +tri99 : li %12, 0 --> tri98 +tri98 : li %13, 0 --> tri97 +tri97 : li %14, 0 --> tri96 +tri96 : li %15, 0 --> tri95 +tri95 : li %16, 0 --> tri94 +tri94 : li %17, 0 --> tri93 +tri93 : li %18, 0 --> tri92 +tri92 : li %19, 0 --> tri91 +tri91 : li %20, 0 --> tri90 +tri90 : li %21, 0 --> tri89 +tri89 : li %22, 0 --> tri88 +tri88 : li %23, 0 --> tri87 +tri87 : li %24, 0 --> tri86 +tri86 : li %25, 0 --> tri85 +tri85 : li %26, 0 --> tri84 +tri84 : li %27, 0 --> tri83 +tri83 : li %28, 0 --> tri82 +tri82 : li %29, 0 --> tri81 +tri81 : li %30, 0 --> tri80 +tri80 : li %31, 0 --> tri79 +tri79 : li %32, 0 --> tri78 +tri78 : li %33, 0 --> tri77 +tri77 : li %34, 0 --> tri76 +tri76 : li %35, 0 --> tri75 +tri75 : li %36, 0 --> tri74 +tri74 : li %37, 0 --> tri73 +tri73 : li %38, 0 --> tri72 +tri72 : li %39, 0 --> tri71 +tri71 : li %40, 0 --> tri70 +tri70 : li %41, 0 --> tri69 +tri69 : li %42, 0 --> tri68 +tri68 : li %43, 0 --> tri67 +tri67 : li %44, 0 --> tri58 +tri58 : emit c12 --> tri57 +tri57 : li %2, 0 --> tri56 +tri56 : emit c11 --> tri55 +tri55 : emit c10 --> tri54 +tri54 : li %4, 0 --> tri1 +tri1 : j --> tri53 +tri53 : li %35, 0 --> tri52 +tri52 : emit c9 --> tri51 +tri51 : slt %36, %4, %1 --> tri50 +tri50 : li %43, 0 --> tri65 +tri65 : seq %34, %36, %43 --> tri49 +tri49 : beq %34, %35 --> tri48, tri0 +tri0 : j --> tri132 +tri132: move $ra, %53 --> tri131 +tri131: move $s7, %52 --> tri130 +tri130: move $s6, %51 --> tri129 +tri129: move $s5, %50 --> tri128 +tri128: move $s4, %49 --> tri127 +tri127: move $s3, %48 --> tri126 +tri126: move $s2, %47 --> tri125 +tri125: move $s1, %46 --> tri124 +tri124: move $s0, %45 --> tri123 +tri123: delframe --> tri122 +tri122: jr $ra +tri48 : emit c7 --> tri47 +tri47 : emit c6 --> tri46 +tri46 : li %3, 1 --> tri5 +tri5 : j --> tri45 +tri45 : li %31, 0 --> tri44 +tri44 : emit c5 --> tri43 +tri43 : sub %33, %1, %4 --> tri42 +tri42 : slt %32, %3, %33 --> tri41 +tri41 : li %42, 0 --> tri64 +tri64 : seq %30, %32, %42 --> tri40 +tri40 : beq %30, %31 --> tri39, tri4 +tri4 : emit c8 --> tri3 +tri3 : li %5, 1 --> tri2 +tri2 : add %4, %4, %5 --> tri1 +tri39 : emit c3 --> tri38 +tri38 : li %21, 0 --> tri37 +tri37 : li %29, 4 --> tri36 +tri36 : mulo %28, %3, %29 --> tri35 +tri35 : add %41, %0, %28 --> tri63 +tri63 : lw %22, 0(%41) --> tri34 +tri34 : li %27, 1 --> tri33 +tri33 : sub %25, %3, %27 --> tri32 +tri32 : li %26, 4 --> tri31 +tri31 : mulo %24, %25, %26 --> tri30 +tri30 : add %40, %0, %24 --> tri62 +tri62 : lw %23, 0(%40) --> tri29 +tri29 : slt %20, %22, %23 --> tri28 +tri28 : beq %20, %21 --> tri8, tri27 +tri27 : emit c2 --> tri26 +tri26 : li %19, 1 --> tri25 +tri25 : sub %17, %3, %19 --> tri24 +tri24 : li %18, 4 --> tri23 +tri23 : mulo %16, %17, %18 --> tri22 +tri22 : add %39, %0, %16 --> tri61 +tri61 : lw %2, 0(%39) --> tri21 +tri21 : emit c1 --> tri20 +tri20 : li %15, 4 --> tri19 +tri19 : mulo %14, %3, %15 --> tri18 +tri18 : add %38, %0, %14 --> tri60 +tri60 : lw %9, 0(%38) --> tri17 +tri17 : li %13, 1 --> tri16 +tri16 : sub %11, %3, %13 --> tri15 +tri15 : li %12, 4 --> tri14 +tri14 : mulo %10, %11, %12 --> tri13 +tri13 : add %37, %0, %10 --> tri59 +tri59 : sw %9, 0(%37) --> tri12 +tri12 : emit c0 --> tri11 +tri11 : li %8, 4 --> tri10 +tri10 : mulo %7, %3, %8 --> tri9 +tri9 : add %44, %0, %7 --> tri66 +tri66 : sw %2, 0(%44) --> tri8 +tri8 : emit c4 --> tri7 +tri7 : li %6, 1 --> tri6 +tri6 : add %3, %3, %6 --> tri5 + +procedure _main(0) +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78 +entry main171 +main171: newframe --> main170 +main170: move %78, $ra --> main169 +main169: move %77, $s7 --> main168 +main168: move %76, $s6 --> main167 +main167: move %75, $s5 --> main166 +main166: move %74, $s4 --> main165 +main165: move %73, $s3 --> main164 +main164: move %72, $s2 --> main163 +main163: move %71, $s1 --> main162 +main162: move %70, $s0 --> main161 +main161: li %1, 0 --> main160 +main160: li %2, 0 --> main159 +main159: li %3, 0 --> main158 +main158: li %4, 0 --> main157 +main157: li %5, 0 --> main156 +main156: li %6, 0 --> main155 +main155: li %7, 0 --> main154 +main154: li %8, 0 --> main153 +main153: li %9, 0 --> main152 +main152: li %10, 0 --> main151 +main151: li %11, 0 --> main150 +main150: li %12, 0 --> main149 +main149: li %13, 0 --> main148 +main148: li %14, 0 --> main147 +main147: li %15, 0 --> main146 +main146: li %16, 0 --> main145 +main145: li %17, 0 --> main144 +main144: li %18, 0 --> main143 +main143: li %19, 0 --> main142 +main142: li %20, 0 --> main141 +main141: li %21, 0 --> main140 +main140: li %22, 0 --> main139 +main139: li %23, 0 --> main138 +main138: li %24, 0 --> main137 +main137: li %25, 0 --> main136 +main136: li %26, 0 --> main135 +main135: li %27, 0 --> main134 +main134: li %28, 0 --> main133 +main133: li %29, 0 --> main132 +main132: li %30, 0 --> main131 +main131: li %31, 0 --> main130 +main130: li %32, 0 --> main129 +main129: li %33, 0 --> main128 +main128: li %34, 0 --> main127 +main127: li %35, 0 --> main126 +main126: li %36, 0 --> main125 +main125: li %37, 0 --> main124 +main124: li %38, 0 --> main123 +main123: li %39, 0 --> main122 +main122: li %40, 0 --> main121 +main121: li %41, 0 --> main120 +main120: li %42, 0 --> main119 +main119: li %43, 0 --> main118 +main118: li %44, 0 --> main117 +main117: li %45, 0 --> main116 +main116: li %46, 0 --> main115 +main115: li %47, 0 --> main114 +main114: li %48, 0 --> main113 +main113: li %49, 0 --> main112 +main112: li %50, 0 --> main111 +main111: li %51, 0 --> main110 +main110: li %52, 0 --> main109 +main109: li %53, 0 --> main108 +main108: li %54, 0 --> main107 +main107: li %55, 0 --> main106 +main106: li %56, 0 --> main105 +main105: li %57, 0 --> main104 +main104: li %58, 0 --> main103 +main103: li %59, 0 --> main102 +main102: li %60, 0 --> main101 +main101: li %61, 0 --> main100 +main100: li %62, 0 --> main99 +main99 : li %63, 0 --> main98 +main98 : li %64, 0 --> main97 +main97 : li %65, 0 --> main96 +main96 : li %66, 0 --> main95 +main95 : li %67, 0 --> main94 +main94 : li %68, 0 --> main93 +main93 : li %69, 0 --> main80 +main80 : emit c24 --> main79 +main79 : li %53, 10 --> main78 +main78 : move %54, $sp --> main194 +main194: move %54, %54 --> main77 +main77 : li %56, 0 --> main76 +main76 : li %57, 4 --> main75 +main75 : mulo %55, %56, %57 --> main74 +main74 : add %69, %54, %55 --> main92 +main92 : sw %53, 0(%69) --> main73 +main73 : emit c23 --> main72 +main72 : li %48, 9 --> main71 +main71 : move %49, $sp --> main193 +main193: move %49, %49 --> main70 +main70 : li %51, 1 --> main69 +main69 : li %52, 4 --> main68 +main68 : mulo %50, %51, %52 --> main67 +main67 : add %67, %49, %50 --> main90 +main90 : sw %48, 0(%67) --> main66 +main66 : emit c22 --> main65 +main65 : li %43, 8 --> main64 +main64 : move %44, $sp --> main192 +main192: move %44, %44 --> main63 +main63 : li %46, 2 --> main62 +main62 : li %47, 4 --> main61 +main61 : mulo %45, %46, %47 --> main60 +main60 : add %66, %44, %45 --> main89 +main89 : sw %43, 0(%66) --> main59 +main59 : emit c21 --> main58 +main58 : li %38, 7 --> main57 +main57 : move %39, $sp --> main191 +main191: move %39, %39 --> main56 +main56 : li %41, 3 --> main55 +main55 : li %42, 4 --> main54 +main54 : mulo %40, %41, %42 --> main53 +main53 : add %65, %39, %40 --> main88 +main88 : sw %38, 0(%65) --> main52 +main52 : emit c20 --> main51 +main51 : li %33, 6 --> main50 +main50 : move %34, $sp --> main190 +main190: move %34, %34 --> main49 +main49 : li %36, 4 --> main48 +main48 : li %37, 4 --> main47 +main47 : mulo %35, %36, %37 --> main46 +main46 : add %64, %34, %35 --> main87 +main87 : sw %33, 0(%64) --> main45 +main45 : emit c19 --> main44 +main44 : li %28, 5 --> main43 +main43 : move %29, $sp --> main188 +main188: move %29, %29 --> main42 +main42 : li %31, 5 --> main41 +main41 : li %32, 4 --> main40 +main40 : mulo %30, %31, %32 --> main39 +main39 : add %63, %29, %30 --> main86 +main86 : sw %28, 0(%63) --> main38 +main38 : emit c18 --> main37 +main37 : li %23, 4 --> main36 +main36 : move %24, $sp --> main187 +main187: move %24, %24 --> main35 +main35 : li %26, 6 --> main34 +main34 : li %27, 4 --> main33 +main33 : mulo %25, %26, %27 --> main32 +main32 : add %62, %24, %25 --> main85 +main85 : sw %23, 0(%62) --> main31 +main31 : emit c17 --> main30 +main30 : li %18, 3 --> main29 +main29 : move %19, $sp --> main186 +main186: move %19, %19 --> main28 +main28 : li %21, 7 --> main27 +main27 : li %22, 4 --> main26 +main26 : mulo %20, %21, %22 --> main25 +main25 : add %61, %19, %20 --> main84 +main84 : sw %18, 0(%61) --> main24 +main24 : emit c16 --> main23 +main23 : li %13, 2 --> main22 +main22 : move %14, $sp --> main185 +main185: move %14, %14 --> main21 +main21 : li %16, 8 --> main20 +main20 : li %17, 4 --> main19 +main19 : mulo %15, %16, %17 --> main18 +main18 : add %60, %14, %15 --> main83 +main83 : sw %13, 0(%60) --> main17 +main17 : emit c15 --> main16 +main16 : li %8, 1 --> main15 +main15 : move %9, $sp --> main184 +main184: move %9, %9 --> main14 +main14 : li %11, 9 --> main13 +main13 : li %12, 4 --> main12 +main12 : mulo %10, %11, %12 --> main11 +main11 : add %59, %9, %10 --> main82 +main82 : sw %8, 0(%59) --> main10 +main10 : emit c14 --> main9 +main9 : move %5, $sp --> main195 +main195: move %5, %5 --> main8 +main8 : li %6, 10 --> main7 +main7 : la %68, tri --> main91 +main91 : j --> main199 +main199: move $a0, %5 --> main198 +main198: move $a1, %6 --> main197 +main197: call %68(2) --> main196 +main196: move %7, $v0 --> main6 +main6 : emit c13 --> main5 +main5 : move %1, $sp --> main189 +main189: move %1, %1 --> main4 +main4 : li %3, 0 --> main3 +main3 : li %4, 4 --> main2 +main2 : mulo %2, %3, %4 --> main1 +main1 : add %58, %1, %2 --> main81 +main81 : lw %0, 0(%58) --> main0 +main0 : j --> main183 +main183: move $v0, %0 --> main182 +main182: move $ra, %78 --> main181 +main181: move $s7, %77 --> main180 +main180: move $s6, %76 --> main179 +main179: move $s5, %75 --> main178 +main178: move $s4, %74 --> main177 +main177: move $s3, %73 --> main176 +main176: move $s2, %72 --> main175 +main175: move $s1, %71 --> main174 +main174: move $s0, %70 --> main173 +main173: delframe --> main172 +main172: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testCOMP_tri.LIN.expected b/tests/clight/testCOMP_tri.LIN.expected new file mode 100644 index 0000000..230c10b --- /dev/null +++ b/tests/clight/testCOMP_tri.LIN.expected @@ -0,0 +1,572 @@ +program + +globals 0 + +procedure tri(2) +var 0 +tri121: +newframe +c12: +c11: +c10: +li $t0, 0 +tri53: +li $a2, 0 +c9: +slt $v0, $t0, $a1 +seq $v0, $v0, $zero +beq $v0, $a2, tri48 +delframe +jr $ra +tri48: +c7: +c6: +li $t1, 1 +tri45: +li $a2, 0 +c5: +sub $v0, $a1, $t0 +slt $v0, $t1, $v0 +seq $v0, $v0, $zero +beq $v0, $a2, tri39 +c8: +li $v0, 1 +add $t0, $t0, $v0 +j tri53 +tri39: +c3: +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +li $v0, 1 +sub $a2, $t1, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +slt $v0, $a3, $v0 +beq $v0, $zero, tri8 +c2: +li $v0, 1 +sub $a2, $t1, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $t2, 0($v0) +c1: +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a0, $v0 +lw $a3, 0($v0) +li $v0, 1 +sub $a2, $t1, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c0: +li $v0, 4 +mulo $v0, $t1, $v0 +add $v0, $a0, $v0 +sw $t2, 0($v0) +tri8: +c4: +li $v0, 1 +add $t1, $t1, $v0 +j tri45 + +procedure _main(0) +var 44 +main171: +newframe +sw $ra, 40($sp) +c24: +li $a1, 10 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c23: +li $a2, 9 +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c22: +li $a2, 8 +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c21: +li $a2, 7 +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c20: +li $a2, 6 +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c19: +li $a2, 5 +move $a1, $sp +li $a0, 5 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c18: +li $a2, 4 +move $a1, $sp +li $a0, 6 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c17: +li $a2, 3 +move $a1, $sp +li $a0, 7 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c16: +li $a2, 2 +move $a1, $sp +li $a0, 8 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c15: +li $a2, 1 +move $a1, $sp +li $a0, 9 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $a2, 0($v0) +c14: +move $a0, $sp +li $a1, 10 +la $v0, tri +call $v0 +c13: +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +lw $ra, 40($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testCOMP_tri.LTL.expected b/tests/clight/testCOMP_tri.LTL.expected new file mode 100644 index 0000000..0defe4d --- /dev/null +++ b/tests/clight/testCOMP_tri.LTL.expected @@ -0,0 +1,741 @@ +program + +globals 0 + +procedure tri(2) +var 0 +entry tri121 +tri121: newframe --> tri120 +tri120: j --> tri119 +tri119: j --> tri118 +tri118: j --> tri117 +tri117: j --> tri116 +tri116: j --> tri115 +tri115: j --> tri114 +tri114: j --> tri113 +tri113: j --> tri112 +tri112: j --> tri111 +tri111: j --> tri110 +tri110: j --> tri109 +tri109: j --> tri108 +tri108: j --> tri107 +tri107: j --> tri106 +tri106: j --> tri105 +tri105: j --> tri104 +tri104: j --> tri103 +tri103: j --> tri102 +tri102: j --> tri101 +tri101: j --> tri100 +tri100: j --> tri99 +tri99 : j --> tri98 +tri98 : j --> tri97 +tri97 : j --> tri96 +tri96 : j --> tri95 +tri95 : j --> tri94 +tri94 : j --> tri93 +tri93 : j --> tri92 +tri92 : j --> tri91 +tri91 : j --> tri90 +tri90 : j --> tri89 +tri89 : j --> tri88 +tri88 : j --> tri87 +tri87 : j --> tri86 +tri86 : j --> tri85 +tri85 : j --> tri84 +tri84 : j --> tri83 +tri83 : j --> tri82 +tri82 : j --> tri81 +tri81 : j --> tri80 +tri80 : j --> tri79 +tri79 : j --> tri78 +tri78 : j --> tri77 +tri77 : j --> tri76 +tri76 : j --> tri75 +tri75 : j --> tri74 +tri74 : j --> tri73 +tri73 : j --> tri72 +tri72 : j --> tri71 +tri71 : j --> tri70 +tri70 : j --> tri69 +tri69 : j --> tri68 +tri68 : j --> tri67 +tri67 : j --> tri58 +tri58 : emit c12 --> tri57 +tri57 : j --> tri56 +tri56 : emit c11 --> tri55 +tri55 : emit c10 --> tri54 +tri54 : li $t0, 0 --> tri1 +tri1 : j --> tri53 +tri53 : li $a2, 0 --> tri52 +tri52 : emit c9 --> tri51 +tri51 : slt $v0, $t0, $a1 --> tri50 +tri50 : j --> tri65 +tri65 : seq $v0, $v0, $zero --> tri49 +tri49 : beq $v0, $a2 --> tri48, tri0 +tri0 : j --> tri132 +tri132: j --> tri131 +tri131: j --> tri130 +tri130: j --> tri129 +tri129: j --> tri128 +tri128: j --> tri127 +tri127: j --> tri126 +tri126: j --> tri125 +tri125: j --> tri124 +tri124: j --> tri123 +tri123: delframe --> tri122 +tri122: jr $ra +tri48 : emit c7 --> tri47 +tri47 : emit c6 --> tri46 +tri46 : li $t1, 1 --> tri5 +tri5 : j --> tri45 +tri45 : li $a2, 0 --> tri44 +tri44 : emit c5 --> tri43 +tri43 : sub $v0, $a1, $t0 --> tri42 +tri42 : slt $v0, $t1, $v0 --> tri41 +tri41 : j --> tri64 +tri64 : seq $v0, $v0, $zero --> tri40 +tri40 : beq $v0, $a2 --> tri39, tri4 +tri4 : emit c8 --> tri3 +tri3 : li $v0, 1 --> tri2 +tri2 : add $t0, $t0, $v0 --> tri1 +tri39 : emit c3 --> tri38 +tri38 : j --> tri37 +tri37 : li $v0, 4 --> tri36 +tri36 : mulo $v0, $t1, $v0 --> tri35 +tri35 : add $v0, $a0, $v0 --> tri63 +tri63 : lw $a3, 0($v0) --> tri34 +tri34 : li $v0, 1 --> tri33 +tri33 : sub $a2, $t1, $v0 --> tri32 +tri32 : li $v0, 4 --> tri31 +tri31 : mulo $v0, $a2, $v0 --> tri30 +tri30 : add $v0, $a0, $v0 --> tri62 +tri62 : lw $v0, 0($v0) --> tri29 +tri29 : slt $v0, $a3, $v0 --> tri28 +tri28 : beq $v0, $zero --> tri8, tri27 +tri27 : emit c2 --> tri26 +tri26 : li $v0, 1 --> tri25 +tri25 : sub $a2, $t1, $v0 --> tri24 +tri24 : li $v0, 4 --> tri23 +tri23 : mulo $v0, $a2, $v0 --> tri22 +tri22 : add $v0, $a0, $v0 --> tri61 +tri61 : lw $t2, 0($v0) --> tri21 +tri21 : emit c1 --> tri20 +tri20 : li $v0, 4 --> tri19 +tri19 : mulo $v0, $t1, $v0 --> tri18 +tri18 : add $v0, $a0, $v0 --> tri60 +tri60 : lw $a3, 0($v0) --> tri17 +tri17 : li $v0, 1 --> tri16 +tri16 : sub $a2, $t1, $v0 --> tri15 +tri15 : li $v0, 4 --> tri14 +tri14 : mulo $v0, $a2, $v0 --> tri13 +tri13 : add $v0, $a0, $v0 --> tri59 +tri59 : lw $a3, 0($v0) --> tri12 +tri12 : emit c0 --> tri11 +tri11 : li $v0, 4 --> tri10 +tri10 : mulo $v0, $t1, $v0 --> tri9 +tri9 : add $v0, $a0, $v0 --> tri66 +tri66 : lw $t2, 0($v0) --> tri8 +tri8 : emit c4 --> tri7 +tri7 : li $v0, 1 --> tri6 +tri6 : add $t1, $t1, $v0 --> tri5 + +procedure _main(0) +var 44 +entry main171 +main171: newframe --> main170 +main170: lw $ra, 40($sp) --> main169 +main169: j --> main168 +main168: j --> main167 +main167: j --> main166 +main166: j --> main165 +main165: j --> main164 +main164: j --> main163 +main163: j --> main162 +main162: j --> main161 +main161: j --> main160 +main160: j --> main159 +main159: j --> main158 +main158: j --> main157 +main157: j --> main156 +main156: j --> main155 +main155: j --> main154 +main154: j --> main153 +main153: j --> main152 +main152: j --> main151 +main151: j --> main150 +main150: j --> main149 +main149: j --> main148 +main148: j --> main147 +main147: j --> main146 +main146: j --> main145 +main145: j --> main144 +main144: j --> main143 +main143: j --> main142 +main142: j --> main141 +main141: j --> main140 +main140: j --> main139 +main139: j --> main138 +main138: j --> main137 +main137: j --> main136 +main136: j --> main135 +main135: j --> main134 +main134: j --> main133 +main133: j --> main132 +main132: j --> main131 +main131: j --> main130 +main130: j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: j --> main126 +main126: j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: j --> main122 +main122: j --> main121 +main121: j --> main120 +main120: j --> main119 +main119: j --> main118 +main118: j --> main117 +main117: j --> main116 +main116: j --> main115 +main115: j --> main114 +main114: j --> main113 +main113: j --> main112 +main112: j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: j --> main108 +main108: j --> main107 +main107: j --> main106 +main106: j --> main105 +main105: j --> main104 +main104: j --> main103 +main103: j --> main102 +main102: j --> main101 +main101: j --> main100 +main100: j --> main99 +main99 : j --> main98 +main98 : j --> main97 +main97 : j --> main96 +main96 : j --> main95 +main95 : j --> main94 +main94 : j --> main93 +main93 : j --> main80 +main80 : emit c24 --> main79 +main79 : li $a1, 10 --> main78 +main78 : move $a0, $sp --> main194 +main194: j --> main77 +main77 : j --> main76 +main76 : li $v0, 4 --> main75 +main75 : mulo $v0, $zero, $v0 --> main74 +main74 : add $v0, $a0, $v0 --> main92 +main92 : lw $a1, 0($v0) --> main73 +main73 : emit c23 --> main72 +main72 : li $a2, 9 --> main71 +main71 : move $a1, $sp --> main193 +main193: j --> main70 +main70 : li $a0, 1 --> main69 +main69 : li $v0, 4 --> main68 +main68 : mulo $v0, $a0, $v0 --> main67 +main67 : add $v0, $a1, $v0 --> main90 +main90 : lw $a2, 0($v0) --> main66 +main66 : emit c22 --> main65 +main65 : li $a2, 8 --> main64 +main64 : move $a1, $sp --> main192 +main192: j --> main63 +main63 : li $a0, 2 --> main62 +main62 : li $v0, 4 --> main61 +main61 : mulo $v0, $a0, $v0 --> main60 +main60 : add $v0, $a1, $v0 --> main89 +main89 : lw $a2, 0($v0) --> main59 +main59 : emit c21 --> main58 +main58 : li $a2, 7 --> main57 +main57 : move $a1, $sp --> main191 +main191: j --> main56 +main56 : li $a0, 3 --> main55 +main55 : li $v0, 4 --> main54 +main54 : mulo $v0, $a0, $v0 --> main53 +main53 : add $v0, $a1, $v0 --> main88 +main88 : lw $a2, 0($v0) --> main52 +main52 : emit c20 --> main51 +main51 : li $a2, 6 --> main50 +main50 : move $a1, $sp --> main190 +main190: j --> main49 +main49 : li $a0, 4 --> main48 +main48 : li $v0, 4 --> main47 +main47 : mulo $v0, $a0, $v0 --> main46 +main46 : add $v0, $a1, $v0 --> main87 +main87 : lw $a2, 0($v0) --> main45 +main45 : emit c19 --> main44 +main44 : li $a2, 5 --> main43 +main43 : move $a1, $sp --> main188 +main188: j --> main42 +main42 : li $a0, 5 --> main41 +main41 : li $v0, 4 --> main40 +main40 : mulo $v0, $a0, $v0 --> main39 +main39 : add $v0, $a1, $v0 --> main86 +main86 : lw $a2, 0($v0) --> main38 +main38 : emit c18 --> main37 +main37 : li $a2, 4 --> main36 +main36 : move $a1, $sp --> main187 +main187: j --> main35 +main35 : li $a0, 6 --> main34 +main34 : li $v0, 4 --> main33 +main33 : mulo $v0, $a0, $v0 --> main32 +main32 : add $v0, $a1, $v0 --> main85 +main85 : lw $a2, 0($v0) --> main31 +main31 : emit c17 --> main30 +main30 : li $a2, 3 --> main29 +main29 : move $a1, $sp --> main186 +main186: j --> main28 +main28 : li $a0, 7 --> main27 +main27 : li $v0, 4 --> main26 +main26 : mulo $v0, $a0, $v0 --> main25 +main25 : add $v0, $a1, $v0 --> main84 +main84 : lw $a2, 0($v0) --> main24 +main24 : emit c16 --> main23 +main23 : li $a2, 2 --> main22 +main22 : move $a1, $sp --> main185 +main185: j --> main21 +main21 : li $a0, 8 --> main20 +main20 : li $v0, 4 --> main19 +main19 : mulo $v0, $a0, $v0 --> main18 +main18 : add $v0, $a1, $v0 --> main83 +main83 : lw $a2, 0($v0) --> main17 +main17 : emit c15 --> main16 +main16 : li $a2, 1 --> main15 +main15 : move $a1, $sp --> main184 +main184: j --> main14 +main14 : li $a0, 9 --> main13 +main13 : li $v0, 4 --> main12 +main12 : mulo $v0, $a0, $v0 --> main11 +main11 : add $v0, $a1, $v0 --> main82 +main82 : lw $a2, 0($v0) --> main10 +main10 : emit c14 --> main9 +main9 : move $a0, $sp --> main195 +main195: j --> main8 +main8 : li $a1, 10 --> main7 +main7 : la $v0, tri --> main91 +main91 : j --> main199 +main199: j --> main198 +main198: j --> main197 +main197: call $v0 --> main196 +main196: j --> main6 +main6 : emit c13 --> main5 +main5 : j --> main189 +main189: j --> main4 +main4 : j --> main3 +main3 : li $v0, 4 --> main2 +main2 : mulo $v0, $zero, $v0 --> main1 +main1 : add $v0, $sp, $v0 --> main81 +main81 : lw $v0, 0($v0) --> main0 +main0 : j --> main183 +main183: j --> main182 +main182: lw $ra, 40($sp) --> main181 +main181: j --> main180 +main180: j --> main179 +main179: j --> main178 +main178: j --> main177 +main177: j --> main176 +main176: j --> main175 +main175: j --> main174 +main174: j --> main173 +main173: delframe --> main172 +main172: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testCOMP_tri.RTL.expected b/tests/clight/testCOMP_tri.RTL.expected new file mode 100644 index 0000000..315dc93 --- /dev/null +++ b/tests/clight/testCOMP_tri.RTL.expected @@ -0,0 +1,697 @@ +program + +globals 0 + +procedure tri(%0; %1) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44 +entry tri109 +tri109: li %2, 0 --> tri108 +tri108: li %3, 0 --> tri107 +tri107: li %4, 0 --> tri106 +tri106: li %5, 0 --> tri105 +tri105: li %6, 0 --> tri104 +tri104: li %7, 0 --> tri103 +tri103: li %8, 0 --> tri102 +tri102: li %9, 0 --> tri101 +tri101: li %10, 0 --> tri100 +tri100: li %11, 0 --> tri99 +tri99 : li %12, 0 --> tri98 +tri98 : li %13, 0 --> tri97 +tri97 : li %14, 0 --> tri96 +tri96 : li %15, 0 --> tri95 +tri95 : li %16, 0 --> tri94 +tri94 : li %17, 0 --> tri93 +tri93 : li %18, 0 --> tri92 +tri92 : li %19, 0 --> tri91 +tri91 : li %20, 0 --> tri90 +tri90 : li %21, 0 --> tri89 +tri89 : li %22, 0 --> tri88 +tri88 : li %23, 0 --> tri87 +tri87 : li %24, 0 --> tri86 +tri86 : li %25, 0 --> tri85 +tri85 : li %26, 0 --> tri84 +tri84 : li %27, 0 --> tri83 +tri83 : li %28, 0 --> tri82 +tri82 : li %29, 0 --> tri81 +tri81 : li %30, 0 --> tri80 +tri80 : li %31, 0 --> tri79 +tri79 : li %32, 0 --> tri78 +tri78 : li %33, 0 --> tri77 +tri77 : li %34, 0 --> tri76 +tri76 : li %35, 0 --> tri75 +tri75 : li %36, 0 --> tri74 +tri74 : li %37, 0 --> tri73 +tri73 : li %38, 0 --> tri72 +tri72 : li %39, 0 --> tri71 +tri71 : li %40, 0 --> tri70 +tri70 : li %41, 0 --> tri69 +tri69 : li %42, 0 --> tri68 +tri68 : li %43, 0 --> tri67 +tri67 : li %44, 0 --> tri58 +tri58 : emit c12 --> tri57 +tri57 : li %2, 0 --> tri56 +tri56 : emit c11 --> tri55 +tri55 : emit c10 --> tri54 +tri54 : li %4, 0 --> tri1 +tri1 : j --> tri53 +tri53 : li %35, 0 --> tri52 +tri52 : emit c9 --> tri51 +tri51 : slt %36, %4, %1 --> tri50 +tri50 : li %43, 0 --> tri65 +tri65 : seq %34, %36, %43 --> tri49 +tri49 : beq %34, %35 --> tri48, tri0 +tri0 : return +tri48 : emit c7 --> tri47 +tri47 : emit c6 --> tri46 +tri46 : li %3, 1 --> tri5 +tri5 : j --> tri45 +tri45 : li %31, 0 --> tri44 +tri44 : emit c5 --> tri43 +tri43 : sub %33, %1, %4 --> tri42 +tri42 : slt %32, %3, %33 --> tri41 +tri41 : li %42, 0 --> tri64 +tri64 : seq %30, %32, %42 --> tri40 +tri40 : beq %30, %31 --> tri39, tri4 +tri4 : emit c8 --> tri3 +tri3 : li %5, 1 --> tri2 +tri2 : add %4, %4, %5 --> tri1 +tri39 : emit c3 --> tri38 +tri38 : li %21, 0 --> tri37 +tri37 : li %29, 4 --> tri36 +tri36 : mulo %28, %3, %29 --> tri35 +tri35 : add %41, %0, %28 --> tri63 +tri63 : lw %22, 0(%41) --> tri34 +tri34 : li %27, 1 --> tri33 +tri33 : sub %25, %3, %27 --> tri32 +tri32 : li %26, 4 --> tri31 +tri31 : mulo %24, %25, %26 --> tri30 +tri30 : add %40, %0, %24 --> tri62 +tri62 : lw %23, 0(%40) --> tri29 +tri29 : slt %20, %22, %23 --> tri28 +tri28 : beq %20, %21 --> tri8, tri27 +tri27 : emit c2 --> tri26 +tri26 : li %19, 1 --> tri25 +tri25 : sub %17, %3, %19 --> tri24 +tri24 : li %18, 4 --> tri23 +tri23 : mulo %16, %17, %18 --> tri22 +tri22 : add %39, %0, %16 --> tri61 +tri61 : lw %2, 0(%39) --> tri21 +tri21 : emit c1 --> tri20 +tri20 : li %15, 4 --> tri19 +tri19 : mulo %14, %3, %15 --> tri18 +tri18 : add %38, %0, %14 --> tri60 +tri60 : lw %9, 0(%38) --> tri17 +tri17 : li %13, 1 --> tri16 +tri16 : sub %11, %3, %13 --> tri15 +tri15 : li %12, 4 --> tri14 +tri14 : mulo %10, %11, %12 --> tri13 +tri13 : add %37, %0, %10 --> tri59 +tri59 : sw %9, 0(%37) --> tri12 +tri12 : emit c0 --> tri11 +tri11 : li %8, 4 --> tri10 +tri10 : mulo %7, %3, %8 --> tri9 +tri9 : add %44, %0, %7 --> tri66 +tri66 : sw %2, 0(%44) --> tri8 +tri8 : emit c4 --> tri7 +tri7 : li %6, 1 --> tri6 +tri6 : add %3, %3, %6 --> tri5 + +function _main() : %0 +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69 +entry main161 +main161: li %1, 0 --> main160 +main160: li %2, 0 --> main159 +main159: li %3, 0 --> main158 +main158: li %4, 0 --> main157 +main157: li %5, 0 --> main156 +main156: li %6, 0 --> main155 +main155: li %7, 0 --> main154 +main154: li %8, 0 --> main153 +main153: li %9, 0 --> main152 +main152: li %10, 0 --> main151 +main151: li %11, 0 --> main150 +main150: li %12, 0 --> main149 +main149: li %13, 0 --> main148 +main148: li %14, 0 --> main147 +main147: li %15, 0 --> main146 +main146: li %16, 0 --> main145 +main145: li %17, 0 --> main144 +main144: li %18, 0 --> main143 +main143: li %19, 0 --> main142 +main142: li %20, 0 --> main141 +main141: li %21, 0 --> main140 +main140: li %22, 0 --> main139 +main139: li %23, 0 --> main138 +main138: li %24, 0 --> main137 +main137: li %25, 0 --> main136 +main136: li %26, 0 --> main135 +main135: li %27, 0 --> main134 +main134: li %28, 0 --> main133 +main133: li %29, 0 --> main132 +main132: li %30, 0 --> main131 +main131: li %31, 0 --> main130 +main130: li %32, 0 --> main129 +main129: li %33, 0 --> main128 +main128: li %34, 0 --> main127 +main127: li %35, 0 --> main126 +main126: li %36, 0 --> main125 +main125: li %37, 0 --> main124 +main124: li %38, 0 --> main123 +main123: li %39, 0 --> main122 +main122: li %40, 0 --> main121 +main121: li %41, 0 --> main120 +main120: li %42, 0 --> main119 +main119: li %43, 0 --> main118 +main118: li %44, 0 --> main117 +main117: li %45, 0 --> main116 +main116: li %46, 0 --> main115 +main115: li %47, 0 --> main114 +main114: li %48, 0 --> main113 +main113: li %49, 0 --> main112 +main112: li %50, 0 --> main111 +main111: li %51, 0 --> main110 +main110: li %52, 0 --> main109 +main109: li %53, 0 --> main108 +main108: li %54, 0 --> main107 +main107: li %55, 0 --> main106 +main106: li %56, 0 --> main105 +main105: li %57, 0 --> main104 +main104: li %58, 0 --> main103 +main103: li %59, 0 --> main102 +main102: li %60, 0 --> main101 +main101: li %61, 0 --> main100 +main100: li %62, 0 --> main99 +main99 : li %63, 0 --> main98 +main98 : li %64, 0 --> main97 +main97 : li %65, 0 --> main96 +main96 : li %66, 0 --> main95 +main95 : li %67, 0 --> main94 +main94 : li %68, 0 --> main93 +main93 : li %69, 0 --> main80 +main80 : emit c24 --> main79 +main79 : li %53, 10 --> main78 +main78 : addi %54, STACK, 0 --> main77 +main77 : li %56, 0 --> main76 +main76 : li %57, 4 --> main75 +main75 : mulo %55, %56, %57 --> main74 +main74 : add %69, %54, %55 --> main92 +main92 : sw %53, 0(%69) --> main73 +main73 : emit c23 --> main72 +main72 : li %48, 9 --> main71 +main71 : addi %49, STACK, 0 --> main70 +main70 : li %51, 1 --> main69 +main69 : li %52, 4 --> main68 +main68 : mulo %50, %51, %52 --> main67 +main67 : add %67, %49, %50 --> main90 +main90 : sw %48, 0(%67) --> main66 +main66 : emit c22 --> main65 +main65 : li %43, 8 --> main64 +main64 : addi %44, STACK, 0 --> main63 +main63 : li %46, 2 --> main62 +main62 : li %47, 4 --> main61 +main61 : mulo %45, %46, %47 --> main60 +main60 : add %66, %44, %45 --> main89 +main89 : sw %43, 0(%66) --> main59 +main59 : emit c21 --> main58 +main58 : li %38, 7 --> main57 +main57 : addi %39, STACK, 0 --> main56 +main56 : li %41, 3 --> main55 +main55 : li %42, 4 --> main54 +main54 : mulo %40, %41, %42 --> main53 +main53 : add %65, %39, %40 --> main88 +main88 : sw %38, 0(%65) --> main52 +main52 : emit c20 --> main51 +main51 : li %33, 6 --> main50 +main50 : addi %34, STACK, 0 --> main49 +main49 : li %36, 4 --> main48 +main48 : li %37, 4 --> main47 +main47 : mulo %35, %36, %37 --> main46 +main46 : add %64, %34, %35 --> main87 +main87 : sw %33, 0(%64) --> main45 +main45 : emit c19 --> main44 +main44 : li %28, 5 --> main43 +main43 : addi %29, STACK, 0 --> main42 +main42 : li %31, 5 --> main41 +main41 : li %32, 4 --> main40 +main40 : mulo %30, %31, %32 --> main39 +main39 : add %63, %29, %30 --> main86 +main86 : sw %28, 0(%63) --> main38 +main38 : emit c18 --> main37 +main37 : li %23, 4 --> main36 +main36 : addi %24, STACK, 0 --> main35 +main35 : li %26, 6 --> main34 +main34 : li %27, 4 --> main33 +main33 : mulo %25, %26, %27 --> main32 +main32 : add %62, %24, %25 --> main85 +main85 : sw %23, 0(%62) --> main31 +main31 : emit c17 --> main30 +main30 : li %18, 3 --> main29 +main29 : addi %19, STACK, 0 --> main28 +main28 : li %21, 7 --> main27 +main27 : li %22, 4 --> main26 +main26 : mulo %20, %21, %22 --> main25 +main25 : add %61, %19, %20 --> main84 +main84 : sw %18, 0(%61) --> main24 +main24 : emit c16 --> main23 +main23 : li %13, 2 --> main22 +main22 : addi %14, STACK, 0 --> main21 +main21 : li %16, 8 --> main20 +main20 : li %17, 4 --> main19 +main19 : mulo %15, %16, %17 --> main18 +main18 : add %60, %14, %15 --> main83 +main83 : sw %13, 0(%60) --> main17 +main17 : emit c15 --> main16 +main16 : li %8, 1 --> main15 +main15 : addi %9, STACK, 0 --> main14 +main14 : li %11, 9 --> main13 +main13 : li %12, 4 --> main12 +main12 : mulo %10, %11, %12 --> main11 +main11 : add %59, %9, %10 --> main82 +main82 : sw %8, 0(%59) --> main10 +main10 : emit c14 --> main9 +main9 : addi %5, STACK, 0 --> main8 +main8 : li %6, 10 --> main7 +main7 : la %68, tri --> main91 +main91 : call %7, %68(%5, %6) --> main6 +main6 : emit c13 --> main5 +main5 : addi %1, STACK, 0 --> main4 +main4 : li %3, 0 --> main3 +main3 : li %4, 4 --> main2 +main2 : mulo %2, %3, %4 --> main1 +main1 : add %58, %1, %2 --> main81 +main81 : lw %0, 0(%58) --> main0 +main0 : return %0 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testCOMP_tri.RTLabs.expected b/tests/clight/testCOMP_tri.RTLabs.expected new file mode 100644 index 0000000..74627db --- /dev/null +++ b/tests/clight/testCOMP_tri.RTLabs.expected @@ -0,0 +1,559 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "tri"(%0, %1): int -> int -> void + locals: %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36 + stacksize: 0 + entry: tri58 + exit: tri0 + + tri9: store int32, add, %0, %7, %2 --> tri8 + tri8: emit c4 --> tri7 + tri7: imm_int 1, %6, --> tri6 + tri6: add %3, %3, %6 --> tri5 + tri58: emit c12 --> tri57 + tri57: imm_int 0, %2, --> tri56 + tri56: emit c11 --> tri55 + tri55: emit c10 --> tri54 + tri54: imm_int 0, %4, --> tri1 + tri53: imm_int 0, %35, --> tri52 + tri52: emit c9 --> tri51 + tri51: lt %36, %4, %1 --> tri50 + tri50: notbool %34, %36 --> tri49 + tri5: --> tri45 + tri49: eq %34, %35 --> tri48, tri0 + tri48: emit c7 --> tri47 + tri47: emit c6 --> tri46 + tri46: imm_int 1, %3, --> tri5 + tri45: imm_int 0, %31, --> tri44 + tri44: emit c5 --> tri43 + tri43: sub %33, %1, %4 --> tri42 + tri42: lt %32, %3, %33 --> tri41 + tri41: notbool %30, %32 --> tri40 + tri40: eq %30, %31 --> tri39, tri4 + tri4: emit c8 --> tri3 + tri39: emit c3 --> tri38 + tri38: imm_int 0, %21, --> tri37 + tri37: imm_int 4, %29, --> tri36 + tri36: mul %28, %3, %29 --> tri35 + tri35: load int32, add, %0, %28, %22 --> tri34 + tri34: imm_int 1, %27, --> tri33 + tri33: sub %25, %3, %27 --> tri32 + tri32: imm_int 4, %26, --> tri31 + tri31: mul %24, %25, %26 --> tri30 + tri30: load int32, add, %0, %24, %23 --> tri29 + tri3: imm_int 1, %5, --> tri2 + tri29: lt %20, %22, %23 --> tri28 + tri28: eq %20, %21 --> tri8, tri27 + tri27: emit c2 --> tri26 + tri26: imm_int 1, %19, --> tri25 + tri25: sub %17, %3, %19 --> tri24 + tri24: imm_int 4, %18, --> tri23 + tri23: mul %16, %17, %18 --> tri22 + tri22: load int32, add, %0, %16, %2 --> tri21 + tri21: emit c1 --> tri20 + tri20: imm_int 4, %15, --> tri19 + tri2: add %4, %4, %5 --> tri1 + tri19: mul %14, %3, %15 --> tri18 + tri18: load int32, add, %0, %14, %9 --> tri17 + tri17: imm_int 1, %13, --> tri16 + tri16: sub %11, %3, %13 --> tri15 + tri15: imm_int 4, %12, --> tri14 + tri14: mul %10, %11, %12 --> tri13 + tri13: store int32, add, %0, %10, %9 --> tri12 + tri12: emit c0 --> tri11 + tri11: imm_int 4, %8, --> tri10 + tri10: mul %7, %3, %8 --> tri9 + tri1: --> tri53 + tri0: return + + + "main"(): int + locals: %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57 + result: %0 + stacksize: 40 + entry: main80 + exit: main0 + + main9: imm_addr 0($sp), %5, --> main8 + main80: emit c24 --> main79 + main8: imm_int 10, %6, --> main7 + main79: imm_int 10, %53, --> main78 + main78: imm_addr 0($sp), %54, --> main77 + main77: imm_int 0, %56, --> main76 + main76: imm_int 4, %57, --> main75 + main75: mul %55, %56, %57 --> main74 + main74: store int32, add, %54, %55, %53 --> main73 + main73: emit c23 --> main72 + main72: imm_int 9, %48, --> main71 + main71: imm_addr 0($sp), %49, --> main70 + main70: imm_int 1, %51, --> main69 + main7: call "tri", %5, %6, %7: int -> int -> void --> main6 + main69: imm_int 4, %52, --> main68 + main68: mul %50, %51, %52 --> main67 + main67: store int32, add, %49, %50, %48 --> main66 + main66: emit c22 --> main65 + main65: imm_int 8, %43, --> main64 + main64: imm_addr 0($sp), %44, --> main63 + main63: imm_int 2, %46, --> main62 + main62: imm_int 4, %47, --> main61 + main61: mul %45, %46, %47 --> main60 + main60: store int32, add, %44, %45, %43 --> main59 + main6: emit c13 --> main5 + main59: emit c21 --> main58 + main58: imm_int 7, %38, --> main57 + main57: imm_addr 0($sp), %39, --> main56 + main56: imm_int 3, %41, --> main55 + main55: imm_int 4, %42, --> main54 + main54: mul %40, %41, %42 --> main53 + main53: store int32, add, %39, %40, %38 --> main52 + main52: emit c20 --> main51 + main51: imm_int 6, %33, --> main50 + main50: imm_addr 0($sp), %34, --> main49 + main5: imm_addr 0($sp), %1, --> main4 + main49: imm_int 4, %36, --> main48 + main48: imm_int 4, %37, --> main47 + main47: mul %35, %36, %37 --> main46 + main46: store int32, add, %34, %35, %33 --> main45 + main45: emit c19 --> main44 + main44: imm_int 5, %28, --> main43 + main43: imm_addr 0($sp), %29, --> main42 + main42: imm_int 5, %31, --> main41 + main41: imm_int 4, %32, --> main40 + main40: mul %30, %31, %32 --> main39 + main4: imm_int 0, %3, --> main3 + main39: store int32, add, %29, %30, %28 --> main38 + main38: emit c18 --> main37 + main37: imm_int 4, %23, --> main36 + main36: imm_addr 0($sp), %24, --> main35 + main35: imm_int 6, %26, --> main34 + main34: imm_int 4, %27, --> main33 + main33: mul %25, %26, %27 --> main32 + main32: store int32, add, %24, %25, %23 --> main31 + main31: emit c17 --> main30 + main30: imm_int 3, %18, --> main29 + main3: imm_int 4, %4, --> main2 + main29: imm_addr 0($sp), %19, --> main28 + main28: imm_int 7, %21, --> main27 + main27: imm_int 4, %22, --> main26 + main26: mul %20, %21, %22 --> main25 + main25: store int32, add, %19, %20, %18 --> main24 + main24: emit c16 --> main23 + main23: imm_int 2, %13, --> main22 + main22: imm_addr 0($sp), %14, --> main21 + main21: imm_int 8, %16, --> main20 + main20: imm_int 4, %17, --> main19 + main2: mul %2, %3, %4 --> main1 + main19: mul %15, %16, %17 --> main18 + main18: store int32, add, %14, %15, %13 --> main17 + main17: emit c15 --> main16 + main16: imm_int 1, %8, --> main15 + main15: imm_addr 0($sp), %9, --> main14 + main14: imm_int 9, %11, --> main13 + main13: imm_int 4, %12, --> main12 + main12: mul %10, %11, %12 --> main11 + main11: store int32, add, %9, %10, %8 --> main10 + main10: emit c14 --> main9 + main1: load int32, add, %1, %2, %0 --> main0 + main0: return %0 + + diff --git a/tests/clight/testCOMP_tri.c b/tests/clight/testCOMP_tri.c new file mode 100644 index 0000000..221d9a1 --- /dev/null +++ b/tests/clight/testCOMP_tri.c @@ -0,0 +1,23 @@ +void tri (int t[], int n) { + int i,j,tmp; + tmp = 0; + + for(i = 0 ;i < n; i=i+1) + { + for(j = 1 ; j < n-i ; j=j+1) + { + if(t[j] < t[j-1]) + { + tmp = t[j-1]; + t[j-1] = t[j]; + t[j] = tmp; + } + } + } +} + +int main(){ + int t[10] = {10,9,8,7,6,5,4,3,2,1}; + tri(t,10); + return t[0]; +} diff --git a/tests/clight/testCOMP_tri.c.expected b/tests/clight/testCOMP_tri.c.expected new file mode 100644 index 0000000..221d9a1 --- /dev/null +++ b/tests/clight/testCOMP_tri.c.expected @@ -0,0 +1,23 @@ +void tri (int t[], int n) { + int i,j,tmp; + tmp = 0; + + for(i = 0 ;i < n; i=i+1) + { + for(j = 1 ; j < n-i ; j=j+1) + { + if(t[j] < t[j-1]) + { + tmp = t[j-1]; + t[j-1] = t[j]; + t[j] = tmp; + } + } + } +} + +int main(){ + int t[10] = {10,9,8,7,6,5,4,3,2,1}; + tri(t,10); + return t[0]; +} diff --git a/tests/clight/testCOMP_tri.log.expected b/tests/clight/testCOMP_tri.log.expected new file mode 100644 index 0000000..ba50dc8 --- /dev/null +++ b/tests/clight/testCOMP_tri.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Constant not supported. diff --git a/tests/clight/testTB_Array_LE.ASM.expected b/tests/clight/testTB_Array_LE.ASM.expected new file mode 100644 index 0000000..5f4d11f --- /dev/null +++ b/tests/clight/testTB_Array_LE.ASM.expected @@ -0,0 +1,437 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 0 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main189 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin array_LE +array_LE38: +c1: +li $t0, 2 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $t0, 0($v0) +c0: +li $a0, 78 +li $v0, 1 +add $a2, $a3, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a1, $v0 +sw $a0, 0($v0) +jr $ra +# end array_LE + + +# begin _main +main189: +addi $sp, $sp, -44 +sw $ra, 40($sp) +c13: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c12: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c11: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c10: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c9: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c8: +li $a1, 0 +move $a0, $sp +addi $a0, $a0, 20 +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c7: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c5: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c4: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c3: +move $a0, $sp +move $a1, $sp +addi $a1, $a1, 20 +li $a2, 0 +li $a3, 0 +la $v0, array_LE38 +jalr $v0 +c2: +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +addi $sp, $sp, 20 +li $a1, 1 +li $a0, 4 +mulo $a0, $a1, $a0 +add $a0, $sp, $a0 +lw $a0, 0($a0) +add $v0, $v0, $a0 +lw $ra, 40($sp) +addi $sp, $sp, 44 +jr $ra +# end _main diff --git a/tests/clight/testTB_Array_LE.Clight.expected b/tests/clight/testTB_Array_LE.Clight.expected new file mode 100644 index 0000000..28cda7d --- /dev/null +++ b/tests/clight/testTB_Array_LE.Clight.expected @@ -0,0 +1,303 @@ +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +void array_LE(int *tabLE, int *tabLE2, int i, int j) +{ + c1: + tabLE[i] = 2; + c0: + tabLE2[(j + 1)] = 78; +} + +int main(void) +{ + int t1[5]; + int t2[5]; + c13: + t1[0] = 0; + c12: + t1[1] = 0; + c11: + t1[2] = 0; + c10: + t1[3] = 0; + c9: + t1[4] = 0; + c8: + t2[0] = 0; + c7: + t2[1] = 0; + c6: + t2[2] = 0; + c5: + t2[3] = 0; + c4: + t2[4] = 0; + c3: + array_LE(t1, t2, 0, 0); + c2: + return t1[0] + t2[1]; +} + + diff --git a/tests/clight/testTB_Array_LE.Cminor.expected b/tests/clight/testTB_Array_LE.Cminor.expected new file mode 100644 index 0000000..4418373 --- /dev/null +++ b/tests/clight/testTB_Array_LE.Cminor.expected @@ -0,0 +1,443 @@ + + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"array_LE" (tabLE, tabLE2, i, j) : int -> int -> int -> int -> void { + + stack 0; + + c1: + int32[tabLE + (i * 4)] = 2; + c0: + int32[tabLE2 + ((j + 1) * 4)] = 78; + +} + + +"main" () : int { + + stack 40; + + c13: + int32[&0 + (0 * 4)] = 0; + c12: + int32[&0 + (1 * 4)] = 0; + c11: + int32[&0 + (2 * 4)] = 0; + c10: + int32[&0 + (3 * 4)] = 0; + c9: + int32[&0 + (4 * 4)] = 0; + c8: + int32[&20 + (0 * 4)] = 0; + c7: + int32[&20 + (1 * 4)] = 0; + c6: + int32[&20 + (2 * 4)] = 0; + c5: + int32[&20 + (3 * 4)] = 0; + c4: + int32[&20 + (4 * 4)] = 0; + c3: + "array_LE"(&0, &20, 0, 0) : int -> int -> int -> int -> void; + c2: + return int32[&0 + (0 * 4)] + int32[&20 + (1 * 4)]; + +} + + diff --git a/tests/clight/testTB_Array_LE.ERTL.expected b/tests/clight/testTB_Array_LE.ERTL.expected new file mode 100644 index 0000000..0ab062a --- /dev/null +++ b/tests/clight/testTB_Array_LE.ERTL.expected @@ -0,0 +1,697 @@ +program + +globals 0 + +procedure array_LE(4) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22 +entry array_LE38 +array_LE38: newframe --> array_LE37 +array_LE37: move %22, $ra --> array_LE36 +array_LE36: move %21, $s7 --> array_LE35 +array_LE35: move %20, $s6 --> array_LE34 +array_LE34: move %19, $s5 --> array_LE33 +array_LE33: move %18, $s4 --> array_LE32 +array_LE32: move %17, $s3 --> array_LE31 +array_LE31: move %16, $s2 --> array_LE30 +array_LE30: move %15, $s1 --> array_LE29 +array_LE29: move %14, $s0 --> array_LE28 +array_LE28: move %0, $a0 --> array_LE27 +array_LE27: move %1, $a1 --> array_LE26 +array_LE26: move %2, $a2 --> array_LE25 +array_LE25: move %3, $a3 --> array_LE24 +array_LE24: li %4, 0 --> array_LE23 +array_LE23: li %5, 0 --> array_LE22 +array_LE22: li %6, 0 --> array_LE21 +array_LE21: li %7, 0 --> array_LE20 +array_LE20: li %8, 0 --> array_LE19 +array_LE19: li %9, 0 --> array_LE18 +array_LE18: li %10, 0 --> array_LE17 +array_LE17: li %11, 0 --> array_LE16 +array_LE16: li %12, 0 --> array_LE15 +array_LE15: li %13, 0 --> array_LE12 +array_LE12: emit c1 --> array_LE11 +array_LE11: li %9, 2 --> array_LE10 +array_LE10: li %11, 4 --> array_LE9 +array_LE9 : mulo %10, %2, %11 --> array_LE8 +array_LE8 : add %13, %0, %10 --> array_LE14 +array_LE14: sw %9, 0(%13) --> array_LE7 +array_LE7 : emit c0 --> array_LE6 +array_LE6 : li %4, 78 --> array_LE5 +array_LE5 : li %8, 1 --> array_LE4 +array_LE4 : add %6, %3, %8 --> array_LE3 +array_LE3 : li %7, 4 --> array_LE2 +array_LE2 : mulo %5, %6, %7 --> array_LE1 +array_LE1 : add %12, %1, %5 --> array_LE13 +array_LE13: sw %4, 0(%12) --> array_LE0 +array_LE0 : j --> array_LE49 +array_LE49: move $ra, %22 --> array_LE48 +array_LE48: move $s7, %21 --> array_LE47 +array_LE47: move $s6, %20 --> array_LE46 +array_LE46: move $s5, %19 --> array_LE45 +array_LE45: move $s4, %18 --> array_LE44 +array_LE44: move $s3, %17 --> array_LE43 +array_LE43: move $s2, %16 --> array_LE42 +array_LE42: move $s1, %15 --> array_LE41 +array_LE41: move $s0, %14 --> array_LE40 +array_LE40: delframe --> array_LE39 +array_LE39: jr $ra + +procedure _main(0) +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78, %79, %80, %81, %82, %83, + %84, %85, %86, %87 +entry main189 +main189: newframe --> main188 +main188: move %87, $ra --> main187 +main187: move %86, $s7 --> main186 +main186: move %85, $s6 --> main185 +main185: move %84, $s5 --> main184 +main184: move %83, $s4 --> main183 +main183: move %82, $s3 --> main182 +main182: move %81, $s2 --> main181 +main181: move %80, $s1 --> main180 +main180: move %79, $s0 --> main179 +main179: li %1, 0 --> main178 +main178: li %2, 0 --> main177 +main177: li %3, 0 --> main176 +main176: li %4, 0 --> main175 +main175: li %5, 0 --> main174 +main174: li %6, 0 --> main173 +main173: li %7, 0 --> main172 +main172: li %8, 0 --> main171 +main171: li %9, 0 --> main170 +main170: li %10, 0 --> main169 +main169: li %11, 0 --> main168 +main168: li %12, 0 --> main167 +main167: li %13, 0 --> main166 +main166: li %14, 0 --> main165 +main165: li %15, 0 --> main164 +main164: li %16, 0 --> main163 +main163: li %17, 0 --> main162 +main162: li %18, 0 --> main161 +main161: li %19, 0 --> main160 +main160: li %20, 0 --> main159 +main159: li %21, 0 --> main158 +main158: li %22, 0 --> main157 +main157: li %23, 0 --> main156 +main156: li %24, 0 --> main155 +main155: li %25, 0 --> main154 +main154: li %26, 0 --> main153 +main153: li %27, 0 --> main152 +main152: li %28, 0 --> main151 +main151: li %29, 0 --> main150 +main150: li %30, 0 --> main149 +main149: li %31, 0 --> main148 +main148: li %32, 0 --> main147 +main147: li %33, 0 --> main146 +main146: li %34, 0 --> main145 +main145: li %35, 0 --> main144 +main144: li %36, 0 --> main143 +main143: li %37, 0 --> main142 +main142: li %38, 0 --> main141 +main141: li %39, 0 --> main140 +main140: li %40, 0 --> main139 +main139: li %41, 0 --> main138 +main138: li %42, 0 --> main137 +main137: li %43, 0 --> main136 +main136: li %44, 0 --> main135 +main135: li %45, 0 --> main134 +main134: li %46, 0 --> main133 +main133: li %47, 0 --> main132 +main132: li %48, 0 --> main131 +main131: li %49, 0 --> main130 +main130: li %50, 0 --> main129 +main129: li %51, 0 --> main128 +main128: li %52, 0 --> main127 +main127: li %53, 0 --> main126 +main126: li %54, 0 --> main125 +main125: li %55, 0 --> main124 +main124: li %56, 0 --> main123 +main123: li %57, 0 --> main122 +main122: li %58, 0 --> main121 +main121: li %59, 0 --> main120 +main120: li %60, 0 --> main119 +main119: li %61, 0 --> main118 +main118: li %62, 0 --> main117 +main117: li %63, 0 --> main116 +main116: li %64, 0 --> main115 +main115: li %65, 0 --> main114 +main114: li %66, 0 --> main113 +main113: li %67, 0 --> main112 +main112: li %68, 0 --> main111 +main111: li %69, 0 --> main110 +main110: li %70, 0 --> main109 +main109: li %71, 0 --> main108 +main108: li %72, 0 --> main107 +main107: li %73, 0 --> main106 +main106: li %74, 0 --> main105 +main105: li %75, 0 --> main104 +main104: li %76, 0 --> main103 +main103: li %77, 0 --> main102 +main102: li %78, 0 --> main88 +main88 : emit c13 --> main87 +main87 : li %61, 0 --> main86 +main86 : move %62, $sp --> main215 +main215: move %62, %62 --> main85 +main85 : li %64, 0 --> main84 +main84 : li %65, 4 --> main83 +main83 : mulo %63, %64, %65 --> main82 +main82 : add %78, %62, %63 --> main101 +main101: sw %61, 0(%78) --> main81 +main81 : emit c12 --> main80 +main80 : li %56, 0 --> main79 +main79 : move %57, $sp --> main214 +main214: move %57, %57 --> main78 +main78 : li %59, 1 --> main77 +main77 : li %60, 4 --> main76 +main76 : mulo %58, %59, %60 --> main75 +main75 : add %77, %57, %58 --> main100 +main100: sw %56, 0(%77) --> main74 +main74 : emit c11 --> main73 +main73 : li %51, 0 --> main72 +main72 : move %52, $sp --> main213 +main213: move %52, %52 --> main71 +main71 : li %54, 2 --> main70 +main70 : li %55, 4 --> main69 +main69 : mulo %53, %54, %55 --> main68 +main68 : add %75, %52, %53 --> main98 +main98 : sw %51, 0(%75) --> main67 +main67 : emit c10 --> main66 +main66 : li %46, 0 --> main65 +main65 : move %47, $sp --> main212 +main212: move %47, %47 --> main64 +main64 : li %49, 3 --> main63 +main63 : li %50, 4 --> main62 +main62 : mulo %48, %49, %50 --> main61 +main61 : add %74, %47, %48 --> main97 +main97 : sw %46, 0(%74) --> main60 +main60 : emit c9 --> main59 +main59 : li %41, 0 --> main58 +main58 : move %42, $sp --> main210 +main210: move %42, %42 --> main57 +main57 : li %44, 4 --> main56 +main56 : li %45, 4 --> main55 +main55 : mulo %43, %44, %45 --> main54 +main54 : add %73, %42, %43 --> main96 +main96 : sw %41, 0(%73) --> main53 +main53 : emit c8 --> main52 +main52 : li %36, 0 --> main51 +main51 : move %37, $sp --> main209 +main209: addi %37, %37, 20 --> main50 +main50 : li %39, 0 --> main49 +main49 : li %40, 4 --> main48 +main48 : mulo %38, %39, %40 --> main47 +main47 : add %72, %37, %38 --> main95 +main95 : sw %36, 0(%72) --> main46 +main46 : emit c7 --> main45 +main45 : li %31, 0 --> main44 +main44 : move %32, $sp --> main208 +main208: addi %32, %32, 20 --> main43 +main43 : li %34, 1 --> main42 +main42 : li %35, 4 --> main41 +main41 : mulo %33, %34, %35 --> main40 +main40 : add %71, %32, %33 --> main94 +main94 : sw %31, 0(%71) --> main39 +main39 : emit c6 --> main38 +main38 : li %26, 0 --> main37 +main37 : move %27, $sp --> main207 +main207: addi %27, %27, 20 --> main36 +main36 : li %29, 2 --> main35 +main35 : li %30, 4 --> main34 +main34 : mulo %28, %29, %30 --> main33 +main33 : add %70, %27, %28 --> main93 +main93 : sw %26, 0(%70) --> main32 +main32 : emit c5 --> main31 +main31 : li %21, 0 --> main30 +main30 : move %22, $sp --> main206 +main206: addi %22, %22, 20 --> main29 +main29 : li %24, 3 --> main28 +main28 : li %25, 4 --> main27 +main27 : mulo %23, %24, %25 --> main26 +main26 : add %69, %22, %23 --> main92 +main92 : sw %21, 0(%69) --> main25 +main25 : emit c4 --> main24 +main24 : li %16, 0 --> main23 +main23 : move %17, $sp --> main205 +main205: addi %17, %17, 20 --> main22 +main22 : li %19, 4 --> main21 +main21 : li %20, 4 --> main20 +main20 : mulo %18, %19, %20 --> main19 +main19 : add %67, %17, %18 --> main90 +main90 : sw %16, 0(%67) --> main18 +main18 : emit c3 --> main17 +main17 : move %11, $sp --> main204 +main204: move %11, %11 --> main16 +main16 : move %12, $sp --> main203 +main203: addi %12, %12, 20 --> main15 +main15 : li %13, 0 --> main14 +main14 : li %14, 0 --> main13 +main13 : la %66, array_LE --> main89 +main89 : j --> main221 +main221: move $a0, %11 --> main220 +main220: move $a1, %12 --> main219 +main219: move $a2, %13 --> main218 +main218: move $a3, %14 --> main217 +main217: call %66(4) --> main216 +main216: move %15, $v0 --> main12 +main12 : emit c2 --> main11 +main11 : move %7, $sp --> main202 +main202: move %7, %7 --> main10 +main10 : li %9, 0 --> main9 +main9 : li %10, 4 --> main8 +main8 : mulo %8, %9, %10 --> main7 +main7 : add %76, %7, %8 --> main99 +main99 : lw %1, 0(%76) --> main6 +main6 : move %3, $sp --> main211 +main211: addi %3, %3, 20 --> main5 +main5 : li %5, 1 --> main4 +main4 : li %6, 4 --> main3 +main3 : mulo %4, %5, %6 --> main2 +main2 : add %68, %3, %4 --> main91 +main91 : lw %2, 0(%68) --> main1 +main1 : add %0, %1, %2 --> main0 +main0 : j --> main201 +main201: move $v0, %0 --> main200 +main200: move $ra, %87 --> main199 +main199: move $s7, %86 --> main198 +main198: move $s6, %85 --> main197 +main197: move $s5, %84 --> main196 +main196: move $s4, %83 --> main195 +main195: move $s3, %82 --> main194 +main194: move $s2, %81 --> main193 +main193: move $s1, %80 --> main192 +main192: move $s0, %79 --> main191 +main191: delframe --> main190 +main190: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_LE.LIN.expected b/tests/clight/testTB_Array_LE.LIN.expected new file mode 100644 index 0000000..fe604af --- /dev/null +++ b/tests/clight/testTB_Array_LE.LIN.expected @@ -0,0 +1,526 @@ +program + +globals 0 + +procedure array_LE(4) +var 0 +array_LE38: +newframe +c1: +li $t0, 2 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $t0, 0($v0) +c0: +li $a0, 78 +li $v0, 1 +add $a2, $a3, $v0 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a1, $v0 +sw $a0, 0($v0) +delframe +jr $ra + +procedure _main(0) +var 44 +main189: +newframe +sw $ra, 40($sp) +c13: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c12: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c11: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c10: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c9: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c8: +li $a1, 0 +move $a0, $sp +addi $a0, $a0, 20 +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c7: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c5: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c4: +move $a1, $sp +addi $a1, $a1, 20 +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c3: +move $a0, $sp +move $a1, $sp +addi $a1, $a1, 20 +li $a2, 0 +li $a3, 0 +la $v0, array_LE +call $v0 +c2: +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +addi $sp, $sp, 20 +li $a1, 1 +li $a0, 4 +mulo $a0, $a1, $a0 +add $a0, $sp, $a0 +lw $a0, 0($a0) +add $v0, $v0, $a0 +lw $ra, 40($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_LE.LTL.expected b/tests/clight/testTB_Array_LE.LTL.expected new file mode 100644 index 0000000..2feae42 --- /dev/null +++ b/tests/clight/testTB_Array_LE.LTL.expected @@ -0,0 +1,680 @@ +program + +globals 0 + +procedure array_LE(4) +var 0 +entry array_LE38 +array_LE38: newframe --> array_LE37 +array_LE37: j --> array_LE36 +array_LE36: j --> array_LE35 +array_LE35: j --> array_LE34 +array_LE34: j --> array_LE33 +array_LE33: j --> array_LE32 +array_LE32: j --> array_LE31 +array_LE31: j --> array_LE30 +array_LE30: j --> array_LE29 +array_LE29: j --> array_LE28 +array_LE28: j --> array_LE27 +array_LE27: j --> array_LE26 +array_LE26: j --> array_LE25 +array_LE25: j --> array_LE24 +array_LE24: j --> array_LE23 +array_LE23: j --> array_LE22 +array_LE22: j --> array_LE21 +array_LE21: j --> array_LE20 +array_LE20: j --> array_LE19 +array_LE19: j --> array_LE18 +array_LE18: j --> array_LE17 +array_LE17: j --> array_LE16 +array_LE16: j --> array_LE15 +array_LE15: j --> array_LE12 +array_LE12: emit c1 --> array_LE11 +array_LE11: li $t0, 2 --> array_LE10 +array_LE10: li $v0, 4 --> array_LE9 +array_LE9 : mulo $v0, $a2, $v0 --> array_LE8 +array_LE8 : add $v0, $a0, $v0 --> array_LE14 +array_LE14: lw $t0, 0($v0) --> array_LE7 +array_LE7 : emit c0 --> array_LE6 +array_LE6 : li $a0, 78 --> array_LE5 +array_LE5 : li $v0, 1 --> array_LE4 +array_LE4 : add $a2, $a3, $v0 --> array_LE3 +array_LE3 : li $v0, 4 --> array_LE2 +array_LE2 : mulo $v0, $a2, $v0 --> array_LE1 +array_LE1 : add $v0, $a1, $v0 --> array_LE13 +array_LE13: lw $a0, 0($v0) --> array_LE0 +array_LE0 : j --> array_LE49 +array_LE49: j --> array_LE48 +array_LE48: j --> array_LE47 +array_LE47: j --> array_LE46 +array_LE46: j --> array_LE45 +array_LE45: j --> array_LE44 +array_LE44: j --> array_LE43 +array_LE43: j --> array_LE42 +array_LE42: j --> array_LE41 +array_LE41: j --> array_LE40 +array_LE40: delframe --> array_LE39 +array_LE39: jr $ra + +procedure _main(0) +var 44 +entry main189 +main189: newframe --> main188 +main188: lw $ra, 40($sp) --> main187 +main187: j --> main186 +main186: j --> main185 +main185: j --> main184 +main184: j --> main183 +main183: j --> main182 +main182: j --> main181 +main181: j --> main180 +main180: j --> main179 +main179: j --> main178 +main178: j --> main177 +main177: j --> main176 +main176: j --> main175 +main175: j --> main174 +main174: j --> main173 +main173: j --> main172 +main172: j --> main171 +main171: j --> main170 +main170: j --> main169 +main169: j --> main168 +main168: j --> main167 +main167: j --> main166 +main166: j --> main165 +main165: j --> main164 +main164: j --> main163 +main163: j --> main162 +main162: j --> main161 +main161: j --> main160 +main160: j --> main159 +main159: j --> main158 +main158: j --> main157 +main157: j --> main156 +main156: j --> main155 +main155: j --> main154 +main154: j --> main153 +main153: j --> main152 +main152: j --> main151 +main151: j --> main150 +main150: j --> main149 +main149: j --> main148 +main148: j --> main147 +main147: j --> main146 +main146: j --> main145 +main145: j --> main144 +main144: j --> main143 +main143: j --> main142 +main142: j --> main141 +main141: j --> main140 +main140: j --> main139 +main139: j --> main138 +main138: j --> main137 +main137: j --> main136 +main136: j --> main135 +main135: j --> main134 +main134: j --> main133 +main133: j --> main132 +main132: j --> main131 +main131: j --> main130 +main130: j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: j --> main126 +main126: j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: j --> main122 +main122: j --> main121 +main121: j --> main120 +main120: j --> main119 +main119: j --> main118 +main118: j --> main117 +main117: j --> main116 +main116: j --> main115 +main115: j --> main114 +main114: j --> main113 +main113: j --> main112 +main112: j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: j --> main108 +main108: j --> main107 +main107: j --> main106 +main106: j --> main105 +main105: j --> main104 +main104: j --> main103 +main103: j --> main102 +main102: j --> main88 +main88 : emit c13 --> main87 +main87 : li $a1, 0 --> main86 +main86 : move $a0, $sp --> main215 +main215: j --> main85 +main85 : j --> main84 +main84 : li $v0, 4 --> main83 +main83 : mulo $v0, $zero, $v0 --> main82 +main82 : add $v0, $a0, $v0 --> main101 +main101: lw $a1, 0($v0) --> main81 +main81 : emit c12 --> main80 +main80 : j --> main79 +main79 : move $a1, $sp --> main214 +main214: j --> main78 +main78 : li $a0, 1 --> main77 +main77 : li $v0, 4 --> main76 +main76 : mulo $v0, $a0, $v0 --> main75 +main75 : add $v0, $a1, $v0 --> main100 +main100: lw $zero, 0($v0) --> main74 +main74 : emit c11 --> main73 +main73 : j --> main72 +main72 : move $a1, $sp --> main213 +main213: j --> main71 +main71 : li $a0, 2 --> main70 +main70 : li $v0, 4 --> main69 +main69 : mulo $v0, $a0, $v0 --> main68 +main68 : add $v0, $a1, $v0 --> main98 +main98 : lw $zero, 0($v0) --> main67 +main67 : emit c10 --> main66 +main66 : j --> main65 +main65 : move $a1, $sp --> main212 +main212: j --> main64 +main64 : li $a0, 3 --> main63 +main63 : li $v0, 4 --> main62 +main62 : mulo $v0, $a0, $v0 --> main61 +main61 : add $v0, $a1, $v0 --> main97 +main97 : lw $zero, 0($v0) --> main60 +main60 : emit c9 --> main59 +main59 : j --> main58 +main58 : move $a1, $sp --> main210 +main210: j --> main57 +main57 : li $a0, 4 --> main56 +main56 : li $v0, 4 --> main55 +main55 : mulo $v0, $a0, $v0 --> main54 +main54 : add $v0, $a1, $v0 --> main96 +main96 : lw $zero, 0($v0) --> main53 +main53 : emit c8 --> main52 +main52 : li $a1, 0 --> main51 +main51 : move $a0, $sp --> main209 +main209: addi $a0, $a0, 20 --> main50 +main50 : j --> main49 +main49 : li $v0, 4 --> main48 +main48 : mulo $v0, $zero, $v0 --> main47 +main47 : add $v0, $a0, $v0 --> main95 +main95 : lw $a1, 0($v0) --> main46 +main46 : emit c7 --> main45 +main45 : j --> main44 +main44 : move $a1, $sp --> main208 +main208: addi $a1, $a1, 20 --> main43 +main43 : li $a0, 1 --> main42 +main42 : li $v0, 4 --> main41 +main41 : mulo $v0, $a0, $v0 --> main40 +main40 : add $v0, $a1, $v0 --> main94 +main94 : lw $zero, 0($v0) --> main39 +main39 : emit c6 --> main38 +main38 : j --> main37 +main37 : move $a1, $sp --> main207 +main207: addi $a1, $a1, 20 --> main36 +main36 : li $a0, 2 --> main35 +main35 : li $v0, 4 --> main34 +main34 : mulo $v0, $a0, $v0 --> main33 +main33 : add $v0, $a1, $v0 --> main93 +main93 : lw $zero, 0($v0) --> main32 +main32 : emit c5 --> main31 +main31 : j --> main30 +main30 : move $a1, $sp --> main206 +main206: addi $a1, $a1, 20 --> main29 +main29 : li $a0, 3 --> main28 +main28 : li $v0, 4 --> main27 +main27 : mulo $v0, $a0, $v0 --> main26 +main26 : add $v0, $a1, $v0 --> main92 +main92 : lw $zero, 0($v0) --> main25 +main25 : emit c4 --> main24 +main24 : j --> main23 +main23 : move $a1, $sp --> main205 +main205: addi $a1, $a1, 20 --> main22 +main22 : li $a0, 4 --> main21 +main21 : li $v0, 4 --> main20 +main20 : mulo $v0, $a0, $v0 --> main19 +main19 : add $v0, $a1, $v0 --> main90 +main90 : lw $zero, 0($v0) --> main18 +main18 : emit c3 --> main17 +main17 : move $a0, $sp --> main204 +main204: j --> main16 +main16 : move $a1, $sp --> main203 +main203: addi $a1, $a1, 20 --> main15 +main15 : li $a2, 0 --> main14 +main14 : li $a3, 0 --> main13 +main13 : la $v0, array_LE --> main89 +main89 : j --> main221 +main221: j --> main220 +main220: j --> main219 +main219: j --> main218 +main218: j --> main217 +main217: call $v0 --> main216 +main216: j --> main12 +main12 : emit c2 --> main11 +main11 : move $a0, $sp --> main202 +main202: j --> main10 +main10 : j --> main9 +main9 : li $v0, 4 --> main8 +main8 : mulo $v0, $zero, $v0 --> main7 +main7 : add $v0, $a0, $v0 --> main99 +main99 : lw $v0, 0($v0) --> main6 +main6 : j --> main211 +main211: addi $sp, $sp, 20 --> main5 +main5 : li $a1, 1 --> main4 +main4 : li $a0, 4 --> main3 +main3 : mulo $a0, $a1, $a0 --> main2 +main2 : add $a0, $sp, $a0 --> main91 +main91 : lw $a0, 0($a0) --> main1 +main1 : add $v0, $v0, $a0 --> main0 +main0 : j --> main201 +main201: j --> main200 +main200: lw $ra, 40($sp) --> main199 +main199: j --> main198 +main198: j --> main197 +main197: j --> main196 +main196: j --> main195 +main195: j --> main194 +main194: j --> main193 +main193: j --> main192 +main192: j --> main191 +main191: delframe --> main190 +main190: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_LE.RTL.expected b/tests/clight/testTB_Array_LE.RTL.expected new file mode 100644 index 0000000..a7203fd --- /dev/null +++ b/tests/clight/testTB_Array_LE.RTL.expected @@ -0,0 +1,627 @@ +program + +globals 0 + +procedure array_LE(%0; %1; %2; %3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13 +entry array_LE24 +array_LE24: li %4, 0 --> array_LE23 +array_LE23: li %5, 0 --> array_LE22 +array_LE22: li %6, 0 --> array_LE21 +array_LE21: li %7, 0 --> array_LE20 +array_LE20: li %8, 0 --> array_LE19 +array_LE19: li %9, 0 --> array_LE18 +array_LE18: li %10, 0 --> array_LE17 +array_LE17: li %11, 0 --> array_LE16 +array_LE16: li %12, 0 --> array_LE15 +array_LE15: li %13, 0 --> array_LE12 +array_LE12: emit c1 --> array_LE11 +array_LE11: li %9, 2 --> array_LE10 +array_LE10: li %11, 4 --> array_LE9 +array_LE9 : mulo %10, %2, %11 --> array_LE8 +array_LE8 : add %13, %0, %10 --> array_LE14 +array_LE14: sw %9, 0(%13) --> array_LE7 +array_LE7 : emit c0 --> array_LE6 +array_LE6 : li %4, 78 --> array_LE5 +array_LE5 : li %8, 1 --> array_LE4 +array_LE4 : add %6, %3, %8 --> array_LE3 +array_LE3 : li %7, 4 --> array_LE2 +array_LE2 : mulo %5, %6, %7 --> array_LE1 +array_LE1 : add %12, %1, %5 --> array_LE13 +array_LE13: sw %4, 0(%12) --> array_LE0 +array_LE0 : return + +function _main() : %0 +stacksize 40 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70, %71, %72, %73, %74, %75, %76, + %77, %78 +entry main179 +main179: li %1, 0 --> main178 +main178: li %2, 0 --> main177 +main177: li %3, 0 --> main176 +main176: li %4, 0 --> main175 +main175: li %5, 0 --> main174 +main174: li %6, 0 --> main173 +main173: li %7, 0 --> main172 +main172: li %8, 0 --> main171 +main171: li %9, 0 --> main170 +main170: li %10, 0 --> main169 +main169: li %11, 0 --> main168 +main168: li %12, 0 --> main167 +main167: li %13, 0 --> main166 +main166: li %14, 0 --> main165 +main165: li %15, 0 --> main164 +main164: li %16, 0 --> main163 +main163: li %17, 0 --> main162 +main162: li %18, 0 --> main161 +main161: li %19, 0 --> main160 +main160: li %20, 0 --> main159 +main159: li %21, 0 --> main158 +main158: li %22, 0 --> main157 +main157: li %23, 0 --> main156 +main156: li %24, 0 --> main155 +main155: li %25, 0 --> main154 +main154: li %26, 0 --> main153 +main153: li %27, 0 --> main152 +main152: li %28, 0 --> main151 +main151: li %29, 0 --> main150 +main150: li %30, 0 --> main149 +main149: li %31, 0 --> main148 +main148: li %32, 0 --> main147 +main147: li %33, 0 --> main146 +main146: li %34, 0 --> main145 +main145: li %35, 0 --> main144 +main144: li %36, 0 --> main143 +main143: li %37, 0 --> main142 +main142: li %38, 0 --> main141 +main141: li %39, 0 --> main140 +main140: li %40, 0 --> main139 +main139: li %41, 0 --> main138 +main138: li %42, 0 --> main137 +main137: li %43, 0 --> main136 +main136: li %44, 0 --> main135 +main135: li %45, 0 --> main134 +main134: li %46, 0 --> main133 +main133: li %47, 0 --> main132 +main132: li %48, 0 --> main131 +main131: li %49, 0 --> main130 +main130: li %50, 0 --> main129 +main129: li %51, 0 --> main128 +main128: li %52, 0 --> main127 +main127: li %53, 0 --> main126 +main126: li %54, 0 --> main125 +main125: li %55, 0 --> main124 +main124: li %56, 0 --> main123 +main123: li %57, 0 --> main122 +main122: li %58, 0 --> main121 +main121: li %59, 0 --> main120 +main120: li %60, 0 --> main119 +main119: li %61, 0 --> main118 +main118: li %62, 0 --> main117 +main117: li %63, 0 --> main116 +main116: li %64, 0 --> main115 +main115: li %65, 0 --> main114 +main114: li %66, 0 --> main113 +main113: li %67, 0 --> main112 +main112: li %68, 0 --> main111 +main111: li %69, 0 --> main110 +main110: li %70, 0 --> main109 +main109: li %71, 0 --> main108 +main108: li %72, 0 --> main107 +main107: li %73, 0 --> main106 +main106: li %74, 0 --> main105 +main105: li %75, 0 --> main104 +main104: li %76, 0 --> main103 +main103: li %77, 0 --> main102 +main102: li %78, 0 --> main88 +main88 : emit c13 --> main87 +main87 : li %61, 0 --> main86 +main86 : addi %62, STACK, 0 --> main85 +main85 : li %64, 0 --> main84 +main84 : li %65, 4 --> main83 +main83 : mulo %63, %64, %65 --> main82 +main82 : add %78, %62, %63 --> main101 +main101: sw %61, 0(%78) --> main81 +main81 : emit c12 --> main80 +main80 : li %56, 0 --> main79 +main79 : addi %57, STACK, 0 --> main78 +main78 : li %59, 1 --> main77 +main77 : li %60, 4 --> main76 +main76 : mulo %58, %59, %60 --> main75 +main75 : add %77, %57, %58 --> main100 +main100: sw %56, 0(%77) --> main74 +main74 : emit c11 --> main73 +main73 : li %51, 0 --> main72 +main72 : addi %52, STACK, 0 --> main71 +main71 : li %54, 2 --> main70 +main70 : li %55, 4 --> main69 +main69 : mulo %53, %54, %55 --> main68 +main68 : add %75, %52, %53 --> main98 +main98 : sw %51, 0(%75) --> main67 +main67 : emit c10 --> main66 +main66 : li %46, 0 --> main65 +main65 : addi %47, STACK, 0 --> main64 +main64 : li %49, 3 --> main63 +main63 : li %50, 4 --> main62 +main62 : mulo %48, %49, %50 --> main61 +main61 : add %74, %47, %48 --> main97 +main97 : sw %46, 0(%74) --> main60 +main60 : emit c9 --> main59 +main59 : li %41, 0 --> main58 +main58 : addi %42, STACK, 0 --> main57 +main57 : li %44, 4 --> main56 +main56 : li %45, 4 --> main55 +main55 : mulo %43, %44, %45 --> main54 +main54 : add %73, %42, %43 --> main96 +main96 : sw %41, 0(%73) --> main53 +main53 : emit c8 --> main52 +main52 : li %36, 0 --> main51 +main51 : addi %37, STACK, 20 --> main50 +main50 : li %39, 0 --> main49 +main49 : li %40, 4 --> main48 +main48 : mulo %38, %39, %40 --> main47 +main47 : add %72, %37, %38 --> main95 +main95 : sw %36, 0(%72) --> main46 +main46 : emit c7 --> main45 +main45 : li %31, 0 --> main44 +main44 : addi %32, STACK, 20 --> main43 +main43 : li %34, 1 --> main42 +main42 : li %35, 4 --> main41 +main41 : mulo %33, %34, %35 --> main40 +main40 : add %71, %32, %33 --> main94 +main94 : sw %31, 0(%71) --> main39 +main39 : emit c6 --> main38 +main38 : li %26, 0 --> main37 +main37 : addi %27, STACK, 20 --> main36 +main36 : li %29, 2 --> main35 +main35 : li %30, 4 --> main34 +main34 : mulo %28, %29, %30 --> main33 +main33 : add %70, %27, %28 --> main93 +main93 : sw %26, 0(%70) --> main32 +main32 : emit c5 --> main31 +main31 : li %21, 0 --> main30 +main30 : addi %22, STACK, 20 --> main29 +main29 : li %24, 3 --> main28 +main28 : li %25, 4 --> main27 +main27 : mulo %23, %24, %25 --> main26 +main26 : add %69, %22, %23 --> main92 +main92 : sw %21, 0(%69) --> main25 +main25 : emit c4 --> main24 +main24 : li %16, 0 --> main23 +main23 : addi %17, STACK, 20 --> main22 +main22 : li %19, 4 --> main21 +main21 : li %20, 4 --> main20 +main20 : mulo %18, %19, %20 --> main19 +main19 : add %67, %17, %18 --> main90 +main90 : sw %16, 0(%67) --> main18 +main18 : emit c3 --> main17 +main17 : addi %11, STACK, 0 --> main16 +main16 : addi %12, STACK, 20 --> main15 +main15 : li %13, 0 --> main14 +main14 : li %14, 0 --> main13 +main13 : la %66, array_LE --> main89 +main89 : call %15, %66(%11, %12, %13, %14) --> main12 +main12 : emit c2 --> main11 +main11 : addi %7, STACK, 0 --> main10 +main10 : li %9, 0 --> main9 +main9 : li %10, 4 --> main8 +main8 : mulo %8, %9, %10 --> main7 +main7 : add %76, %7, %8 --> main99 +main99 : lw %1, 0(%76) --> main6 +main6 : addi %3, STACK, 20 --> main5 +main5 : li %5, 1 --> main4 +main4 : li %6, 4 --> main3 +main3 : mulo %4, %5, %6 --> main2 +main2 : add %68, %3, %4 --> main91 +main91 : lw %2, 0(%68) --> main1 +main1 : add %0, %1, %2 --> main0 +main0 : return %0 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_LE.RTLabs.expected b/tests/clight/testTB_Array_LE.RTLabs.expected new file mode 100644 index 0000000..6e09cd5 --- /dev/null +++ b/tests/clight/testTB_Array_LE.RTLabs.expected @@ -0,0 +1,521 @@ +program: (main function is "main") + + + globals: + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "array_LE"(%0, %1, %2, %3): int -> int -> int -> int -> void + locals: %4, %5, %6, %7, %8, %9, %10, %11 + stacksize: 0 + entry: array_LE12 + exit: array_LE0 + + array_LE9: mul %10, %2, %11 --> array_LE8 + array_LE8: store int32, add, %0, %10, %9 --> array_LE7 + array_LE7: emit c0 --> array_LE6 + array_LE6: imm_int 78, %4, --> array_LE5 + array_LE5: imm_int 1, %8, --> array_LE4 + array_LE4: add %6, %3, %8 --> array_LE3 + array_LE3: imm_int 4, %7, --> array_LE2 + array_LE2: mul %5, %6, %7 --> array_LE1 + array_LE12: emit c1 --> array_LE11 + array_LE11: imm_int 2, %9, --> array_LE10 + array_LE10: imm_int 4, %11, --> array_LE9 + array_LE1: store int32, add, %1, %5, %4 --> array_LE0 + array_LE0: return + + + "main"(): int + locals: %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65 + result: %0 + stacksize: 40 + entry: main88 + exit: main0 + + main9: imm_int 4, %10, --> main8 + main88: emit c13 --> main87 + main87: imm_int 0, %61, --> main86 + main86: imm_addr 0($sp), %62, --> main85 + main85: imm_int 0, %64, --> main84 + main84: imm_int 4, %65, --> main83 + main83: mul %63, %64, %65 --> main82 + main82: store int32, add, %62, %63, %61 --> main81 + main81: emit c12 --> main80 + main80: imm_int 0, %56, --> main79 + main8: mul %8, %9, %10 --> main7 + main79: imm_addr 0($sp), %57, --> main78 + main78: imm_int 1, %59, --> main77 + main77: imm_int 4, %60, --> main76 + main76: mul %58, %59, %60 --> main75 + main75: store int32, add, %57, %58, %56 --> main74 + main74: emit c11 --> main73 + main73: imm_int 0, %51, --> main72 + main72: imm_addr 0($sp), %52, --> main71 + main71: imm_int 2, %54, --> main70 + main70: imm_int 4, %55, --> main69 + main7: load int32, add, %7, %8, %1 --> main6 + main69: mul %53, %54, %55 --> main68 + main68: store int32, add, %52, %53, %51 --> main67 + main67: emit c10 --> main66 + main66: imm_int 0, %46, --> main65 + main65: imm_addr 0($sp), %47, --> main64 + main64: imm_int 3, %49, --> main63 + main63: imm_int 4, %50, --> main62 + main62: mul %48, %49, %50 --> main61 + main61: store int32, add, %47, %48, %46 --> main60 + main60: emit c9 --> main59 + main6: imm_addr 20($sp), %3, --> main5 + main59: imm_int 0, %41, --> main58 + main58: imm_addr 0($sp), %42, --> main57 + main57: imm_int 4, %44, --> main56 + main56: imm_int 4, %45, --> main55 + main55: mul %43, %44, %45 --> main54 + main54: store int32, add, %42, %43, %41 --> main53 + main53: emit c8 --> main52 + main52: imm_int 0, %36, --> main51 + main51: imm_addr 20($sp), %37, --> main50 + main50: imm_int 0, %39, --> main49 + main5: imm_int 1, %5, --> main4 + main49: imm_int 4, %40, --> main48 + main48: mul %38, %39, %40 --> main47 + main47: store int32, add, %37, %38, %36 --> main46 + main46: emit c7 --> main45 + main45: imm_int 0, %31, --> main44 + main44: imm_addr 20($sp), %32, --> main43 + main43: imm_int 1, %34, --> main42 + main42: imm_int 4, %35, --> main41 + main41: mul %33, %34, %35 --> main40 + main40: store int32, add, %32, %33, %31 --> main39 + main4: imm_int 4, %6, --> main3 + main39: emit c6 --> main38 + main38: imm_int 0, %26, --> main37 + main37: imm_addr 20($sp), %27, --> main36 + main36: imm_int 2, %29, --> main35 + main35: imm_int 4, %30, --> main34 + main34: mul %28, %29, %30 --> main33 + main33: store int32, add, %27, %28, %26 --> main32 + main32: emit c5 --> main31 + main31: imm_int 0, %21, --> main30 + main30: imm_addr 20($sp), %22, --> main29 + main3: mul %4, %5, %6 --> main2 + main29: imm_int 3, %24, --> main28 + main28: imm_int 4, %25, --> main27 + main27: mul %23, %24, %25 --> main26 + main26: store int32, add, %22, %23, %21 --> main25 + main25: emit c4 --> main24 + main24: imm_int 0, %16, --> main23 + main23: imm_addr 20($sp), %17, --> main22 + main22: imm_int 4, %19, --> main21 + main21: imm_int 4, %20, --> main20 + main20: mul %18, %19, %20 --> main19 + main2: load int32, add, %3, %4, %2 --> main1 + main19: store int32, add, %17, %18, %16 --> main18 + main18: emit c3 --> main17 + main17: imm_addr 0($sp), %11, --> main16 + main16: imm_addr 20($sp), %12, --> main15 + main15: imm_int 0, %13, --> main14 + main14: imm_int 0, %14, --> main13 + main13: call "array_LE", %11, %12, %13, %14, %15: int -> int -> int -> int -> void --> main12 + main12: emit c2 --> main11 + main11: imm_addr 0($sp), %7, --> main10 + main10: imm_int 0, %9, --> main9 + main1: add %0, %1, %2 --> main0 + main0: return %0 + + diff --git a/tests/clight/testTB_Array_LE.c b/tests/clight/testTB_Array_LE.c new file mode 100644 index 0000000..d3dacca --- /dev/null +++ b/tests/clight/testTB_Array_LE.c @@ -0,0 +1,10 @@ +void array_LE (int tabLE[], int tabLE2[], int i, int j) { + tabLE[i] = 2; + tabLE2[j+1] = 78; +} +int main(){ + int t1[5] = {0,0,0,0,0}; + int t2[5] = {0,0,0,0,0}; + array_LE(t1,t2,0,0); + return t1[0]+t2[1]; +} diff --git a/tests/clight/testTB_Array_LE.c.expected b/tests/clight/testTB_Array_LE.c.expected new file mode 100644 index 0000000..d3dacca --- /dev/null +++ b/tests/clight/testTB_Array_LE.c.expected @@ -0,0 +1,10 @@ +void array_LE (int tabLE[], int tabLE2[], int i, int j) { + tabLE[i] = 2; + tabLE2[j+1] = 78; +} +int main(){ + int t1[5] = {0,0,0,0,0}; + int t2[5] = {0,0,0,0,0}; + array_LE(t1,t2,0,0); + return t1[0]+t2[1]; +} diff --git a/tests/clight/testTB_Array_LE.log.expected b/tests/clight/testTB_Array_LE.log.expected new file mode 100644 index 0000000..ba50dc8 --- /dev/null +++ b/tests/clight/testTB_Array_LE.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Constant not supported. diff --git a/tests/clight/testTB_Array_double.ASM.expected b/tests/clight/testTB_Array_double.ASM.expected new file mode 100644 index 0000000..0970ee3 --- /dev/null +++ b/tests/clight/testTB_Array_double.ASM.expected @@ -0,0 +1,405 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 20 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main120 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin array_double +array_double49: +c2: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a1, $v0 +lw $a2, 0($v0) +c1: +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a1, $v0 +lw $v0, 0($v0) +add $a1, $v0, $a2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c0: +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +jr $ra +# end array_double + + +# begin _main +main120: +addi $sp, $sp, -24 +sw $ra, 20($sp) +li $a0, 13 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 21 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 34 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 55 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 89 +move $v0, $gp +sw $a0, 16($v0) +c9: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c8: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c7: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c5: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c4: +move $a0, $sp +move $a1, $gp +li $a2, 0 +li $a3, 0 +la $v0, array_double49 +jalr $v0 +c3: +lw $ra, 20($sp) +addi $sp, $sp, 24 +jr $ra +# end _main diff --git a/tests/clight/testTB_Array_double.Clight.expected b/tests/clight/testTB_Array_double.Clight.expected new file mode 100644 index 0000000..cbec71b --- /dev/null +++ b/tests/clight/testTB_Array_double.Clight.expected @@ -0,0 +1,298 @@ +int t2[5] = { 13, 21, 34, 55, 89, }; + +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int array_double(int *tableau1, int *tableau2, int i, int j) +{ + int a; + c2: + a = tableau2[i]; + c1: + tableau1[j] = tableau2[j] + a; + c0: + return tableau1[j]; +} + +int main(void) +{ + int t1[5]; + int t; + c9: + t1[0] = 0; + c8: + t1[1] = 0; + c7: + t1[2] = 0; + c6: + t1[3] = 0; + c5: + t1[4] = 0; + c4: + t = array_double(t1, t2, 0, 0); + c3: + return t; +} + + diff --git a/tests/clight/testTB_Array_double.Cminor.expected b/tests/clight/testTB_Array_double.Cminor.expected new file mode 100644 index 0000000..7a2d40e --- /dev/null +++ b/tests/clight/testTB_Array_double.Cminor.expected @@ -0,0 +1,440 @@ + +var "t2" {13, 21, 34, 55, 89} + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"array_double" (tableau1, tableau2, i, j) : int -> int -> int -> int -> int { + + stack 0; + + var a; + + c2: + a = int32[tableau2 + (i * 4)]; + c1: + int32[tableau1 + (j * 4)] = int32[tableau2 + (j * 4)] + a; + c0: + return int32[tableau1 + (j * 4)]; + +} + + +"main" () : int { + + stack 20; + + var t; + + c9: + int32[&0 + (0 * 4)] = 0; + c8: + int32[&0 + (1 * 4)] = 0; + c7: + int32[&0 + (2 * 4)] = 0; + c6: + int32[&0 + (3 * 4)] = 0; + c5: + int32[&0 + (4 * 4)] = 0; + c4: + t = "array_double"(&0, "t2", 0, 0) : int -> int -> int -> int -> int; + c3: + return t; + +} + + diff --git a/tests/clight/testTB_Array_double.ERTL.expected b/tests/clight/testTB_Array_double.ERTL.expected new file mode 100644 index 0000000..b9d02a7 --- /dev/null +++ b/tests/clight/testTB_Array_double.ERTL.expected @@ -0,0 +1,634 @@ +program + +globals 20 + +procedure array_double(4) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28 +entry array_double49 +array_double49: newframe --> array_double48 +array_double48: move %28, $ra --> array_double47 +array_double47: move %27, $s7 --> array_double46 +array_double46: move %26, $s6 --> array_double45 +array_double45: move %25, $s5 --> array_double44 +array_double44: move %24, $s4 --> array_double43 +array_double43: move %23, $s3 --> array_double42 +array_double42: move %22, $s2 --> array_double41 +array_double41: move %21, $s1 --> array_double40 +array_double40: move %20, $s0 --> array_double39 +array_double39: move %0, $a0 --> array_double38 +array_double38: move %1, $a1 --> array_double37 +array_double37: move %2, $a2 --> array_double36 +array_double36: move %3, $a3 --> array_double35 +array_double35: li %4, 0 --> array_double34 +array_double34: li %6, 0 --> array_double33 +array_double33: li %7, 0 --> array_double32 +array_double32: li %8, 0 --> array_double31 +array_double31: li %9, 0 --> array_double30 +array_double30: li %10, 0 --> array_double29 +array_double29: li %11, 0 --> array_double28 +array_double28: li %12, 0 --> array_double27 +array_double27: li %13, 0 --> array_double26 +array_double26: li %14, 0 --> array_double25 +array_double25: li %15, 0 --> array_double24 +array_double24: li %16, 0 --> array_double23 +array_double23: li %17, 0 --> array_double22 +array_double22: li %18, 0 --> array_double21 +array_double21: li %19, 0 --> array_double16 +array_double16: emit c2 --> array_double15 +array_double15: li %15, 4 --> array_double14 +array_double14: mulo %14, %2, %15 --> array_double13 +array_double13: add %17, %1, %14 --> array_double18 +array_double18: lw %4, 0(%17) --> array_double12 +array_double12: emit c1 --> array_double11 +array_double11: li %13, 4 --> array_double10 +array_double10: mulo %12, %3, %13 --> array_double9 +array_double9 : add %19, %1, %12 --> array_double20 +array_double20: lw %11, 0(%19) --> array_double8 +array_double8 : add %8, %11, %4 --> array_double7 +array_double7 : li %10, 4 --> array_double6 +array_double6 : mulo %9, %3, %10 --> array_double5 +array_double5 : add %18, %0, %9 --> array_double19 +array_double19: sw %8, 0(%18) --> array_double4 +array_double4 : emit c0 --> array_double3 +array_double3 : li %7, 4 --> array_double2 +array_double2 : mulo %6, %3, %7 --> array_double1 +array_double1 : add %16, %0, %6 --> array_double17 +array_double17: lw %5, 0(%16) --> array_double0 +array_double0 : j --> array_double61 +array_double61: move $v0, %5 --> array_double60 +array_double60: move $ra, %28 --> array_double59 +array_double59: move $s7, %27 --> array_double58 +array_double58: move $s6, %26 --> array_double57 +array_double57: move $s5, %25 --> array_double56 +array_double56: move $s4, %24 --> array_double55 +array_double55: move $s3, %23 --> array_double54 +array_double54: move $s2, %22 --> array_double53 +array_double53: move $s1, %21 --> array_double52 +array_double52: move $s0, %20 --> array_double51 +array_double51: delframe --> array_double50 +array_double50: jr $ra (xmits $v0) + +procedure _main(0) +stacksize 20 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55 +entry main120 +main120: newframe --> main119 +main119: move %55, $ra --> main118 +main118: move %54, $s7 --> main117 +main117: move %53, $s6 --> main116 +main116: move %52, $s5 --> main115 +main115: move %51, $s4 --> main114 +main114: move %50, $s3 --> main113 +main113: move %49, $s2 --> main112 +main112: move %48, $s1 --> main111 +main111: move %47, $s0 --> main110 +main110: li %0, 0 --> main109 +main109: li %2, 0 --> main108 +main108: li %3, 0 --> main107 +main107: li %4, 0 --> main106 +main106: li %5, 0 --> main105 +main105: li %6, 0 --> main104 +main104: li %7, 0 --> main103 +main103: li %8, 0 --> main102 +main102: li %9, 0 --> main101 +main101: li %10, 0 --> main100 +main100: li %11, 0 --> main99 +main99 : li %12, 0 --> main98 +main98 : li %13, 0 --> main97 +main97 : li %14, 0 --> main96 +main96 : li %15, 0 --> main95 +main95 : li %16, 0 --> main94 +main94 : li %17, 0 --> main93 +main93 : li %18, 0 --> main92 +main92 : li %19, 0 --> main91 +main91 : li %20, 0 --> main90 +main90 : li %21, 0 --> main89 +main89 : li %22, 0 --> main88 +main88 : li %23, 0 --> main87 +main87 : li %24, 0 --> main86 +main86 : li %25, 0 --> main85 +main85 : li %26, 0 --> main84 +main84 : li %27, 0 --> main83 +main83 : li %28, 0 --> main82 +main82 : li %29, 0 --> main81 +main81 : li %30, 0 --> main80 +main80 : li %31, 0 --> main79 +main79 : li %32, 0 --> main78 +main78 : li %33, 0 --> main77 +main77 : li %34, 0 --> main76 +main76 : li %35, 0 --> main75 +main75 : li %36, 0 --> main74 +main74 : li %37, 0 --> main73 +main73 : li %38, 0 --> main72 +main72 : li %39, 0 --> main71 +main71 : li %40, 0 --> main70 +main70 : li %41, 0 --> main69 +main69 : li %42, 0 --> main68 +main68 : li %43, 0 --> main67 +main67 : li %44, 0 --> main66 +main66 : li %45, 0 --> main65 +main65 : li %46, 0 --> main53 +main53 : li %35, 13 --> main52 +main52 : move %45, $gp --> main142 +main142: move %45, %45 --> main63 +main63 : sw %35, 0(%45) --> main51 +main51 : li %34, 21 --> main50 +main50 : move %44, $gp --> main141 +main141: move %44, %44 --> main62 +main62 : sw %34, 4(%44) --> main49 +main49 : li %33, 34 --> main48 +main48 : move %43, $gp --> main140 +main140: move %43, %43 --> main61 +main61 : sw %33, 8(%43) --> main47 +main47 : li %32, 55 --> main46 +main46 : move %42, $gp --> main139 +main139: move %42, %42 --> main60 +main60 : sw %32, 12(%42) --> main45 +main45 : li %31, 89 --> main44 +main44 : move %41, $gp --> main138 +main138: move %41, %41 --> main59 +main59 : sw %31, 16(%41) --> main43 +main43 : emit c9 --> main42 +main42 : li %26, 0 --> main41 +main41 : move %27, $sp --> main137 +main137: move %27, %27 --> main40 +main40 : li %29, 0 --> main39 +main39 : li %30, 4 --> main38 +main38 : mulo %28, %29, %30 --> main37 +main37 : add %40, %27, %28 --> main58 +main58 : sw %26, 0(%40) --> main36 +main36 : emit c8 --> main35 +main35 : li %21, 0 --> main34 +main34 : move %22, $sp --> main136 +main136: move %22, %22 --> main33 +main33 : li %24, 1 --> main32 +main32 : li %25, 4 --> main31 +main31 : mulo %23, %24, %25 --> main30 +main30 : add %39, %22, %23 --> main57 +main57 : sw %21, 0(%39) --> main29 +main29 : emit c7 --> main28 +main28 : li %16, 0 --> main27 +main27 : move %17, $sp --> main135 +main135: move %17, %17 --> main26 +main26 : li %19, 2 --> main25 +main25 : li %20, 4 --> main24 +main24 : mulo %18, %19, %20 --> main23 +main23 : add %37, %17, %18 --> main55 +main55 : sw %16, 0(%37) --> main22 +main22 : emit c6 --> main21 +main21 : li %11, 0 --> main20 +main20 : move %12, $sp --> main134 +main134: move %12, %12 --> main19 +main19 : li %14, 3 --> main18 +main18 : li %15, 4 --> main17 +main17 : mulo %13, %14, %15 --> main16 +main16 : add %36, %12, %13 --> main54 +main54 : sw %11, 0(%36) --> main15 +main15 : emit c5 --> main14 +main14 : li %6, 0 --> main13 +main13 : move %7, $sp --> main133 +main133: move %7, %7 --> main12 +main12 : li %9, 4 --> main11 +main11 : li %10, 4 --> main10 +main10 : mulo %8, %9, %10 --> main9 +main9 : add %46, %7, %8 --> main64 +main64 : sw %6, 0(%46) --> main8 +main8 : emit c4 --> main7 +main7 : move %2, $sp --> main150 +main150: move %2, %2 --> main6 +main6 : move %3, $gp --> main149 +main149: move %3, %3 --> main5 +main5 : li %4, 0 --> main4 +main4 : li %5, 0 --> main3 +main3 : la %38, array_double --> main56 +main56 : j --> main148 +main148: move $a0, %2 --> main147 +main147: move $a1, %3 --> main146 +main146: move $a2, %4 --> main145 +main145: move $a3, %5 --> main144 +main144: call %38(4) --> main143 +main143: move %0, $v0 --> main2 +main2 : emit c3 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main132 +main132: move $v0, %1 --> main131 +main131: move $ra, %55 --> main130 +main130: move $s7, %54 --> main129 +main129: move $s6, %53 --> main128 +main128: move $s5, %52 --> main127 +main127: move $s4, %51 --> main126 +main126: move $s3, %50 --> main125 +main125: move $s2, %49 --> main124 +main124: move $s1, %48 --> main123 +main123: move $s0, %47 --> main122 +main122: delframe --> main121 +main121: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_double.LIN.expected b/tests/clight/testTB_Array_double.LIN.expected new file mode 100644 index 0000000..8d912b8 --- /dev/null +++ b/tests/clight/testTB_Array_double.LIN.expected @@ -0,0 +1,494 @@ +program + +globals 20 + +procedure array_double(4) +var 0 +array_double49: +newframe +c2: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a1, $v0 +lw $a2, 0($v0) +c1: +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a1, $v0 +lw $v0, 0($v0) +add $a1, $v0, $a2 +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c0: +li $v0, 4 +mulo $v0, $a3, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +delframe +jr $ra + +procedure _main(0) +var 24 +main120: +newframe +sw $ra, 20($sp) +li $a0, 13 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 21 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 34 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 55 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 89 +move $v0, $gp +sw $a0, 16($v0) +c9: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c8: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c7: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c5: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c4: +move $a0, $sp +move $a1, $gp +li $a2, 0 +li $a3, 0 +la $v0, array_double +call $v0 +c3: +lw $ra, 20($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_double.LTL.expected b/tests/clight/testTB_Array_double.LTL.expected new file mode 100644 index 0000000..dec17a3 --- /dev/null +++ b/tests/clight/testTB_Array_double.LTL.expected @@ -0,0 +1,621 @@ +program + +globals 20 + +procedure array_double(4) +var 0 +entry array_double49 +array_double49: newframe --> array_double48 +array_double48: j --> array_double47 +array_double47: j --> array_double46 +array_double46: j --> array_double45 +array_double45: j --> array_double44 +array_double44: j --> array_double43 +array_double43: j --> array_double42 +array_double42: j --> array_double41 +array_double41: j --> array_double40 +array_double40: j --> array_double39 +array_double39: j --> array_double38 +array_double38: j --> array_double37 +array_double37: j --> array_double36 +array_double36: j --> array_double35 +array_double35: j --> array_double34 +array_double34: j --> array_double33 +array_double33: j --> array_double32 +array_double32: j --> array_double31 +array_double31: j --> array_double30 +array_double30: j --> array_double29 +array_double29: j --> array_double28 +array_double28: j --> array_double27 +array_double27: j --> array_double26 +array_double26: j --> array_double25 +array_double25: j --> array_double24 +array_double24: j --> array_double23 +array_double23: j --> array_double22 +array_double22: j --> array_double21 +array_double21: j --> array_double16 +array_double16: emit c2 --> array_double15 +array_double15: li $v0, 4 --> array_double14 +array_double14: mulo $v0, $a2, $v0 --> array_double13 +array_double13: add $v0, $a1, $v0 --> array_double18 +array_double18: lw $a2, 0($v0) --> array_double12 +array_double12: emit c1 --> array_double11 +array_double11: li $v0, 4 --> array_double10 +array_double10: mulo $v0, $a3, $v0 --> array_double9 +array_double9 : add $v0, $a1, $v0 --> array_double20 +array_double20: lw $v0, 0($v0) --> array_double8 +array_double8 : add $a1, $v0, $a2 --> array_double7 +array_double7 : li $v0, 4 --> array_double6 +array_double6 : mulo $v0, $a3, $v0 --> array_double5 +array_double5 : add $v0, $a0, $v0 --> array_double19 +array_double19: lw $a1, 0($v0) --> array_double4 +array_double4 : emit c0 --> array_double3 +array_double3 : li $v0, 4 --> array_double2 +array_double2 : mulo $v0, $a3, $v0 --> array_double1 +array_double1 : add $v0, $a0, $v0 --> array_double17 +array_double17: lw $v0, 0($v0) --> array_double0 +array_double0 : j --> array_double61 +array_double61: j --> array_double60 +array_double60: j --> array_double59 +array_double59: j --> array_double58 +array_double58: j --> array_double57 +array_double57: j --> array_double56 +array_double56: j --> array_double55 +array_double55: j --> array_double54 +array_double54: j --> array_double53 +array_double53: j --> array_double52 +array_double52: j --> array_double51 +array_double51: delframe --> array_double50 +array_double50: jr $ra + +procedure _main(0) +var 24 +entry main120 +main120: newframe --> main119 +main119: lw $ra, 20($sp) --> main118 +main118: j --> main117 +main117: j --> main116 +main116: j --> main115 +main115: j --> main114 +main114: j --> main113 +main113: j --> main112 +main112: j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: j --> main108 +main108: j --> main107 +main107: j --> main106 +main106: j --> main105 +main105: j --> main104 +main104: j --> main103 +main103: j --> main102 +main102: j --> main101 +main101: j --> main100 +main100: j --> main99 +main99 : j --> main98 +main98 : j --> main97 +main97 : j --> main96 +main96 : j --> main95 +main95 : j --> main94 +main94 : j --> main93 +main93 : j --> main92 +main92 : j --> main91 +main91 : j --> main90 +main90 : j --> main89 +main89 : j --> main88 +main88 : j --> main87 +main87 : j --> main86 +main86 : j --> main85 +main85 : j --> main84 +main84 : j --> main83 +main83 : j --> main82 +main82 : j --> main81 +main81 : j --> main80 +main80 : j --> main79 +main79 : j --> main78 +main78 : j --> main77 +main77 : j --> main76 +main76 : j --> main75 +main75 : j --> main74 +main74 : j --> main73 +main73 : j --> main72 +main72 : j --> main71 +main71 : j --> main70 +main70 : j --> main69 +main69 : j --> main68 +main68 : j --> main67 +main67 : j --> main66 +main66 : j --> main65 +main65 : j --> main53 +main53 : li $a0, 13 --> main52 +main52 : move $v0, $gp --> main142 +main142: j --> main63 +main63 : lw $a0, 0($v0) --> main51 +main51 : li $a0, 21 --> main50 +main50 : move $v0, $gp --> main141 +main141: j --> main62 +main62 : lw $a0, 4($v0) --> main49 +main49 : li $a0, 34 --> main48 +main48 : move $v0, $gp --> main140 +main140: j --> main61 +main61 : lw $a0, 8($v0) --> main47 +main47 : li $a0, 55 --> main46 +main46 : move $v0, $gp --> main139 +main139: j --> main60 +main60 : lw $a0, 12($v0) --> main45 +main45 : li $a0, 89 --> main44 +main44 : move $v0, $gp --> main138 +main138: j --> main59 +main59 : lw $a0, 16($v0) --> main43 +main43 : emit c9 --> main42 +main42 : li $a1, 0 --> main41 +main41 : move $a0, $sp --> main137 +main137: j --> main40 +main40 : j --> main39 +main39 : li $v0, 4 --> main38 +main38 : mulo $v0, $zero, $v0 --> main37 +main37 : add $v0, $a0, $v0 --> main58 +main58 : lw $a1, 0($v0) --> main36 +main36 : emit c8 --> main35 +main35 : j --> main34 +main34 : move $a1, $sp --> main136 +main136: j --> main33 +main33 : li $a0, 1 --> main32 +main32 : li $v0, 4 --> main31 +main31 : mulo $v0, $a0, $v0 --> main30 +main30 : add $v0, $a1, $v0 --> main57 +main57 : lw $zero, 0($v0) --> main29 +main29 : emit c7 --> main28 +main28 : j --> main27 +main27 : move $a1, $sp --> main135 +main135: j --> main26 +main26 : li $a0, 2 --> main25 +main25 : li $v0, 4 --> main24 +main24 : mulo $v0, $a0, $v0 --> main23 +main23 : add $v0, $a1, $v0 --> main55 +main55 : lw $zero, 0($v0) --> main22 +main22 : emit c6 --> main21 +main21 : j --> main20 +main20 : move $a1, $sp --> main134 +main134: j --> main19 +main19 : li $a0, 3 --> main18 +main18 : li $v0, 4 --> main17 +main17 : mulo $v0, $a0, $v0 --> main16 +main16 : add $v0, $a1, $v0 --> main54 +main54 : lw $zero, 0($v0) --> main15 +main15 : emit c5 --> main14 +main14 : j --> main13 +main13 : move $a1, $sp --> main133 +main133: j --> main12 +main12 : li $a0, 4 --> main11 +main11 : li $v0, 4 --> main10 +main10 : mulo $v0, $a0, $v0 --> main9 +main9 : add $v0, $a1, $v0 --> main64 +main64 : lw $zero, 0($v0) --> main8 +main8 : emit c4 --> main7 +main7 : move $a0, $sp --> main150 +main150: j --> main6 +main6 : move $a1, $gp --> main149 +main149: j --> main5 +main5 : li $a2, 0 --> main4 +main4 : li $a3, 0 --> main3 +main3 : la $v0, array_double --> main56 +main56 : j --> main148 +main148: j --> main147 +main147: j --> main146 +main146: j --> main145 +main145: j --> main144 +main144: call $v0 --> main143 +main143: j --> main2 +main2 : emit c3 --> main1 +main1 : j --> main0 +main0 : j --> main132 +main132: j --> main131 +main131: lw $ra, 20($sp) --> main130 +main130: j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: j --> main126 +main126: j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: j --> main122 +main122: delframe --> main121 +main121: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_double.RTL.expected b/tests/clight/testTB_Array_double.RTL.expected new file mode 100644 index 0000000..fb95f4a --- /dev/null +++ b/tests/clight/testTB_Array_double.RTL.expected @@ -0,0 +1,565 @@ +program + +globals 20 + +function array_double(%0; %1; %2; %3) : %5 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19 +entry array_double35 +array_double35: li %4, 0 --> array_double34 +array_double34: li %6, 0 --> array_double33 +array_double33: li %7, 0 --> array_double32 +array_double32: li %8, 0 --> array_double31 +array_double31: li %9, 0 --> array_double30 +array_double30: li %10, 0 --> array_double29 +array_double29: li %11, 0 --> array_double28 +array_double28: li %12, 0 --> array_double27 +array_double27: li %13, 0 --> array_double26 +array_double26: li %14, 0 --> array_double25 +array_double25: li %15, 0 --> array_double24 +array_double24: li %16, 0 --> array_double23 +array_double23: li %17, 0 --> array_double22 +array_double22: li %18, 0 --> array_double21 +array_double21: li %19, 0 --> array_double16 +array_double16: emit c2 --> array_double15 +array_double15: li %15, 4 --> array_double14 +array_double14: mulo %14, %2, %15 --> array_double13 +array_double13: add %17, %1, %14 --> array_double18 +array_double18: lw %4, 0(%17) --> array_double12 +array_double12: emit c1 --> array_double11 +array_double11: li %13, 4 --> array_double10 +array_double10: mulo %12, %3, %13 --> array_double9 +array_double9 : add %19, %1, %12 --> array_double20 +array_double20: lw %11, 0(%19) --> array_double8 +array_double8 : add %8, %11, %4 --> array_double7 +array_double7 : li %10, 4 --> array_double6 +array_double6 : mulo %9, %3, %10 --> array_double5 +array_double5 : add %18, %0, %9 --> array_double19 +array_double19: sw %8, 0(%18) --> array_double4 +array_double4 : emit c0 --> array_double3 +array_double3 : li %7, 4 --> array_double2 +array_double2 : mulo %6, %3, %7 --> array_double1 +array_double1 : add %16, %0, %6 --> array_double17 +array_double17: lw %5, 0(%16) --> array_double0 +array_double0 : return %5 + +function _main() : %1 +stacksize 20 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46 +entry main110 +main110: li %0, 0 --> main109 +main109: li %2, 0 --> main108 +main108: li %3, 0 --> main107 +main107: li %4, 0 --> main106 +main106: li %5, 0 --> main105 +main105: li %6, 0 --> main104 +main104: li %7, 0 --> main103 +main103: li %8, 0 --> main102 +main102: li %9, 0 --> main101 +main101: li %10, 0 --> main100 +main100: li %11, 0 --> main99 +main99 : li %12, 0 --> main98 +main98 : li %13, 0 --> main97 +main97 : li %14, 0 --> main96 +main96 : li %15, 0 --> main95 +main95 : li %16, 0 --> main94 +main94 : li %17, 0 --> main93 +main93 : li %18, 0 --> main92 +main92 : li %19, 0 --> main91 +main91 : li %20, 0 --> main90 +main90 : li %21, 0 --> main89 +main89 : li %22, 0 --> main88 +main88 : li %23, 0 --> main87 +main87 : li %24, 0 --> main86 +main86 : li %25, 0 --> main85 +main85 : li %26, 0 --> main84 +main84 : li %27, 0 --> main83 +main83 : li %28, 0 --> main82 +main82 : li %29, 0 --> main81 +main81 : li %30, 0 --> main80 +main80 : li %31, 0 --> main79 +main79 : li %32, 0 --> main78 +main78 : li %33, 0 --> main77 +main77 : li %34, 0 --> main76 +main76 : li %35, 0 --> main75 +main75 : li %36, 0 --> main74 +main74 : li %37, 0 --> main73 +main73 : li %38, 0 --> main72 +main72 : li %39, 0 --> main71 +main71 : li %40, 0 --> main70 +main70 : li %41, 0 --> main69 +main69 : li %42, 0 --> main68 +main68 : li %43, 0 --> main67 +main67 : li %44, 0 --> main66 +main66 : li %45, 0 --> main65 +main65 : li %46, 0 --> main53 +main53 : li %35, 13 --> main52 +main52 : addi %45, GLOBALS, 0 --> main63 +main63 : sw %35, 0(%45) --> main51 +main51 : li %34, 21 --> main50 +main50 : addi %44, GLOBALS, 0 --> main62 +main62 : sw %34, 4(%44) --> main49 +main49 : li %33, 34 --> main48 +main48 : addi %43, GLOBALS, 0 --> main61 +main61 : sw %33, 8(%43) --> main47 +main47 : li %32, 55 --> main46 +main46 : addi %42, GLOBALS, 0 --> main60 +main60 : sw %32, 12(%42) --> main45 +main45 : li %31, 89 --> main44 +main44 : addi %41, GLOBALS, 0 --> main59 +main59 : sw %31, 16(%41) --> main43 +main43 : emit c9 --> main42 +main42 : li %26, 0 --> main41 +main41 : addi %27, STACK, 0 --> main40 +main40 : li %29, 0 --> main39 +main39 : li %30, 4 --> main38 +main38 : mulo %28, %29, %30 --> main37 +main37 : add %40, %27, %28 --> main58 +main58 : sw %26, 0(%40) --> main36 +main36 : emit c8 --> main35 +main35 : li %21, 0 --> main34 +main34 : addi %22, STACK, 0 --> main33 +main33 : li %24, 1 --> main32 +main32 : li %25, 4 --> main31 +main31 : mulo %23, %24, %25 --> main30 +main30 : add %39, %22, %23 --> main57 +main57 : sw %21, 0(%39) --> main29 +main29 : emit c7 --> main28 +main28 : li %16, 0 --> main27 +main27 : addi %17, STACK, 0 --> main26 +main26 : li %19, 2 --> main25 +main25 : li %20, 4 --> main24 +main24 : mulo %18, %19, %20 --> main23 +main23 : add %37, %17, %18 --> main55 +main55 : sw %16, 0(%37) --> main22 +main22 : emit c6 --> main21 +main21 : li %11, 0 --> main20 +main20 : addi %12, STACK, 0 --> main19 +main19 : li %14, 3 --> main18 +main18 : li %15, 4 --> main17 +main17 : mulo %13, %14, %15 --> main16 +main16 : add %36, %12, %13 --> main54 +main54 : sw %11, 0(%36) --> main15 +main15 : emit c5 --> main14 +main14 : li %6, 0 --> main13 +main13 : addi %7, STACK, 0 --> main12 +main12 : li %9, 4 --> main11 +main11 : li %10, 4 --> main10 +main10 : mulo %8, %9, %10 --> main9 +main9 : add %46, %7, %8 --> main64 +main64 : sw %6, 0(%46) --> main8 +main8 : emit c4 --> main7 +main7 : addi %2, STACK, 0 --> main6 +main6 : addi %3, GLOBALS, 0 --> main5 +main5 : li %4, 0 --> main4 +main4 : li %5, 0 --> main3 +main3 : la %38, array_double --> main56 +main56 : call %0, %38(%2, %3, %4, %5) --> main2 +main2 : emit c3 --> main1 +main1 : move %1, %0 --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_double.RTLabs.expected b/tests/clight/testTB_Array_double.RTLabs.expected new file mode 100644 index 0000000..c273a03 --- /dev/null +++ b/tests/clight/testTB_Array_double.RTLabs.expected @@ -0,0 +1,492 @@ +program: (main function is "main") + + + globals: + "t2" = {13, 21, 34, 55, 89} + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "array_double"(%0, %1, %2, %3): int -> int -> int -> int -> int + locals: %5, %4, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15 + result: %5 + stacksize: 0 + entry: array_double16 + exit: array_double0 + + array_double9: load int32, add, %1, %12, %11 --> array_double8 + array_double8: add %8, %11, %4 --> array_double7 + array_double7: imm_int 4, %10, --> array_double6 + array_double6: mul %9, %3, %10 --> array_double5 + array_double5: store int32, add, %0, %9, %8 --> array_double4 + array_double4: emit c0 --> array_double3 + array_double3: imm_int 4, %7, --> array_double2 + array_double2: mul %6, %3, %7 --> array_double1 + array_double16: emit c2 --> array_double15 + array_double15: imm_int 4, %15, --> array_double14 + array_double14: mul %14, %2, %15 --> array_double13 + array_double13: load int32, add, %1, %14, %4 --> array_double12 + array_double12: emit c1 --> array_double11 + array_double11: imm_int 4, %13, --> array_double10 + array_double10: mul %12, %3, %13 --> array_double9 + array_double1: load int32, add, %0, %6, %5 --> array_double0 + array_double0: return %5 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35 + result: %1 + stacksize: 20 + entry: main53 + exit: main0 + + main9: store int32, add, %7, %8, %6 --> main8 + main8: emit c4 --> main7 + main7: imm_addr 0($sp), %2, --> main6 + main6: imm_addr "t2", %3, --> main5 + main53: imm_int 13, %35, --> main52 + main52: store int32, 0("t2"), , %35 --> main51 + main51: imm_int 21, %34, --> main50 + main50: store int32, 4("t2"), , %34 --> main49 + main5: imm_int 0, %4, --> main4 + main49: imm_int 34, %33, --> main48 + main48: store int32, 8("t2"), , %33 --> main47 + main47: imm_int 55, %32, --> main46 + main46: store int32, 12("t2"), , %32 --> main45 + main45: imm_int 89, %31, --> main44 + main44: store int32, 16("t2"), , %31 --> main43 + main43: emit c9 --> main42 + main42: imm_int 0, %26, --> main41 + main41: imm_addr 0($sp), %27, --> main40 + main40: imm_int 0, %29, --> main39 + main4: imm_int 0, %5, --> main3 + main39: imm_int 4, %30, --> main38 + main38: mul %28, %29, %30 --> main37 + main37: store int32, add, %27, %28, %26 --> main36 + main36: emit c8 --> main35 + main35: imm_int 0, %21, --> main34 + main34: imm_addr 0($sp), %22, --> main33 + main33: imm_int 1, %24, --> main32 + main32: imm_int 4, %25, --> main31 + main31: mul %23, %24, %25 --> main30 + main30: store int32, add, %22, %23, %21 --> main29 + main3: call "array_double", %2, %3, %4, %5, %0: int -> int -> int -> int -> int --> main2 + main29: emit c7 --> main28 + main28: imm_int 0, %16, --> main27 + main27: imm_addr 0($sp), %17, --> main26 + main26: imm_int 2, %19, --> main25 + main25: imm_int 4, %20, --> main24 + main24: mul %18, %19, %20 --> main23 + main23: store int32, add, %17, %18, %16 --> main22 + main22: emit c6 --> main21 + main21: imm_int 0, %11, --> main20 + main20: imm_addr 0($sp), %12, --> main19 + main2: emit c3 --> main1 + main19: imm_int 3, %14, --> main18 + main18: imm_int 4, %15, --> main17 + main17: mul %13, %14, %15 --> main16 + main16: store int32, add, %12, %13, %11 --> main15 + main15: emit c5 --> main14 + main14: imm_int 0, %6, --> main13 + main13: imm_addr 0($sp), %7, --> main12 + main12: imm_int 4, %9, --> main11 + main11: imm_int 4, %10, --> main10 + main10: mul %8, %9, %10 --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/testTB_Array_double.c b/tests/clight/testTB_Array_double.c new file mode 100644 index 0000000..94fb026 --- /dev/null +++ b/tests/clight/testTB_Array_double.c @@ -0,0 +1,15 @@ +int t2[5] = {13, 21, 34, 55, 89}; + +int array_double (int tableau1[], int tableau2[], int i, int j) { + int a; + + a = tableau2[i]; + + tableau1[j] = tableau2[j]+a; + + return tableau1[j]; +} +int main(){ + int t1[5] = {0,0,0,0,0}; + return array_double(t1,t2,0,0); +} diff --git a/tests/clight/testTB_Array_double.c.expected b/tests/clight/testTB_Array_double.c.expected new file mode 100644 index 0000000..94fb026 --- /dev/null +++ b/tests/clight/testTB_Array_double.c.expected @@ -0,0 +1,15 @@ +int t2[5] = {13, 21, 34, 55, 89}; + +int array_double (int tableau1[], int tableau2[], int i, int j) { + int a; + + a = tableau2[i]; + + tableau1[j] = tableau2[j]+a; + + return tableau1[j]; +} +int main(){ + int t1[5] = {0,0,0,0,0}; + return array_double(t1,t2,0,0); +} diff --git a/tests/clight/testTB_Array_double.log.expected b/tests/clight/testTB_Array_double.log.expected new file mode 100644 index 0000000..ba50dc8 --- /dev/null +++ b/tests/clight/testTB_Array_double.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Constant not supported. diff --git a/tests/clight/testTB_Array_ecriture.ASM.expected b/tests/clight/testTB_Array_ecriture.ASM.expected new file mode 100644 index 0000000..707be20 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.ASM.expected @@ -0,0 +1,364 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 20 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main56 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin array_ecriture +array_ecriture35: +c2: +li $a3, 1 +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c1: +li $a1, 5 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c0: +li $v0, 0 +jr $ra +# end array_ecriture + + +# begin _main +main56: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $v0, $gp +sw $zero, 0($v0) +move $v0, $gp +sw $zero, 4($v0) +move $v0, $gp +sw $zero, 8($v0) +move $v0, $gp +sw $zero, 12($v0) +move $v0, $gp +sw $zero, 16($v0) +c4: +move $a0, $gp +li $a1, 0 +li $a2, 1 +la $v0, array_ecriture35 +jalr $v0 +c3: +li $a0, 1 +li $v0, 4 +mulo $a0, $a0, $v0 +move $v0, $gp +add $v0, $v0, $a0 +lw $v0, 0($v0) +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end _main diff --git a/tests/clight/testTB_Array_ecriture.Clight.expected b/tests/clight/testTB_Array_ecriture.Clight.expected new file mode 100644 index 0000000..1acc1c4 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.Clight.expected @@ -0,0 +1,286 @@ +int t[5] = { 0, 0, 0, 0, 0, }; + +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int array_ecriture(int *tabecr, int i, int j) +{ + c2: + tabecr[i] = 1; + c1: + tabecr[j] = 5; + c0: + return 0; +} + +int main(void) +{ + int a; + c4: + a = array_ecriture(t, 0, 1); + c3: + return t[1]; +} + + diff --git a/tests/clight/testTB_Array_ecriture.Cminor.expected b/tests/clight/testTB_Array_ecriture.Cminor.expected new file mode 100644 index 0000000..fc34775 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.Cminor.expected @@ -0,0 +1,428 @@ + +var "t" {0, 0, 0, 0, 0} + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"array_ecriture" (tabecr, i, j) : int -> int -> int -> int { + + stack 0; + + c2: + int32[tabecr + (i * 4)] = 1; + c1: + int32[tabecr + (j * 4)] = 5; + c0: + return 0; + +} + + +"main" () : int { + + stack 0; + + var a; + + c4: + a = "array_ecriture"("t", 0, 1) : int -> int -> int -> int; + c3: + return int32["t" + (1 * 4)]; + +} + + diff --git a/tests/clight/testTB_Array_ecriture.ERTL.expected b/tests/clight/testTB_Array_ecriture.ERTL.expected new file mode 100644 index 0000000..36dedf3 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.ERTL.expected @@ -0,0 +1,544 @@ +program + +globals 20 + +procedure array_ecriture(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20 +entry array_ecriture35 +array_ecriture35: newframe --> array_ecriture34 +array_ecriture34: move %20, $ra --> array_ecriture33 +array_ecriture33: move %19, $s7 --> array_ecriture32 +array_ecriture32: move %18, $s6 --> array_ecriture31 +array_ecriture31: move %17, $s5 --> array_ecriture30 +array_ecriture30: move %16, $s4 --> array_ecriture29 +array_ecriture29: move %15, $s3 --> array_ecriture28 +array_ecriture28: move %14, $s2 --> array_ecriture27 +array_ecriture27: move %13, $s1 --> array_ecriture26 +array_ecriture26: move %12, $s0 --> array_ecriture25 +array_ecriture25: move %0, $a0 --> array_ecriture24 +array_ecriture24: move %1, $a1 --> array_ecriture23 +array_ecriture23: move %2, $a2 --> array_ecriture22 +array_ecriture22: li %4, 0 --> array_ecriture21 +array_ecriture21: li %5, 0 --> array_ecriture20 +array_ecriture20: li %6, 0 --> array_ecriture19 +array_ecriture19: li %7, 0 --> array_ecriture18 +array_ecriture18: li %8, 0 --> array_ecriture17 +array_ecriture17: li %9, 0 --> array_ecriture16 +array_ecriture16: li %10, 0 --> array_ecriture15 +array_ecriture15: li %11, 0 --> array_ecriture12 +array_ecriture12: emit c2 --> array_ecriture11 +array_ecriture11: li %7, 1 --> array_ecriture10 +array_ecriture10: li %9, 4 --> array_ecriture9 +array_ecriture9 : mulo %8, %1, %9 --> array_ecriture8 +array_ecriture8 : add %11, %0, %8 --> array_ecriture14 +array_ecriture14: sw %7, 0(%11) --> array_ecriture7 +array_ecriture7 : emit c1 --> array_ecriture6 +array_ecriture6 : li %4, 5 --> array_ecriture5 +array_ecriture5 : li %6, 4 --> array_ecriture4 +array_ecriture4 : mulo %5, %2, %6 --> array_ecriture3 +array_ecriture3 : add %10, %0, %5 --> array_ecriture13 +array_ecriture13: sw %4, 0(%10) --> array_ecriture2 +array_ecriture2 : emit c0 --> array_ecriture1 +array_ecriture1 : li %3, 0 --> array_ecriture0 +array_ecriture0 : j --> array_ecriture47 +array_ecriture47: move $v0, %3 --> array_ecriture46 +array_ecriture46: move $ra, %20 --> array_ecriture45 +array_ecriture45: move $s7, %19 --> array_ecriture44 +array_ecriture44: move $s6, %18 --> array_ecriture43 +array_ecriture43: move $s5, %17 --> array_ecriture42 +array_ecriture42: move $s4, %16 --> array_ecriture41 +array_ecriture41: move $s3, %15 --> array_ecriture40 +array_ecriture40: move $s2, %14 --> array_ecriture39 +array_ecriture39: move $s1, %13 --> array_ecriture38 +array_ecriture38: move $s0, %12 --> array_ecriture37 +array_ecriture37: delframe --> array_ecriture36 +array_ecriture36: jr $ra (xmits $v0) + +procedure _main(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27 +entry main56 +main56: newframe --> main55 +main55: move %27, $ra --> main54 +main54: move %26, $s7 --> main53 +main53: move %25, $s6 --> main52 +main52: move %24, $s5 --> main51 +main51: move %23, $s4 --> main50 +main50: move %22, $s3 --> main49 +main49: move %21, $s2 --> main48 +main48: move %20, $s1 --> main47 +main47: move %19, $s0 --> main46 +main46: li %0, 0 --> main45 +main45: li %2, 0 --> main44 +main44: li %3, 0 --> main43 +main43: li %4, 0 --> main42 +main42: li %5, 0 --> main41 +main41: li %6, 0 --> main40 +main40: li %7, 0 --> main39 +main39: li %8, 0 --> main38 +main38: li %9, 0 --> main37 +main37: li %10, 0 --> main36 +main36: li %11, 0 --> main35 +main35: li %12, 0 --> main34 +main34: li %13, 0 --> main33 +main33: li %14, 0 --> main32 +main32: li %15, 0 --> main31 +main31: li %16, 0 --> main30 +main30: li %17, 0 --> main29 +main29: li %18, 0 --> main20 +main20: li %12, 0 --> main19 +main19: move %17, $gp --> main74 +main74: move %17, %17 --> main27 +main27: sw %12, 0(%17) --> main18 +main18: li %11, 0 --> main17 +main17: move %16, $gp --> main73 +main73: move %16, %16 --> main26 +main26: sw %11, 4(%16) --> main16 +main16: li %10, 0 --> main15 +main15: move %15, $gp --> main72 +main72: move %15, %15 --> main25 +main25: sw %10, 8(%15) --> main14 +main14: li %9, 0 --> main13 +main13: move %14, $gp --> main71 +main71: move %14, %14 --> main24 +main24: sw %9, 12(%14) --> main12 +main12: li %8, 0 --> main11 +main11: move %13, $gp --> main70 +main70: move %13, %13 --> main23 +main23: sw %8, 16(%13) --> main10 +main10: emit c4 --> main9 +main9 : move %5, $gp --> main80 +main80: move %5, %5 --> main8 +main8 : li %6, 0 --> main7 +main7 : li %7, 1 --> main6 +main6 : la %18, array_ecriture --> main28 +main28: j --> main79 +main79: move $a0, %5 --> main78 +main78: move $a1, %6 --> main77 +main77: move $a2, %7 --> main76 +main76: call %18(3) --> main75 +main75: move %0, $v0 --> main5 +main5 : emit c3 --> main4 +main4 : li %3, 1 --> main3 +main3 : li %4, 4 --> main2 +main2 : mulo %2, %3, %4 --> main1 +main1 : move %1, $gp --> main69 +main69: move %1, %1 --> main22 +main22: add %1, %1, %2 --> main21 +main21: lw %1, 0(%1) --> main0 +main0 : j --> main68 +main68: move $v0, %1 --> main67 +main67: move $ra, %27 --> main66 +main66: move $s7, %26 --> main65 +main65: move $s6, %25 --> main64 +main64: move $s5, %24 --> main63 +main63: move $s4, %23 --> main62 +main62: move $s3, %22 --> main61 +main61: move $s2, %21 --> main60 +main60: move $s1, %20 --> main59 +main59: move $s0, %19 --> main58 +main58: delframe --> main57 +main57: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_ecriture.LIN.expected b/tests/clight/testTB_Array_ecriture.LIN.expected new file mode 100644 index 0000000..5f5e6da --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.LIN.expected @@ -0,0 +1,453 @@ +program + +globals 20 + +procedure array_ecriture(3) +var 0 +array_ecriture35: +newframe +c2: +li $a3, 1 +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +sw $a3, 0($v0) +c1: +li $a1, 5 +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c0: +li $v0, 0 +delframe +jr $ra + +procedure _main(0) +var 4 +main56: +newframe +sw $ra, 0($sp) +move $v0, $gp +sw $zero, 0($v0) +move $v0, $gp +sw $zero, 4($v0) +move $v0, $gp +sw $zero, 8($v0) +move $v0, $gp +sw $zero, 12($v0) +move $v0, $gp +sw $zero, 16($v0) +c4: +move $a0, $gp +li $a1, 0 +li $a2, 1 +la $v0, array_ecriture +call $v0 +c3: +li $a0, 1 +li $v0, 4 +mulo $a0, $a0, $v0 +move $v0, $gp +add $v0, $v0, $a0 +lw $v0, 0($v0) +lw $ra, 0($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_ecriture.LTL.expected b/tests/clight/testTB_Array_ecriture.LTL.expected new file mode 100644 index 0000000..2c792b9 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.LTL.expected @@ -0,0 +1,537 @@ +program + +globals 20 + +procedure array_ecriture(3) +var 0 +entry array_ecriture35 +array_ecriture35: newframe --> array_ecriture34 +array_ecriture34: j --> array_ecriture33 +array_ecriture33: j --> array_ecriture32 +array_ecriture32: j --> array_ecriture31 +array_ecriture31: j --> array_ecriture30 +array_ecriture30: j --> array_ecriture29 +array_ecriture29: j --> array_ecriture28 +array_ecriture28: j --> array_ecriture27 +array_ecriture27: j --> array_ecriture26 +array_ecriture26: j --> array_ecriture25 +array_ecriture25: j --> array_ecriture24 +array_ecriture24: j --> array_ecriture23 +array_ecriture23: j --> array_ecriture22 +array_ecriture22: j --> array_ecriture21 +array_ecriture21: j --> array_ecriture20 +array_ecriture20: j --> array_ecriture19 +array_ecriture19: j --> array_ecriture18 +array_ecriture18: j --> array_ecriture17 +array_ecriture17: j --> array_ecriture16 +array_ecriture16: j --> array_ecriture15 +array_ecriture15: j --> array_ecriture12 +array_ecriture12: emit c2 --> array_ecriture11 +array_ecriture11: li $a3, 1 --> array_ecriture10 +array_ecriture10: li $v0, 4 --> array_ecriture9 +array_ecriture9 : mulo $v0, $a1, $v0 --> array_ecriture8 +array_ecriture8 : add $v0, $a0, $v0 --> array_ecriture14 +array_ecriture14: lw $a3, 0($v0) --> array_ecriture7 +array_ecriture7 : emit c1 --> array_ecriture6 +array_ecriture6 : li $a1, 5 --> array_ecriture5 +array_ecriture5 : li $v0, 4 --> array_ecriture4 +array_ecriture4 : mulo $v0, $a2, $v0 --> array_ecriture3 +array_ecriture3 : add $v0, $a0, $v0 --> array_ecriture13 +array_ecriture13: lw $a1, 0($v0) --> array_ecriture2 +array_ecriture2 : emit c0 --> array_ecriture1 +array_ecriture1 : li $v0, 0 --> array_ecriture0 +array_ecriture0 : j --> array_ecriture47 +array_ecriture47: j --> array_ecriture46 +array_ecriture46: j --> array_ecriture45 +array_ecriture45: j --> array_ecriture44 +array_ecriture44: j --> array_ecriture43 +array_ecriture43: j --> array_ecriture42 +array_ecriture42: j --> array_ecriture41 +array_ecriture41: j --> array_ecriture40 +array_ecriture40: j --> array_ecriture39 +array_ecriture39: j --> array_ecriture38 +array_ecriture38: j --> array_ecriture37 +array_ecriture37: delframe --> array_ecriture36 +array_ecriture36: jr $ra + +procedure _main(0) +var 4 +entry main56 +main56: newframe --> main55 +main55: lw $ra, 0($sp) --> main54 +main54: j --> main53 +main53: j --> main52 +main52: j --> main51 +main51: j --> main50 +main50: j --> main49 +main49: j --> main48 +main48: j --> main47 +main47: j --> main46 +main46: j --> main45 +main45: j --> main44 +main44: j --> main43 +main43: j --> main42 +main42: j --> main41 +main41: j --> main40 +main40: j --> main39 +main39: j --> main38 +main38: j --> main37 +main37: j --> main36 +main36: j --> main35 +main35: j --> main34 +main34: j --> main33 +main33: j --> main32 +main32: j --> main31 +main31: j --> main30 +main30: j --> main29 +main29: j --> main20 +main20: j --> main19 +main19: move $v0, $gp --> main74 +main74: j --> main27 +main27: lw $zero, 0($v0) --> main18 +main18: j --> main17 +main17: move $v0, $gp --> main73 +main73: j --> main26 +main26: lw $zero, 4($v0) --> main16 +main16: j --> main15 +main15: move $v0, $gp --> main72 +main72: j --> main25 +main25: lw $zero, 8($v0) --> main14 +main14: j --> main13 +main13: move $v0, $gp --> main71 +main71: j --> main24 +main24: lw $zero, 12($v0) --> main12 +main12: j --> main11 +main11: move $v0, $gp --> main70 +main70: j --> main23 +main23: lw $zero, 16($v0) --> main10 +main10: emit c4 --> main9 +main9 : move $a0, $gp --> main80 +main80: j --> main8 +main8 : li $a1, 0 --> main7 +main7 : li $a2, 1 --> main6 +main6 : la $v0, array_ecriture --> main28 +main28: j --> main79 +main79: j --> main78 +main78: j --> main77 +main77: j --> main76 +main76: call $v0 --> main75 +main75: j --> main5 +main5 : emit c3 --> main4 +main4 : li $a0, 1 --> main3 +main3 : li $v0, 4 --> main2 +main2 : mulo $a0, $a0, $v0 --> main1 +main1 : move $v0, $gp --> main69 +main69: j --> main22 +main22: add $v0, $v0, $a0 --> main21 +main21: lw $v0, 0($v0) --> main0 +main0 : j --> main68 +main68: j --> main67 +main67: lw $ra, 0($sp) --> main66 +main66: j --> main65 +main65: j --> main64 +main64: j --> main63 +main63: j --> main62 +main62: j --> main61 +main61: j --> main60 +main60: j --> main59 +main59: j --> main58 +main58: delframe --> main57 +main57: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_ecriture.RTL.expected b/tests/clight/testTB_Array_ecriture.RTL.expected new file mode 100644 index 0000000..cb8e401 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.RTL.expected @@ -0,0 +1,483 @@ +program + +globals 20 + +function array_ecriture(%0; %1; %2) : %3 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11 +entry array_ecriture22 +array_ecriture22: li %4, 0 --> array_ecriture21 +array_ecriture21: li %5, 0 --> array_ecriture20 +array_ecriture20: li %6, 0 --> array_ecriture19 +array_ecriture19: li %7, 0 --> array_ecriture18 +array_ecriture18: li %8, 0 --> array_ecriture17 +array_ecriture17: li %9, 0 --> array_ecriture16 +array_ecriture16: li %10, 0 --> array_ecriture15 +array_ecriture15: li %11, 0 --> array_ecriture12 +array_ecriture12: emit c2 --> array_ecriture11 +array_ecriture11: li %7, 1 --> array_ecriture10 +array_ecriture10: li %9, 4 --> array_ecriture9 +array_ecriture9 : mulo %8, %1, %9 --> array_ecriture8 +array_ecriture8 : add %11, %0, %8 --> array_ecriture14 +array_ecriture14: sw %7, 0(%11) --> array_ecriture7 +array_ecriture7 : emit c1 --> array_ecriture6 +array_ecriture6 : li %4, 5 --> array_ecriture5 +array_ecriture5 : li %6, 4 --> array_ecriture4 +array_ecriture4 : mulo %5, %2, %6 --> array_ecriture3 +array_ecriture3 : add %10, %0, %5 --> array_ecriture13 +array_ecriture13: sw %4, 0(%10) --> array_ecriture2 +array_ecriture2 : emit c0 --> array_ecriture1 +array_ecriture1 : li %3, 0 --> array_ecriture0 +array_ecriture0 : return %3 + +function _main() : %1 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18 +entry main46 +main46: li %0, 0 --> main45 +main45: li %2, 0 --> main44 +main44: li %3, 0 --> main43 +main43: li %4, 0 --> main42 +main42: li %5, 0 --> main41 +main41: li %6, 0 --> main40 +main40: li %7, 0 --> main39 +main39: li %8, 0 --> main38 +main38: li %9, 0 --> main37 +main37: li %10, 0 --> main36 +main36: li %11, 0 --> main35 +main35: li %12, 0 --> main34 +main34: li %13, 0 --> main33 +main33: li %14, 0 --> main32 +main32: li %15, 0 --> main31 +main31: li %16, 0 --> main30 +main30: li %17, 0 --> main29 +main29: li %18, 0 --> main20 +main20: li %12, 0 --> main19 +main19: addi %17, GLOBALS, 0 --> main27 +main27: sw %12, 0(%17) --> main18 +main18: li %11, 0 --> main17 +main17: addi %16, GLOBALS, 0 --> main26 +main26: sw %11, 4(%16) --> main16 +main16: li %10, 0 --> main15 +main15: addi %15, GLOBALS, 0 --> main25 +main25: sw %10, 8(%15) --> main14 +main14: li %9, 0 --> main13 +main13: addi %14, GLOBALS, 0 --> main24 +main24: sw %9, 12(%14) --> main12 +main12: li %8, 0 --> main11 +main11: addi %13, GLOBALS, 0 --> main23 +main23: sw %8, 16(%13) --> main10 +main10: emit c4 --> main9 +main9 : addi %5, GLOBALS, 0 --> main8 +main8 : li %6, 0 --> main7 +main7 : li %7, 1 --> main6 +main6 : la %18, array_ecriture --> main28 +main28: call %0, %18(%5, %6, %7) --> main5 +main5 : emit c3 --> main4 +main4 : li %3, 1 --> main3 +main3 : li %4, 4 --> main2 +main2 : mulo %2, %3, %4 --> main1 +main1 : addi %1, GLOBALS, 0 --> main22 +main22: add %1, %1, %2 --> main21 +main21: lw %1, 0(%1) --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_ecriture.RTLabs.expected b/tests/clight/testTB_Array_ecriture.RTLabs.expected new file mode 100644 index 0000000..69473f3 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.RTLabs.expected @@ -0,0 +1,455 @@ +program: (main function is "main") + + + globals: + "t" = {0, 0, 0, 0, 0} + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "array_ecriture"(%0, %1, %2): int -> int -> int -> int + locals: %3, %4, %5, %6, %7, %8, %9 + result: %3 + stacksize: 0 + entry: array_ecriture12 + exit: array_ecriture0 + + array_ecriture9: mul %8, %1, %9 --> array_ecriture8 + array_ecriture8: store int32, add, %0, %8, %7 --> array_ecriture7 + array_ecriture7: emit c1 --> array_ecriture6 + array_ecriture6: imm_int 5, %4, --> array_ecriture5 + array_ecriture5: imm_int 4, %6, --> array_ecriture4 + array_ecriture4: mul %5, %2, %6 --> array_ecriture3 + array_ecriture3: store int32, add, %0, %5, %4 --> array_ecriture2 + array_ecriture2: emit c0 --> array_ecriture1 + array_ecriture12: emit c2 --> array_ecriture11 + array_ecriture11: imm_int 1, %7, --> array_ecriture10 + array_ecriture10: imm_int 4, %9, --> array_ecriture9 + array_ecriture1: imm_int 0, %3, --> array_ecriture0 + array_ecriture0: return %3 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12 + result: %1 + stacksize: 0 + entry: main20 + exit: main0 + + main9: imm_addr "t", %5, --> main8 + main8: imm_int 0, %6, --> main7 + main7: imm_int 1, %7, --> main6 + main6: call "array_ecriture", %5, %6, %7, %0: int -> int -> int -> int --> main5 + main5: emit c3 --> main4 + main4: imm_int 1, %3, --> main3 + main3: imm_int 4, %4, --> main2 + main20: imm_int 0, %12, --> main19 + main2: mul %2, %3, %4 --> main1 + main19: store int32, 0("t"), , %12 --> main18 + main18: imm_int 0, %11, --> main17 + main17: store int32, 4("t"), , %11 --> main16 + main16: imm_int 0, %10, --> main15 + main15: store int32, 8("t"), , %10 --> main14 + main14: imm_int 0, %9, --> main13 + main13: store int32, 12("t"), , %9 --> main12 + main12: imm_int 0, %8, --> main11 + main11: store int32, 16("t"), , %8 --> main10 + main10: emit c4 --> main9 + main1: load int32, add, 0("t"), %2, %1 --> main0 + main0: return %1 + + diff --git a/tests/clight/testTB_Array_ecriture.c b/tests/clight/testTB_Array_ecriture.c new file mode 100644 index 0000000..add6fe2 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.c @@ -0,0 +1,14 @@ +int t[5] = {0,0,0,0,0}; + +int array_ecriture (int tabecr[], int i, int j) { + + tabecr[i] = 1; + tabecr[j] = 5; + + return 0; +} + +int main(){ + int a = array_ecriture(t,0,1); + return t[1]; +} diff --git a/tests/clight/testTB_Array_ecriture.c.expected b/tests/clight/testTB_Array_ecriture.c.expected new file mode 100644 index 0000000..add6fe2 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.c.expected @@ -0,0 +1,14 @@ +int t[5] = {0,0,0,0,0}; + +int array_ecriture (int tabecr[], int i, int j) { + + tabecr[i] = 1; + tabecr[j] = 5; + + return 0; +} + +int main(){ + int a = array_ecriture(t,0,1); + return t[1]; +} diff --git a/tests/clight/testTB_Array_ecriture.log.expected b/tests/clight/testTB_Array_ecriture.log.expected new file mode 100644 index 0000000..48d8669 --- /dev/null +++ b/tests/clight/testTB_Array_ecriture.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Load mode not supported. diff --git a/tests/clight/testTB_Array_lecture.ASM.expected b/tests/clight/testTB_Array_lecture.ASM.expected new file mode 100644 index 0000000..90ab730 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.ASM.expected @@ -0,0 +1,361 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 20 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main48 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin array_lecture +array_lecture33: +c2: +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +lw $a1, 0($v0) +c1: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +c0: +add $v0, $a1, $v0 +jr $ra +# end array_lecture + + +# begin _main +main48: +addi $sp, $sp, -4 +sw $ra, 0($sp) +li $a0, 1 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 2 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 3 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 5 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 8 +move $v0, $gp +sw $a0, 16($v0) +c4: +move $a0, $gp +li $a1, 0 +li $a2, 4 +la $v0, array_lecture33 +jalr $v0 +c3: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end _main diff --git a/tests/clight/testTB_Array_lecture.Clight.expected b/tests/clight/testTB_Array_lecture.Clight.expected new file mode 100644 index 0000000..70030df --- /dev/null +++ b/tests/clight/testTB_Array_lecture.Clight.expected @@ -0,0 +1,288 @@ +int t[5] = { 1, 2, 3, 5, 8, }; + +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +int array_lecture(int *tablec, int i, int j) +{ + int a; + int b; + c2: + a = tablec[i]; + c1: + b = tablec[j]; + c0: + return a + b; +} + +int main(void) +{ + int t__1; + c4: + t__1 = array_lecture(t, 0, 4); + c3: + return t__1; +} + + diff --git a/tests/clight/testTB_Array_lecture.Cminor.expected b/tests/clight/testTB_Array_lecture.Cminor.expected new file mode 100644 index 0000000..27b79e2 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.Cminor.expected @@ -0,0 +1,430 @@ + +var "t" {1, 2, 3, 5, 8} + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"array_lecture" (tablec, i, j) : int -> int -> int -> int { + + stack 0; + + var b, a; + + c2: + a = int32[tablec + (i * 4)]; + c1: + b = int32[tablec + (j * 4)]; + c0: + return a + b; + +} + + +"main" () : int { + + stack 0; + + var t__1; + + c4: + t__1 = "array_lecture"("t", 0, 4) : int -> int -> int -> int; + c3: + return t__1; + +} + + diff --git a/tests/clight/testTB_Array_lecture.ERTL.expected b/tests/clight/testTB_Array_lecture.ERTL.expected new file mode 100644 index 0000000..ddf11f8 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.ERTL.expected @@ -0,0 +1,533 @@ +program + +globals 20 + +procedure array_lecture(3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20 +entry array_lecture33 +array_lecture33: newframe --> array_lecture32 +array_lecture32: move %20, $ra --> array_lecture31 +array_lecture31: move %19, $s7 --> array_lecture30 +array_lecture30: move %18, $s6 --> array_lecture29 +array_lecture29: move %17, $s5 --> array_lecture28 +array_lecture28: move %16, $s4 --> array_lecture27 +array_lecture27: move %15, $s3 --> array_lecture26 +array_lecture26: move %14, $s2 --> array_lecture25 +array_lecture25: move %13, $s1 --> array_lecture24 +array_lecture24: move %12, $s0 --> array_lecture23 +array_lecture23: move %0, $a0 --> array_lecture22 +array_lecture22: move %1, $a1 --> array_lecture21 +array_lecture21: move %2, $a2 --> array_lecture20 +array_lecture20: li %3, 0 --> array_lecture19 +array_lecture19: li %4, 0 --> array_lecture18 +array_lecture18: li %6, 0 --> array_lecture17 +array_lecture17: li %7, 0 --> array_lecture16 +array_lecture16: li %8, 0 --> array_lecture15 +array_lecture15: li %9, 0 --> array_lecture14 +array_lecture14: li %10, 0 --> array_lecture13 +array_lecture13: li %11, 0 --> array_lecture10 +array_lecture10: emit c2 --> array_lecture9 +array_lecture9 : li %9, 4 --> array_lecture8 +array_lecture8 : mulo %8, %1, %9 --> array_lecture7 +array_lecture7 : add %11, %0, %8 --> array_lecture12 +array_lecture12: lw %4, 0(%11) --> array_lecture6 +array_lecture6 : emit c1 --> array_lecture5 +array_lecture5 : li %7, 4 --> array_lecture4 +array_lecture4 : mulo %6, %2, %7 --> array_lecture3 +array_lecture3 : add %10, %0, %6 --> array_lecture11 +array_lecture11: lw %3, 0(%10) --> array_lecture2 +array_lecture2 : emit c0 --> array_lecture1 +array_lecture1 : add %5, %4, %3 --> array_lecture0 +array_lecture0 : j --> array_lecture45 +array_lecture45: move $v0, %5 --> array_lecture44 +array_lecture44: move $ra, %20 --> array_lecture43 +array_lecture43: move $s7, %19 --> array_lecture42 +array_lecture42: move $s6, %18 --> array_lecture41 +array_lecture41: move $s5, %17 --> array_lecture40 +array_lecture40: move $s4, %16 --> array_lecture39 +array_lecture39: move $s3, %15 --> array_lecture38 +array_lecture38: move $s2, %14 --> array_lecture37 +array_lecture37: move $s1, %13 --> array_lecture36 +array_lecture36: move $s0, %12 --> array_lecture35 +array_lecture35: delframe --> array_lecture34 +array_lecture34: jr $ra (xmits $v0) + +procedure _main(0) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24 +entry main48 +main48: newframe --> main47 +main47: move %24, $ra --> main46 +main46: move %23, $s7 --> main45 +main45: move %22, $s6 --> main44 +main44: move %21, $s5 --> main43 +main43: move %20, $s4 --> main42 +main42: move %19, $s3 --> main41 +main41: move %18, $s2 --> main40 +main40: move %17, $s1 --> main39 +main39: move %16, $s0 --> main38 +main38: li %0, 0 --> main37 +main37: li %2, 0 --> main36 +main36: li %3, 0 --> main35 +main35: li %4, 0 --> main34 +main34: li %5, 0 --> main33 +main33: li %6, 0 --> main32 +main32: li %7, 0 --> main31 +main31: li %8, 0 --> main30 +main30: li %9, 0 --> main29 +main29: li %10, 0 --> main28 +main28: li %11, 0 --> main27 +main27: li %12, 0 --> main26 +main26: li %13, 0 --> main25 +main25: li %14, 0 --> main24 +main24: li %15, 0 --> main17 +main17: li %9, 1 --> main16 +main16: move %13, $gp --> main64 +main64: move %13, %13 --> main21 +main21: sw %9, 0(%13) --> main15 +main15: li %8, 2 --> main14 +main14: move %12, $gp --> main63 +main63: move %12, %12 --> main20 +main20: sw %8, 4(%12) --> main13 +main13: li %7, 3 --> main12 +main12: move %11, $gp --> main62 +main62: move %11, %11 --> main19 +main19: sw %7, 8(%11) --> main11 +main11: li %6, 5 --> main10 +main10: move %10, $gp --> main61 +main61: move %10, %10 --> main18 +main18: sw %6, 12(%10) --> main9 +main9 : li %5, 8 --> main8 +main8 : move %15, $gp --> main71 +main71: move %15, %15 --> main23 +main23: sw %5, 16(%15) --> main7 +main7 : emit c4 --> main6 +main6 : move %2, $gp --> main70 +main70: move %2, %2 --> main5 +main5 : li %3, 0 --> main4 +main4 : li %4, 4 --> main3 +main3 : la %14, array_lecture --> main22 +main22: j --> main69 +main69: move $a0, %2 --> main68 +main68: move $a1, %3 --> main67 +main67: move $a2, %4 --> main66 +main66: call %14(3) --> main65 +main65: move %0, $v0 --> main2 +main2 : emit c3 --> main1 +main1 : move %1, %0 --> main0 +main0 : j --> main60 +main60: move $v0, %1 --> main59 +main59: move $ra, %24 --> main58 +main58: move $s7, %23 --> main57 +main57: move $s6, %22 --> main56 +main56: move $s5, %21 --> main55 +main55: move $s4, %20 --> main54 +main54: move $s3, %19 --> main53 +main53: move $s2, %18 --> main52 +main52: move $s1, %17 --> main51 +main51: move $s0, %16 --> main50 +main50: delframe --> main49 +main49: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_lecture.LIN.expected b/tests/clight/testTB_Array_lecture.LIN.expected new file mode 100644 index 0000000..d9670d2 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.LIN.expected @@ -0,0 +1,450 @@ +program + +globals 20 + +procedure array_lecture(3) +var 0 +array_lecture33: +newframe +c2: +li $v0, 4 +mulo $v0, $a1, $v0 +add $v0, $a0, $v0 +lw $a1, 0($v0) +c1: +li $v0, 4 +mulo $v0, $a2, $v0 +add $v0, $a0, $v0 +lw $v0, 0($v0) +c0: +add $v0, $a1, $v0 +delframe +jr $ra + +procedure _main(0) +var 4 +main48: +newframe +sw $ra, 0($sp) +li $a0, 1 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 2 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 3 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 5 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 8 +move $v0, $gp +sw $a0, 16($v0) +c4: +move $a0, $gp +li $a1, 0 +li $a2, 4 +la $v0, array_lecture +call $v0 +c3: +lw $ra, 0($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_lecture.LTL.expected b/tests/clight/testTB_Array_lecture.LTL.expected new file mode 100644 index 0000000..81f8260 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.LTL.expected @@ -0,0 +1,526 @@ +program + +globals 20 + +procedure array_lecture(3) +var 0 +entry array_lecture33 +array_lecture33: newframe --> array_lecture32 +array_lecture32: j --> array_lecture31 +array_lecture31: j --> array_lecture30 +array_lecture30: j --> array_lecture29 +array_lecture29: j --> array_lecture28 +array_lecture28: j --> array_lecture27 +array_lecture27: j --> array_lecture26 +array_lecture26: j --> array_lecture25 +array_lecture25: j --> array_lecture24 +array_lecture24: j --> array_lecture23 +array_lecture23: j --> array_lecture22 +array_lecture22: j --> array_lecture21 +array_lecture21: j --> array_lecture20 +array_lecture20: j --> array_lecture19 +array_lecture19: j --> array_lecture18 +array_lecture18: j --> array_lecture17 +array_lecture17: j --> array_lecture16 +array_lecture16: j --> array_lecture15 +array_lecture15: j --> array_lecture14 +array_lecture14: j --> array_lecture13 +array_lecture13: j --> array_lecture10 +array_lecture10: emit c2 --> array_lecture9 +array_lecture9 : li $v0, 4 --> array_lecture8 +array_lecture8 : mulo $v0, $a1, $v0 --> array_lecture7 +array_lecture7 : add $v0, $a0, $v0 --> array_lecture12 +array_lecture12: lw $a1, 0($v0) --> array_lecture6 +array_lecture6 : emit c1 --> array_lecture5 +array_lecture5 : li $v0, 4 --> array_lecture4 +array_lecture4 : mulo $v0, $a2, $v0 --> array_lecture3 +array_lecture3 : add $v0, $a0, $v0 --> array_lecture11 +array_lecture11: lw $v0, 0($v0) --> array_lecture2 +array_lecture2 : emit c0 --> array_lecture1 +array_lecture1 : add $v0, $a1, $v0 --> array_lecture0 +array_lecture0 : j --> array_lecture45 +array_lecture45: j --> array_lecture44 +array_lecture44: j --> array_lecture43 +array_lecture43: j --> array_lecture42 +array_lecture42: j --> array_lecture41 +array_lecture41: j --> array_lecture40 +array_lecture40: j --> array_lecture39 +array_lecture39: j --> array_lecture38 +array_lecture38: j --> array_lecture37 +array_lecture37: j --> array_lecture36 +array_lecture36: j --> array_lecture35 +array_lecture35: delframe --> array_lecture34 +array_lecture34: jr $ra + +procedure _main(0) +var 4 +entry main48 +main48: newframe --> main47 +main47: lw $ra, 0($sp) --> main46 +main46: j --> main45 +main45: j --> main44 +main44: j --> main43 +main43: j --> main42 +main42: j --> main41 +main41: j --> main40 +main40: j --> main39 +main39: j --> main38 +main38: j --> main37 +main37: j --> main36 +main36: j --> main35 +main35: j --> main34 +main34: j --> main33 +main33: j --> main32 +main32: j --> main31 +main31: j --> main30 +main30: j --> main29 +main29: j --> main28 +main28: j --> main27 +main27: j --> main26 +main26: j --> main25 +main25: j --> main24 +main24: j --> main17 +main17: li $a0, 1 --> main16 +main16: move $v0, $gp --> main64 +main64: j --> main21 +main21: lw $a0, 0($v0) --> main15 +main15: li $a0, 2 --> main14 +main14: move $v0, $gp --> main63 +main63: j --> main20 +main20: lw $a0, 4($v0) --> main13 +main13: li $a0, 3 --> main12 +main12: move $v0, $gp --> main62 +main62: j --> main19 +main19: lw $a0, 8($v0) --> main11 +main11: li $a0, 5 --> main10 +main10: move $v0, $gp --> main61 +main61: j --> main18 +main18: lw $a0, 12($v0) --> main9 +main9 : li $a0, 8 --> main8 +main8 : move $v0, $gp --> main71 +main71: j --> main23 +main23: lw $a0, 16($v0) --> main7 +main7 : emit c4 --> main6 +main6 : move $a0, $gp --> main70 +main70: j --> main5 +main5 : li $a1, 0 --> main4 +main4 : li $a2, 4 --> main3 +main3 : la $v0, array_lecture --> main22 +main22: j --> main69 +main69: j --> main68 +main68: j --> main67 +main67: j --> main66 +main66: call $v0 --> main65 +main65: j --> main2 +main2 : emit c3 --> main1 +main1 : j --> main0 +main0 : j --> main60 +main60: j --> main59 +main59: lw $ra, 0($sp) --> main58 +main58: j --> main57 +main57: j --> main56 +main56: j --> main55 +main55: j --> main54 +main54: j --> main53 +main53: j --> main52 +main52: j --> main51 +main51: j --> main50 +main50: delframe --> main49 +main49: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_lecture.RTL.expected b/tests/clight/testTB_Array_lecture.RTL.expected new file mode 100644 index 0000000..2194229 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.RTL.expected @@ -0,0 +1,473 @@ +program + +globals 20 + +function array_lecture(%0; %1; %2) : %5 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11 +entry array_lecture20 +array_lecture20: li %3, 0 --> array_lecture19 +array_lecture19: li %4, 0 --> array_lecture18 +array_lecture18: li %6, 0 --> array_lecture17 +array_lecture17: li %7, 0 --> array_lecture16 +array_lecture16: li %8, 0 --> array_lecture15 +array_lecture15: li %9, 0 --> array_lecture14 +array_lecture14: li %10, 0 --> array_lecture13 +array_lecture13: li %11, 0 --> array_lecture10 +array_lecture10: emit c2 --> array_lecture9 +array_lecture9 : li %9, 4 --> array_lecture8 +array_lecture8 : mulo %8, %1, %9 --> array_lecture7 +array_lecture7 : add %11, %0, %8 --> array_lecture12 +array_lecture12: lw %4, 0(%11) --> array_lecture6 +array_lecture6 : emit c1 --> array_lecture5 +array_lecture5 : li %7, 4 --> array_lecture4 +array_lecture4 : mulo %6, %2, %7 --> array_lecture3 +array_lecture3 : add %10, %0, %6 --> array_lecture11 +array_lecture11: lw %3, 0(%10) --> array_lecture2 +array_lecture2 : emit c0 --> array_lecture1 +array_lecture1 : add %5, %4, %3 --> array_lecture0 +array_lecture0 : return %5 + +function _main() : %1 +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15 +entry main38 +main38: li %0, 0 --> main37 +main37: li %2, 0 --> main36 +main36: li %3, 0 --> main35 +main35: li %4, 0 --> main34 +main34: li %5, 0 --> main33 +main33: li %6, 0 --> main32 +main32: li %7, 0 --> main31 +main31: li %8, 0 --> main30 +main30: li %9, 0 --> main29 +main29: li %10, 0 --> main28 +main28: li %11, 0 --> main27 +main27: li %12, 0 --> main26 +main26: li %13, 0 --> main25 +main25: li %14, 0 --> main24 +main24: li %15, 0 --> main17 +main17: li %9, 1 --> main16 +main16: addi %13, GLOBALS, 0 --> main21 +main21: sw %9, 0(%13) --> main15 +main15: li %8, 2 --> main14 +main14: addi %12, GLOBALS, 0 --> main20 +main20: sw %8, 4(%12) --> main13 +main13: li %7, 3 --> main12 +main12: addi %11, GLOBALS, 0 --> main19 +main19: sw %7, 8(%11) --> main11 +main11: li %6, 5 --> main10 +main10: addi %10, GLOBALS, 0 --> main18 +main18: sw %6, 12(%10) --> main9 +main9 : li %5, 8 --> main8 +main8 : addi %15, GLOBALS, 0 --> main23 +main23: sw %5, 16(%15) --> main7 +main7 : emit c4 --> main6 +main6 : addi %2, GLOBALS, 0 --> main5 +main5 : li %3, 0 --> main4 +main4 : li %4, 4 --> main3 +main3 : la %14, array_lecture --> main22 +main22: call %0, %14(%2, %3, %4) --> main2 +main2 : emit c3 --> main1 +main1 : move %1, %0 --> main0 +main0 : return %1 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + diff --git a/tests/clight/testTB_Array_lecture.RTLabs.expected b/tests/clight/testTB_Array_lecture.RTLabs.expected new file mode 100644 index 0000000..f925ee6 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.RTLabs.expected @@ -0,0 +1,450 @@ +program: (main function is "main") + + + globals: + "t" = {1, 2, 3, 5, 8} + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "array_lecture"(%0, %1, %2): int -> int -> int -> int + locals: %5, %3, %4, %6, %7, %8, %9 + result: %5 + stacksize: 0 + entry: array_lecture10 + exit: array_lecture0 + + array_lecture9: imm_int 4, %9, --> array_lecture8 + array_lecture8: mul %8, %1, %9 --> array_lecture7 + array_lecture7: load int32, add, %0, %8, %4 --> array_lecture6 + array_lecture6: emit c1 --> array_lecture5 + array_lecture5: imm_int 4, %7, --> array_lecture4 + array_lecture4: mul %6, %2, %7 --> array_lecture3 + array_lecture3: load int32, add, %0, %6, %3 --> array_lecture2 + array_lecture2: emit c0 --> array_lecture1 + array_lecture10: emit c2 --> array_lecture9 + array_lecture1: add %5, %4, %3 --> array_lecture0 + array_lecture0: return %5 + + + "main"(): int + locals: %1, %0, %2, %3, %4, %5, %6, %7, %8, %9 + result: %1 + stacksize: 0 + entry: main17 + exit: main0 + + main9: imm_int 8, %5, --> main8 + main8: store int32, 16("t"), , %5 --> main7 + main7: emit c4 --> main6 + main6: imm_addr "t", %2, --> main5 + main5: imm_int 0, %3, --> main4 + main4: imm_int 4, %4, --> main3 + main3: call "array_lecture", %2, %3, %4, %0: int -> int -> int -> int --> main2 + main2: emit c3 --> main1 + main17: imm_int 1, %9, --> main16 + main16: store int32, 0("t"), , %9 --> main15 + main15: imm_int 2, %8, --> main14 + main14: store int32, 4("t"), , %8 --> main13 + main13: imm_int 3, %7, --> main12 + main12: store int32, 8("t"), , %7 --> main11 + main11: imm_int 5, %6, --> main10 + main10: store int32, 12("t"), , %6 --> main9 + main1: mov %1, %0 --> main0 + main0: return %1 + + diff --git a/tests/clight/testTB_Array_lecture.c b/tests/clight/testTB_Array_lecture.c new file mode 100644 index 0000000..4c683bd --- /dev/null +++ b/tests/clight/testTB_Array_lecture.c @@ -0,0 +1,14 @@ +int t[5] = {1,2,3,5,8}; + +int array_lecture (int tablec[], int i, int j) { + int a, b; + + a = tablec[i]; + b = tablec[j]; + + return a+b; +} + +int main(){ + return array_lecture(t,0,4); +} diff --git a/tests/clight/testTB_Array_lecture.c.expected b/tests/clight/testTB_Array_lecture.c.expected new file mode 100644 index 0000000..4c683bd --- /dev/null +++ b/tests/clight/testTB_Array_lecture.c.expected @@ -0,0 +1,14 @@ +int t[5] = {1,2,3,5,8}; + +int array_lecture (int tablec[], int i, int j) { + int a, b; + + a = tablec[i]; + b = tablec[j]; + + return a+b; +} + +int main(){ + return array_lecture(t,0,4); +} diff --git a/tests/clight/testTB_Array_lecture.log.expected b/tests/clight/testTB_Array_lecture.log.expected new file mode 100644 index 0000000..ba50dc8 --- /dev/null +++ b/tests/clight/testTB_Array_lecture.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Constant not supported. diff --git a/tests/clight/testTB_boucle.ASM.expected b/tests/clight/testTB_boucle.ASM.expected new file mode 100644 index 0000000..27629dc --- /dev/null +++ b/tests/clight/testTB_boucle.ASM.expected @@ -0,0 +1,434 @@ +# extern __builtin_varargs_start: int -> void +# extern __builtin_va_start: int -> int -> void +# extern __builtin_va_end: int -> void +# extern __builtin_va_copy: int -> int -> void +# extern __builtin_va_arg: int -> int -> void +# extern __builtin_types_compatible_p: int -> int -> int +# extern __builtin_tanl: float -> float +# extern __builtin_tanhl: float -> float +# extern __builtin_tanhf: float -> float +# extern __builtin_tanh: float -> float +# extern __builtin_tanf: float -> float +# extern __builtin_tan: float -> float +# extern __builtin_strspn: int -> int -> int +# extern __builtin_strpbrk: int -> int -> int +# extern __builtin_strncpy: int -> int -> int -> int +# extern __builtin_strncmp: int -> int -> int -> int +# extern __builtin_strncat: int -> int -> int -> int +# extern __builtin_strcspn: int -> int -> int +# extern __builtin_strcpy: int -> int -> int +# extern __builtin_strcmp: int -> int -> int +# extern __builtin_strchr: int -> int -> int +# extern __builtin_stpcpy: int -> int -> int +# extern __builtin_stdarg_start: int -> void +# extern __builtin_sqrtl: float -> float +# extern __builtin_sqrtf: float -> float +# extern __builtin_sqrt: float -> float +# extern __builtin_sinl: float -> float +# extern __builtin_sinhl: float -> float +# extern __builtin_sinhf: float -> float +# extern __builtin_sinh: float -> float +# extern __builtin_sinf: float -> float +# extern __builtin_sin: float -> float +# extern __builtin_return_address: int -> int +# extern __builtin_return: int -> void +# extern __builtin_powil: float -> int -> float +# extern __builtin_powif: float -> int -> float +# extern __builtin_powi: float -> int -> float +# extern __builtin_popcountll: int -> int +# extern __builtin_popcountl: int -> int +# extern __builtin_popcount: int -> int +# extern __builtin_parityll: int -> int +# extern __builtin_parityl: int -> int +# extern __builtin_parity: int -> int +# extern __builtin_object_size: int -> int -> int +# extern __builtin_next_arg: int +# extern __builtin_nansl: int -> float +# extern __builtin_nansf: int -> float +# extern __builtin_nans: int -> float +# extern __builtin_nanl: int -> float +# extern __builtin_nanf: int -> float +# extern __builtin_nan: int -> float +# extern __builtin_modfl: float -> int -> float +# extern __builtin_modff: float -> int -> float +# extern __builtin_mempcpy: int -> int -> int -> int +# extern __builtin_memcpy: int -> int -> int -> int +# extern __builtin_logl: float -> float +# extern __builtin_logf: float -> float +# extern __builtin_log10l: float -> float +# extern __builtin_log10f: float -> float +# extern __builtin_log10: float -> float +# extern __builtin_log: float -> float +# extern __builtin_ldexpl: float -> int -> float +# extern __builtin_ldexpf: float -> int -> float +# extern __builtin_ldexp: float -> int -> float +# extern __builtin_infl: float +# extern __builtin_inff: float +# extern __builtin_inf: float +# extern __builtin_huge_vall: float +# extern __builtin_huge_valf: float +# extern __builtin_huge_val: float +# extern __builtin_frexpl: float -> int -> float +# extern __builtin_frexpf: float -> int -> float +# extern __builtin_frexp: float -> int -> float +# extern __builtin_frame_address: int -> int +# extern __builtin_fmodl: float -> float +# extern __builtin_fmodf: float -> float +# extern __builtin_fmod: float -> float +# extern __builtin_floorl: float -> float +# extern __builtin_floorf: float -> float +# extern __builtin_floor: float -> float +# extern __builtin_ffsll: int -> int +# extern __builtin_ffsl: int -> int +# extern __builtin_ffs: int -> int +# extern __builtin_fabsl: float -> float +# extern __builtin_fabsf: float -> float +# extern __builtin_fabs: float -> float +# extern __builtin_expl: float -> float +# extern __builtin_expf: float -> float +# extern __builtin_expect: int -> int -> int +# extern __builtin_exp: float -> float +# extern __builtin_ctzll: int -> int +# extern __builtin_ctzl: int -> int +# extern __builtin_ctz: int -> int +# extern __builtin_cosl: float -> float +# extern __builtin_coshl: float -> float +# extern __builtin_coshf: float -> float +# extern __builtin_cosh: float -> float +# extern __builtin_cosf: float -> float +# extern __builtin_cos: float -> float +# extern __builtin_constant_p: int -> int +# extern __builtin_clzll: int -> int +# extern __builtin_clzl: int -> int +# extern __builtin_clz: int -> int +# extern __builtin_ceill: float -> float +# extern __builtin_ceilf: float -> float +# extern __builtin_ceil: float -> float +# extern __builtin_atanl: float -> float +# extern __builtin_atanf: float -> float +# extern __builtin_atan2l: float -> float -> float +# extern __builtin_atan2f: float -> float -> float +# extern __builtin_atan2: float -> float -> float +# extern __builtin_atan: float -> float +# extern __builtin_asinl: float -> float +# extern __builtin_asinf: float -> float +# extern __builtin_asin: float -> float +# extern __builtin_alloca: int -> int +# extern __builtin_acosl: float -> float +# extern __builtin_acosf: float -> float +# extern __builtin_acos: float -> float +# extern __builtin___vsprintf_chk: int -> int -> int -> int -> int -> int +# extern __builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int +# extern __builtin___vprintf_chk: int -> int -> int -> int +# extern __builtin___vfprintf_chk: int -> int -> int -> int -> int +# extern __builtin___strncpy_chk: int -> int -> int -> int -> int +# extern __builtin___strncat_chk: int -> int -> int -> int -> int +# extern __builtin___strcpy_chk: int -> int -> int -> int +# extern __builtin___strcat_chk: int -> int -> int -> int +# extern __builtin___stpcpy_chk: int -> int -> int -> int +# extern __builtin___memset_chk: int -> int -> int -> int -> int +# extern __builtin___mempcpy_chk: int -> int -> int -> int -> int +# extern __builtin___memmove_chk: int -> int -> int -> int -> int +# extern __builtin___memcpy_chk: int -> int -> int -> int -> int + +# begin preamble +.data +globals: +.space 40 +nl: +.asciiz "\n" +.align 2 +.text +main: +la $gp, globals +j main155 +print_int: +li $v0, 1 +syscall +jr $ra +print_intln: +li $v0, 1 +syscall +la $a0, nl +li $v0, 4 +syscall +jr $ra +scan_int: +li $v0, 5 +syscall +jr $ra +alloc: +li $v0, 9 +syscall +jr $ra + +pow2: +li $v0, 1 +sllv $v0, $v0, $a0 +jr $ra + +mod: +beqz $a0, mod0 +beqz $a1, mod0 +li $t2, 0 +mod_t0: +bgtz $a0, mod_a0_pos +neg $t0, $a0 +addi $t2, $t2, 1 +j mod_t1 +mod_a0_pos: +move $t0, $a0 +mod_t1: +bgtz $a1, mod_a1_pos +neg $t1, $a1 +addi $t2, $t2, 2 +j mod_main +mod_a1_pos: +move $t1, $a1 +mod_main: +rem $v0, $t0, $t1 +beqz $t2, mod_exit +addi $t2, -1 +beqz $t2, mod_case1 +addi $t2, -1 +beqz $t2, mod_case2 +neg $v0, $v0 +j mod_exit +mod_case1: +sub $v0, $a1, $v0 +j mod_exit +mod_case2: +add $v0, $a1, $v0 +j mod_exit +mod0: +li $v0, 0 +mod_exit: +jr $ra + +toint: +# $a0: size +# $a1: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +jal pow2 +move $a0, $a1 +move $a1, $v0 +jal mod +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 8 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +toint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a1, $a0 +li $a0, 16 +jal toint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +sign_ext: +# $a0: size +# $a1: int to extend +li $v0, 32 +sub $a0, $v0, $a0 +sllv $v0, $a1, $a0 +srav $v0, $v0, $a0 +jr $ra + +ofint: +# $a0: signedness +# $a1: size +# $a2: int to convert +addi $sp, $sp, -4 +sw $ra, 0($sp) +beqz $a0, ofint_unsigned +move $a0, $a1 +move $a1, $a2 +jal sign_ext +j ofint_exit +ofint_unsigned: +move $v0, $a2 +ofint_exit: +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint8: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 8 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 1 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra + +ofuint16: +addi $sp, $sp, -4 +sw $ra, 0($sp) +move $a2, $a0 +li $a1, 16 +li $a0, 0 +jal ofint +lw $ra, 0($sp) +addi $sp, $sp, 4 +jr $ra +# end preamble + + +# begin _main +main155: +addi $sp, $sp, -24 +sw $ra, 20($sp) +li $a0, 1 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 2 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 3 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 5 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 8 +move $v0, $gp +sw $a0, 16($v0) +li $a0, 13 +move $v0, $gp +sw $a0, 20($v0) +li $a0, 21 +move $v0, $gp +sw $a0, 24($v0) +li $a0, 34 +move $v0, $gp +sw $a0, 28($v0) +li $a0, 55 +move $v0, $gp +sw $a0, 32($v0) +li $a0, 89 +move $v0, $gp +sw $a0, 36($v0) +c11: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c10: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c9: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c8: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c7: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +move $a0, $gp +move $a1, $gp +addi $a1, $a1, 20 +move $a2, $sp +li $a3, 5 +la $v0, TB_Boucle59 +jalr $v0 +c5: +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +lw $ra, 20($sp) +addi $sp, $sp, 24 +jr $ra +# end _main + + +# begin TB_Boucle +TB_Boucle59: +c4: +c3: +li $t0, 0 +TB_Boucle20: +li $t1, 0 +c2: +slt $v0, $t0, $a3 +seq $v0, $v0, $zero +beq $v0, $t1, TB_Boucle15 +jr $ra +TB_Boucle15: +c0: +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a0, $v0 +lw $t1, 0($v0) +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a1, $v0 +lw $v0, 0($v0) +add $t1, $t1, $v0 +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a2, $v0 +sw $t1, 0($v0) +c1: +li $v0, 1 +add $t0, $t0, $v0 +j TB_Boucle20 +# end TB_Boucle diff --git a/tests/clight/testTB_boucle.Clight.expected b/tests/clight/testTB_boucle.Clight.expected new file mode 100644 index 0000000..96ecfe8 --- /dev/null +++ b/tests/clight/testTB_boucle.Clight.expected @@ -0,0 +1,298 @@ +int t1[5] = { 1, 2, 3, 5, 8, }; + +int t2[5] = { 13, 21, 34, 55, 89, }; + +extern void *__builtin___memcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memmove_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___mempcpy_chk(void *, void *, unsigned int, unsigned int); + +extern void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); + +extern unsigned char *__builtin___stpcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcat_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strcpy_chk(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin___strncat_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern unsigned char *__builtin___strncpy_chk(unsigned char *, unsigned char *, unsigned int, unsigned int); + +extern int __builtin___vfprintf_chk(void *, int, unsigned char *, void *); + +extern int __builtin___vprintf_chk(int, unsigned char *, void *); + +extern int __builtin___vsnprintf_chk(unsigned char *, unsigned int, int, unsigned int, unsigned char *, void *); + +extern int __builtin___vsprintf_chk(unsigned char *, int, unsigned int, unsigned char *, void *); + +extern double __builtin_acos(double); + +extern float __builtin_acosf(float); + +extern double __builtin_acosl(double); + +extern void *__builtin_alloca(unsigned int); + +extern double __builtin_asin(double); + +extern float __builtin_asinf(float); + +extern double __builtin_asinl(double); + +extern double __builtin_atan(double); + +extern float __builtin_atanf(float); + +extern double __builtin_atanl(double); + +extern double __builtin_atan2(double, double); + +extern float __builtin_atan2f(float, float); + +extern double __builtin_atan2l(double, double); + +extern double __builtin_ceil(double); + +extern float __builtin_ceilf(float); + +extern double __builtin_ceill(double); + +extern double __builtin_cos(double); + +extern float __builtin_cosf(float); + +extern double __builtin_cosl(double); + +extern double __builtin_cosh(double); + +extern float __builtin_coshf(float); + +extern double __builtin_coshl(double); + +extern int __builtin_clz(unsigned int); + +extern int __builtin_clzl(unsigned int); + +extern int __builtin_clzll(unsigned int); + +extern int __builtin_constant_p(int); + +extern int __builtin_ctz(unsigned int); + +extern int __builtin_ctzl(unsigned int); + +extern int __builtin_ctzll(unsigned int); + +extern double __builtin_exp(double); + +extern float __builtin_expf(float); + +extern double __builtin_expl(double); + +extern int __builtin_expect(int, int); + +extern double __builtin_fabs(double); + +extern float __builtin_fabsf(float); + +extern double __builtin_fabsl(double); + +extern int __builtin_ffs(unsigned int); + +extern int __builtin_ffsl(unsigned int); + +extern int __builtin_ffsll(unsigned int); + +extern void *__builtin_frame_address(unsigned int); + +extern double __builtin_floor(double); + +extern float __builtin_floorf(float); + +extern double __builtin_floorl(double); + +extern double __builtin_huge_val(void); + +extern float __builtin_huge_valf(void); + +extern double __builtin_huge_vall(void); + +extern double __builtin_inf(void); + +extern float __builtin_inff(void); + +extern double __builtin_infl(void); + +extern void *__builtin_memcpy(void *, void *, unsigned int); + +extern void *__builtin_mempcpy(void *, void *, unsigned int); + +extern double __builtin_fmod(double); + +extern float __builtin_fmodf(float); + +extern double __builtin_fmodl(double); + +extern double __builtin_frexp(double, int *); + +extern float __builtin_frexpf(float, int *); + +extern double __builtin_frexpl(double, int *); + +extern double __builtin_ldexp(double, int); + +extern float __builtin_ldexpf(float, int); + +extern double __builtin_ldexpl(double, int); + +extern double __builtin_log(double); + +extern float __builtin_logf(float); + +extern double __builtin_logl(double); + +extern double __builtin_log10(double); + +extern float __builtin_log10f(float); + +extern double __builtin_log10l(double); + +extern float __builtin_modff(float, float *); + +extern double __builtin_modfl(double, double *); + +extern double __builtin_nan(unsigned char *); + +extern float __builtin_nanf(unsigned char *); + +extern double __builtin_nanl(unsigned char *); + +extern double __builtin_nans(unsigned char *); + +extern float __builtin_nansf(unsigned char *); + +extern double __builtin_nansl(unsigned char *); + +extern void *__builtin_next_arg(void); + +extern unsigned int __builtin_object_size(void *, int); + +extern int __builtin_parity(unsigned int); + +extern int __builtin_parityl(unsigned int); + +extern int __builtin_parityll(unsigned int); + +extern int __builtin_popcount(unsigned int); + +extern int __builtin_popcountl(unsigned int); + +extern int __builtin_popcountll(unsigned int); + +extern double __builtin_powi(double, int); + +extern float __builtin_powif(float, int); + +extern double __builtin_powil(double, int); + +extern void __builtin_return(void *); + +extern void *__builtin_return_address(unsigned int); + +extern double __builtin_sin(double); + +extern float __builtin_sinf(float); + +extern double __builtin_sinl(double); + +extern double __builtin_sinh(double); + +extern float __builtin_sinhf(float); + +extern double __builtin_sinhl(double); + +extern double __builtin_sqrt(double); + +extern float __builtin_sqrtf(float); + +extern double __builtin_sqrtl(double); + +extern unsigned char *__builtin_stpcpy(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strchr(unsigned char *, unsigned char); + +extern int __builtin_strcmp(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strcpy(unsigned char *, unsigned char *); + +extern unsigned int __builtin_strcspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strncat(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strncmp(unsigned char *, unsigned char *, unsigned int); + +extern unsigned char *__builtin_strncpy(unsigned char *, unsigned char *, unsigned int); + +extern int __builtin_strspn(unsigned char *, unsigned char *); + +extern unsigned char *__builtin_strpbrk(unsigned char *, unsigned char *); + +extern int __builtin_types_compatible_p(unsigned int, unsigned int); + +extern double __builtin_tan(double); + +extern float __builtin_tanf(float); + +extern double __builtin_tanl(double); + +extern double __builtin_tanh(double); + +extern float __builtin_tanhf(float); + +extern double __builtin_tanhl(double); + +extern void __builtin_va_end(void *); + +extern void __builtin_varargs_start(void *); + +extern void __builtin_va_start(void *, void *); + +extern void __builtin_stdarg_start(void *); + +extern void __builtin_va_arg(void *, unsigned int); + +extern void __builtin_va_copy(void *, void *); + +void TB_Boucle(int *tabEntree1, int *tabEntree2, int *tabSortie, int size) +{ + int i; + c4: + for (({ c3: i = 0; }); (/* c2 */ i < size); ({ c1: i = i + 1; })) { + c0: + tabSortie[i] = tabEntree1[i] + tabEntree2[i]; + } +} + +int main(void) +{ + int out[5]; + c11: + out[0] = 0; + c10: + out[1] = 0; + c9: + out[2] = 0; + c8: + out[3] = 0; + c7: + out[4] = 0; + c6: + TB_Boucle(t1, t2, out, 5); + c5: + return out[4]; +} + + diff --git a/tests/clight/testTB_boucle.Cminor.expected b/tests/clight/testTB_boucle.Cminor.expected new file mode 100644 index 0000000..88d1e4e --- /dev/null +++ b/tests/clight/testTB_boucle.Cminor.expected @@ -0,0 +1,451 @@ + +var "t1" {1, 2, 3, 5, 8} +var "t2" {13, 21, 34, 55, 89} + + +extern "__builtin___memcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memmove_chk" : int -> int -> int -> int -> int + + +extern "__builtin___mempcpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___memset_chk" : int -> int -> int -> int -> int + + +extern "__builtin___stpcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strcat_chk" : int -> int -> int -> int + + +extern "__builtin___strcpy_chk" : int -> int -> int -> int + + +extern "__builtin___strncat_chk" : int -> int -> int -> int -> int + + +extern "__builtin___strncpy_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vfprintf_chk" : int -> int -> int -> int -> int + + +extern "__builtin___vprintf_chk" : int -> int -> int -> int + + +extern "__builtin___vsnprintf_chk" : int -> int -> int -> int -> int -> int -> int + + +extern "__builtin___vsprintf_chk" : int -> int -> int -> int -> int -> int + + +extern "__builtin_acos" : float -> float + + +extern "__builtin_acosf" : float -> float + + +extern "__builtin_acosl" : float -> float + + +extern "__builtin_alloca" : int -> int + + +extern "__builtin_asin" : float -> float + + +extern "__builtin_asinf" : float -> float + + +extern "__builtin_asinl" : float -> float + + +extern "__builtin_atan" : float -> float + + +extern "__builtin_atanf" : float -> float + + +extern "__builtin_atanl" : float -> float + + +extern "__builtin_atan2" : float -> float -> float + + +extern "__builtin_atan2f" : float -> float -> float + + +extern "__builtin_atan2l" : float -> float -> float + + +extern "__builtin_ceil" : float -> float + + +extern "__builtin_ceilf" : float -> float + + +extern "__builtin_ceill" : float -> float + + +extern "__builtin_cos" : float -> float + + +extern "__builtin_cosf" : float -> float + + +extern "__builtin_cosl" : float -> float + + +extern "__builtin_cosh" : float -> float + + +extern "__builtin_coshf" : float -> float + + +extern "__builtin_coshl" : float -> float + + +extern "__builtin_clz" : int -> int + + +extern "__builtin_clzl" : int -> int + + +extern "__builtin_clzll" : int -> int + + +extern "__builtin_constant_p" : int -> int + + +extern "__builtin_ctz" : int -> int + + +extern "__builtin_ctzl" : int -> int + + +extern "__builtin_ctzll" : int -> int + + +extern "__builtin_exp" : float -> float + + +extern "__builtin_expf" : float -> float + + +extern "__builtin_expl" : float -> float + + +extern "__builtin_expect" : int -> int -> int + + +extern "__builtin_fabs" : float -> float + + +extern "__builtin_fabsf" : float -> float + + +extern "__builtin_fabsl" : float -> float + + +extern "__builtin_ffs" : int -> int + + +extern "__builtin_ffsl" : int -> int + + +extern "__builtin_ffsll" : int -> int + + +extern "__builtin_frame_address" : int -> int + + +extern "__builtin_floor" : float -> float + + +extern "__builtin_floorf" : float -> float + + +extern "__builtin_floorl" : float -> float + + +extern "__builtin_huge_val" : float + + +extern "__builtin_huge_valf" : float + + +extern "__builtin_huge_vall" : float + + +extern "__builtin_inf" : float + + +extern "__builtin_inff" : float + + +extern "__builtin_infl" : float + + +extern "__builtin_memcpy" : int -> int -> int -> int + + +extern "__builtin_mempcpy" : int -> int -> int -> int + + +extern "__builtin_fmod" : float -> float + + +extern "__builtin_fmodf" : float -> float + + +extern "__builtin_fmodl" : float -> float + + +extern "__builtin_frexp" : float -> int -> float + + +extern "__builtin_frexpf" : float -> int -> float + + +extern "__builtin_frexpl" : float -> int -> float + + +extern "__builtin_ldexp" : float -> int -> float + + +extern "__builtin_ldexpf" : float -> int -> float + + +extern "__builtin_ldexpl" : float -> int -> float + + +extern "__builtin_log" : float -> float + + +extern "__builtin_logf" : float -> float + + +extern "__builtin_logl" : float -> float + + +extern "__builtin_log10" : float -> float + + +extern "__builtin_log10f" : float -> float + + +extern "__builtin_log10l" : float -> float + + +extern "__builtin_modff" : float -> int -> float + + +extern "__builtin_modfl" : float -> int -> float + + +extern "__builtin_nan" : int -> float + + +extern "__builtin_nanf" : int -> float + + +extern "__builtin_nanl" : int -> float + + +extern "__builtin_nans" : int -> float + + +extern "__builtin_nansf" : int -> float + + +extern "__builtin_nansl" : int -> float + + +extern "__builtin_next_arg" : int + + +extern "__builtin_object_size" : int -> int -> int + + +extern "__builtin_parity" : int -> int + + +extern "__builtin_parityl" : int -> int + + +extern "__builtin_parityll" : int -> int + + +extern "__builtin_popcount" : int -> int + + +extern "__builtin_popcountl" : int -> int + + +extern "__builtin_popcountll" : int -> int + + +extern "__builtin_powi" : float -> int -> float + + +extern "__builtin_powif" : float -> int -> float + + +extern "__builtin_powil" : float -> int -> float + + +extern "__builtin_return" : int -> void + + +extern "__builtin_return_address" : int -> int + + +extern "__builtin_sin" : float -> float + + +extern "__builtin_sinf" : float -> float + + +extern "__builtin_sinl" : float -> float + + +extern "__builtin_sinh" : float -> float + + +extern "__builtin_sinhf" : float -> float + + +extern "__builtin_sinhl" : float -> float + + +extern "__builtin_sqrt" : float -> float + + +extern "__builtin_sqrtf" : float -> float + + +extern "__builtin_sqrtl" : float -> float + + +extern "__builtin_stpcpy" : int -> int -> int + + +extern "__builtin_strchr" : int -> int -> int + + +extern "__builtin_strcmp" : int -> int -> int + + +extern "__builtin_strcpy" : int -> int -> int + + +extern "__builtin_strcspn" : int -> int -> int + + +extern "__builtin_strncat" : int -> int -> int -> int + + +extern "__builtin_strncmp" : int -> int -> int -> int + + +extern "__builtin_strncpy" : int -> int -> int -> int + + +extern "__builtin_strspn" : int -> int -> int + + +extern "__builtin_strpbrk" : int -> int -> int + + +extern "__builtin_types_compatible_p" : int -> int -> int + + +extern "__builtin_tan" : float -> float + + +extern "__builtin_tanf" : float -> float + + +extern "__builtin_tanl" : float -> float + + +extern "__builtin_tanh" : float -> float + + +extern "__builtin_tanhf" : float -> float + + +extern "__builtin_tanhl" : float -> float + + +extern "__builtin_va_end" : int -> void + + +extern "__builtin_varargs_start" : int -> void + + +extern "__builtin_va_start" : int -> int -> void + + +extern "__builtin_stdarg_start" : int -> void + + +extern "__builtin_va_arg" : int -> int -> void + + +extern "__builtin_va_copy" : int -> int -> void + + +"TB_Boucle" (tabEntree1, tabEntree2, tabSortie, size) : int -> int -> int -> int -> void { + + stack 0; + + var i; + + c4: + c3: + i = 0; + block { + loop { + if (!(/* c2 */ i < size)) { + exit 0; + } + else { + } + block { + c0: + int32[tabSortie + (i * 4)] = int32[tabEntree1 + (i * 4)] + int32[tabEntree2 + (i * 4)]; + } + c1: + i = i + 1; + } + } + +} + + +"main" () : int { + + stack 20; + + c11: + int32[&0 + (0 * 4)] = 0; + c10: + int32[&0 + (1 * 4)] = 0; + c9: + int32[&0 + (2 * 4)] = 0; + c8: + int32[&0 + (3 * 4)] = 0; + c7: + int32[&0 + (4 * 4)] = 0; + c6: + "TB_Boucle"("t1", "t2", &0, 5) : int -> int -> int -> int -> void; + c5: + return int32[&0 + (4 * 4)]; + +} + + diff --git a/tests/clight/testTB_boucle.ERTL.expected b/tests/clight/testTB_boucle.ERTL.expected new file mode 100644 index 0000000..a24e2a5 --- /dev/null +++ b/tests/clight/testTB_boucle.ERTL.expected @@ -0,0 +1,688 @@ +program + +globals 40 + +procedure _main(0) +stacksize 20 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61, %62, + %63, %64, %65, %66, %67, %68, %69, + %70 +entry main155 +main155: newframe --> main154 +main154: move %70, $ra --> main153 +main153: move %69, $s7 --> main152 +main152: move %68, $s6 --> main151 +main151: move %67, $s5 --> main150 +main150: move %66, $s4 --> main149 +main149: move %65, $s3 --> main148 +main148: move %64, $s2 --> main147 +main147: move %63, $s1 --> main146 +main146: move %62, $s0 --> main145 +main145: li %1, 0 --> main144 +main144: li %2, 0 --> main143 +main143: li %3, 0 --> main142 +main142: li %4, 0 --> main141 +main141: li %5, 0 --> main140 +main140: li %6, 0 --> main139 +main139: li %7, 0 --> main138 +main138: li %8, 0 --> main137 +main137: li %9, 0 --> main136 +main136: li %10, 0 --> main135 +main135: li %11, 0 --> main134 +main134: li %12, 0 --> main133 +main133: li %13, 0 --> main132 +main132: li %14, 0 --> main131 +main131: li %15, 0 --> main130 +main130: li %16, 0 --> main129 +main129: li %17, 0 --> main128 +main128: li %18, 0 --> main127 +main127: li %19, 0 --> main126 +main126: li %20, 0 --> main125 +main125: li %21, 0 --> main124 +main124: li %22, 0 --> main123 +main123: li %23, 0 --> main122 +main122: li %24, 0 --> main121 +main121: li %25, 0 --> main120 +main120: li %26, 0 --> main119 +main119: li %27, 0 --> main118 +main118: li %28, 0 --> main117 +main117: li %29, 0 --> main116 +main116: li %30, 0 --> main115 +main115: li %31, 0 --> main114 +main114: li %32, 0 --> main113 +main113: li %33, 0 --> main112 +main112: li %34, 0 --> main111 +main111: li %35, 0 --> main110 +main110: li %36, 0 --> main109 +main109: li %37, 0 --> main108 +main108: li %38, 0 --> main107 +main107: li %39, 0 --> main106 +main106: li %40, 0 --> main105 +main105: li %41, 0 --> main104 +main104: li %42, 0 --> main103 +main103: li %43, 0 --> main102 +main102: li %44, 0 --> main101 +main101: li %45, 0 --> main100 +main100: li %46, 0 --> main99 +main99 : li %47, 0 --> main98 +main98 : li %48, 0 --> main97 +main97 : li %49, 0 --> main96 +main96 : li %50, 0 --> main95 +main95 : li %51, 0 --> main94 +main94 : li %52, 0 --> main93 +main93 : li %53, 0 --> main92 +main92 : li %54, 0 --> main91 +main91 : li %55, 0 --> main90 +main90 : li %56, 0 --> main89 +main89 : li %57, 0 --> main88 +main88 : li %58, 0 --> main87 +main87 : li %59, 0 --> main86 +main86 : li %60, 0 --> main85 +main85 : li %61, 0 --> main67 +main67 : li %44, 1 --> main66 +main66 : move %60, $gp --> main185 +main185: move %60, %60 --> main83 +main83 : sw %44, 0(%60) --> main65 +main65 : li %43, 2 --> main64 +main64 : move %59, $gp --> main184 +main184: move %59, %59 --> main82 +main82 : sw %43, 4(%59) --> main63 +main63 : li %42, 3 --> main62 +main62 : move %58, $gp --> main183 +main183: move %58, %58 --> main81 +main81 : sw %42, 8(%58) --> main61 +main61 : li %41, 5 --> main60 +main60 : move %57, $gp --> main182 +main182: move %57, %57 --> main80 +main80 : sw %41, 12(%57) --> main59 +main59 : li %40, 8 --> main58 +main58 : move %56, $gp --> main181 +main181: move %56, %56 --> main79 +main79 : sw %40, 16(%56) --> main57 +main57 : li %39, 13 --> main56 +main56 : move %55, $gp --> main180 +main180: move %55, %55 --> main78 +main78 : sw %39, 20(%55) --> main55 +main55 : li %38, 21 --> main54 +main54 : move %54, $gp --> main179 +main179: move %54, %54 --> main77 +main77 : sw %38, 24(%54) --> main53 +main53 : li %37, 34 --> main52 +main52 : move %53, $gp --> main178 +main178: move %53, %53 --> main76 +main76 : sw %37, 28(%53) --> main51 +main51 : li %36, 55 --> main50 +main50 : move %52, $gp --> main177 +main177: move %52, %52 --> main75 +main75 : sw %36, 32(%52) --> main49 +main49 : li %35, 89 --> main48 +main48 : move %51, $gp --> main175 +main175: move %51, %51 --> main74 +main74 : sw %35, 36(%51) --> main47 +main47 : emit c11 --> main46 +main46 : li %30, 0 --> main45 +main45 : move %31, $sp --> main174 +main174: move %31, %31 --> main44 +main44 : li %33, 0 --> main43 +main43 : li %34, 4 --> main42 +main42 : mulo %32, %33, %34 --> main41 +main41 : add %50, %31, %32 --> main73 +main73 : sw %30, 0(%50) --> main40 +main40 : emit c10 --> main39 +main39 : li %25, 0 --> main38 +main38 : move %26, $sp --> main173 +main173: move %26, %26 --> main37 +main37 : li %28, 1 --> main36 +main36 : li %29, 4 --> main35 +main35 : mulo %27, %28, %29 --> main34 +main34 : add %49, %26, %27 --> main72 +main72 : sw %25, 0(%49) --> main33 +main33 : emit c9 --> main32 +main32 : li %20, 0 --> main31 +main31 : move %21, $sp --> main172 +main172: move %21, %21 --> main30 +main30 : li %23, 2 --> main29 +main29 : li %24, 4 --> main28 +main28 : mulo %22, %23, %24 --> main27 +main27 : add %48, %21, %22 --> main71 +main71 : sw %20, 0(%48) --> main26 +main26 : emit c8 --> main25 +main25 : li %15, 0 --> main24 +main24 : move %16, $sp --> main171 +main171: move %16, %16 --> main23 +main23 : li %18, 3 --> main22 +main22 : li %19, 4 --> main21 +main21 : mulo %17, %18, %19 --> main20 +main20 : add %47, %16, %17 --> main70 +main70 : sw %15, 0(%47) --> main19 +main19 : emit c7 --> main18 +main18 : li %10, 0 --> main17 +main17 : move %11, $sp --> main170 +main170: move %11, %11 --> main16 +main16 : li %13, 4 --> main15 +main15 : li %14, 4 --> main14 +main14 : mulo %12, %13, %14 --> main13 +main13 : add %46, %11, %12 --> main69 +main69 : sw %10, 0(%46) --> main12 +main12 : emit c6 --> main11 +main11 : move %5, $gp --> main169 +main169: move %5, %5 --> main10 +main10 : move %6, $gp --> main168 +main168: addi %6, %6, 20 --> main9 +main9 : move %7, $sp --> main192 +main192: move %7, %7 --> main8 +main8 : li %8, 5 --> main7 +main7 : la %61, TB_Boucle --> main84 +main84 : j --> main191 +main191: move $a0, %5 --> main190 +main190: move $a1, %6 --> main189 +main189: move $a2, %7 --> main188 +main188: move $a3, %8 --> main187 +main187: call %61(4) --> main186 +main186: move %9, $v0 --> main6 +main6 : emit c5 --> main5 +main5 : move %1, $sp --> main176 +main176: move %1, %1 --> main4 +main4 : li %3, 4 --> main3 +main3 : li %4, 4 --> main2 +main2 : mulo %2, %3, %4 --> main1 +main1 : add %45, %1, %2 --> main68 +main68 : lw %0, 0(%45) --> main0 +main0 : j --> main167 +main167: move $v0, %0 --> main166 +main166: move $ra, %70 --> main165 +main165: move $s7, %69 --> main164 +main164: move $s6, %68 --> main163 +main163: move $s5, %67 --> main162 +main162: move $s4, %66 --> main161 +main161: move $s3, %65 --> main160 +main160: move $s2, %64 --> main159 +main159: move $s1, %63 --> main158 +main158: move $s0, %62 --> main157 +main157: delframe --> main156 +main156: jr $ra (xmits $v0) + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + +procedure TB_Boucle(4) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30 +entry TB_Boucle59 +TB_Boucle59: newframe --> TB_Boucle58 +TB_Boucle58: move %30, $ra --> TB_Boucle57 +TB_Boucle57: move %29, $s7 --> TB_Boucle56 +TB_Boucle56: move %28, $s6 --> TB_Boucle55 +TB_Boucle55: move %27, $s5 --> TB_Boucle54 +TB_Boucle54: move %26, $s4 --> TB_Boucle53 +TB_Boucle53: move %25, $s3 --> TB_Boucle52 +TB_Boucle52: move %24, $s2 --> TB_Boucle51 +TB_Boucle51: move %23, $s1 --> TB_Boucle50 +TB_Boucle50: move %22, $s0 --> TB_Boucle49 +TB_Boucle49: move %0, $a0 --> TB_Boucle48 +TB_Boucle48: move %1, $a1 --> TB_Boucle47 +TB_Boucle47: move %2, $a2 --> TB_Boucle46 +TB_Boucle46: move %3, $a3 --> TB_Boucle45 +TB_Boucle45: li %4, 0 --> TB_Boucle44 +TB_Boucle44: li %5, 0 --> TB_Boucle43 +TB_Boucle43: li %6, 0 --> TB_Boucle42 +TB_Boucle42: li %7, 0 --> TB_Boucle41 +TB_Boucle41: li %8, 0 --> TB_Boucle40 +TB_Boucle40: li %9, 0 --> TB_Boucle39 +TB_Boucle39: li %10, 0 --> TB_Boucle38 +TB_Boucle38: li %11, 0 --> TB_Boucle37 +TB_Boucle37: li %12, 0 --> TB_Boucle36 +TB_Boucle36: li %13, 0 --> TB_Boucle35 +TB_Boucle35: li %14, 0 --> TB_Boucle34 +TB_Boucle34: li %15, 0 --> TB_Boucle33 +TB_Boucle33: li %16, 0 --> TB_Boucle32 +TB_Boucle32: li %17, 0 --> TB_Boucle31 +TB_Boucle31: li %18, 0 --> TB_Boucle30 +TB_Boucle30: li %19, 0 --> TB_Boucle29 +TB_Boucle29: li %20, 0 --> TB_Boucle28 +TB_Boucle28: li %21, 0 --> TB_Boucle23 +TB_Boucle23: emit c4 --> TB_Boucle22 +TB_Boucle22: emit c3 --> TB_Boucle21 +TB_Boucle21: li %4, 0 --> TB_Boucle1 +TB_Boucle1 : j --> TB_Boucle20 +TB_Boucle20: li %16, 0 --> TB_Boucle19 +TB_Boucle19: emit c2 --> TB_Boucle18 +TB_Boucle18: slt %17, %4, %3 --> TB_Boucle17 +TB_Boucle17: li %19, 0 --> TB_Boucle25 +TB_Boucle25: seq %15, %17, %19 --> TB_Boucle16 +TB_Boucle16: beq %15, %16 --> TB_Boucle15, TB_Boucle0 +TB_Boucle0 : j --> TB_Boucle70 +TB_Boucle70: move $ra, %30 --> TB_Boucle69 +TB_Boucle69: move $s7, %29 --> TB_Boucle68 +TB_Boucle68: move $s6, %28 --> TB_Boucle67 +TB_Boucle67: move $s5, %27 --> TB_Boucle66 +TB_Boucle66: move $s4, %26 --> TB_Boucle65 +TB_Boucle65: move $s3, %25 --> TB_Boucle64 +TB_Boucle64: move $s2, %24 --> TB_Boucle63 +TB_Boucle63: move $s1, %23 --> TB_Boucle62 +TB_Boucle62: move $s0, %22 --> TB_Boucle61 +TB_Boucle61: delframe --> TB_Boucle60 +TB_Boucle60: jr $ra +TB_Boucle15: emit c0 --> TB_Boucle14 +TB_Boucle14: li %14, 4 --> TB_Boucle13 +TB_Boucle13: mulo %13, %4, %14 --> TB_Boucle12 +TB_Boucle12: add %18, %0, %13 --> TB_Boucle24 +TB_Boucle24: lw %9, 0(%18) --> TB_Boucle11 +TB_Boucle11: li %12, 4 --> TB_Boucle10 +TB_Boucle10: mulo %11, %4, %12 --> TB_Boucle9 +TB_Boucle9 : add %21, %1, %11 --> TB_Boucle27 +TB_Boucle27: lw %10, 0(%21) --> TB_Boucle8 +TB_Boucle8 : add %6, %9, %10 --> TB_Boucle7 +TB_Boucle7 : li %8, 4 --> TB_Boucle6 +TB_Boucle6 : mulo %7, %4, %8 --> TB_Boucle5 +TB_Boucle5 : add %20, %2, %7 --> TB_Boucle26 +TB_Boucle26: sw %6, 0(%20) --> TB_Boucle4 +TB_Boucle4 : emit c1 --> TB_Boucle3 +TB_Boucle3 : li %5, 1 --> TB_Boucle2 +TB_Boucle2 : add %4, %4, %5 --> TB_Boucle1 + diff --git a/tests/clight/testTB_boucle.LIN.expected b/tests/clight/testTB_boucle.LIN.expected new file mode 100644 index 0000000..c2acc22 --- /dev/null +++ b/tests/clight/testTB_boucle.LIN.expected @@ -0,0 +1,523 @@ +program + +globals 40 + +procedure _main(0) +var 24 +main155: +newframe +sw $ra, 20($sp) +li $a0, 1 +move $v0, $gp +sw $a0, 0($v0) +li $a0, 2 +move $v0, $gp +sw $a0, 4($v0) +li $a0, 3 +move $v0, $gp +sw $a0, 8($v0) +li $a0, 5 +move $v0, $gp +sw $a0, 12($v0) +li $a0, 8 +move $v0, $gp +sw $a0, 16($v0) +li $a0, 13 +move $v0, $gp +sw $a0, 20($v0) +li $a0, 21 +move $v0, $gp +sw $a0, 24($v0) +li $a0, 34 +move $v0, $gp +sw $a0, 28($v0) +li $a0, 55 +move $v0, $gp +sw $a0, 32($v0) +li $a0, 89 +move $v0, $gp +sw $a0, 36($v0) +c11: +li $a1, 0 +move $a0, $sp +li $v0, 4 +mulo $v0, $zero, $v0 +add $v0, $a0, $v0 +sw $a1, 0($v0) +c10: +move $a1, $sp +li $a0, 1 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c9: +move $a1, $sp +li $a0, 2 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c8: +move $a1, $sp +li $a0, 3 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c7: +move $a1, $sp +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $a1, $v0 +sw $zero, 0($v0) +c6: +move $a0, $gp +move $a1, $gp +addi $a1, $a1, 20 +move $a2, $sp +li $a3, 5 +la $v0, TB_Boucle +call $v0 +c5: +li $a0, 4 +li $v0, 4 +mulo $v0, $a0, $v0 +add $v0, $sp, $v0 +lw $v0, 0($v0) +lw $ra, 20($sp) +delframe +jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + +procedure TB_Boucle(4) +var 0 +TB_Boucle59: +newframe +c4: +c3: +li $t0, 0 +TB_Boucle20: +li $t1, 0 +c2: +slt $v0, $t0, $a3 +seq $v0, $v0, $zero +beq $v0, $t1, TB_Boucle15 +delframe +jr $ra +TB_Boucle15: +c0: +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a0, $v0 +lw $t1, 0($v0) +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a1, $v0 +lw $v0, 0($v0) +add $t1, $t1, $v0 +li $v0, 4 +mulo $v0, $t0, $v0 +add $v0, $a2, $v0 +sw $t1, 0($v0) +c1: +li $v0, 1 +add $t0, $t0, $v0 +j TB_Boucle20 + diff --git a/tests/clight/testTB_boucle.LTL.expected b/tests/clight/testTB_boucle.LTL.expected new file mode 100644 index 0000000..f5358f1 --- /dev/null +++ b/tests/clight/testTB_boucle.LTL.expected @@ -0,0 +1,672 @@ +program + +globals 40 + +procedure _main(0) +var 24 +entry main155 +main155: newframe --> main154 +main154: lw $ra, 20($sp) --> main153 +main153: j --> main152 +main152: j --> main151 +main151: j --> main150 +main150: j --> main149 +main149: j --> main148 +main148: j --> main147 +main147: j --> main146 +main146: j --> main145 +main145: j --> main144 +main144: j --> main143 +main143: j --> main142 +main142: j --> main141 +main141: j --> main140 +main140: j --> main139 +main139: j --> main138 +main138: j --> main137 +main137: j --> main136 +main136: j --> main135 +main135: j --> main134 +main134: j --> main133 +main133: j --> main132 +main132: j --> main131 +main131: j --> main130 +main130: j --> main129 +main129: j --> main128 +main128: j --> main127 +main127: j --> main126 +main126: j --> main125 +main125: j --> main124 +main124: j --> main123 +main123: j --> main122 +main122: j --> main121 +main121: j --> main120 +main120: j --> main119 +main119: j --> main118 +main118: j --> main117 +main117: j --> main116 +main116: j --> main115 +main115: j --> main114 +main114: j --> main113 +main113: j --> main112 +main112: j --> main111 +main111: j --> main110 +main110: j --> main109 +main109: j --> main108 +main108: j --> main107 +main107: j --> main106 +main106: j --> main105 +main105: j --> main104 +main104: j --> main103 +main103: j --> main102 +main102: j --> main101 +main101: j --> main100 +main100: j --> main99 +main99 : j --> main98 +main98 : j --> main97 +main97 : j --> main96 +main96 : j --> main95 +main95 : j --> main94 +main94 : j --> main93 +main93 : j --> main92 +main92 : j --> main91 +main91 : j --> main90 +main90 : j --> main89 +main89 : j --> main88 +main88 : j --> main87 +main87 : j --> main86 +main86 : j --> main85 +main85 : j --> main67 +main67 : li $a0, 1 --> main66 +main66 : move $v0, $gp --> main185 +main185: j --> main83 +main83 : lw $a0, 0($v0) --> main65 +main65 : li $a0, 2 --> main64 +main64 : move $v0, $gp --> main184 +main184: j --> main82 +main82 : lw $a0, 4($v0) --> main63 +main63 : li $a0, 3 --> main62 +main62 : move $v0, $gp --> main183 +main183: j --> main81 +main81 : lw $a0, 8($v0) --> main61 +main61 : li $a0, 5 --> main60 +main60 : move $v0, $gp --> main182 +main182: j --> main80 +main80 : lw $a0, 12($v0) --> main59 +main59 : li $a0, 8 --> main58 +main58 : move $v0, $gp --> main181 +main181: j --> main79 +main79 : lw $a0, 16($v0) --> main57 +main57 : li $a0, 13 --> main56 +main56 : move $v0, $gp --> main180 +main180: j --> main78 +main78 : lw $a0, 20($v0) --> main55 +main55 : li $a0, 21 --> main54 +main54 : move $v0, $gp --> main179 +main179: j --> main77 +main77 : lw $a0, 24($v0) --> main53 +main53 : li $a0, 34 --> main52 +main52 : move $v0, $gp --> main178 +main178: j --> main76 +main76 : lw $a0, 28($v0) --> main51 +main51 : li $a0, 55 --> main50 +main50 : move $v0, $gp --> main177 +main177: j --> main75 +main75 : lw $a0, 32($v0) --> main49 +main49 : li $a0, 89 --> main48 +main48 : move $v0, $gp --> main175 +main175: j --> main74 +main74 : lw $a0, 36($v0) --> main47 +main47 : emit c11 --> main46 +main46 : li $a1, 0 --> main45 +main45 : move $a0, $sp --> main174 +main174: j --> main44 +main44 : j --> main43 +main43 : li $v0, 4 --> main42 +main42 : mulo $v0, $zero, $v0 --> main41 +main41 : add $v0, $a0, $v0 --> main73 +main73 : lw $a1, 0($v0) --> main40 +main40 : emit c10 --> main39 +main39 : j --> main38 +main38 : move $a1, $sp --> main173 +main173: j --> main37 +main37 : li $a0, 1 --> main36 +main36 : li $v0, 4 --> main35 +main35 : mulo $v0, $a0, $v0 --> main34 +main34 : add $v0, $a1, $v0 --> main72 +main72 : lw $zero, 0($v0) --> main33 +main33 : emit c9 --> main32 +main32 : j --> main31 +main31 : move $a1, $sp --> main172 +main172: j --> main30 +main30 : li $a0, 2 --> main29 +main29 : li $v0, 4 --> main28 +main28 : mulo $v0, $a0, $v0 --> main27 +main27 : add $v0, $a1, $v0 --> main71 +main71 : lw $zero, 0($v0) --> main26 +main26 : emit c8 --> main25 +main25 : j --> main24 +main24 : move $a1, $sp --> main171 +main171: j --> main23 +main23 : li $a0, 3 --> main22 +main22 : li $v0, 4 --> main21 +main21 : mulo $v0, $a0, $v0 --> main20 +main20 : add $v0, $a1, $v0 --> main70 +main70 : lw $zero, 0($v0) --> main19 +main19 : emit c7 --> main18 +main18 : j --> main17 +main17 : move $a1, $sp --> main170 +main170: j --> main16 +main16 : li $a0, 4 --> main15 +main15 : li $v0, 4 --> main14 +main14 : mulo $v0, $a0, $v0 --> main13 +main13 : add $v0, $a1, $v0 --> main69 +main69 : lw $zero, 0($v0) --> main12 +main12 : emit c6 --> main11 +main11 : move $a0, $gp --> main169 +main169: j --> main10 +main10 : move $a1, $gp --> main168 +main168: addi $a1, $a1, 20 --> main9 +main9 : move $a2, $sp --> main192 +main192: j --> main8 +main8 : li $a3, 5 --> main7 +main7 : la $v0, TB_Boucle --> main84 +main84 : j --> main191 +main191: j --> main190 +main190: j --> main189 +main189: j --> main188 +main188: j --> main187 +main187: call $v0 --> main186 +main186: j --> main6 +main6 : emit c5 --> main5 +main5 : j --> main176 +main176: j --> main4 +main4 : li $a0, 4 --> main3 +main3 : li $v0, 4 --> main2 +main2 : mulo $v0, $a0, $v0 --> main1 +main1 : add $v0, $sp, $v0 --> main68 +main68 : lw $v0, 0($v0) --> main0 +main0 : j --> main167 +main167: j --> main166 +main166: lw $ra, 20($sp) --> main165 +main165: j --> main164 +main164: j --> main163 +main163: j --> main162 +main162: j --> main161 +main161: j --> main160 +main160: j --> main159 +main159: j --> main158 +main158: j --> main157 +main157: delframe --> main156 +main156: jr $ra + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + +procedure TB_Boucle(4) +var 0 +entry TB_Boucle59 +TB_Boucle59: newframe --> TB_Boucle58 +TB_Boucle58: j --> TB_Boucle57 +TB_Boucle57: j --> TB_Boucle56 +TB_Boucle56: j --> TB_Boucle55 +TB_Boucle55: j --> TB_Boucle54 +TB_Boucle54: j --> TB_Boucle53 +TB_Boucle53: j --> TB_Boucle52 +TB_Boucle52: j --> TB_Boucle51 +TB_Boucle51: j --> TB_Boucle50 +TB_Boucle50: j --> TB_Boucle49 +TB_Boucle49: j --> TB_Boucle48 +TB_Boucle48: j --> TB_Boucle47 +TB_Boucle47: j --> TB_Boucle46 +TB_Boucle46: j --> TB_Boucle45 +TB_Boucle45: j --> TB_Boucle44 +TB_Boucle44: j --> TB_Boucle43 +TB_Boucle43: j --> TB_Boucle42 +TB_Boucle42: j --> TB_Boucle41 +TB_Boucle41: j --> TB_Boucle40 +TB_Boucle40: j --> TB_Boucle39 +TB_Boucle39: j --> TB_Boucle38 +TB_Boucle38: j --> TB_Boucle37 +TB_Boucle37: j --> TB_Boucle36 +TB_Boucle36: j --> TB_Boucle35 +TB_Boucle35: j --> TB_Boucle34 +TB_Boucle34: j --> TB_Boucle33 +TB_Boucle33: j --> TB_Boucle32 +TB_Boucle32: j --> TB_Boucle31 +TB_Boucle31: j --> TB_Boucle30 +TB_Boucle30: j --> TB_Boucle29 +TB_Boucle29: j --> TB_Boucle28 +TB_Boucle28: j --> TB_Boucle23 +TB_Boucle23: emit c4 --> TB_Boucle22 +TB_Boucle22: emit c3 --> TB_Boucle21 +TB_Boucle21: li $t0, 0 --> TB_Boucle1 +TB_Boucle1 : j --> TB_Boucle20 +TB_Boucle20: li $t1, 0 --> TB_Boucle19 +TB_Boucle19: emit c2 --> TB_Boucle18 +TB_Boucle18: slt $v0, $t0, $a3 --> TB_Boucle17 +TB_Boucle17: j --> TB_Boucle25 +TB_Boucle25: seq $v0, $v0, $zero --> TB_Boucle16 +TB_Boucle16: beq $v0, $t1 --> TB_Boucle15, TB_Boucle0 +TB_Boucle0 : j --> TB_Boucle70 +TB_Boucle70: j --> TB_Boucle69 +TB_Boucle69: j --> TB_Boucle68 +TB_Boucle68: j --> TB_Boucle67 +TB_Boucle67: j --> TB_Boucle66 +TB_Boucle66: j --> TB_Boucle65 +TB_Boucle65: j --> TB_Boucle64 +TB_Boucle64: j --> TB_Boucle63 +TB_Boucle63: j --> TB_Boucle62 +TB_Boucle62: j --> TB_Boucle61 +TB_Boucle61: delframe --> TB_Boucle60 +TB_Boucle60: jr $ra +TB_Boucle15: emit c0 --> TB_Boucle14 +TB_Boucle14: li $v0, 4 --> TB_Boucle13 +TB_Boucle13: mulo $v0, $t0, $v0 --> TB_Boucle12 +TB_Boucle12: add $v0, $a0, $v0 --> TB_Boucle24 +TB_Boucle24: lw $t1, 0($v0) --> TB_Boucle11 +TB_Boucle11: li $v0, 4 --> TB_Boucle10 +TB_Boucle10: mulo $v0, $t0, $v0 --> TB_Boucle9 +TB_Boucle9 : add $v0, $a1, $v0 --> TB_Boucle27 +TB_Boucle27: lw $v0, 0($v0) --> TB_Boucle8 +TB_Boucle8 : add $t1, $t1, $v0 --> TB_Boucle7 +TB_Boucle7 : li $v0, 4 --> TB_Boucle6 +TB_Boucle6 : mulo $v0, $t0, $v0 --> TB_Boucle5 +TB_Boucle5 : add $v0, $a2, $v0 --> TB_Boucle26 +TB_Boucle26: lw $t1, 0($v0) --> TB_Boucle4 +TB_Boucle4 : emit c1 --> TB_Boucle3 +TB_Boucle3 : li $v0, 1 --> TB_Boucle2 +TB_Boucle2 : add $t0, $t0, $v0 --> TB_Boucle1 + diff --git a/tests/clight/testTB_boucle.RTL.expected b/tests/clight/testTB_boucle.RTL.expected new file mode 100644 index 0000000..19f0251 --- /dev/null +++ b/tests/clight/testTB_boucle.RTL.expected @@ -0,0 +1,613 @@ +program + +globals 40 + +function _main() : %0 +stacksize 20 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21, %22, %23, %24, %25, %26, %27, + %28, %29, %30, %31, %32, %33, %34, + %35, %36, %37, %38, %39, %40, %41, + %42, %43, %44, %45, %46, %47, %48, + %49, %50, %51, %52, %53, %54, %55, + %56, %57, %58, %59, %60, %61 +entry main145 +main145: li %1, 0 --> main144 +main144: li %2, 0 --> main143 +main143: li %3, 0 --> main142 +main142: li %4, 0 --> main141 +main141: li %5, 0 --> main140 +main140: li %6, 0 --> main139 +main139: li %7, 0 --> main138 +main138: li %8, 0 --> main137 +main137: li %9, 0 --> main136 +main136: li %10, 0 --> main135 +main135: li %11, 0 --> main134 +main134: li %12, 0 --> main133 +main133: li %13, 0 --> main132 +main132: li %14, 0 --> main131 +main131: li %15, 0 --> main130 +main130: li %16, 0 --> main129 +main129: li %17, 0 --> main128 +main128: li %18, 0 --> main127 +main127: li %19, 0 --> main126 +main126: li %20, 0 --> main125 +main125: li %21, 0 --> main124 +main124: li %22, 0 --> main123 +main123: li %23, 0 --> main122 +main122: li %24, 0 --> main121 +main121: li %25, 0 --> main120 +main120: li %26, 0 --> main119 +main119: li %27, 0 --> main118 +main118: li %28, 0 --> main117 +main117: li %29, 0 --> main116 +main116: li %30, 0 --> main115 +main115: li %31, 0 --> main114 +main114: li %32, 0 --> main113 +main113: li %33, 0 --> main112 +main112: li %34, 0 --> main111 +main111: li %35, 0 --> main110 +main110: li %36, 0 --> main109 +main109: li %37, 0 --> main108 +main108: li %38, 0 --> main107 +main107: li %39, 0 --> main106 +main106: li %40, 0 --> main105 +main105: li %41, 0 --> main104 +main104: li %42, 0 --> main103 +main103: li %43, 0 --> main102 +main102: li %44, 0 --> main101 +main101: li %45, 0 --> main100 +main100: li %46, 0 --> main99 +main99 : li %47, 0 --> main98 +main98 : li %48, 0 --> main97 +main97 : li %49, 0 --> main96 +main96 : li %50, 0 --> main95 +main95 : li %51, 0 --> main94 +main94 : li %52, 0 --> main93 +main93 : li %53, 0 --> main92 +main92 : li %54, 0 --> main91 +main91 : li %55, 0 --> main90 +main90 : li %56, 0 --> main89 +main89 : li %57, 0 --> main88 +main88 : li %58, 0 --> main87 +main87 : li %59, 0 --> main86 +main86 : li %60, 0 --> main85 +main85 : li %61, 0 --> main67 +main67 : li %44, 1 --> main66 +main66 : addi %60, GLOBALS, 0 --> main83 +main83 : sw %44, 0(%60) --> main65 +main65 : li %43, 2 --> main64 +main64 : addi %59, GLOBALS, 0 --> main82 +main82 : sw %43, 4(%59) --> main63 +main63 : li %42, 3 --> main62 +main62 : addi %58, GLOBALS, 0 --> main81 +main81 : sw %42, 8(%58) --> main61 +main61 : li %41, 5 --> main60 +main60 : addi %57, GLOBALS, 0 --> main80 +main80 : sw %41, 12(%57) --> main59 +main59 : li %40, 8 --> main58 +main58 : addi %56, GLOBALS, 0 --> main79 +main79 : sw %40, 16(%56) --> main57 +main57 : li %39, 13 --> main56 +main56 : addi %55, GLOBALS, 0 --> main78 +main78 : sw %39, 20(%55) --> main55 +main55 : li %38, 21 --> main54 +main54 : addi %54, GLOBALS, 0 --> main77 +main77 : sw %38, 24(%54) --> main53 +main53 : li %37, 34 --> main52 +main52 : addi %53, GLOBALS, 0 --> main76 +main76 : sw %37, 28(%53) --> main51 +main51 : li %36, 55 --> main50 +main50 : addi %52, GLOBALS, 0 --> main75 +main75 : sw %36, 32(%52) --> main49 +main49 : li %35, 89 --> main48 +main48 : addi %51, GLOBALS, 0 --> main74 +main74 : sw %35, 36(%51) --> main47 +main47 : emit c11 --> main46 +main46 : li %30, 0 --> main45 +main45 : addi %31, STACK, 0 --> main44 +main44 : li %33, 0 --> main43 +main43 : li %34, 4 --> main42 +main42 : mulo %32, %33, %34 --> main41 +main41 : add %50, %31, %32 --> main73 +main73 : sw %30, 0(%50) --> main40 +main40 : emit c10 --> main39 +main39 : li %25, 0 --> main38 +main38 : addi %26, STACK, 0 --> main37 +main37 : li %28, 1 --> main36 +main36 : li %29, 4 --> main35 +main35 : mulo %27, %28, %29 --> main34 +main34 : add %49, %26, %27 --> main72 +main72 : sw %25, 0(%49) --> main33 +main33 : emit c9 --> main32 +main32 : li %20, 0 --> main31 +main31 : addi %21, STACK, 0 --> main30 +main30 : li %23, 2 --> main29 +main29 : li %24, 4 --> main28 +main28 : mulo %22, %23, %24 --> main27 +main27 : add %48, %21, %22 --> main71 +main71 : sw %20, 0(%48) --> main26 +main26 : emit c8 --> main25 +main25 : li %15, 0 --> main24 +main24 : addi %16, STACK, 0 --> main23 +main23 : li %18, 3 --> main22 +main22 : li %19, 4 --> main21 +main21 : mulo %17, %18, %19 --> main20 +main20 : add %47, %16, %17 --> main70 +main70 : sw %15, 0(%47) --> main19 +main19 : emit c7 --> main18 +main18 : li %10, 0 --> main17 +main17 : addi %11, STACK, 0 --> main16 +main16 : li %13, 4 --> main15 +main15 : li %14, 4 --> main14 +main14 : mulo %12, %13, %14 --> main13 +main13 : add %46, %11, %12 --> main69 +main69 : sw %10, 0(%46) --> main12 +main12 : emit c6 --> main11 +main11 : addi %5, GLOBALS, 0 --> main10 +main10 : addi %6, GLOBALS, 20 --> main9 +main9 : addi %7, STACK, 0 --> main8 +main8 : li %8, 5 --> main7 +main7 : la %61, TB_Boucle --> main84 +main84 : call %9, %61(%5, %6, %7, %8) --> main6 +main6 : emit c5 --> main5 +main5 : addi %1, STACK, 0 --> main4 +main4 : li %3, 4 --> main3 +main3 : li %4, 4 --> main2 +main2 : mulo %2, %3, %4 --> main1 +main1 : add %45, %1, %2 --> main68 +main68 : lw %0, 0(%45) --> main0 +main0 : return %0 + +__builtin_varargs_start: int -> void + + +__builtin_va_start: int -> int -> void + + +__builtin_va_end: int -> void + + +__builtin_va_copy: int -> int -> void + + +__builtin_va_arg: int -> int -> void + + +__builtin_types_compatible_p: int -> int -> int + + +__builtin_tanl: float -> float + + +__builtin_tanhl: float -> float + + +__builtin_tanhf: float -> float + + +__builtin_tanh: float -> float + + +__builtin_tanf: float -> float + + +__builtin_tan: float -> float + + +__builtin_strspn: int -> int -> int + + +__builtin_strpbrk: int -> int -> int + + +__builtin_strncpy: int -> int -> int -> int + + +__builtin_strncmp: int -> int -> int -> int + + +__builtin_strncat: int -> int -> int -> int + + +__builtin_strcspn: int -> int -> int + + +__builtin_strcpy: int -> int -> int + + +__builtin_strcmp: int -> int -> int + + +__builtin_strchr: int -> int -> int + + +__builtin_stpcpy: int -> int -> int + + +__builtin_stdarg_start: int -> void + + +__builtin_sqrtl: float -> float + + +__builtin_sqrtf: float -> float + + +__builtin_sqrt: float -> float + + +__builtin_sinl: float -> float + + +__builtin_sinhl: float -> float + + +__builtin_sinhf: float -> float + + +__builtin_sinh: float -> float + + +__builtin_sinf: float -> float + + +__builtin_sin: float -> float + + +__builtin_return_address: int -> int + + +__builtin_return: int -> void + + +__builtin_powil: float -> int -> float + + +__builtin_powif: float -> int -> float + + +__builtin_powi: float -> int -> float + + +__builtin_popcountll: int -> int + + +__builtin_popcountl: int -> int + + +__builtin_popcount: int -> int + + +__builtin_parityll: int -> int + + +__builtin_parityl: int -> int + + +__builtin_parity: int -> int + + +__builtin_object_size: int -> int -> int + + +__builtin_next_arg: int + + +__builtin_nansl: int -> float + + +__builtin_nansf: int -> float + + +__builtin_nans: int -> float + + +__builtin_nanl: int -> float + + +__builtin_nanf: int -> float + + +__builtin_nan: int -> float + + +__builtin_modfl: float -> int -> float + + +__builtin_modff: float -> int -> float + + +__builtin_mempcpy: int -> int -> int -> int + + +__builtin_memcpy: int -> int -> int -> int + + +__builtin_logl: float -> float + + +__builtin_logf: float -> float + + +__builtin_log10l: float -> float + + +__builtin_log10f: float -> float + + +__builtin_log10: float -> float + + +__builtin_log: float -> float + + +__builtin_ldexpl: float -> int -> float + + +__builtin_ldexpf: float -> int -> float + + +__builtin_ldexp: float -> int -> float + + +__builtin_infl: float + + +__builtin_inff: float + + +__builtin_inf: float + + +__builtin_huge_vall: float + + +__builtin_huge_valf: float + + +__builtin_huge_val: float + + +__builtin_frexpl: float -> int -> float + + +__builtin_frexpf: float -> int -> float + + +__builtin_frexp: float -> int -> float + + +__builtin_frame_address: int -> int + + +__builtin_fmodl: float -> float + + +__builtin_fmodf: float -> float + + +__builtin_fmod: float -> float + + +__builtin_floorl: float -> float + + +__builtin_floorf: float -> float + + +__builtin_floor: float -> float + + +__builtin_ffsll: int -> int + + +__builtin_ffsl: int -> int + + +__builtin_ffs: int -> int + + +__builtin_fabsl: float -> float + + +__builtin_fabsf: float -> float + + +__builtin_fabs: float -> float + + +__builtin_expl: float -> float + + +__builtin_expf: float -> float + + +__builtin_expect: int -> int -> int + + +__builtin_exp: float -> float + + +__builtin_ctzll: int -> int + + +__builtin_ctzl: int -> int + + +__builtin_ctz: int -> int + + +__builtin_cosl: float -> float + + +__builtin_coshl: float -> float + + +__builtin_coshf: float -> float + + +__builtin_cosh: float -> float + + +__builtin_cosf: float -> float + + +__builtin_cos: float -> float + + +__builtin_constant_p: int -> int + + +__builtin_clzll: int -> int + + +__builtin_clzl: int -> int + + +__builtin_clz: int -> int + + +__builtin_ceill: float -> float + + +__builtin_ceilf: float -> float + + +__builtin_ceil: float -> float + + +__builtin_atanl: float -> float + + +__builtin_atanf: float -> float + + +__builtin_atan2l: float -> float -> float + + +__builtin_atan2f: float -> float -> float + + +__builtin_atan2: float -> float -> float + + +__builtin_atan: float -> float + + +__builtin_asinl: float -> float + + +__builtin_asinf: float -> float + + +__builtin_asin: float -> float + + +__builtin_alloca: int -> int + + +__builtin_acosl: float -> float + + +__builtin_acosf: float -> float + + +__builtin_acos: float -> float + + +__builtin___vsprintf_chk: int -> int -> int -> int -> int -> int + + +__builtin___vsnprintf_chk: int -> int -> int -> int -> int -> int -> int + + +__builtin___vprintf_chk: int -> int -> int -> int + + +__builtin___vfprintf_chk: int -> int -> int -> int -> int + + +__builtin___strncpy_chk: int -> int -> int -> int -> int + + +__builtin___strncat_chk: int -> int -> int -> int -> int + + +__builtin___strcpy_chk: int -> int -> int -> int + + +__builtin___strcat_chk: int -> int -> int -> int + + +__builtin___stpcpy_chk: int -> int -> int -> int + + +__builtin___memset_chk: int -> int -> int -> int -> int + + +__builtin___mempcpy_chk: int -> int -> int -> int -> int + + +__builtin___memmove_chk: int -> int -> int -> int -> int + + +__builtin___memcpy_chk: int -> int -> int -> int -> int + + +procedure TB_Boucle(%0; %1; %2; %3) +stacksize 0 +var %0, %1, %2, %3, %4, %5, %6, + %7, %8, %9, %10, %11, %12, %13, + %14, %15, %16, %17, %18, %19, %20, + %21 +entry TB_Boucle45 +TB_Boucle45: li %4, 0 --> TB_Boucle44 +TB_Boucle44: li %5, 0 --> TB_Boucle43 +TB_Boucle43: li %6, 0 --> TB_Boucle42 +TB_Boucle42: li %7, 0 --> TB_Boucle41 +TB_Boucle41: li %8, 0 --> TB_Boucle40 +TB_Boucle40: li %9, 0 --> TB_Boucle39 +TB_Boucle39: li %10, 0 --> TB_Boucle38 +TB_Boucle38: li %11, 0 --> TB_Boucle37 +TB_Boucle37: li %12, 0 --> TB_Boucle36 +TB_Boucle36: li %13, 0 --> TB_Boucle35 +TB_Boucle35: li %14, 0 --> TB_Boucle34 +TB_Boucle34: li %15, 0 --> TB_Boucle33 +TB_Boucle33: li %16, 0 --> TB_Boucle32 +TB_Boucle32: li %17, 0 --> TB_Boucle31 +TB_Boucle31: li %18, 0 --> TB_Boucle30 +TB_Boucle30: li %19, 0 --> TB_Boucle29 +TB_Boucle29: li %20, 0 --> TB_Boucle28 +TB_Boucle28: li %21, 0 --> TB_Boucle23 +TB_Boucle23: emit c4 --> TB_Boucle22 +TB_Boucle22: emit c3 --> TB_Boucle21 +TB_Boucle21: li %4, 0 --> TB_Boucle1 +TB_Boucle1 : j --> TB_Boucle20 +TB_Boucle20: li %16, 0 --> TB_Boucle19 +TB_Boucle19: emit c2 --> TB_Boucle18 +TB_Boucle18: slt %17, %4, %3 --> TB_Boucle17 +TB_Boucle17: li %19, 0 --> TB_Boucle25 +TB_Boucle25: seq %15, %17, %19 --> TB_Boucle16 +TB_Boucle16: beq %15, %16 --> TB_Boucle15, TB_Boucle0 +TB_Boucle0 : return +TB_Boucle15: emit c0 --> TB_Boucle14 +TB_Boucle14: li %14, 4 --> TB_Boucle13 +TB_Boucle13: mulo %13, %4, %14 --> TB_Boucle12 +TB_Boucle12: add %18, %0, %13 --> TB_Boucle24 +TB_Boucle24: lw %9, 0(%18) --> TB_Boucle11 +TB_Boucle11: li %12, 4 --> TB_Boucle10 +TB_Boucle10: mulo %11, %4, %12 --> TB_Boucle9 +TB_Boucle9 : add %21, %1, %11 --> TB_Boucle27 +TB_Boucle27: lw %10, 0(%21) --> TB_Boucle8 +TB_Boucle8 : add %6, %9, %10 --> TB_Boucle7 +TB_Boucle7 : li %8, 4 --> TB_Boucle6 +TB_Boucle6 : mulo %7, %4, %8 --> TB_Boucle5 +TB_Boucle5 : add %20, %2, %7 --> TB_Boucle26 +TB_Boucle26: sw %6, 0(%20) --> TB_Boucle4 +TB_Boucle4 : emit c1 --> TB_Boucle3 +TB_Boucle3 : li %5, 1 --> TB_Boucle2 +TB_Boucle2 : add %4, %4, %5 --> TB_Boucle1 + diff --git a/tests/clight/testTB_boucle.RTLabs.expected b/tests/clight/testTB_boucle.RTLabs.expected new file mode 100644 index 0000000..d76b258 --- /dev/null +++ b/tests/clight/testTB_boucle.RTLabs.expected @@ -0,0 +1,513 @@ +program: (main function is "main") + + + globals: + "t1" = {1, 2, 3, 5, 8} + "t2" = {13, 21, 34, 55, 89} + + + "__builtin___memcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memmove_chk": int -> int -> int -> int -> int + + + "__builtin___mempcpy_chk": int -> int -> int -> int -> int + + + "__builtin___memset_chk": int -> int -> int -> int -> int + + + "__builtin___stpcpy_chk": int -> int -> int -> int + + + "__builtin___strcat_chk": int -> int -> int -> int + + + "__builtin___strcpy_chk": int -> int -> int -> int + + + "__builtin___strncat_chk": int -> int -> int -> int -> int + + + "__builtin___strncpy_chk": int -> int -> int -> int -> int + + + "__builtin___vfprintf_chk": int -> int -> int -> int -> int + + + "__builtin___vprintf_chk": int -> int -> int -> int + + + "__builtin___vsnprintf_chk": int -> int -> int -> int -> int -> int -> int + + + "__builtin___vsprintf_chk": int -> int -> int -> int -> int -> int + + + "__builtin_acos": float -> float + + + "__builtin_acosf": float -> float + + + "__builtin_acosl": float -> float + + + "__builtin_alloca": int -> int + + + "__builtin_asin": float -> float + + + "__builtin_asinf": float -> float + + + "__builtin_asinl": float -> float + + + "__builtin_atan": float -> float + + + "__builtin_atanf": float -> float + + + "__builtin_atanl": float -> float + + + "__builtin_atan2": float -> float -> float + + + "__builtin_atan2f": float -> float -> float + + + "__builtin_atan2l": float -> float -> float + + + "__builtin_ceil": float -> float + + + "__builtin_ceilf": float -> float + + + "__builtin_ceill": float -> float + + + "__builtin_cos": float -> float + + + "__builtin_cosf": float -> float + + + "__builtin_cosl": float -> float + + + "__builtin_cosh": float -> float + + + "__builtin_coshf": float -> float + + + "__builtin_coshl": float -> float + + + "__builtin_clz": int -> int + + + "__builtin_clzl": int -> int + + + "__builtin_clzll": int -> int + + + "__builtin_constant_p": int -> int + + + "__builtin_ctz": int -> int + + + "__builtin_ctzl": int -> int + + + "__builtin_ctzll": int -> int + + + "__builtin_exp": float -> float + + + "__builtin_expf": float -> float + + + "__builtin_expl": float -> float + + + "__builtin_expect": int -> int -> int + + + "__builtin_fabs": float -> float + + + "__builtin_fabsf": float -> float + + + "__builtin_fabsl": float -> float + + + "__builtin_ffs": int -> int + + + "__builtin_ffsl": int -> int + + + "__builtin_ffsll": int -> int + + + "__builtin_frame_address": int -> int + + + "__builtin_floor": float -> float + + + "__builtin_floorf": float -> float + + + "__builtin_floorl": float -> float + + + "__builtin_huge_val": float + + + "__builtin_huge_valf": float + + + "__builtin_huge_vall": float + + + "__builtin_inf": float + + + "__builtin_inff": float + + + "__builtin_infl": float + + + "__builtin_memcpy": int -> int -> int -> int + + + "__builtin_mempcpy": int -> int -> int -> int + + + "__builtin_fmod": float -> float + + + "__builtin_fmodf": float -> float + + + "__builtin_fmodl": float -> float + + + "__builtin_frexp": float -> int -> float + + + "__builtin_frexpf": float -> int -> float + + + "__builtin_frexpl": float -> int -> float + + + "__builtin_ldexp": float -> int -> float + + + "__builtin_ldexpf": float -> int -> float + + + "__builtin_ldexpl": float -> int -> float + + + "__builtin_log": float -> float + + + "__builtin_logf": float -> float + + + "__builtin_logl": float -> float + + + "__builtin_log10": float -> float + + + "__builtin_log10f": float -> float + + + "__builtin_log10l": float -> float + + + "__builtin_modff": float -> int -> float + + + "__builtin_modfl": float -> int -> float + + + "__builtin_nan": int -> float + + + "__builtin_nanf": int -> float + + + "__builtin_nanl": int -> float + + + "__builtin_nans": int -> float + + + "__builtin_nansf": int -> float + + + "__builtin_nansl": int -> float + + + "__builtin_next_arg": int + + + "__builtin_object_size": int -> int -> int + + + "__builtin_parity": int -> int + + + "__builtin_parityl": int -> int + + + "__builtin_parityll": int -> int + + + "__builtin_popcount": int -> int + + + "__builtin_popcountl": int -> int + + + "__builtin_popcountll": int -> int + + + "__builtin_powi": float -> int -> float + + + "__builtin_powif": float -> int -> float + + + "__builtin_powil": float -> int -> float + + + "__builtin_return": int -> void + + + "__builtin_return_address": int -> int + + + "__builtin_sin": float -> float + + + "__builtin_sinf": float -> float + + + "__builtin_sinl": float -> float + + + "__builtin_sinh": float -> float + + + "__builtin_sinhf": float -> float + + + "__builtin_sinhl": float -> float + + + "__builtin_sqrt": float -> float + + + "__builtin_sqrtf": float -> float + + + "__builtin_sqrtl": float -> float + + + "__builtin_stpcpy": int -> int -> int + + + "__builtin_strchr": int -> int -> int + + + "__builtin_strcmp": int -> int -> int + + + "__builtin_strcpy": int -> int -> int + + + "__builtin_strcspn": int -> int -> int + + + "__builtin_strncat": int -> int -> int -> int + + + "__builtin_strncmp": int -> int -> int -> int + + + "__builtin_strncpy": int -> int -> int -> int + + + "__builtin_strspn": int -> int -> int + + + "__builtin_strpbrk": int -> int -> int + + + "__builtin_types_compatible_p": int -> int -> int + + + "__builtin_tan": float -> float + + + "__builtin_tanf": float -> float + + + "__builtin_tanl": float -> float + + + "__builtin_tanh": float -> float + + + "__builtin_tanhf": float -> float + + + "__builtin_tanhl": float -> float + + + "__builtin_va_end": int -> void + + + "__builtin_varargs_start": int -> void + + + "__builtin_va_start": int -> int -> void + + + "__builtin_stdarg_start": int -> void + + + "__builtin_va_arg": int -> int -> void + + + "__builtin_va_copy": int -> int -> void + + + "TB_Boucle"(%0, %1, %2, %3): int -> int -> int -> int -> void + locals: %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17 + stacksize: 0 + entry: TB_Boucle23 + exit: TB_Boucle0 + + TB_Boucle9: load int32, add, %1, %11, %10 --> TB_Boucle8 + TB_Boucle8: add %6, %9, %10 --> TB_Boucle7 + TB_Boucle7: imm_int 4, %8, --> TB_Boucle6 + TB_Boucle6: mul %7, %4, %8 --> TB_Boucle5 + TB_Boucle5: store int32, add, %2, %7, %6 --> TB_Boucle4 + TB_Boucle4: emit c1 --> TB_Boucle3 + TB_Boucle3: imm_int 1, %5, --> TB_Boucle2 + TB_Boucle23: emit c4 --> TB_Boucle22 + TB_Boucle22: emit c3 --> TB_Boucle21 + TB_Boucle21: imm_int 0, %4, --> TB_Boucle1 + TB_Boucle20: imm_int 0, %16, --> TB_Boucle19 + TB_Boucle2: add %4, %4, %5 --> TB_Boucle1 + TB_Boucle19: emit c2 --> TB_Boucle18 + TB_Boucle18: lt %17, %4, %3 --> TB_Boucle17 + TB_Boucle17: notbool %15, %17 --> TB_Boucle16 + TB_Boucle16: eq %15, %16 --> TB_Boucle15, TB_Boucle0 + TB_Boucle15: emit c0 --> TB_Boucle14 + TB_Boucle14: imm_int 4, %14, --> TB_Boucle13 + TB_Boucle13: mul %13, %4, %14 --> TB_Boucle12 + TB_Boucle12: load int32, add, %0, %13, %9 --> TB_Boucle11 + TB_Boucle11: imm_int 4, %12, --> TB_Boucle10 + TB_Boucle10: mul %11, %4, %12 --> TB_Boucle9 + TB_Boucle1: --> TB_Boucle20 + TB_Boucle0: return + + + "main"(): int + locals: %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44 + result: %0 + stacksize: 20 + entry: main67 + exit: main0 + + main9: imm_addr 0($sp), %7, --> main8 + main8: imm_int 5, %8, --> main7 + main7: call "TB_Boucle", %5, %6, %7, %8, %9: int -> int -> int -> int -> void --> main6 + main67: imm_int 1, %44, --> main66 + main66: store int32, 0("t1"), , %44 --> main65 + main65: imm_int 2, %43, --> main64 + main64: store int32, 4("t1"), , %43 --> main63 + main63: imm_int 3, %42, --> main62 + main62: store int32, 8("t1"), , %42 --> main61 + main61: imm_int 5, %41, --> main60 + main60: store int32, 12("t1"), , %41 --> main59 + main6: emit c5 --> main5 + main59: imm_int 8, %40, --> main58 + main58: store int32, 16("t1"), , %40 --> main57 + main57: imm_int 13, %39, --> main56 + main56: store int32, 0("t2"), , %39 --> main55 + main55: imm_int 21, %38, --> main54 + main54: store int32, 4("t2"), , %38 --> main53 + main53: imm_int 34, %37, --> main52 + main52: store int32, 8("t2"), , %37 --> main51 + main51: imm_int 55, %36, --> main50 + main50: store int32, 12("t2"), , %36 --> main49 + main5: imm_addr 0($sp), %1, --> main4 + main49: imm_int 89, %35, --> main48 + main48: store int32, 16("t2"), , %35 --> main47 + main47: emit c11 --> main46 + main46: imm_int 0, %30, --> main45 + main45: imm_addr 0($sp), %31, --> main44 + main44: imm_int 0, %33, --> main43 + main43: imm_int 4, %34, --> main42 + main42: mul %32, %33, %34 --> main41 + main41: store int32, add, %31, %32, %30 --> main40 + main40: emit c10 --> main39 + main4: imm_int 4, %3, --> main3 + main39: imm_int 0, %25, --> main38 + main38: imm_addr 0($sp), %26, --> main37 + main37: imm_int 1, %28, --> main36 + main36: imm_int 4, %29, --> main35 + main35: mul %27, %28, %29 --> main34 + main34: store int32, add, %26, %27, %25 --> main33 + main33: emit c9 --> main32 + main32: imm_int 0, %20, --> main31 + main31: imm_addr 0($sp), %21, --> main30 + main30: imm_int 2, %23, --> main29 + main3: imm_int 4, %4, --> main2 + main29: imm_int 4, %24, --> main28 + main28: mul %22, %23, %24 --> main27 + main27: store int32, add, %21, %22, %20 --> main26 + main26: emit c8 --> main25 + main25: imm_int 0, %15, --> main24 + main24: imm_addr 0($sp), %16, --> main23 + main23: imm_int 3, %18, --> main22 + main22: imm_int 4, %19, --> main21 + main21: mul %17, %18, %19 --> main20 + main20: store int32, add, %16, %17, %15 --> main19 + main2: mul %2, %3, %4 --> main1 + main19: emit c7 --> main18 + main18: imm_int 0, %10, --> main17 + main17: imm_addr 0($sp), %11, --> main16 + main16: imm_int 4, %13, --> main15 + main15: imm_int 4, %14, --> main14 + main14: mul %12, %13, %14 --> main13 + main13: store int32, add, %11, %12, %10 --> main12 + main12: emit c6 --> main11 + main11: imm_addr "t1", %5, --> main10 + main10: imm_addr "t2", %6, --> main9 + main1: load int32, add, %1, %2, %0 --> main0 + main0: return %0 + + diff --git a/tests/clight/testTB_boucle.c b/tests/clight/testTB_boucle.c new file mode 100644 index 0000000..52351bd --- /dev/null +++ b/tests/clight/testTB_boucle.c @@ -0,0 +1,15 @@ +int t1[5] = {1,2,3,5,8}; +int t2[5] = {13,21,34,55,89}; + +void TB_Boucle (int tabEntree1[], int tabEntree2[],int tabSortie[], int size) { + int i; + for (i = 0; i < size; i++){ + tabSortie[i] = tabEntree1[i]+tabEntree2[i]; + } +} + +int main(){ + int out[5] = {0,0,0,0,0}; + TB_Boucle(t1,t2,out,5); + return out[4]; +} diff --git a/tests/clight/testTB_boucle.c.expected b/tests/clight/testTB_boucle.c.expected new file mode 100644 index 0000000..52351bd --- /dev/null +++ b/tests/clight/testTB_boucle.c.expected @@ -0,0 +1,15 @@ +int t1[5] = {1,2,3,5,8}; +int t2[5] = {13,21,34,55,89}; + +void TB_Boucle (int tabEntree1[], int tabEntree2[],int tabSortie[], int size) { + int i; + for (i = 0; i < size; i++){ + tabSortie[i] = tabEntree1[i]+tabEntree2[i]; + } +} + +int main(){ + int out[5] = {0,0,0,0,0}; + TB_Boucle(t1,t2,out,5); + return out[4]; +} diff --git a/tests/clight/testTB_boucle.log.expected b/tests/clight/testTB_boucle.log.expected new file mode 100644 index 0000000..ba50dc8 --- /dev/null +++ b/tests/clight/testTB_boucle.log.expected @@ -0,0 +1,2 @@ +Global Error (Translation RTLabs -> RTL): + Constant not supported. diff --git a/tests/review1/bubble_sort.c b/tests/review1/bubble_sort.c new file mode 100644 index 0000000..1f0a4cf --- /dev/null +++ b/tests/review1/bubble_sort.c @@ -0,0 +1,41 @@ + +#define SIZE 5 + +char min (char tab[], char size, char n) { + char i, min_index, min; + + if (size == 0) return 0; + + min_index = n; + min = tab[min_index]; + for (i = n+1 ; i < size ; i++) { + if (tab[i] < min) { + min_index = i; + min = tab[min_index]; + } + } + + return min_index; +} + +void swap (char tab[], char i, char j) { + char t; + t = tab[i] ; tab[i] = tab[j] ; tab[j] = t; +} + +void bubble_sort(char tab[], char size) { + char i, min_index; + + for (i = 0 ; i < size ; i++) { + min_index = min(tab, size, i); + swap(tab, i, min_index); + } +} + +int main () { + char tab[] = {26, 21, 43, 62, 8}; + + bubble_sort(tab, SIZE); + + return (tab[3]); +} diff --git a/tests/review1/search.c b/tests/review1/search.c new file mode 100644 index 0000000..cc1e4b2 --- /dev/null +++ b/tests/review1/search.c @@ -0,0 +1,29 @@ +#define SIZE 5 +#define NB_FINDS 2 + +// Searching for the values below +int to_find[NB_FINDS] = {57, -1}; + +int search (int tab[], int size, int to_find) { + int low = 0, high = size-1, i; + + while (high >= low) { + i = (high+low) / 2; + if (tab[i] == to_find) return i; + if (tab[i] > to_find) high = i-1; + if (tab[i] < to_find) low = i+1; + } + + return (-1); +} + +int main () { + int tab[SIZE] = {-30, -18, 23, 57, 120}; + int res; + int i; + + for (i = 0 ; i < NB_FINDS ; i++) + println(search(tab, SIZE, to_find[i])); + + return 0; +} diff --git a/tests/tmp_tests/Backend/array_copy.c b/tests/tmp_tests/Backend/array_copy.c new file mode 100644 index 0000000..4111e9c --- /dev/null +++ b/tests/tmp_tests/Backend/array_copy.c @@ -0,0 +1,35 @@ + +#define SIZE 5 + +signed char tab1[SIZE] = {10, -3, 25, 56, -32}; + +void copy (signed char dst[], signed char src[], signed char size) { + signed char i; + + for (i = 0 ; i < size ; i++) + dst[i] = src[i]; +} + +void print_tab (signed char tab[], signed char size) { + signed char i; + + for (i = 0 ; i < size ; i++) { + print_schar(tab[i]); + space(); + } + newline(); +} + +signed char main () { + signed char tab2[SIZE]; + signed char tab3[SIZE] = {0, 1, 2, 3, 4}; + + copy(tab2, tab1, SIZE); + copy(tab1, tab3, SIZE); + + print_tab(tab1, SIZE); + print_tab(tab2, SIZE); + print_tab(tab3, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Backend/array_copy_u.c b/tests/tmp_tests/Backend/array_copy_u.c new file mode 100644 index 0000000..831e156 --- /dev/null +++ b/tests/tmp_tests/Backend/array_copy_u.c @@ -0,0 +1,35 @@ + +#define SIZE 5 + +unsigned char tab1[SIZE] = {10, -3, 25, 56, -32}; + +void copy (unsigned char dst[], unsigned char src[], unsigned char size) { + unsigned char i; + + for (i = 0 ; i < size ; i++) + dst[i] = src[i]; +} + +void print_tab (unsigned char tab[], unsigned char size) { + unsigned char i; + + for (i = 0 ; i < size ; i++) { + print_uchar(tab[i]); + space(); + } + newline(); +} + +unsigned char main () { + unsigned char tab2[SIZE]; + unsigned char tab3[SIZE] = {0, 1, 2, 3, 4}; + + copy(tab2, tab1, SIZE); + copy(tab1, tab3, SIZE); + + print_tab(tab1, SIZE); + print_tab(tab2, SIZE); + print_tab(tab3, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Backend/bubble_sort.c b/tests/tmp_tests/Backend/bubble_sort.c new file mode 100644 index 0000000..9d29206 --- /dev/null +++ b/tests/tmp_tests/Backend/bubble_sort.c @@ -0,0 +1,52 @@ + +#define SIZE 5 + +signed char min (signed char tab[], signed char size, signed char n) { + signed char i, min_index, min; + + if (size == 0) return 0; + + min_index = n; + min = tab[min_index]; + for (i = n+1 ; i < size ; i++) { + if (tab[i] < min) { + min_index = i; + min = tab[min_index]; + } + } + + return min_index; +} + +void swap (signed char tab[], signed char i, signed char j) { + signed char t; + t = tab[i] ; tab[i] = tab[j] ; tab[j] = t; +} + +void bubble_sort(signed char tab[], signed char size) { + signed char i, min_index; + + for (i = 0 ; i < size ; i++) { + min_index = min(tab, size, i); + swap(tab, i, min_index); + } +} + +void print_tab (signed char tab[], signed char size) { + signed char i; + + for (i = 0 ; i < size ; i++) { + print_schar(tab[i]); + space(); + } + newline(); +} + +signed char main () { + signed char tab[SIZE] = {26, -21, 43, -62, 8}; + + bubble_sort(tab, SIZE); + print_tab(tab, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Backend/bubble_sort_u.c b/tests/tmp_tests/Backend/bubble_sort_u.c new file mode 100644 index 0000000..9af2cf4 --- /dev/null +++ b/tests/tmp_tests/Backend/bubble_sort_u.c @@ -0,0 +1,52 @@ + +#define SIZE 5 + +unsigned char min (unsigned char tab[], unsigned char size, unsigned char n) { + unsigned char i, min_index, min; + + if (size == 0) return 0; + + min_index = n; + min = tab[min_index]; + for (i = n+1 ; i < size ; i++) { + if (tab[i] < min) { + min_index = i; + min = tab[min_index]; + } + } + + return min_index; +} + +void swap (unsigned char tab[], unsigned char i, unsigned char j) { + unsigned char t; + t = tab[i] ; tab[i] = tab[j] ; tab[j] = t; +} + +void bubble_sort(unsigned char tab[], unsigned char size) { + unsigned char i, min_index; + + for (i = 0 ; i < size ; i++) { + min_index = min(tab, size, i); + swap(tab, i, min_index); + } +} + +void print_tab (unsigned char tab[], unsigned char size) { + unsigned char i; + + for (i = 0 ; i < size ; i++) { + print_uchar(tab[i]); + space(); + } + newline(); +} + +unsigned char main () { + unsigned char tab[SIZE] = {26, -21, 43, -62, 8}; + + bubble_sort(tab, SIZE); + print_tab(tab, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Backend/quicksort.c b/tests/tmp_tests/Backend/quicksort.c new file mode 100644 index 0000000..a1be748 --- /dev/null +++ b/tests/tmp_tests/Backend/quicksort.c @@ -0,0 +1,51 @@ + +#define SIZE 5 + +void swap (signed char a[], signed char i, signed char j) { + signed char t; + t = a[i] ; a[i] = a[j] ; a[j] = t; +} + +signed char partition (signed char a[], signed char l, signed char r) { + signed char pivot, i, j; + pivot = a[l]; + i = l; j = r+1; + + while (1) { + while (i <= r && a[i] <= pivot) ++i; + do --j; while (a[j] > pivot); + if (i >= j) break; + swap(a, i, j); + } + swap(a, l, j); + return j; +} + +void quicksort (signed char a[], signed char l, signed char r) { + signed char j; + + if (l < r) { + j = partition(a, l, r); + quicksort(a, l, j-1); + quicksort(a, j+1, r); + } +} + +void print_tab (signed char tab[], signed char size) { + signed char i; + + for (i = 0 ; i < size ; i++) { + print_schar(tab[i]); + space(); + } + newline(); +} + +signed char main () { + signed char tab[SIZE] = {26, -21, 43, -62, 8}; + + quicksort(tab, 0, SIZE-1); + print_tab(tab, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Backend/quicksort_u.c b/tests/tmp_tests/Backend/quicksort_u.c new file mode 100644 index 0000000..09cd4c6 --- /dev/null +++ b/tests/tmp_tests/Backend/quicksort_u.c @@ -0,0 +1,51 @@ + +#define SIZE 5 + +void swap (unsigned char a[], unsigned char i, unsigned char j) { + unsigned char t; + t = a[i] ; a[i] = a[j] ; a[j] = t; +} + +unsigned char partition (unsigned char a[], unsigned char l, unsigned char r) { + unsigned char pivot, i, j; + pivot = a[l]; + i = l; j = r+1; + + while (1) { + while (i <= r && a[i] <= pivot) ++i; + do --j; while (a[j] > pivot); + if (i >= j) break; + swap(a, i, j); + } + swap(a, l, j); + return j; +} + +void quicksort (unsigned char a[], unsigned char l, unsigned char r) { + unsigned char j; + + if (l < r) { + j = partition(a, l, r); + quicksort(a, l, j-1); + quicksort(a, j+1, r); + } +} + +void print_tab (unsigned char tab[], unsigned char size) { + unsigned char i; + + for (i = 0 ; i < size ; i++) { + print_uchar(tab[i]); + space(); + } + newline(); +} + +unsigned char main () { + unsigned char tab[SIZE] = {26, -21, 43, -62, 8}; + + quicksort(tab, 0, SIZE-1); + print_tab(tab, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Backend/search.c b/tests/tmp_tests/Backend/search.c new file mode 100644 index 0000000..50c3441 --- /dev/null +++ b/tests/tmp_tests/Backend/search.c @@ -0,0 +1,32 @@ +#define SIZE 5 +#define NB_FINDS 2 + +// Searching for the values below +signed char to_find[NB_FINDS] = {57, -1}; + +signed char search (signed char tab[], signed char size, signed char to_find) { + signed char low = 0, high = size-1, i; + + while (high >= low) { + i = (high+low) / 2; + if (tab[i] == to_find) return i; + if (tab[i] > to_find) high = i-1; + if (tab[i] < to_find) low = i+1; + } + + return (-1); +} + +signed char main () { + signed char tab[SIZE] = {-30, -18, 23, 57, 120}; + signed char res; + signed char i; + + for (i = 0 ; i < NB_FINDS ; i++) { + print_schar(search(tab, SIZE, to_find[i])); + space(); + } + newline(); + + return 0; +} diff --git a/tests/tmp_tests/Backend/struct_and_ptr_and_fact.c b/tests/tmp_tests/Backend/struct_and_ptr_and_fact.c new file mode 100644 index 0000000..7efde17 --- /dev/null +++ b/tests/tmp_tests/Backend/struct_and_ptr_and_fact.c @@ -0,0 +1,40 @@ + +typedef struct foo { + signed char dummy; + signed char x; +} foo; + +foo *p; +foo save; + +signed char fact1 (signed char x) { + if (x <= 1) return 1; + return (x * fact1(x-1)); +} + +signed char fact2 (signed char x) { + signed char i, res = 1; + + for (i = 1 ; i <= x ; i++) + res *= i; + + return res; +} + +signed char main () { + foo x, y; + foo* q[3]; + + x.x = 5; + + q[1] = &x; + p = &x; + save = x; + x.x = fact1(save.x); + y.x = fact2(save.x); + + print_schar((*(q[1])).x == y.x); + newline(); + + return 0; +} diff --git a/tests/tmp_tests/Backend/struct_and_ptr_and_fact_u.c b/tests/tmp_tests/Backend/struct_and_ptr_and_fact_u.c new file mode 100644 index 0000000..50e77fc --- /dev/null +++ b/tests/tmp_tests/Backend/struct_and_ptr_and_fact_u.c @@ -0,0 +1,40 @@ + +typedef struct foo { + unsigned char dummy; + unsigned char x; +} foo; + +foo *p; +foo save; + +unsigned char fact1 (unsigned char x) { + if (x <= 1) return 1; + return (x * fact1(x-1)); +} + +unsigned char fact2 (unsigned char x) { + unsigned char i, res = 1; + + for (i = 1 ; i <= x ; i++) + res *= i; + + return res; +} + +unsigned char main () { + foo x, y; + foo* q[3]; + + x.x = 5; + + q[1] = &x; + p = &x; + save = x; + x.x = fact1(save.x); + y.x = fact2(save.x); + + print_uchar((*(q[1])).x == y.x); + newline(); + + return 0; +} diff --git a/tests/tmp_tests/Frontend/array_copy.RTLabs b/tests/tmp_tests/Frontend/array_copy.RTLabs new file mode 100644 index 0000000..9d2cf5c --- /dev/null +++ b/tests/tmp_tests/Frontend/array_copy.RTLabs @@ -0,0 +1,201 @@ +program: + + + globals: + "tab1" { int32[5] } + + + extern "print_sint": int4s -> void + + + extern "newline": void + + + extern "space": void + + + "copy"(ptr %0, ptr %1, int4s %2) + locals: int4s %3, int4s %5, ptr %6, int4s %7, ptr %8, int4s %9, int4s %10, int4s %11, int4s %12, int4s %13, int4s %14, int1s %15 + result: void %4 + stacksize: struct {} + entry: copy19 + exit: copy0 + + copy9: imm %10, imm_sizeof (int32) --> copy8 + copy8: mul %9, %3, %10 --> copy7 + copy7: addp %8, %1, %9 --> copy6 + copy6: load int32, %8, %7 --> copy5 + copy5: store int32, %6, %7 --> copy4 + copy4: imm %5, imm_int 1 --> copy3 + copy3: add %3, %3, %5 --> copy2 + copy2: --> copy16 + copy19: emit _cost2 --> copy18 + copy18: imm %15, imm_int 0 --> copy17 + copy17: int1sto4 %3, %15 --> copy2 + copy16: lt %14, %3, %2 --> copy15 + copy15: notbool %13, %14 --> copy14 + copy14: %13? --> copy1, copy13 + copy13: emit _cost0 --> copy12 + copy12: imm %12, imm_sizeof (int32) --> copy11 + copy11: mul %11, %3, %12 --> copy10 + copy10: addp %6, %0, %11 --> copy9 + copy1: emit _cost1 --> copy0 + copy0: return + + + "print_tab"(ptr %0, int4s %1) + locals: int4s %2, int1u %4, int4s %5, int1u %6, int4s %7, int1u %8, ptr %9, int4s %10, int4s %11, int4s %12, int4s %13, int1s %14 + result: void %3 + stacksize: struct {} + entry: print_tab18 + exit: print_tab0 + + print_tab9: addp %9, %0, %10 --> print_tab8 + print_tab8: load int32, %9, %7 --> print_tab7 + print_tab7: call "print_sint", [%7], %8: int4s -> void --> print_tab6 + print_tab6: call "space", [], %6: void --> print_tab5 + print_tab5: imm %5, imm_int 1 --> print_tab4 + print_tab4: add %2, %2, %5 --> print_tab3 + print_tab3: --> print_tab15 + print_tab2: emit _cost4 --> print_tab1 + print_tab18: emit _cost5 --> print_tab17 + print_tab17: imm %14, imm_int 0 --> print_tab16 + print_tab16: int1sto4 %2, %14 --> print_tab3 + print_tab15: lt %13, %2, %1 --> print_tab14 + print_tab14: notbool %12, %13 --> print_tab13 + print_tab13: %12? --> print_tab2, print_tab12 + print_tab12: emit _cost3 --> print_tab11 + print_tab11: imm %11, imm_sizeof (int32) --> print_tab10 + print_tab10: mul %10, %2, %11 --> print_tab9 + print_tab1: call "newline", [], %4: void --> print_tab0 + print_tab0: return + + + "main"() + locals: int1s %1, ptr %2, int4s %3, int1u %4, int1s %5, ptr %6, offset %7, ptr %8, int4s %9, int1u %10, int1s %11, ptr %12, offset %13, ptr %14, int4s %15, int1u %16, int1s %17, ptr %18, ptr %19, int4s %20, int1u %21, int1s %22, ptr %23, offset %24, ptr %25, ptr %26, int4s %27, int1u %28, int1s %29, ptr %30, offset %31, ptr %32, int4s %33, int1s %34, ptr %35, int1s %36, int1s %37, int1s %38, ptr %39, offset %40, ptr %41, int4s %42, int1s %43, ptr %44, int1s %45, int1s %46, int1s %47, ptr %48, offset %49, ptr %50, int4s %51, int1s %52, ptr %53, int1s %54, int1s %55, int1s %56, ptr %57, offset %58, ptr %59, int4s %60, int1s %61, ptr %62, int1s %63, int1s %64, int1s %65, ptr %66, offset %67, ptr %68, int4s %69, int1s %70, ptr %71, int1s %72, int1s %73, int1s %74, ptr %75, offset %76, ptr %77, int4u %78, ptr %79, offset %80, offset %81, offset %82, ptr %83, int4u %84, ptr %85, offset %86, offset %87, offset %88, ptr %89, int4u %90, ptr %91, offset %92, offset %93, offset %94, ptr %95, int4u %96, ptr %97, offset %98, offset %99, offset %100, ptr %101, int4u %102, ptr %103, offset %104, offset %105, offset %106 + result: int4s %0 + stacksize: struct {int32[5], int32[5]} + entry: main118 + exit: main0 + + main99: imm %90, imm_int 25 --> main98 + main98: store int32, %89, %90 --> main97 + main97: imm %85, imm_addr "tab1" --> main96 + main96: imm %87, imm_int 0 --> main95 + main95: imm %88, imm_offset { int32[5], 3 } --> main94 + main94: add %86, %87, %88 --> main93 + main93: addp %83, %85, %86 --> main92 + main92: imm %84, imm_int 56 --> main91 + main91: store int32, %83, %84 --> main90 + main90: imm %79, imm_addr "tab1" --> main89 + main9: call "print_tab", [%8, %9], %10: ptr -> int4s -> void --> main8 + main89: imm %81, imm_int 0 --> main88 + main88: imm %82, imm_offset { int32[5], 4 } --> main87 + main87: add %80, %81, %82 --> main86 + main86: addp %77, %79, %80 --> main85 + main85: imm %78, imm_int -32 --> main84 + main84: store int32, %77, %78 --> main83 + main83: emit _cost6 --> main82 + main82: imm %75, imm_addr STACK --> main81 + main81: imm %76, imm_offset { struct {int32[5], int32[5]}, 1 } --> main80 + main80: addp %71, %75, %76 --> main79 + main8: imm %6, imm_addr STACK --> main7 + main79: imm %73, imm_int 0 --> main78 + main78: imm %74, imm_sizeof (int32) --> main77 + main77: mul %72, %73, %74 --> main76 + main76: addp %68, %71, %72 --> main75 + main75: imm %70, imm_int 0 --> main74 + main74: int1sto4 %69, %70 --> main73 + main73: store int32, %68, %69 --> main72 + main72: imm %66, imm_addr STACK --> main71 + main71: imm %67, imm_offset { struct {int32[5], int32[5]}, 1 } --> main70 + main70: addp %62, %66, %67 --> main69 + main7: imm %7, imm_offset { struct {int32[5], int32[5]}, 1 } --> main6 + main69: imm %64, imm_int 1 --> main68 + main68: imm %65, imm_sizeof (int32) --> main67 + main67: mul %63, %64, %65 --> main66 + main66: addp %59, %62, %63 --> main65 + main65: imm %61, imm_int 1 --> main64 + main64: int1sto4 %60, %61 --> main63 + main63: store int32, %59, %60 --> main62 + main62: imm %57, imm_addr STACK --> main61 + main61: imm %58, imm_offset { struct {int32[5], int32[5]}, 1 } --> main60 + main60: addp %53, %57, %58 --> main59 + main6: addp %2, %6, %7 --> main5 + main59: imm %55, imm_int 2 --> main58 + main58: imm %56, imm_sizeof (int32) --> main57 + main57: mul %54, %55, %56 --> main56 + main56: addp %50, %53, %54 --> main55 + main55: imm %52, imm_int 2 --> main54 + main54: int1sto4 %51, %52 --> main53 + main53: store int32, %50, %51 --> main52 + main52: imm %48, imm_addr STACK --> main51 + main51: imm %49, imm_offset { struct {int32[5], int32[5]}, 1 } --> main50 + main50: addp %44, %48, %49 --> main49 + main5: imm %5, imm_int 5 --> main4 + main49: imm %46, imm_int 3 --> main48 + main48: imm %47, imm_sizeof (int32) --> main47 + main47: mul %45, %46, %47 --> main46 + main46: addp %41, %44, %45 --> main45 + main45: imm %43, imm_int 3 --> main44 + main44: int1sto4 %42, %43 --> main43 + main43: store int32, %41, %42 --> main42 + main42: imm %39, imm_addr STACK --> main41 + main41: imm %40, imm_offset { struct {int32[5], int32[5]}, 1 } --> main40 + main40: addp %35, %39, %40 --> main39 + main4: int1sto4 %3, %5 --> main3 + main39: imm %37, imm_int 4 --> main38 + main38: imm %38, imm_sizeof (int32) --> main37 + main37: mul %36, %37, %38 --> main36 + main36: addp %32, %35, %36 --> main35 + main35: imm %34, imm_int 4 --> main34 + main34: int1sto4 %33, %34 --> main33 + main33: store int32, %32, %33 --> main32 + main32: imm %30, imm_addr STACK --> main31 + main31: imm %31, imm_offset { struct {int32[5]}, 0 } --> main30 + main30: addp %25, %30, %31 --> main29 + main3: call "print_tab", [%2, %3], %4: ptr -> int4s -> void --> main2 + main29: imm %26, imm_addr "tab1" --> main28 + main28: imm %29, imm_int 5 --> main27 + main27: int1sto4 %27, %29 --> main26 + main26: call "copy", [%25, %26, %27], %28: ptr -> ptr -> int4s -> void --> main25 + main25: imm %18, imm_addr "tab1" --> main24 + main24: imm %23, imm_addr STACK --> main23 + main23: imm %24, imm_offset { struct {int32[5], int32[5]}, 1 } --> main22 + main22: addp %19, %23, %24 --> main21 + main21: imm %22, imm_int 5 --> main20 + main20: int1sto4 %20, %22 --> main19 + main2: imm %1, imm_int 0 --> main1 + main19: call "copy", [%18, %19, %20], %21: ptr -> ptr -> int4s -> void --> main18 + main18: imm %14, imm_addr "tab1" --> main17 + main17: imm %17, imm_int 5 --> main16 + main16: int1sto4 %15, %17 --> main15 + main15: call "print_tab", [%14, %15], %16: ptr -> int4s -> void --> main14 + main14: imm %12, imm_addr STACK --> main13 + main13: imm %13, imm_offset { struct {int32[5]}, 0 } --> main12 + main12: addp %8, %12, %13 --> main11 + main118: imm %103, imm_addr "tab1" --> main117 + main117: imm %105, imm_int 0 --> main116 + main116: imm %106, imm_offset { int32[5], 0 } --> main115 + main115: add %104, %105, %106 --> main114 + main114: addp %101, %103, %104 --> main113 + main113: imm %102, imm_int 10 --> main112 + main112: store int32, %101, %102 --> main111 + main111: imm %97, imm_addr "tab1" --> main110 + main110: imm %99, imm_int 0 --> main109 + main11: imm %11, imm_int 5 --> main10 + main109: imm %100, imm_offset { int32[5], 1 } --> main108 + main108: add %98, %99, %100 --> main107 + main107: addp %95, %97, %98 --> main106 + main106: imm %96, imm_int -3 --> main105 + main105: store int32, %95, %96 --> main104 + main104: imm %91, imm_addr "tab1" --> main103 + main103: imm %93, imm_int 0 --> main102 + main102: imm %94, imm_offset { int32[5], 2 } --> main101 + main101: add %92, %93, %94 --> main100 + main100: addp %89, %91, %92 --> main99 + main10: int1sto4 %9, %11 --> main9 + main1: int1sto4 %0, %1 --> main0 + main0: return %0 + + diff --git a/tests/tmp_tests/Frontend/array_copy.c b/tests/tmp_tests/Frontend/array_copy.c new file mode 100644 index 0000000..187888e --- /dev/null +++ b/tests/tmp_tests/Frontend/array_copy.c @@ -0,0 +1,35 @@ + +#define SIZE 5 + +int tab1[SIZE] = {10, -3, 25, 56, -32}; + +void copy (int dst[], int src[], int size) { + int i; + + for (i = 0 ; i < size ; i++) + dst[i] = src[i]; +} + +void print_tab (int tab[], int size) { + int i; + + for (i = 0 ; i < size ; i++) { + print_sint(tab[i]); + space(); + } + newline(); +} + +int main () { + int tab2[SIZE]; + int tab3[SIZE] = {0, 1, 2, 3, 4}; + + copy(tab2, tab1, SIZE); + copy(tab1, tab3, SIZE); + + print_tab(tab1, SIZE); + print_tab(tab2, SIZE); + print_tab(tab3, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Frontend/bubble_sort.RTLabs b/tests/tmp_tests/Frontend/bubble_sort.RTLabs new file mode 100644 index 0000000..9cc571c --- /dev/null +++ b/tests/tmp_tests/Frontend/bubble_sort.RTLabs @@ -0,0 +1,218 @@ +program: + + + globals: + + + extern "print_sint": int4s -> void + + + extern "newline": void + + + extern "space": void + + + "min"(ptr %0, int4s %1, int4s %2) + locals: int4s %3, int4s %4, int4s %5, int4s %7, ptr %8, int4s %9, int4s %10, int4s %11, int4s %12, ptr %13, int4s %14, int4s %15, int4s %16, int4s %17, int4s %18, ptr %19, int4s %20, int4s %21, int1s %22, int4s %23, int4s %24 + result: int4s %6 + stacksize: struct {} + entry: min37 + exit: min0 + + min9: mul %9, %5, %10 --> min8 + min8: addp %8, %0, %9 --> min7 + min7: load int32, %8, %4 --> min5 + min6: emit _cost1 --> min5 + min5: imm %7, imm_int 1 --> min4 + min4: add %3, %3, %7 --> min3 + min37: emit _cost6 --> min36 + min36: imm %24, imm_int 0 --> min35 + min35: eq %23, %1, %24 --> min34 + min34: %23? --> min33, min30 + min33: emit _cost4 --> min32 + min32: imm %22, imm_int 0 --> min31 + min31: int1sto4 %6, %22 --> min0 + min30: emit _cost5 --> min29 + min3: --> min22 + min29: id %5, %2 --> min28 + min28: imm %21, imm_sizeof (int32) --> min27 + min27: mul %20, %5, %21 --> min26 + min26: addp %19, %0, %20 --> min25 + min25: load int32, %19, %4 --> min24 + min24: imm %18, imm_int 1 --> min23 + min23: add %3, %2, %18 --> min3 + min22: lt %17, %3, %1 --> min21 + min21: notbool %16, %17 --> min20 + min20: %16? --> min2, min19 + min2: emit _cost3 --> min1 + min19: emit _cost2 --> min18 + min18: imm %15, imm_sizeof (int32) --> min17 + min17: mul %14, %3, %15 --> min16 + min16: addp %13, %0, %14 --> min15 + min15: load int32, %13, %12 --> min14 + min14: lt %11, %12, %4 --> min13 + min13: %11? --> min12, min6 + min12: emit _cost0 --> min11 + min11: id %5, %3 --> min10 + min10: imm %10, imm_sizeof (int32) --> min9 + min1: id %6, %5 --> min0 + min0: return %6 + + + "swap"(ptr %0, int4s %1, int4s %2) + locals: int4s %3, ptr %5, int4s %6, int4s %7, ptr %8, int4s %9, ptr %10, int4s %11, int4s %12, int4s %13, int4s %14, ptr %15, int4s %16, int4s %17 + result: void %4 + stacksize: struct {} + entry: swap17 + exit: swap0 + + swap9: imm %12, imm_sizeof (int32) --> swap8 + swap8: mul %11, %2, %12 --> swap7 + swap7: addp %10, %0, %11 --> swap6 + swap6: load int32, %10, %9 --> swap5 + swap5: store int32, %8, %9 --> swap4 + swap4: imm %7, imm_sizeof (int32) --> swap3 + swap3: mul %6, %2, %7 --> swap2 + swap2: addp %5, %0, %6 --> swap1 + swap17: emit _cost7 --> swap16 + swap16: imm %17, imm_sizeof (int32) --> swap15 + swap15: mul %16, %1, %17 --> swap14 + swap14: addp %15, %0, %16 --> swap13 + swap13: load int32, %15, %3 --> swap12 + swap12: imm %14, imm_sizeof (int32) --> swap11 + swap11: mul %13, %1, %14 --> swap10 + swap10: addp %8, %0, %13 --> swap9 + swap1: store int32, %5, %3 --> swap0 + swap0: return + + + "bubble_sort"(ptr %0, int4s %1) + locals: int4s %2, int4s %3, int4s %4, int4s %6, int1u %7, int4s %8, int4s %9, int1s %10 + result: void %5 + stacksize: struct {} + entry: bubble_sort14 + exit: bubble_sort0 + + bubble_sort9: %8? --> bubble_sort1, bubble_sort8 + bubble_sort8: emit _cost8 --> bubble_sort7 + bubble_sort7: call "min", [%0, %1, %2], %4: ptr -> int4s -> int4s -> int4s --> bubble_sort6 + bubble_sort6: id %3, %4 --> bubble_sort5 + bubble_sort5: call "swap", [%0, %2, %3], %7: ptr -> int4s -> int4s -> void --> bubble_sort4 + bubble_sort4: imm %6, imm_int 1 --> bubble_sort3 + bubble_sort3: add %2, %2, %6 --> bubble_sort2 + bubble_sort2: --> bubble_sort11 + bubble_sort14: emit _cost10 --> bubble_sort13 + bubble_sort13: imm %10, imm_int 0 --> bubble_sort12 + bubble_sort12: int1sto4 %2, %10 --> bubble_sort2 + bubble_sort11: lt %9, %2, %1 --> bubble_sort10 + bubble_sort10: notbool %8, %9 --> bubble_sort9 + bubble_sort1: emit _cost9 --> bubble_sort0 + bubble_sort0: return + + + "print_tab"(ptr %0, int4s %1) + locals: int4s %2, int1u %4, int4s %5, int1u %6, int4s %7, int1u %8, ptr %9, int4s %10, int4s %11, int4s %12, int4s %13, int1s %14 + result: void %3 + stacksize: struct {} + entry: print_tab18 + exit: print_tab0 + + print_tab9: addp %9, %0, %10 --> print_tab8 + print_tab8: load int32, %9, %7 --> print_tab7 + print_tab7: call "print_sint", [%7], %8: int4s -> void --> print_tab6 + print_tab6: call "space", [], %6: void --> print_tab5 + print_tab5: imm %5, imm_int 1 --> print_tab4 + print_tab4: add %2, %2, %5 --> print_tab3 + print_tab3: --> print_tab15 + print_tab2: emit _cost12 --> print_tab1 + print_tab18: emit _cost13 --> print_tab17 + print_tab17: imm %14, imm_int 0 --> print_tab16 + print_tab16: int1sto4 %2, %14 --> print_tab3 + print_tab15: lt %13, %2, %1 --> print_tab14 + print_tab14: notbool %12, %13 --> print_tab13 + print_tab13: %12? --> print_tab2, print_tab12 + print_tab12: emit _cost11 --> print_tab11 + print_tab11: imm %11, imm_sizeof (int32) --> print_tab10 + print_tab10: mul %10, %2, %11 --> print_tab9 + print_tab1: call "newline", [], %4: void --> print_tab0 + print_tab0: return + + + "main"() + locals: int1s %1, ptr %2, int4s %3, int1u %4, int1s %5, ptr %6, offset %7, ptr %8, int4s %9, int1u %10, int1s %11, ptr %12, offset %13, ptr %14, int4s %15, int1s %16, ptr %17, int1s %18, int1s %19, int1s %20, ptr %21, offset %22, ptr %23, int4s %24, int1s %25, int1s %26, ptr %27, int1s %28, int1s %29, int1s %30, ptr %31, offset %32, ptr %33, int4s %34, int1s %35, ptr %36, int1s %37, int1s %38, int1s %39, ptr %40, offset %41, ptr %42, int4s %43, int1s %44, int1s %45, ptr %46, int1s %47, int1s %48, int1s %49, ptr %50, offset %51, ptr %52, int4s %53, int1s %54, ptr %55, int1s %56, int1s %57, int1s %58, ptr %59, offset %60 + result: int4s %0 + stacksize: struct {int32[5]} + entry: main67 + exit: main0 + + main9: call "bubble_sort", [%8, %9], %10: ptr -> int4s -> void --> main8 + main8: imm %6, imm_addr STACK --> main7 + main7: imm %7, imm_offset { struct {int32[5]}, 0 } --> main6 + main67: emit _cost14 --> main66 + main66: imm %59, imm_addr STACK --> main65 + main65: imm %60, imm_offset { struct {int32[5]}, 0 } --> main64 + main64: addp %55, %59, %60 --> main63 + main63: imm %57, imm_int 0 --> main62 + main62: imm %58, imm_sizeof (int32) --> main61 + main61: mul %56, %57, %58 --> main60 + main60: addp %52, %55, %56 --> main59 + main6: addp %2, %6, %7 --> main5 + main59: imm %54, imm_int 26 --> main58 + main58: int1sto4 %53, %54 --> main57 + main57: store int32, %52, %53 --> main56 + main56: imm %50, imm_addr STACK --> main55 + main55: imm %51, imm_offset { struct {int32[5]}, 0 } --> main54 + main54: addp %46, %50, %51 --> main53 + main53: imm %48, imm_int 1 --> main52 + main52: imm %49, imm_sizeof (int32) --> main51 + main51: mul %47, %48, %49 --> main50 + main50: addp %42, %46, %47 --> main49 + main5: imm %5, imm_int 5 --> main4 + main49: imm %45, imm_int 21 --> main48 + main48: negint %44, %45 --> main47 + main47: int1sto4 %43, %44 --> main46 + main46: store int32, %42, %43 --> main45 + main45: imm %40, imm_addr STACK --> main44 + main44: imm %41, imm_offset { struct {int32[5]}, 0 } --> main43 + main43: addp %36, %40, %41 --> main42 + main42: imm %38, imm_int 2 --> main41 + main41: imm %39, imm_sizeof (int32) --> main40 + main40: mul %37, %38, %39 --> main39 + main4: int1sto4 %3, %5 --> main3 + main39: addp %33, %36, %37 --> main38 + main38: imm %35, imm_int 43 --> main37 + main37: int1sto4 %34, %35 --> main36 + main36: store int32, %33, %34 --> main35 + main35: imm %31, imm_addr STACK --> main34 + main34: imm %32, imm_offset { struct {int32[5]}, 0 } --> main33 + main33: addp %27, %31, %32 --> main32 + main32: imm %29, imm_int 3 --> main31 + main31: imm %30, imm_sizeof (int32) --> main30 + main30: mul %28, %29, %30 --> main29 + main3: call "print_tab", [%2, %3], %4: ptr -> int4s -> void --> main2 + main29: addp %23, %27, %28 --> main28 + main28: imm %26, imm_int 62 --> main27 + main27: negint %25, %26 --> main26 + main26: int1sto4 %24, %25 --> main25 + main25: store int32, %23, %24 --> main24 + main24: imm %21, imm_addr STACK --> main23 + main23: imm %22, imm_offset { struct {int32[5]}, 0 } --> main22 + main22: addp %17, %21, %22 --> main21 + main21: imm %19, imm_int 4 --> main20 + main20: imm %20, imm_sizeof (int32) --> main19 + main2: imm %1, imm_int 0 --> main1 + main19: mul %18, %19, %20 --> main18 + main18: addp %14, %17, %18 --> main17 + main17: imm %16, imm_int 8 --> main16 + main16: int1sto4 %15, %16 --> main15 + main15: store int32, %14, %15 --> main14 + main14: imm %12, imm_addr STACK --> main13 + main13: imm %13, imm_offset { struct {int32[5]}, 0 } --> main12 + main12: addp %8, %12, %13 --> main11 + main11: imm %11, imm_int 5 --> main10 + main10: int1sto4 %9, %11 --> main9 + main1: int1sto4 %0, %1 --> main0 + main0: return %0 + + diff --git a/tests/tmp_tests/Frontend/bubble_sort.c b/tests/tmp_tests/Frontend/bubble_sort.c new file mode 100644 index 0000000..d6a8b1a --- /dev/null +++ b/tests/tmp_tests/Frontend/bubble_sort.c @@ -0,0 +1,52 @@ + +#define SIZE 5 + +int min (int tab[], int size, int n) { + int i, min_index, min; + + if (size == 0) return 0; + + min_index = n; + min = tab[min_index]; + for (i = n+1 ; i < size ; i++) { + if (tab[i] < min) { + min_index = i; + min = tab[min_index]; + } + } + + return min_index; +} + +void swap (int tab[], int i, int j) { + int t; + t = tab[i] ; tab[i] = tab[j] ; tab[j] = t; +} + +void bubble_sort(int tab[], int size) { + int i, min_index; + + for (i = 0 ; i < size ; i++) { + min_index = min(tab, size, i); + swap(tab, i, min_index); + } +} + +void print_tab (int tab[], int size) { + int i; + + for (i = 0 ; i < size ; i++) { + print_sint(tab[i]); + space(); + } + newline(); +} + +int main () { + int tab[SIZE] = {26, -21, 43, -62, 8}; + + bubble_sort(tab, SIZE); + print_tab(tab, SIZE); + + return 0; +} diff --git a/tests/tmp_tests/Frontend/call.c b/tests/tmp_tests/Frontend/call.c new file mode 100644 index 0000000..f595731 --- /dev/null +++ b/tests/tmp_tests/Frontend/call.c @@ -0,0 +1,4 @@ + +int f () { return 0; } + +int main () { return (f()); } diff --git a/tests/tmp_tests/Frontend/quicksort.RTLabs b/tests/tmp_tests/Frontend/quicksort.RTLabs new file mode 100644 index 0000000..5766cfd --- /dev/null +++ b/tests/tmp_tests/Frontend/quicksort.RTLabs @@ -0,0 +1,239 @@ +program: + + + globals: + + + extern "print_sint": int4s -> void + + + extern "newline": void + + + extern "space": void + + + "swap"(ptr %0, int4s %1, int4s %2) + locals: int4s %3, ptr %5, int4s %6, int4s %7, ptr %8, int4s %9, ptr %10, int4s %11, int4s %12, int4s %13, int4s %14, ptr %15, int4s %16, int4s %17 + result: void %4 + stacksize: struct {} + entry: swap17 + exit: swap0 + + swap9: imm %12, imm_sizeof (int32) --> swap8 + swap8: mul %11, %2, %12 --> swap7 + swap7: addp %10, %0, %11 --> swap6 + swap6: load int32, %10, %9 --> swap5 + swap5: store int32, %8, %9 --> swap4 + swap4: imm %7, imm_sizeof (int32) --> swap3 + swap3: mul %6, %2, %7 --> swap2 + swap2: addp %5, %0, %6 --> swap1 + swap17: emit _cost0 --> swap16 + swap16: imm %17, imm_sizeof (int32) --> swap15 + swap15: mul %16, %1, %17 --> swap14 + swap14: addp %15, %0, %16 --> swap13 + swap13: load int32, %15, %3 --> swap12 + swap12: imm %14, imm_sizeof (int32) --> swap11 + swap11: mul %13, %1, %14 --> swap10 + swap10: addp %8, %0, %13 --> swap9 + swap1: store int32, %5, %3 --> swap0 + swap0: return + + + "partition"(ptr %0, int4s %1, int4s %2) + locals: int4s %3, int4s %4, int4s %5, int1u %7, int1u %8, int4s %9, int4s %10, int4s %11, int4s %12, ptr %13, int4s %14, int4s %15, int4s %16, int4s %17, int4s %18, int4s %19, int4s %20, int4s %21, ptr %22, int4s %23, int4s %24, int4s %25, int1s %26, int1s %27, int4s %28, ptr %29, int4s %30, int4s %31 + result: int4s %6 + stacksize: struct {} + entry: partition55 + exit: partition0 + + partition9: ge %9, %3, %4 --> partition8 + partition8: %9? --> partition7, partition6 + partition7: emit _cost1 --> partition3 + partition6: emit _cost2 --> partition5 + partition55: emit _cost13 --> partition54 + partition54: imm %31, imm_sizeof (int32) --> partition53 + partition53: mul %30, %1, %31 --> partition52 + partition52: addp %29, %0, %30 --> partition51 + partition51: load int32, %29, %5 --> partition50 + partition50: id %3, %1 --> partition49 + partition5: call "swap", [%0, %3, %4], %8: ptr -> int4s -> int4s -> void --> partition4 + partition49: imm %28, imm_int 1 --> partition48 + partition48: add %4, %2, %28 --> partition4 + partition47: imm %27, imm_int 1 --> partition46 + partition46: notbool %26, %27 --> partition45 + partition45: %26? --> partition3, partition44 + partition44: emit _cost11 --> partition23 + partition43: le %25, %3, %2 --> partition42 + partition42: %25? --> partition41, partition30 + partition41: emit _cost8 --> partition40 + partition40: imm %24, imm_sizeof (int32) --> partition39 + partition4: --> partition47 + partition39: mul %23, %3, %24 --> partition38 + partition38: addp %22, %0, %23 --> partition37 + partition37: load int32, %22, %21 --> partition36 + partition36: le %20, %21, %5 --> partition35 + partition35: %20? --> partition34, partition32 + partition34: emit _cost6 --> partition33 + partition33: imm %19, imm_int 1 --> partition28 + partition32: emit _cost7 --> partition31 + partition31: imm %19, imm_int 0 --> partition28 + partition30: emit _cost9 --> partition29 + partition3: emit _cost12 --> partition2 + partition29: imm %19, imm_int 0 --> partition28 + partition28: notbool %18, %19 --> partition27 + partition27: %18? --> partition22, partition26 + partition26: emit _cost5 --> partition25 + partition25: imm %17, imm_int 1 --> partition24 + partition24: add %3, %3, %17 --> partition23 + partition23: --> partition43 + partition22: emit _cost10 --> partition11 + partition21: emit _cost3 --> partition20 + partition20: imm %16, imm_int 1 --> partition19 + partition2: call "swap", [%0, %1, %4], %7: ptr -> int4s -> int4s -> void --> partition1 + partition19: sub %4, %4, %16 --> partition18 + partition18: imm %15, imm_sizeof (int32) --> partition17 + partition17: mul %14, %4, %15 --> partition16 + partition16: addp %13, %0, %14 --> partition15 + partition15: load int32, %13, %12 --> partition14 + partition14: gt %11, %12, %5 --> partition13 + partition13: notbool %10, %11 --> partition12 + partition12: %10? --> partition10, partition11 + partition11: --> partition21 + partition10: emit _cost4 --> partition9 + partition1: id %6, %4 --> partition0 + partition0: return %6 + + + "quicksort"(ptr %0, int4s %1, int4s %2) + locals: int4s %3, int4s %4, int4s %6, int1u %7, int4s %8, int4s %9, int1u %10, int4s %11, int4s %12 + result: void %5 + stacksize: struct {} + entry: quicksort13 + exit: quicksort0 + + quicksort9: call "partition", [%0, %1, %2], %4: ptr -> int4s -> int4s -> int4s --> quicksort8 + quicksort8: id %3, %4 --> quicksort7 + quicksort7: imm %11, imm_int 1 --> quicksort6 + quicksort6: sub %9, %3, %11 --> quicksort5 + quicksort5: call "quicksort", [%0, %1, %9], %10: ptr -> int4s -> int4s -> void --> quicksort4 + quicksort4: imm %8, imm_int 1 --> quicksort3 + quicksort3: add %6, %3, %8 --> quicksort2 + quicksort2: call "quicksort", [%0, %6, %2], %7: ptr -> int4s -> int4s -> void --> quicksort0 + quicksort13: emit _cost16 --> quicksort12 + quicksort12: lt %12, %1, %2 --> quicksort11 + quicksort11: %12? --> quicksort10, quicksort1 + quicksort10: emit _cost14 --> quicksort9 + quicksort1: emit _cost15 --> quicksort0 + quicksort0: return + + + "print_tab"(ptr %0, int4s %1) + locals: int4s %2, int1u %4, int4s %5, int1u %6, int4s %7, int1u %8, ptr %9, int4s %10, int4s %11, int4s %12, int4s %13, int1s %14 + result: void %3 + stacksize: struct {} + entry: print_tab18 + exit: print_tab0 + + print_tab9: addp %9, %0, %10 --> print_tab8 + print_tab8: load int32, %9, %7 --> print_tab7 + print_tab7: call "print_sint", [%7], %8: int4s -> void --> print_tab6 + print_tab6: call "space", [], %6: void --> print_tab5 + print_tab5: imm %5, imm_int 1 --> print_tab4 + print_tab4: add %2, %2, %5 --> print_tab3 + print_tab3: --> print_tab15 + print_tab2: emit _cost18 --> print_tab1 + print_tab18: emit _cost19 --> print_tab17 + print_tab17: imm %14, imm_int 0 --> print_tab16 + print_tab16: int1sto4 %2, %14 --> print_tab3 + print_tab15: lt %13, %2, %1 --> print_tab14 + print_tab14: notbool %12, %13 --> print_tab13 + print_tab13: %12? --> print_tab2, print_tab12 + print_tab12: emit _cost17 --> print_tab11 + print_tab11: imm %11, imm_sizeof (int32) --> print_tab10 + print_tab10: mul %10, %2, %11 --> print_tab9 + print_tab1: call "newline", [], %4: void --> print_tab0 + print_tab0: return + + + "main"() + locals: int1s %1, ptr %2, int4s %3, int1u %4, int1s %5, ptr %6, offset %7, ptr %8, int4s %9, int4s %10, int1u %11, int1s %12, int1s %13, int1s %14, int1s %15, ptr %16, offset %17, ptr %18, int4s %19, int1s %20, ptr %21, int1s %22, int1s %23, int1s %24, ptr %25, offset %26, ptr %27, int4s %28, int1s %29, int1s %30, ptr %31, int1s %32, int1s %33, int1s %34, ptr %35, offset %36, ptr %37, int4s %38, int1s %39, ptr %40, int1s %41, int1s %42, int1s %43, ptr %44, offset %45, ptr %46, int4s %47, int1s %48, int1s %49, ptr %50, int1s %51, int1s %52, int1s %53, ptr %54, offset %55, ptr %56, int4s %57, int1s %58, ptr %59, int1s %60, int1s %61, int1s %62, ptr %63, offset %64 + result: int4s %0 + stacksize: struct {int32[5]} + entry: main71 + exit: main0 + + main9: call "quicksort", [%8, %9, %10], %11: ptr -> int4s -> int4s -> void --> main8 + main8: imm %6, imm_addr STACK --> main7 + main71: emit _cost20 --> main70 + main70: imm %63, imm_addr STACK --> main69 + main7: imm %7, imm_offset { struct {int32[5]}, 0 } --> main6 + main69: imm %64, imm_offset { struct {int32[5]}, 0 } --> main68 + main68: addp %59, %63, %64 --> main67 + main67: imm %61, imm_int 0 --> main66 + main66: imm %62, imm_sizeof (int32) --> main65 + main65: mul %60, %61, %62 --> main64 + main64: addp %56, %59, %60 --> main63 + main63: imm %58, imm_int 26 --> main62 + main62: int1sto4 %57, %58 --> main61 + main61: store int32, %56, %57 --> main60 + main60: imm %54, imm_addr STACK --> main59 + main6: addp %2, %6, %7 --> main5 + main59: imm %55, imm_offset { struct {int32[5]}, 0 } --> main58 + main58: addp %50, %54, %55 --> main57 + main57: imm %52, imm_int 1 --> main56 + main56: imm %53, imm_sizeof (int32) --> main55 + main55: mul %51, %52, %53 --> main54 + main54: addp %46, %50, %51 --> main53 + main53: imm %49, imm_int 21 --> main52 + main52: negint %48, %49 --> main51 + main51: int1sto4 %47, %48 --> main50 + main50: store int32, %46, %47 --> main49 + main5: imm %5, imm_int 5 --> main4 + main49: imm %44, imm_addr STACK --> main48 + main48: imm %45, imm_offset { struct {int32[5]}, 0 } --> main47 + main47: addp %40, %44, %45 --> main46 + main46: imm %42, imm_int 2 --> main45 + main45: imm %43, imm_sizeof (int32) --> main44 + main44: mul %41, %42, %43 --> main43 + main43: addp %37, %40, %41 --> main42 + main42: imm %39, imm_int 43 --> main41 + main41: int1sto4 %38, %39 --> main40 + main40: store int32, %37, %38 --> main39 + main4: int1sto4 %3, %5 --> main3 + main39: imm %35, imm_addr STACK --> main38 + main38: imm %36, imm_offset { struct {int32[5]}, 0 } --> main37 + main37: addp %31, %35, %36 --> main36 + main36: imm %33, imm_int 3 --> main35 + main35: imm %34, imm_sizeof (int32) --> main34 + main34: mul %32, %33, %34 --> main33 + main33: addp %27, %31, %32 --> main32 + main32: imm %30, imm_int 62 --> main31 + main31: negint %29, %30 --> main30 + main30: int1sto4 %28, %29 --> main29 + main3: call "print_tab", [%2, %3], %4: ptr -> int4s -> void --> main2 + main29: store int32, %27, %28 --> main28 + main28: imm %25, imm_addr STACK --> main27 + main27: imm %26, imm_offset { struct {int32[5]}, 0 } --> main26 + main26: addp %21, %25, %26 --> main25 + main25: imm %23, imm_int 4 --> main24 + main24: imm %24, imm_sizeof (int32) --> main23 + main23: mul %22, %23, %24 --> main22 + main22: addp %18, %21, %22 --> main21 + main21: imm %20, imm_int 8 --> main20 + main20: int1sto4 %19, %20 --> main19 + main2: imm %1, imm_int 0 --> main1 + main19: store int32, %18, %19 --> main18 + main18: imm %16, imm_addr STACK --> main17 + main17: imm %17, imm_offset { struct {int32[5]}, 0 } --> main16 + main16: addp %8, %16, %17 --> main15 + main15: imm %15, imm_int 0 --> main14 + main14: int1sto4 %9, %15 --> main13 + main13: imm %13, imm_int 5 --> main12 + main12: imm %14, imm_int 1 --> main11 + main11: sub %12, %13, %14 --> main10 + main10: int1sto4 %10, %12 --> main9 + main1: int1sto4 %0, %1 --> main0 + main0: return %0 + + diff --git a/tests/tmp_tests/Frontend/quicksort.c b/tests/tmp_tests/Frontend/quicksort.c new file mode 100644 index 0000000..bbf6eea --- /dev/null +++ b/tests/tmp_tests/Frontend/quicksort.c @@ -0,0 +1,61 @@ + +#define SIZE 5 + +void swap (int a[], int i, int j) { + int t; + t = a[i] ; a[i] = a[j] ; a[j] = t; +} + +int partition (int a[], int l, int r) { + int pivot, i, j; + pivot = a[l]; + i = l; j = r+1; + + while (1) { + while (i <= r && a[i] <= pivot) ++i; + do --j; while (a[j] > pivot); + if (i >= j) break; + swap(a, i, j); + } + swap(a, l, j); + return j; +} + +void quicksort (int a[], int l, int r) { + int j; + + if (l < r) { + j = partition(a, l, r); + quicksort(a, l, j-1); + quicksort(a, j+1, r); + } +} + +void print_tab (int tab[], int size) { + int i; + + for (i = 0 ; i < size ; i++) { + print_sint(tab[i]); + space(); + } + newline(); +} + +int is_sorted (int tab[], int size) { + int i, res = 1; + + for (i = 0 ; i < size-1 ; i++) res = res && (tab[i] <= tab[i+1]); + + return res; +} + +int main () { + int tab[SIZE] = {26, -21, 43, -62, 8}; + + quicksort(tab, 0, SIZE-1); + print_tab(tab, SIZE); + print_sint(is_sorted(tab, SIZE)); + newline(); + + return (is_sorted(tab, SIZE)); +} diff --git a/tests/tmp_tests/Frontend/search.RTLabs b/tests/tmp_tests/Frontend/search.RTLabs new file mode 100644 index 0000000..3b0c033 --- /dev/null +++ b/tests/tmp_tests/Frontend/search.RTLabs @@ -0,0 +1,177 @@ +program: + + + globals: + "to_find" { int32[2] } + + + extern "print_sint": int4s -> void + + + extern "newline": void + + + extern "space": void + + + "search"(ptr %0, int4s %1, int4s %2) + locals: int4s %3, int4s %4, int4s %5, int1s %7, int1s %8, int4s %9, int4s %10, int4s %11, ptr %12, int4s %13, int4s %14, int4s %15, int4s %16, int4s %17, ptr %18, int4s %19, int4s %20, int4s %21, int4s %22, ptr %23, int4s %24, int4s %25, int4s %26, int4s %27, int4s %28, int4s %29, int4s %30, int1s %31 + result: int4s %6 + stacksize: struct {} + entry: search46 + exit: search0 + + search9: emit _cost0 --> search8 + search8: imm %9, imm_int 1 --> search7 + search7: add %5, %4, %9 --> search5 + search6: emit _cost1 --> search5 + search5: --> search41 + search46: emit _cost8 --> search45 + search45: imm %31, imm_int 0 --> search44 + search44: int1sto4 %5, %31 --> search43 + search43: imm %30, imm_int 1 --> search42 + search42: sub %3, %1, %30 --> search5 + search41: ge %29, %3, %5 --> search40 + search40: notbool %28, %29 --> search39 + search4: emit _cost7 --> search3 + search39: %28? --> search4, search38 + search38: emit _cost6 --> search37 + search37: add %26, %3, %5 --> search36 + search36: imm %27, imm_int 2 --> search35 + search35: div %4, %26, %27 --> search34 + search34: imm %25, imm_sizeof (int32) --> search33 + search33: mul %24, %4, %25 --> search32 + search32: addp %23, %0, %24 --> search31 + search31: load int32, %23, %22 --> search30 + search30: eq %21, %22, %2 --> search29 + search3: imm %8, imm_int 1 --> search2 + search29: %21? --> search28, search26 + search28: emit _cost4 --> search27 + search27: id %6, %4 --> search0 + search26: emit _cost5 --> search25 + search25: imm %20, imm_sizeof (int32) --> search24 + search24: mul %19, %4, %20 --> search23 + search23: addp %18, %0, %19 --> search22 + search22: load int32, %18, %17 --> search21 + search21: gt %16, %17, %2 --> search20 + search20: %16? --> search19, search16 + search2: negint %7, %8 --> search1 + search19: emit _cost2 --> search18 + search18: imm %15, imm_int 1 --> search17 + search17: sub %3, %4, %15 --> search15 + search16: emit _cost3 --> search15 + search15: imm %14, imm_sizeof (int32) --> search14 + search14: mul %13, %4, %14 --> search13 + search13: addp %12, %0, %13 --> search12 + search12: load int32, %12, %11 --> search11 + search11: lt %10, %11, %2 --> search10 + search10: %10? --> search9, search6 + search1: int1sto4 %6, %7 --> search0 + search0: return %6 + + + "main"() + locals: int4s %0, int4s %1, int4s %2, int4s %3, int1s %5, int1u %6, int4s %7, int1u %8, int1u %9, ptr %10, int4s %11, int4s %12, ptr %13, ptr %14, int4s %15, int4s %16, int1s %17, ptr %18, offset %19, int4s %20, int4s %21, int4s %22, int1s %23, ptr %24, int4s %25, int1s %26, ptr %27, int1s %28, int1s %29, int1s %30, ptr %31, offset %32, ptr %33, int4s %34, int1s %35, ptr %36, int1s %37, int1s %38, int1s %39, ptr %40, offset %41, ptr %42, int4s %43, int1s %44, ptr %45, int1s %46, int1s %47, int1s %48, ptr %49, offset %50, ptr %51, int4s %52, int1s %53, int1s %54, ptr %55, int1s %56, int1s %57, int1s %58, ptr %59, offset %60, ptr %61, int4s %62, int1s %63, int1s %64, ptr %65, int1s %66, int1s %67, int1s %68, ptr %69, offset %70, ptr %71, int4u %72, ptr %73, offset %74, offset %75, offset %76, ptr %77, int4u %78, ptr %79, offset %80, offset %81, offset %82 + result: int4s %4 + stacksize: struct {int32[5]} + entry: main95 + exit: main0 + + main95: imm %79, imm_addr "to_find" --> main94 + main94: imm %81, imm_int 0 --> main93 + main93: imm %82, imm_offset { int32[2], 0 } --> main92 + main92: add %80, %81, %82 --> main91 + main91: addp %77, %79, %80 --> main90 + main90: imm %78, imm_int 57 --> main89 + main9: call "print_sint", [%2], %9: int4s -> void --> main8 + main89: store int32, %77, %78 --> main88 + main88: imm %73, imm_addr "to_find" --> main87 + main87: imm %75, imm_int 0 --> main86 + main86: imm %76, imm_offset { int32[2], 1 } --> main85 + main85: add %74, %75, %76 --> main84 + main84: addp %71, %73, %74 --> main83 + main83: imm %72, imm_int -1 --> main82 + main82: store int32, %71, %72 --> main81 + main81: emit _cost11 --> main80 + main80: imm %69, imm_addr STACK --> main79 + main8: call "space", [], %8: void --> main7 + main79: imm %70, imm_offset { struct {int32[5]}, 0 } --> main78 + main78: addp %65, %69, %70 --> main77 + main77: imm %67, imm_int 0 --> main76 + main76: imm %68, imm_sizeof (int32) --> main75 + main75: mul %66, %67, %68 --> main74 + main74: addp %61, %65, %66 --> main73 + main73: imm %64, imm_int 30 --> main72 + main72: negint %63, %64 --> main71 + main71: int1sto4 %62, %63 --> main70 + main70: store int32, %61, %62 --> main69 + main7: imm %7, imm_int 1 --> main6 + main69: imm %59, imm_addr STACK --> main68 + main68: imm %60, imm_offset { struct {int32[5]}, 0 } --> main67 + main67: addp %55, %59, %60 --> main66 + main66: imm %57, imm_int 1 --> main65 + main65: imm %58, imm_sizeof (int32) --> main64 + main64: mul %56, %57, %58 --> main63 + main63: addp %51, %55, %56 --> main62 + main62: imm %54, imm_int 18 --> main61 + main61: negint %53, %54 --> main60 + main60: int1sto4 %52, %53 --> main59 + main6: add %0, %0, %7 --> main5 + main59: store int32, %51, %52 --> main58 + main58: imm %49, imm_addr STACK --> main57 + main57: imm %50, imm_offset { struct {int32[5]}, 0 } --> main56 + main56: addp %45, %49, %50 --> main55 + main55: imm %47, imm_int 2 --> main54 + main54: imm %48, imm_sizeof (int32) --> main53 + main53: mul %46, %47, %48 --> main52 + main52: addp %42, %45, %46 --> main51 + main51: imm %44, imm_int 23 --> main50 + main50: int1sto4 %43, %44 --> main49 + main5: --> main26 + main49: store int32, %42, %43 --> main48 + main48: imm %40, imm_addr STACK --> main47 + main47: imm %41, imm_offset { struct {int32[5]}, 0 } --> main46 + main46: addp %36, %40, %41 --> main45 + main45: imm %38, imm_int 3 --> main44 + main44: imm %39, imm_sizeof (int32) --> main43 + main43: mul %37, %38, %39 --> main42 + main42: addp %33, %36, %37 --> main41 + main41: imm %35, imm_int 57 --> main40 + main40: int1sto4 %34, %35 --> main39 + main4: emit _cost10 --> main3 + main39: store int32, %33, %34 --> main38 + main38: imm %31, imm_addr STACK --> main37 + main37: imm %32, imm_offset { struct {int32[5]}, 0 } --> main36 + main36: addp %27, %31, %32 --> main35 + main35: imm %29, imm_int 4 --> main34 + main34: imm %30, imm_sizeof (int32) --> main33 + main33: mul %28, %29, %30 --> main32 + main32: addp %24, %27, %28 --> main31 + main31: imm %26, imm_int 120 --> main30 + main30: int1sto4 %25, %26 --> main29 + main3: call "newline", [], %6: void --> main2 + main29: store int32, %24, %25 --> main28 + main28: imm %23, imm_int 0 --> main27 + main27: int1sto4 %0, %23 --> main5 + main26: imm %22, imm_int 2 --> main25 + main25: lt %21, %0, %22 --> main24 + main24: notbool %20, %21 --> main23 + main23: %20? --> main4, main22 + main22: emit _cost9 --> main21 + main21: imm %18, imm_addr STACK --> main20 + main20: imm %19, imm_offset { struct {int32[5]}, 0 } --> main19 + main2: imm %5, imm_int 0 --> main1 + main19: addp %10, %18, %19 --> main18 + main18: imm %17, imm_int 5 --> main17 + main17: int1sto4 %11, %17 --> main16 + main16: imm %14, imm_addr "to_find" --> main15 + main15: imm %16, imm_sizeof (int32) --> main14 + main14: mul %15, %0, %16 --> main13 + main13: addp %13, %14, %15 --> main12 + main12: load int32, %13, %12 --> main11 + main11: call "search", [%10, %11, %12], %3: ptr -> int4s -> int4s -> int4s --> main10 + main10: id %2, %3 --> main9 + main1: int1sto4 %4, %5 --> main0 + main0: return %4 + + diff --git a/tests/tmp_tests/Frontend/search.c b/tests/tmp_tests/Frontend/search.c new file mode 100644 index 0000000..f671546 --- /dev/null +++ b/tests/tmp_tests/Frontend/search.c @@ -0,0 +1,32 @@ +#define SIZE 5 +#define NB_FINDS 2 + +// Searching for the values below +int to_find[NB_FINDS] = {57, -1}; + +int search (int tab[], int size, int to_find) { + int low = 0, high = size-1, i; + + while (high >= low) { + i = (high+low) / 2; + if (tab[i] == to_find) return i; + if (tab[i] > to_find) high = i-1; + if (tab[i] < to_find) low = i+1; + } + + return (-1); +} + +int main () { + int tab[SIZE] = {-30, -18, 23, 57, 120}; + int res; + int i; + + for (i = 0 ; i < NB_FINDS ; i++) { + print_sint(search(tab, SIZE, to_find[i])); + space(); + } + newline(); + + return 0; +} diff --git a/tests/tmp_tests/Frontend/struct_and_ptr_and_fact.RTLabs b/tests/tmp_tests/Frontend/struct_and_ptr_and_fact.RTLabs new file mode 100644 index 0000000..c2ce22c --- /dev/null +++ b/tests/tmp_tests/Frontend/struct_and_ptr_and_fact.RTLabs @@ -0,0 +1,163 @@ +program: + + + globals: + "p" { ptr } + "save" { struct {int32, int32} } + + + extern "print_sint": int4s -> void + + + extern "newline": void + + + "fact1"(int4s %0) + locals: int4s %1, int4s %2, int4s %4, int4s %5, int1s %6, int4s %7, int4s %8 + result: int4s %3 + stacksize: struct {} + entry: fact113 + exit: fact10 + + fact19: emit _cost0 --> fact18 + fact18: imm %6, imm_int 1 --> fact17 + fact17: int1sto4 %3, %6 --> fact10 + fact16: emit _cost1 --> fact15 + fact15: imm %5, imm_int 1 --> fact14 + fact14: sub %4, %0, %5 --> fact13 + fact13: call "fact1", [%4], %2: int4s -> int4s --> fact12 + fact12: id %1, %2 --> fact11 + fact113: emit _cost2 --> fact112 + fact112: imm %8, imm_int 1 --> fact111 + fact111: le %7, %0, %8 --> fact110 + fact110: %7? --> fact19, fact16 + fact11: mul %3, %0, %1 --> fact10 + fact10: return %3 + + + "fact2"(int4s %0) + locals: int4s %1, int4s %2, int4s %4, int4s %5, int4s %6, int1s %7, int1s %8 + result: int4s %3 + stacksize: struct {} + entry: fact215 + exit: fact20 + + fact29: notbool %5, %6 --> fact28 + fact28: %5? --> fact22, fact27 + fact27: emit _cost3 --> fact26 + fact26: mul %2, %2, %1 --> fact25 + fact25: imm %4, imm_int 1 --> fact24 + fact24: add %1, %1, %4 --> fact23 + fact23: --> fact210 + fact22: emit _cost4 --> fact21 + fact215: emit _cost5 --> fact214 + fact214: imm %8, imm_int 1 --> fact213 + fact213: int1sto4 %2, %8 --> fact212 + fact212: imm %7, imm_int 1 --> fact211 + fact211: int1sto4 %1, %7 --> fact23 + fact210: le %6, %1, %0 --> fact29 + fact21: id %3, %2 --> fact20 + fact20: return %3 + + + "main"() + locals: int4s %0, int4s %1, int4s %2, int4s %3, int1s %5, int1u %6, int4s %7, int1u %8, int4s %9, int4s %10, ptr %11, ptr %12, offset %13, ptr %14, offset %15, ptr %16, ptr %17, offset %18, ptr %19, ptr %20, int1s %21, int1s %22, int1s %23, ptr %24, offset %25, ptr %26, ptr %27, offset %28, ptr %29, offset %30, int4s %31, ptr %32, ptr %33, offset %34, ptr %35, ptr %36, offset %37, ptr %38, offset %39, int4s %40, ptr %41, ptr %42, offset %43, ptr %44, int4s %45, ptr %46, ptr %47, offset %48, ptr %49, offset %50, ptr %51, offset %52, ptr %53, int4s %54, ptr %55, ptr %56, offset %57, ptr %58, offset %59, ptr %60, offset %61, ptr %62, ptr %63, ptr %64, offset %65, ptr %66, ptr %67, ptr %68, offset %69, ptr %70, int1s %71, int1s %72, int1s %73, ptr %74, offset %75, ptr %76, int4s %77, int1s %78, ptr %79, offset %80, ptr %81, offset %82 + result: int4s %4 + stacksize: struct {struct {int32, int32}, struct {int32, int32}, ptr[3]} + entry: main91 + exit: main0 + + main91: emit _cost6 --> main90 + main90: imm %81, imm_addr STACK --> main89 + main9: addp %12, %14, %15 --> main8 + main89: imm %82, imm_offset { struct {struct {int32, int32}}, 0 } --> main88 + main88: addp %79, %81, %82 --> main87 + main87: imm %80, imm_offset { struct {int32, int32}, 1 } --> main86 + main86: addp %76, %79, %80 --> main85 + main85: imm %78, imm_int 5 --> main84 + main84: int1sto4 %77, %78 --> main83 + main83: store int32, %76, %77 --> main82 + main82: imm %74, imm_addr STACK --> main81 + main81: imm %75, imm_offset { struct {struct {int32, int32}, struct {int32, int32}, ptr[3]}, 2 } --> main80 + main80: addp %70, %74, %75 --> main79 + main8: imm %13, imm_offset { struct {int32, int32}, 1 } --> main7 + main79: imm %72, imm_int 1 --> main78 + main78: imm %73, imm_sizeof (ptr) --> main77 + main77: mul %71, %72, %73 --> main76 + main76: addp %66, %70, %71 --> main75 + main75: imm %68, imm_addr STACK --> main74 + main74: imm %69, imm_offset { struct {struct {int32, int32}}, 0 } --> main73 + main73: addp %67, %68, %69 --> main72 + main72: store ptr, %66, %67 --> main71 + main71: imm %62, imm_addr "p" --> main70 + main70: imm %64, imm_addr STACK --> main69 + main7: addp %11, %12, %13 --> main6 + main69: imm %65, imm_offset { struct {struct {int32, int32}}, 0 } --> main68 + main68: addp %63, %64, %65 --> main67 + main67: store ptr, %62, %63 --> main66 + main66: imm %60, imm_addr "save" --> main65 + main65: imm %61, imm_offset { struct {int32, int32}, 0 } --> main64 + main64: addp %53, %60, %61 --> main63 + main63: imm %58, imm_addr STACK --> main62 + main62: imm %59, imm_offset { struct {struct {int32, int32}}, 0 } --> main61 + main61: addp %56, %58, %59 --> main60 + main60: imm %57, imm_offset { struct {int32, int32}, 0 } --> main59 + main6: load int32, %11, %10 --> main5 + main59: addp %55, %56, %57 --> main58 + main58: load int32, %55, %54 --> main57 + main57: store int32, %53, %54 --> main56 + main56: imm %51, imm_addr "save" --> main55 + main55: imm %52, imm_offset { struct {int32, int32}, 1 } --> main54 + main54: addp %44, %51, %52 --> main53 + main53: imm %49, imm_addr STACK --> main52 + main52: imm %50, imm_offset { struct {struct {int32, int32}}, 0 } --> main51 + main51: addp %47, %49, %50 --> main50 + main50: imm %48, imm_offset { struct {int32, int32}, 1 } --> main49 + main5: eq %7, %9, %10 --> main4 + main49: addp %46, %47, %48 --> main48 + main48: load int32, %46, %45 --> main47 + main47: store int32, %44, %45 --> main46 + main46: imm %42, imm_addr "save" --> main45 + main45: imm %43, imm_offset { struct {int32, int32}, 1 } --> main44 + main44: addp %41, %42, %43 --> main43 + main43: load int32, %41, %40 --> main42 + main42: call "fact1", [%40], %2: int4s -> int4s --> main41 + main41: id %1, %2 --> main40 + main40: imm %38, imm_addr STACK --> main39 + main4: call "print_sint", [%7], %8: int4s -> void --> main3 + main39: imm %39, imm_offset { struct {struct {int32, int32}}, 0 } --> main38 + main38: addp %36, %38, %39 --> main37 + main37: imm %37, imm_offset { struct {int32, int32}, 1 } --> main36 + main36: addp %35, %36, %37 --> main35 + main35: store int32, %35, %1 --> main34 + main34: imm %33, imm_addr "save" --> main33 + main33: imm %34, imm_offset { struct {int32, int32}, 1 } --> main32 + main32: addp %32, %33, %34 --> main31 + main31: load int32, %32, %31 --> main30 + main30: call "fact2", [%31], %3: int4s -> int4s --> main29 + main3: call "newline", [], %6: void --> main2 + main29: id %0, %3 --> main28 + main28: imm %29, imm_addr STACK --> main27 + main27: imm %30, imm_offset { struct {struct {int32, int32}, struct {int32, int32}}, 1 } --> main26 + main26: addp %27, %29, %30 --> main25 + main25: imm %28, imm_offset { struct {int32, int32}, 1 } --> main24 + main24: addp %26, %27, %28 --> main23 + main23: store int32, %26, %0 --> main22 + main22: imm %24, imm_addr STACK --> main21 + main21: imm %25, imm_offset { struct {struct {int32, int32}, struct {int32, int32}, ptr[3]}, 2 } --> main20 + main20: addp %20, %24, %25 --> main19 + main2: imm %5, imm_int 0 --> main1 + main19: imm %22, imm_int 1 --> main18 + main18: imm %23, imm_sizeof (ptr) --> main17 + main17: mul %21, %22, %23 --> main16 + main16: addp %19, %20, %21 --> main15 + main15: load ptr, %19, %17 --> main14 + main14: imm %18, imm_offset { struct {int32, int32}, 1 } --> main13 + main13: addp %16, %17, %18 --> main12 + main12: load int32, %16, %9 --> main11 + main11: imm %14, imm_addr STACK --> main10 + main10: imm %15, imm_offset { struct {struct {int32, int32}, struct {int32, int32}}, 1 } --> main9 + main1: int1sto4 %4, %5 --> main0 + main0: return %4 + + diff --git a/tests/tmp_tests/Frontend/struct_and_ptr_and_fact.c b/tests/tmp_tests/Frontend/struct_and_ptr_and_fact.c new file mode 100644 index 0000000..c59410a --- /dev/null +++ b/tests/tmp_tests/Frontend/struct_and_ptr_and_fact.c @@ -0,0 +1,40 @@ + +typedef struct foo { + int dummy; + int x; +} foo; + +foo *p; +foo save; + +int fact1 (int x) { + if (x <= 1) return 1; + return (x * fact1(x-1)); +} + +int fact2 (int x) { + int i, res = 1; + + for (i = 1 ; i <= x ; i++) + res *= i; + + return res; +} + +int main () { + foo x, y; + foo* q[3]; + + x.x = 5; + + q[1] = &x; + p = &x; + save = x; + x.x = fact1(save.x); + y.x = fact2(save.x); + + print_sint((*(q[1])).x == y.x); + newline(); + + return 0; +} diff --git a/web/accweb.html b/web/accweb.html new file mode 100644 index 0000000..4562b54 --- /dev/null +++ b/web/accweb.html @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ CerCo : A cost annotating compiler for the C language. +

+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+ + + + diff --git a/web/fetopen.png b/web/fetopen.png new file mode 100644 index 0000000..785484a Binary files /dev/null and b/web/fetopen.png differ diff --git a/web/make-cerco-input.sh b/web/make-cerco-input.sh new file mode 100755 index 0000000..8cd41d9 --- /dev/null +++ b/web/make-cerco-input.sh @@ -0,0 +1,16 @@ +#!/usr/bin/zsh + +OUTPUT=cerco_input.xml + +echo '
' > $OUTPUT + +foreach i in $*; do + echo "
" >> $OUTPUT + echo "
`basename $i`
" >> $OUTPUT + echo "> $OUTPUT + cat $i >> $OUTPUT + echo "]]>" >> $OUTPUT + echo "
" >> $OUTPUT +done + +echo '
' >> $OUTPUT \ No newline at end of file