Browse Source

* record whether a function uses fastmath, and define the function as
strictfp if it doesn't (so LLVM doesn't perform transformations that can
change the fp/exception behaviour)

git-svn-id: trunk@43818 -

Jonas Maebe 5 năm trước cách đây
mục cha
commit
b355ba3d39

+ 2 - 0
compiler/llvm/agllvm.pas

@@ -1024,6 +1024,8 @@ implementation
             writer.AsmWrite(' "thunk"');
             writer.AsmWrite(' "thunk"');
           if llvmflag_null_pointer_valid in llvmversion_properties[current_settings.llvmversion] then
           if llvmflag_null_pointer_valid in llvmversion_properties[current_settings.llvmversion] then
             writer.AsmWrite(' "null-pointer-is-valid"="true"');
             writer.AsmWrite(' "null-pointer-is-valid"="true"');
+          if not(pio_fastmath in pd.implprocoptions) then
+            writer.AsmWrite(' strictfp');
         end;
         end;
 
 
 
 

+ 3 - 1
compiler/symconst.pas

@@ -440,7 +440,9 @@ type
     { a nested routine accesses a local variable from this routine }
     { a nested routine accesses a local variable from this routine }
     pio_nested_access,
     pio_nested_access,
     { a stub/thunk }
     { a stub/thunk }
-    pio_thunk
+    pio_thunk,
+    { compiled with fastmath enabled }
+    pio_fastmath
   );
   );
   timplprocoptions = set of timplprocoption;
   timplprocoptions = set of timplprocoption;
 
 

+ 2 - 0
compiler/symdef.pas

@@ -6015,6 +6015,8 @@ implementation
          import_nr:=0;
          import_nr:=0;
          inlininginfo:=nil;
          inlininginfo:=nil;
          deprecatedmsg:=nil;
          deprecatedmsg:=nil;
+         if cs_opt_fastmath in current_settings.optimizerswitches then
+           include(implprocoptions, pio_fastmath);
       end;
       end;
 
 
 
 

+ 2 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -3215,7 +3215,8 @@ const
     (mask:pio_has_inlininginfo; str:'HasInliningInfo'),
     (mask:pio_has_inlininginfo; str:'HasInliningInfo'),
     (mask:pio_inline_not_possible; str:'InlineNotPossible'),
     (mask:pio_inline_not_possible; str:'InlineNotPossible'),
     (mask:pio_nested_access; str:'NestedAccess'),
     (mask:pio_nested_access; str:'NestedAccess'),
-    (mask:pio_thunk; str:'Thunk')
+    (mask:pio_thunk; str:'Thunk'),
+    (mask:pio_fastmath; str:'FastMath')
   );
   );
 var
 var
   i: timplprocoption;
   i: timplprocoption;