comparison dmd/mars.c @ 445:cc40db549aea

Changed the handling of variadic intrinsics a bit. Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues. Changed the handling of parameter attributes to a bit more generalized approach. Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 . Parameter attribs now properly set for intrinsic calls if necessary. Made the tango.math.Math patch less intrusive. Fixed/added some mini tests.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Fri, 01 Aug 2008 17:59:58 +0200
parents 47b64d06eb9f
children 15c804b6ce77
comparison
equal deleted inserted replaced
444:f2b5f86348ef 445:cc40db549aea
176 -debug=level compile in debug code <= level\n\ 176 -debug=level compile in debug code <= level\n\
177 -debug=ident compile in debug code identified by ident\n\ 177 -debug=ident compile in debug code identified by ident\n\
178 -debuglib=name set symbolic debug library to name\n\ 178 -debuglib=name set symbolic debug library to name\n\
179 -defaultlib=name set default library to name\n\ 179 -defaultlib=name set default library to name\n\
180 -dis disassemble module after compiling\n\ 180 -dis disassemble module after compiling\n\
181 -fp80 enable 80bit reals on x86 32bit (EXPERIMENTAL)\n\
182 -g add symbolic debug info\n\ 181 -g add symbolic debug info\n\
183 -gc add symbolic debug info, pretend to be C\n\ 182 -gc add symbolic debug info, pretend to be C\n\
184 -H generate 'header' file\n\ 183 -H generate 'header' file\n\
185 -Hd<hdrdir> write 'header' file to <hdrdir> directory\n\ 184 -Hd<hdrdir> write 'header' file to <hdrdir> directory\n\
186 -Hf<filename> write 'header' file to <filename>\n\ 185 -Hf<filename> write 'header' file to <filename>\n\
405 global.params.novalidate = 1; 404 global.params.novalidate = 1;
406 else if (strcmp(p + 1, "dis") == 0) 405 else if (strcmp(p + 1, "dis") == 0)
407 global.params.disassemble = 1; 406 global.params.disassemble = 1;
408 else if (strcmp(p + 1, "annotate") == 0) 407 else if (strcmp(p + 1, "annotate") == 0)
409 global.params.llvmAnnotate = 1; 408 global.params.llvmAnnotate = 1;
410 else if (strcmp(p + 1, "fp80") == 0)
411 global.params.useFP80 = 1;
412 else if (strcmp(p + 1, "noasm") == 0) 409 else if (strcmp(p + 1, "noasm") == 0)
413 global.params.useInlineAsm = 0; 410 global.params.useInlineAsm = 0;
414 else if (p[1] == 'o') 411 else if (p[1] == 'o')
415 { 412 {
416 switch (p[2]) 413 switch (p[2])
695 692
696 if (global.params.llvmArch == 0) { 693 if (global.params.llvmArch == 0) {
697 findDefaultTarget(); 694 findDefaultTarget();
698 } 695 }
699 696
700 bool is_x86 = false;
701 if (strcmp(global.params.llvmArch,"x86")==0) { 697 if (strcmp(global.params.llvmArch,"x86")==0) {
702 VersionCondition::addPredefinedGlobalIdent("X86"); 698 VersionCondition::addPredefinedGlobalIdent("X86");
703 //VersionCondition::addPredefinedGlobalIdent("LLVM_InlineAsm_X86");
704 global.params.isLE = true; 699 global.params.isLE = true;
705 global.params.is64bit = false; 700 global.params.is64bit = false;
706 global.params.cpu = ARCHx86; 701 global.params.cpu = ARCHx86;
707 tt_arch = "i686"; 702 tt_arch = "i686";
708 data_layout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128-a0:0:64"; 703 data_layout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128-a0:0:64";
709 is_x86 = true; 704 if (global.params.useInlineAsm) {
705 VersionCondition::addPredefinedGlobalIdent("D_InlineAsm");
706 VersionCondition::addPredefinedGlobalIdent("D_InlineAsm_X86");
707 }
710 } 708 }
711 else if (strcmp(global.params.llvmArch,"x86-64")==0) { 709 else if (strcmp(global.params.llvmArch,"x86-64")==0) {
712 VersionCondition::addPredefinedGlobalIdent("X86_64"); 710 VersionCondition::addPredefinedGlobalIdent("X86_64");
713 //VersionCondition::addPredefinedGlobalIdent("LLVM_InlineAsm_X86_64");
714 global.params.isLE = true; 711 global.params.isLE = true;
715 global.params.is64bit = true; 712 global.params.is64bit = true;
716 global.params.cpu = ARCHx86_64; 713 global.params.cpu = ARCHx86_64;
717 tt_arch = "x86_64"; 714 tt_arch = "x86_64";
718 data_layout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"; 715 data_layout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64";
748 VersionCondition::addPredefinedGlobalIdent("BigEndian"); 745 VersionCondition::addPredefinedGlobalIdent("BigEndian");
749 } 746 }
750 747
751 if (global.params.is64bit) { 748 if (global.params.is64bit) {
752 VersionCondition::addPredefinedGlobalIdent("LLVM64"); 749 VersionCondition::addPredefinedGlobalIdent("LLVM64");
753 }
754
755 if (global.params.useFP80) {
756 if (!is_x86) {
757 error("the -fp80 option is only valid for the x86 32bit architecture");
758 fatal();
759 }
760 VersionCondition::addPredefinedGlobalIdent("LLVM_X86_FP80");
761 }
762 if (is_x86 && global.params.useInlineAsm) {
763 VersionCondition::addPredefinedGlobalIdent("D_InlineAsm");
764 VersionCondition::addPredefinedGlobalIdent("D_InlineAsm_X86");
765 } 750 }
766 751
767 assert(tt_arch != 0); 752 assert(tt_arch != 0);
768 assert(tt_os != 0); 753 assert(tt_os != 0);
769 assert(data_layout != 0); 754 assert(data_layout != 0);