Ver Fonte

* disable several complex procedures for avr with a newly introduced define: EXCLUDE_COMPLEX_PROCS. They
might compile with an improved register allocator in the future

git-svn-id: trunk@30546 -

florian há 10 anos atrás
pai
commit
886e3e8d02
5 ficheiros alterados com 32 adições e 3 exclusões
  1. 7 0
      rtl/embedded/system.pp
  2. 4 0
      rtl/inc/int64.inc
  3. 9 3
      rtl/inc/sstrings.inc
  4. 8 0
      rtl/inc/text.inc
  5. 4 0
      rtl/inc/typefile.inc

+ 7 - 0
rtl/embedded/system.pp

@@ -22,6 +22,13 @@ Unit System;
 
 {$define FPC_IS_SYSTEM}
 {$define HAS_CMDLINE}
+
+{ currently, the avr compiler cannot compile complex procedures especially dealing with int64
+  which are probaly anyways rarely used on avr }
+{$ifdef CPUAVR}
+{$define EXCLUDE_COMPLEX_PROCS}
+{$endif CPUAVR}
+
 { $define USE_NOTHREADMANAGER}
 
 {$define DISABLE_NO_THREAD_MANAGER}

+ 4 - 0
rtl/inc/int64.inc

@@ -323,6 +323,9 @@
          q1,q2,q3 : qword;
 
       begin
+{$ifdef EXCLUDE_COMPLEX_PROCS}
+         runerror(219);
+{$else EXCLUDE_COMPLEX_PROCS}
         { there's no difference between signed and unsigned multiplication,
           when the destination size is equal to the source size and overflow
           checking is off }
@@ -363,6 +366,7 @@
             else
               fpc_mul_int64:=q3;
           end;
+{$endif EXCLUDE_COMPLEX_PROCS}
       end;
 {$endif FPC_SYSTEM_HAS_MUL_INT64}
 

+ 9 - 3
rtl/inc/sstrings.inc

@@ -990,24 +990,26 @@ end;
 {$endif}
 
 {$ifndef FPC_STR_ENUM_INTERN}
-{ currently, the avr code generator fails on this procedure, so we disable it, 
+{ currently, the avr code generator fails on this procedure, so we disable it,
   this is not a good solution but fixing compilation of this procedure for
   avr is hard, requires significant changes to the register allocator to take
   care of different register classes }
-{$ifndef CPUAVR}
 procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of char);compilerproc;
 var
   ss : shortstring;
   maxlen : SizeInt;
 begin
+{$ifdef EXCLUDE_COMPLEX_PROCS}
+  runerror(219);
+{$else EXCLUDE_COMPLEX_PROCS}
   fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
   if length(ss)<high(a)+1 then
     maxlen:=length(ss)
   else
     maxlen:=high(a)+1;
   fpc_shortstr_chararray_intern_charmove(ss,a,maxlen);
+{$endif EXCLUDE_COMPLEX_PROCS}
 end;
-{$endif CPUAVR}
 {$endif not FPC_STR_ENUM_INTERN}
 
 procedure fpc_chararray_bool(b : boolean;len:sizeint;out a : array of char);compilerproc;
@@ -1220,6 +1222,9 @@ end;
         maxqword=qword($ffffffffffffffff);
 
   begin
+{$ifdef EXCLUDE_COMPLEX_PROCS}
+    runerror(219);
+{$else EXCLUDE_COMPLEX_PROCS}
     fpc_val_int64_shortstr := 0;
     Temp:=0;
     Code:=InitVal(s,negative,base);
@@ -1263,6 +1268,7 @@ end;
     fpc_val_int64_shortstr:=int64(Temp);
     If Negative Then
       fpc_val_int64_shortstr:=-fpc_val_int64_shortstr;
+{$endif EXCLUDE_COMPLEX_PROCS}
   end;
 
 

+ 8 - 0
rtl/inc/text.inc

@@ -1217,6 +1217,9 @@ var
     s:string;
 
 begin
+{$ifdef EXCLUDE_COMPLEX_PROCS}
+  runerror(219);
+{$else EXCLUDE_COMPLEX_PROCS}
   if textrec(t).mode<>fmoutput then
     begin
       if textrec(t).mode=fminput then
@@ -1229,6 +1232,7 @@ begin
   if (inoutres <> 0) then
     exit;
   fpc_writeBuffer(t,s[1],length(s));
+{$endif EXCLUDE_COMPLEX_PROCS}
 end;
 
 {$ifdef FPC_HAS_STR_CURRENCY}
@@ -1681,6 +1685,9 @@ var
   p,startp,maxp : pchar;
   end_of_string:boolean;
 Begin
+{$ifdef EXCLUDE_COMPLEX_PROCS}
+  runerror(219);
+{$else EXCLUDE_COMPLEX_PROCS}
   ReadPCharLen:=0;
   If not CheckRead(f) then
     exit;
@@ -1722,6 +1729,7 @@ Begin
     inc(sPos,Len);
   until (spos=MaxLen) or end_of_string;
   ReadPCharLen:=spos;
+{$endif EXCLUDE_COMPLEX_PROCS}
 End;
 
 

+ 4 - 0
rtl/inc/typefile.inc

@@ -81,8 +81,12 @@ Procedure DoAssign(var t : TypedFile);
 const
   start : dword = 0;
 Begin
+{$ifdef EXCLUDE_COMPLEX_PROCS}
+  runerror(219);
+{$else EXCLUDE_COMPLEX_PROCS}
   Assign(t,'fpc_'+HexStr(start,8)+'.tmp');
   inc(start);
+{$endif EXCLUDE_COMPLEX_PROCS}
 End;
 {$endif FPC_HAS_FEATURE_RANDOM}