llvm.org GIT mirror llvm / 8c46d79
Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure the kaleidoscope 'library' functions aren't dead-stripped in release builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246201 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 4 years ago
15 changed file(s) with 53 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
565565
566566 /// putchard - putchar that takes a double and returns 0.
567567 extern "C" double putchard(double X) {
568 putchar((char)X);
568 fputc((char)X, stderr);
569569 return 0;
570570 }
571571
1212 add_kaleidoscope_chapter(Kaleidoscope-Ch4
1313 toy.cpp
1414 )
15
16 export_executable_symbols(Kaleidoscope-Ch4)
630630 //===----------------------------------------------------------------------===//
631631
632632 /// putchard - putchar that takes a double and returns 0.
633 extern "C" double putchard(double X) {
634 putchar((char)X);
633 __attribute__((used)) extern "C" double putchard(double X) {
634 fputc((char)X, stderr);
635635 return 0;
636636 }
637637
638638 /// printd - printf that takes a double prints it as "%f\n", returning 0.
639 extern "C" double printd(double X) {
640 printf("%f\n", X);
639 __attribute__((used)) extern "C" double printd(double X) {
640 fprintf(stderr, "%f\n", X);
641641 return 0;
642642 }
643643
1212 add_kaleidoscope_chapter(Kaleidoscope-Ch5
1313 toy.cpp
1414 )
15
16 export_executable_symbols(Kaleidoscope-Ch5)
904904 //===----------------------------------------------------------------------===//
905905
906906 /// putchard - putchar that takes a double and returns 0.
907 extern "C" double putchard(double X) {
908 putchar((char)X);
907 __attribute__((used)) extern "C" double putchard(double X) {
908 fputc((char)X, stderr);
909909 return 0;
910910 }
911911
912912 /// printd - printf that takes a double prints it as "%f\n", returning 0.
913 extern "C" double printd(double X) {
914 printf("%f\n", X);
913 __attribute__((used)) extern "C" double printd(double X) {
914 fprintf(stderr, "%f\n", X);
915915 return 0;
916916 }
917917
1212 add_kaleidoscope_chapter(Kaleidoscope-Ch6
1313 toy.cpp
1414 )
15
16 export_executable_symbols(Kaleidoscope-Ch6)
10221022 //===----------------------------------------------------------------------===//
10231023
10241024 /// putchard - putchar that takes a double and returns 0.
1025 extern "C" double putchard(double X) {
1026 putchar((char)X);
1025 __attribute__((used)) extern "C" double putchard(double X) {
1026 fputc((char)X, stderr);
10271027 return 0;
10281028 }
10291029
10301030 /// printd - printf that takes a double prints it as "%f\n", returning 0.
1031 extern "C" double printd(double X) {
1032 printf("%f\n", X);
1031 __attribute__((used)) extern "C" double printd(double X) {
1032 fprintf(stderr, "%f\n", X);
10331033 return 0;
10341034 }
10351035
1212 add_kaleidoscope_chapter(Kaleidoscope-Ch7
1313 toy.cpp
1414 )
15
16 export_executable_symbols(Kaleidoscope-Ch7)
11881188 //===----------------------------------------------------------------------===//
11891189
11901190 /// putchard - putchar that takes a double and returns 0.
1191 extern "C" double putchard(double X) {
1192 putchar((char)X);
1191 __attribute__((used)) extern "C" double putchard(double X) {
1192 fputc((char)X, stderr);
11931193 return 0;
11941194 }
11951195
11961196 /// printd - printf that takes a double prints it as "%f\n", returning 0.
1197 extern "C" double printd(double X) {
1198 printf("%f\n", X);
1197 __attribute__((used)) extern "C" double printd(double X) {
1198 fprintf(stderr, "%f\n", X);
11991199 return 0;
12001200 }
12011201
88 add_kaleidoscope_chapter(Kaleidoscope-Ch8
99 toy.cpp
1010 )
11
12 export_executable_symbols(Kaleidoscope-Ch8)
13821382 //===----------------------------------------------------------------------===//
13831383
13841384 /// putchard - putchar that takes a double and returns 0.
1385 extern "C" double putchard(double X) {
1386 putchar((char)X);
1385 __attribute__((used)) extern "C" double putchard(double X) {
1386 fputc((char)X, stderr);
13871387 return 0;
13881388 }
13891389
13901390 /// printd - printf that takes a double prints it as "%f\n", returning 0.
1391 extern "C" double printd(double X) {
1392 printf("%f\n", X);
1391 __attribute__((used)) extern "C" double printd(double X) {
1392 fprintf(stderr, "%f\n", X);
13931393 return 0;
13941394 }
13951395
0 if(LLVM_BUILD_EXAMPLES)
1 set(ENABLE_EXAMPLES 1)
2 endif()
3
4 configure_lit_site_cfg(
15 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
26 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
9599 )
96100 endif()
97101
102 if(LLVM_BUILD_EXAMPLES)
103 list(APPEND LLVM_TEST_DEPENDS
104 Kaleidoscope-Ch3
105 Kaleidoscope-Ch4
106 Kaleidoscope-Ch5
107 Kaleidoscope-Ch6
108 Kaleidoscope-Ch7
109 )
110 endif()
111
98112 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
99113 ${CMAKE_CURRENT_BINARY_DIR}
100114 PARAMS llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
145145 @$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp
146146 @$(ECHOPATH) s=@HAVE_LIBZ@=$(HAVE_LIBZ)=g >> lit.tmp
147147 @$(ECHOPATH) s=@HAVE_DIA_SDK@=0=g >> lit.tmp
148 @$(ECHOPATH) s=@ENABLE_EXAMPLES@=$(BUILD_EXAMPLES)=g >> lit.tmp
148149 @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
149150 @-rm -f lit.tmp
150151
257257 r"\byaml2obj\b",
258258 r"\byaml-bench\b",
259259 r"\bverify-uselistorder\b",
260 r"\bKaleidoscope-Ch3\b",
261 r"\bKaleidoscope-Ch4\b",
262 r"\bKaleidoscope-Ch5\b",
263 r"\bKaleidoscope-Ch6\b",
264 r"\bKaleidoscope-Ch7\b",
265 r"\bKaleidoscope-Ch8\b",
260266 # Handle these specially as they are strings searched
261267 # for during testing.
262268 r"\| \bcount\b",
3434 config.have_zlib = "@HAVE_LIBZ@"
3535 config.have_dia_sdk = @HAVE_DIA_SDK@
3636 config.enable_ffi = "@LLVM_ENABLE_FFI@"
37 config.test_examples = "@ENABLE_EXAMPLES@"
3738
3839 # Support substitution of the tools_dir with user parameters. This is
3940 # used when we can't determine the tool dir at configuration time.