comparison dmd/mars.c @ 675:bfe5229f9d8e

Disable bc output by default. Remove -dis. Add -output-bc, -output-ll, -output-s. Call to gcc to convert assembly to object file still required.
author Christian Kamm <kamm incasoftware de>
date Sat, 11 Oct 2008 13:07:59 +0200
parents 6aaa3d3c1183
children 1f0a78174598
comparison
equal deleted inserted replaced
674:db6a7e574cbd 675:bfe5229f9d8e
50 hdr_ext = "di"; 50 hdr_ext = "di";
51 doc_ext = "html"; 51 doc_ext = "html";
52 ddoc_ext = "ddoc"; 52 ddoc_ext = "ddoc";
53 53
54 // LDC 54 // LDC
55 obj_ext = "bc";
56 ll_ext = "ll"; 55 ll_ext = "ll";
57 bc_ext = "bc"; 56 bc_ext = "bc";
57 s_ext = "s";
58 #if _WIN32 58 #if _WIN32
59 nativeobj_ext = "obj"; 59 obj_ext = "obj";
60 #elif POSIX 60 #elif POSIX
61 nativeobj_ext = "o"; 61 obj_ext = "o";
62 #else 62 #else
63 #error "fix this" 63 #error "fix this"
64 #endif 64 #endif
65 65
66 copyright = "Copyright (c) 1999-2008 by Digital Mars and Tomas Lindquist Olsen"; 66 copyright = "Copyright (c) 1999-2008 by Digital Mars and Tomas Lindquist Olsen";
165 -of<filename> name output file to <filename>\n\ 165 -of<filename> name output file to <filename>\n\
166 -o- do not write object file\n\ 166 -o- do not write object file\n\
167 -od<objdir> write object files to directory <objdir>\n\ 167 -od<objdir> write object files to directory <objdir>\n\
168 -op do not strip paths from source file\n\ 168 -op do not strip paths from source file\n\
169 -oq write object files with fully qualified names\n\ 169 -oq write object files with fully qualified names\n\
170 \n\
171 -output-ll write LLVM IR\n\
172 -output-bc write LLVM bitcode\n\
173 -output-s write native assembly\n\
170 \n\ 174 \n\
171 -c do not link\n\ 175 -c do not link\n\
172 -L<linkerflag> pass <linkerflag> to llvm-ld\n\ 176 -L<linkerflag> pass <linkerflag> to llvm-ld\n\
173 \n\ 177 \n\
174 -g add symbolic debug info\n\ 178 -g add symbolic debug info\n\
214 -noverify do not run the validation pass before writing bitcode\n\ 218 -noverify do not run the validation pass before writing bitcode\n\
215 -unittest compile in unit tests\n\ 219 -unittest compile in unit tests\n\
216 -d allow deprecated features\n\ 220 -d allow deprecated features\n\
217 \n\ 221 \n\
218 -annotate annotate the bitcode with human readable source code\n\ 222 -annotate annotate the bitcode with human readable source code\n\
219 -dis disassemble module after compiling\n\
220 -ignore ignore unsupported pragmas\n\ 223 -ignore ignore unsupported pragmas\n\
221 \n\ 224 \n\
222 Path options:\n\ 225 Path options:\n\
223 -I<path> where to look for imports\n\ 226 -I<path> where to look for imports\n\
224 -J<path> where to look for string imports\n\ 227 -J<path> where to look for string imports\n\
402 global.params.forceBE = 1; 405 global.params.forceBE = 1;
403 else if (strcmp(p + 1, "noruntime") == 0) 406 else if (strcmp(p + 1, "noruntime") == 0)
404 global.params.noruntime = 1; 407 global.params.noruntime = 1;
405 else if (strcmp(p + 1, "noverify") == 0) 408 else if (strcmp(p + 1, "noverify") == 0)
406 global.params.novalidate = 1; 409 global.params.novalidate = 1;
407 else if (strcmp(p + 1, "dis") == 0)
408 global.params.disassemble = 1;
409 else if (strcmp(p + 1, "annotate") == 0) 410 else if (strcmp(p + 1, "annotate") == 0)
410 global.params.llvmAnnotate = 1; 411 global.params.llvmAnnotate = 1;
411 else if (strncmp(p + 1, "enable-", 7) == 0 || 412 else if (strncmp(p + 1, "enable-", 7) == 0 ||
412 strncmp(p + 1, "disable-", 8) == 0) 413 strncmp(p + 1, "disable-", 8) == 0)
413 { 414 {
461 if (p[3]) 462 if (p[3])
462 goto Lerror; 463 goto Lerror;
463 global.params.fqnNames = 1; 464 global.params.fqnNames = 1;
464 break; 465 break;
465 466
467 case 'u':
468 if (strncmp(p+1, "output-", 7) != 0)
469 goto Lerror;
470 if (strcmp(p+8, "ll") == 0)
471 global.params.output_ll = 1;
472 else if (strcmp(p+8, "bc") == 0)
473 global.params.output_bc = 1;
474 else if (strcmp(p+8, "s") == 0)
475 global.params.output_s = 1;
476 else
477 goto Lerror;
478 break;
479
466 case 0: 480 case 0:
467 error("-o no longer supported, use -of or -od"); 481 error("-o no longer supported, use -of or -od");
468 break; 482 break;
469 483
470 default: 484 default:
916 930
917 p = FileName::name(p); // strip path 931 p = FileName::name(p); // strip path
918 ext = FileName::ext(p); 932 ext = FileName::ext(p);
919 if (ext) 933 if (ext)
920 { 934 {
921 #if IN_LLVM 935 #if TARGET_LINUX
922 if (strcmp(ext, global.nativeobj_ext) == 0 || 936 if (strcmp(ext, global.obj_ext) == 0 ||
923 strcmp(ext, global.obj_ext) == 0) 937 strcmp(ext, global.bc_ext) == 0)
924 #elif TARGET_LINUX
925 if (strcmp(ext, global.obj_ext) == 0)
926 #else 938 #else
927 if (stricmp(ext, global.obj_ext) == 0) 939 if (stricmp(ext, global.obj_ext) == 0 ||
940 stricmp(ext, global.bc_ext) == 0)
928 #endif 941 #endif
929 { 942 {
930 global.params.objfiles->push(files.data[i]); 943 global.params.objfiles->push(files.data[i]);
931 continue; 944 continue;
932 } 945 }