diff --git a/compiler/cgbase.pas b/compiler/cgbase.pas index 2e7d09100b..a248d1a6d7 100644 --- a/compiler/cgbase.pas +++ b/compiler/cgbase.pas @@ -241,10 +241,10 @@ interface var mms_movescalar : pmmshuffle; - procedure supregset_reset(var regs:tsuperregisterset;setall:boolean); - procedure supregset_include(var regs:tsuperregisterset;s:tsuperregister); - procedure supregset_exclude(var regs:tsuperregisterset;s:tsuperregister); - function supregset_in(const regs:tsuperregisterset;s:tsuperregister):boolean; + procedure supregset_reset(var regs:tsuperregisterset;setall:boolean);{$ifdef USEINLINE}inline;{$endif} + procedure supregset_include(var regs:tsuperregisterset;s:tsuperregister);{$ifdef USEINLINE}inline;{$endif} + procedure supregset_exclude(var regs:tsuperregisterset;s:tsuperregister);{$ifdef USEINLINE}inline;{$endif} + function supregset_in(const regs:tsuperregisterset;s:tsuperregister):boolean;{$ifdef USEINLINE}inline;{$endif} function newreg(rt:tregistertype;sr:tsuperregister;sb:tsubregister):tregister;{$ifdef USEINLINE}inline;{$endif} function getsubreg(r:tregister):tsubregister;{$ifdef USEINLINE}inline;{$endif} @@ -260,10 +260,10 @@ interface function int_cgsize(const a: aword): tcgsize; { return the inverse condition of opcmp } - function inverse_opcmp(opcmp: topcmp): topcmp; + function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif} { return whether op is commutative } - function commutativeop(op: topcg): boolean; + function commutativeop(op: topcg): boolean;{$ifdef USEINLINE}inline;{$endif} { returns true, if shuffle describes a real shuffle operation and not only a move } function realshuffle(shuffle : pmmshuffle) : boolean; @@ -277,7 +277,7 @@ implementation uses verbose; - procedure supregset_reset(var regs:tsuperregisterset;setall:boolean); + procedure supregset_reset(var regs:tsuperregisterset;setall:boolean);{$ifdef USEINLINE}inline;{$endif} var b : byte; begin @@ -289,19 +289,19 @@ implementation end; - procedure supregset_include(var regs:tsuperregisterset;s:tsuperregister); + procedure supregset_include(var regs:tsuperregisterset;s:tsuperregister);{$ifdef USEINLINE}inline;{$endif} begin - include(regs[s shr 8],(s and $ff)) + include(regs[s shr 8],(s and $ff)); end; - procedure supregset_exclude(var regs:tsuperregisterset;s:tsuperregister); + procedure supregset_exclude(var regs:tsuperregisterset;s:tsuperregister);{$ifdef USEINLINE}inline;{$endif} begin - exclude(regs[s shr 8],(s and $ff)) + exclude(regs[s shr 8],(s and $ff)); end; - function supregset_in(const regs:tsuperregisterset;s:tsuperregister):boolean; + function supregset_in(const regs:tsuperregisterset;s:tsuperregister):boolean;{$ifdef USEINLINE}inline;{$endif} begin result:=(s and $ff) in regs[s shr 8]; end; @@ -411,7 +411,7 @@ implementation end; - function inverse_opcmp(opcmp: topcmp): topcmp; + function inverse_opcmp(opcmp: topcmp): topcmp;{$ifdef USEINLINE}inline;{$endif} const list: array[TOpCmp] of TOpCmp = (OC_NONE,OC_NE,OC_LTE,OC_GTE,OC_LT,OC_GT,OC_EQ,OC_A,OC_AE, @@ -421,7 +421,7 @@ implementation end; - function commutativeop(op: topcg): boolean; + function commutativeop(op: topcg): boolean;{$ifdef USEINLINE}inline;{$endif} const list: array[topcg] of boolean = (true,true,true,false,false,true,true,false,false, @@ -469,7 +469,10 @@ finalization end. { $Log$ - Revision 1.74 2003-10-30 14:56:40 mazen + Revision 1.75 2003-10-31 15:51:11 peter + * USEINLINE directive added (not enabled yet) + + Revision 1.74 2003/10/30 14:56:40 mazen + add support for double float register vars Revision 1.73 2003/10/29 15:07:01 mazen diff --git a/compiler/cutils.pas b/compiler/cutils.pas index 781955e62f..b6571f2794 100644 --- a/compiler/cutils.pas +++ b/compiler/cutils.pas @@ -35,15 +35,15 @@ interface pstring = ^string; {# Returns the minimal value between @var(a) and @var(b) } - function min(a,b : longint) : longint; + function min(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif} {# Returns the maximum value between @var(a) and @var(b) } - function max(a,b : longint) : longint; + function max(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif} {# Returns the value in @var(x) swapped to different endian } - function SwapLong(x : longint): longint; + function SwapLong(x : longint): longint;{$ifdef USEINLINE}inline;{$endif} {# Returns the value in @va(x) swapped to different endian } - function SwapWord(x : word): word; + function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif} {# Return value @var(i) aligned on @var(a) boundary } - function align(i,a:longint):longint; + function align(i,a:longint):longint;{$ifdef USEINLINE}inline;{$endif} function used_align(varalign,minalign,maxalign:longint):longint; function size_2_align(len : longint) : longint; @@ -58,15 +58,15 @@ interface function GetToken(var s:string;endchar:char):string; procedure uppervar(var s : string); function hexstr(val : cardinal;cnt : cardinal) : string; - function tostru(i:cardinal) : string; - function tostr(i : longint) : string; - function realtostr(e:extended):string; - function int64tostr(i : int64) : string; - function tostr_with_plus(i : longint) : string; + function tostru(i:cardinal) : string;{$ifdef USEINLINE}inline;{$endif} + function tostr(i : longint) : string;{$ifdef USEINLINE}inline;{$endif} + function realtostr(e:extended):string;{$ifdef USEINLINE}inline;{$endif} + function int64tostr(i : int64) : string;{$ifdef USEINLINE}inline;{$endif} + function tostr_with_plus(i : longint) : string;{$ifdef USEINLINE}inline;{$endif} function DStr(l:longint):string; procedure valint(S : string;var V : longint;var code : integer); {# Returns true if the string s is a number } - function is_number(const s : string) : boolean; + function is_number(const s : string) : boolean;{$ifdef USEINLINE}inline;{$endif} {# Returns true if value is a power of 2, the actual exponent value is returned in power. } @@ -76,12 +76,12 @@ interface { releases the string p and assignes nil to p } { if p=nil then freemem isn't called } - procedure stringdispose(var p : pstring); + procedure stringdispose(var p : pstring);{$ifdef USEINLINE}inline;{$endif} { allocates mem for a copy of s, copies s to this mem and returns } { a pointer to this mem } - function stringdup(const s : string) : pstring; + function stringdup(const s : string) : pstring;{$ifdef USEINLINE}inline;{$endif} {# Allocates memory for the string @var(s) and copies s as zero terminated string to that allocated memory and returns a pointer @@ -132,7 +132,7 @@ uses lowertbl : array[char] of char; - function min(a,b : longint) : longint; + function min(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif} { return the minimal of a and b } @@ -144,7 +144,7 @@ uses end; - function max(a,b : longint) : longint; + function max(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif} { return the maximum of a and b } @@ -156,7 +156,7 @@ uses end; - Function SwapLong(x : longint): longint; + Function SwapLong(x : longint): longint;{$ifdef USEINLINE}inline;{$endif} var y : word; z : word; @@ -169,7 +169,7 @@ uses End; - Function SwapWord(x : word): word; + Function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif} var z : byte; Begin @@ -180,7 +180,7 @@ uses End; - function align(i,a:longint):longint; + function align(i,a:longint):longint;{$ifdef USEINLINE}inline;{$endif} { return value aligned boundary } @@ -359,7 +359,7 @@ uses end; - function tostru(i:cardinal):string; + function tostru(i:cardinal):string;{$ifdef USEINLINE}inline;{$endif} { return string of value i, but for cardinals } @@ -368,7 +368,7 @@ uses end; - function tostr(i : longint) : string; + function tostr(i : longint) : string;{$ifdef USEINLINE}inline;{$endif} { return string of value i } @@ -501,36 +501,29 @@ uses end; - function realtostr(e:extended):string; + function realtostr(e:extended):string;{$ifdef USEINLINE}inline;{$endif} begin str(e,result); end; - function int64tostr(i : int64) : string; + function int64tostr(i : int64) : string;{$ifdef USEINLINE}inline;{$endif} { return string of value i } - var - hs : string; begin - str(i,hs); - int64tostr:=hs; + str(i,result); end; - function tostr_with_plus(i : longint) : string; + function tostr_with_plus(i : longint) : string;{$ifdef USEINLINE}inline;{$endif} { return string of value i, but always include a + when i>=0 } - var - hs : string; begin - str(i,hs); + str(i,result); if i>=0 then - tostr_with_plus:='+'+hs - else - tostr_with_plus:=hs; + result:='+'+result; end; @@ -573,7 +566,7 @@ uses {$endif not FPC} - function is_number(const s : string) : boolean; + function is_number(const s : string) : boolean;{$ifdef USEINLINE}inline;{$endif} { is string a correct number ? } @@ -710,21 +703,20 @@ uses end; - procedure stringdispose(var p : pstring); + procedure stringdispose(var p : pstring);{$ifdef USEINLINE}inline;{$endif} begin if assigned(p) then - freemem(p,length(p^)+1); - p:=nil; + begin + freemem(p,length(p^)+1); + p:=nil; + end; end; - function stringdup(const s : string) : pstring; - var - p : pstring; + function stringdup(const s : string) : pstring;{$ifdef USEINLINE}inline;{$endif} begin - getmem(p,length(s)+1); - p^:=s; - stringdup:=p; + getmem(result,length(s)+1); + result^:=s; end; @@ -792,8 +784,10 @@ uses procedure ansistringdispose(var p : pchar;length : longint); begin if assigned(p) then - freemem(p,length+1); - p:=nil; + begin + freemem(p,length+1); + p:=nil; + end; end; @@ -863,7 +857,10 @@ initialization end. { $Log$ - Revision 1.28 2003-09-03 15:55:00 peter + Revision 1.29 2003-10-31 15:51:11 peter + * USEINLINE directive added (not enabled yet) + + Revision 1.28 2003/09/03 15:55:00 peter * NEWRA branch merged Revision 1.27.2.2 2003/08/29 17:28:59 peter diff --git a/compiler/fpcdefs.inc b/compiler/fpcdefs.inc index b6623dc5b5..f625b32ee2 100644 --- a/compiler/fpcdefs.inc +++ b/compiler/fpcdefs.inc @@ -6,6 +6,7 @@ {$mode objfpc} {$H-} {$goto on} + {$inline on} { This reduces the memory requirements a lot } {$PACKENUM 1} @@ -14,6 +15,8 @@ exceptions in the constructors } {$ifndef VER1_0} {$IMPLICITEXCEPTIONS OFF} + //{$calling register} + //{$define USEINLINE} {$endif VER1_0} {$define FPCPROCVAR} @@ -82,7 +85,10 @@ { $Log$ - Revision 1.25 2003-09-06 16:47:24 florian + Revision 1.26 2003-10-31 15:51:11 peter + * USEINLINE directive added (not enabled yet) + + Revision 1.25 2003/09/06 16:47:24 florian + support of NaN and Inf in the compiler as values of real constants Revision 1.24 2003/09/03 15:55:00 peter