[PATCH] XCore target: add support to build MultiSource/Applications/lemon

robert lytton robert at xmos.com
Fri Feb 14 04:42:53 PST 2014


  ...and now upload the correct diff - oops.

http://llvm-reviews.chandlerc.com/D2784

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D2784?vs=7124&id=7126#toc

Files:
  MultiSource/Applications/lemon/Makefile
  MultiSource/Applications/lemon/lemon.c

Index: MultiSource/Applications/lemon/Makefile
===================================================================
--- MultiSource/Applications/lemon/Makefile
+++ MultiSource/Applications/lemon/Makefile
@@ -3,11 +3,22 @@
 Source = lemon.c
 
 PROG = lemon
-RUN_OPTIONS = $(PROJ_SRC_DIR)/parse.y $(PROJ_SRC_DIR)/example1.y $(PROJ_SRC_DIR)/example2.y $(PROJ_SRC_DIR)/example3.y $(PROJ_SRC_DIR)/example4.y $(PROJ_SRC_DIR)/example5.y $(PROJ_SRC_DIR)/lighttpd_configparser.y $(PROJ_SRC_DIR)/lighttpd_mod_ssi_exprparser.y $(PROJ_SRC_DIR)/wireshark_dtd_grammar.lemon $(PROJ_SRC_DIR)/wireshark_grammar.lemon $(PROJ_SRC_DIR)/wireshark_mate_grammar.lemon $(PROJ_SRC_DIR)/xapian_queryparser.lemony $(PROJ_SRC_DIR)/ecmascript.y
-HASH_PROGRAM_OUTPUT = 1
 
+LEMON_INPUT = $(PROJ_SRC_DIR)/parse.y $(PROJ_SRC_DIR)/example1.y $(PROJ_SRC_DIR)/example2.y $(PROJ_SRC_DIR)/example3.y $(PROJ_SRC_DIR)/example4.y $(PROJ_SRC_DIR)/example5.y $(PROJ_SRC_DIR)/lighttpd_configparser.y $(PROJ_SRC_DIR)/lighttpd_mod_ssi_exprparser.y $(PROJ_SRC_DIR)/wireshark_dtd_grammar.lemon $(PROJ_SRC_DIR)/wireshark_grammar.lemon $(PROJ_SRC_DIR)/wireshark_mate_grammar.lemon $(PROJ_SRC_DIR)/xapian_queryparser.lemony $(PROJ_SRC_DIR)/ecmascript.y
+
+ifneq ($(ARCH),XCore)
+RUN_OPTIONS = $(LEMON_INPUT)
 # With a Debug+Asserts build may time out if the default limit is used.
 RUNTIMELIMIT := 1500
+else
+# XCore must run multiple tests from the RUNUNDER script rather than use fork().
+# The list of tests is repeated 20 times (see main() in lemon.c)
+LEMON_INPUTx5 = $(LEMON_INPUT) $(LEMON_INPUT) $(LEMON_INPUT) $(LEMON_INPUT) $(LEMON_INPUT)
+RUN_OPTIONS = XCORE_FORK $(LEMON_INPUTx5) $(LEMON_INPUTx5) $(LEMON_INPUTx5) $(LEMON_INPUTx5)
+# RUNTIMELIMIT will be set externally for XCore runs
+endif
+
+HASH_PROGRAM_OUTPUT = 1
 
 include $(LEVEL)/Makefile.config
 
Index: MultiSource/Applications/lemon/lemon.c
===================================================================
--- MultiSource/Applications/lemon/lemon.c
+++ MultiSource/Applications/lemon/lemon.c
@@ -1515,7 +1515,9 @@
     printf("                   %d states, %d parser table entries, %d conflicts\n",
       lem.nstate, lem.tablesize, lem.nconflict);
   }
+#ifndef __XS1B__
   exit(lem.errorcnt + lem.nconflict);
+#endif
   return (lem.errorcnt + lem.nconflict);
 }
 /******************** From the file "msort.c" *******************************/
@@ -4857,6 +4859,15 @@
  * one input a time, and has a global state */
 int main(int argc, char **argv)
 {
+#ifdef __XS1B__
+	if (argc == 2) {
+		/* we pass in one child at a time from the wrapper script */
+		char *argv_child[] = {"lemon-child","-s",argv[1],NULL};
+		fprintf(stdout,"Processing %s\n",mybasename(argv[1]));
+		if (lemon_main(3, argv_child))
+			fprintf(stderr,"Error while running on: %s\n",mybasename(argv[1]));
+	}
+#else
 	int j,i = 0;
 	for(j=0;j<20;j++) {
 		/* test finishes too fast, run more times to get
@@ -4877,6 +4888,7 @@
 			}
 		}
 	}
+#endif
 	return 0;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2784.4.patch
Type: text/x-patch
Size: 2962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140214/98fed575/attachment.bin>


More information about the llvm-commits mailing list