Browse Source

made it possible to override the decision from the cgs, if a certain muln needs a helper

git-svn-id: trunk@36347 -
Károly Balogh 8 years ago
parent
commit
b755524c38
1 changed files with 17 additions and 2 deletions
  1. 17 2
      compiler/nadd.pas

+ 17 - 2
compiler/nadd.pas

@@ -73,6 +73,12 @@ interface
           { full 64 bit multiplies.                                }
           { full 64 bit multiplies.                                }
           function use_generic_mul64bit: boolean; virtual;
           function use_generic_mul64bit: boolean; virtual;
 
 
+{$ifdef cpuneedsmulhelper}
+          { override to customize to decide if the code generator }
+          { can handle a given multiply node directly, or it needs helpers }
+          function use_mul_helper: boolean; virtual;
+{$endif cpuneedsmulhelper}
+
           { shall be overriden if the target cpu supports
           { shall be overriden if the target cpu supports
             an fma instruction
             an fma instruction
           }
           }
@@ -3159,6 +3165,16 @@ implementation
       end;
       end;
 
 
 
 
+{$ifdef cpuneedsmulhelper}
+    function taddnode.use_mul_helper: boolean;
+      begin
+        result:=(nodetype=muln) and
+                not(torddef(resultdef).ordtype in [u8bit,s8bit
+                {$if defined(cpu16bitalu) or defined(avr)},u16bit,s16bit{$endif}]);
+      end;
+{$endif cpuneedsmulhelper}
+
+
     function taddnode.pass_1 : tnode;
     function taddnode.pass_1 : tnode;
 
 
       function isconstsetfewelements(p : tnode) : boolean;
       function isconstsetfewelements(p : tnode) : boolean;
@@ -3345,8 +3361,7 @@ implementation
              else
              else
                begin
                begin
 {$ifdef cpuneedsmulhelper}
 {$ifdef cpuneedsmulhelper}
-                 if (nodetype=muln) and not(torddef(resultdef).ordtype in [u8bit,s8bit
-                   {$if defined(cpu16bitalu) or defined(avr)},u16bit,s16bit{$endif}]) then
+                 if use_mul_helper then
                    begin
                    begin
                      result := nil;
                      result := nil;