marked a few uses of TConstExprInt as const during parameter passing, to avoid a few unnecessary record copying

git-svn-id: trunk@35509 -
This commit is contained in:
Károly Balogh 2017-03-03 17:29:59 +00:00
parent ece13bcc5a
commit 5426c11611
7 changed files with 21 additions and 21 deletions

View File

@ -105,7 +105,7 @@ interface
exponent value is returned in power.
}
function ispowerof2(value : int64;out power : longint) : boolean;
function ispowerof2(value : Tconstexprint;out power : longint) : boolean;
function ispowerof2(const value : Tconstexprint;out power : longint) : boolean;
function nextpowerof2(value : int64; out power: longint) : int64;
{$ifdef VER2_6} { only 2.7.1+ has a popcnt function in the system unit }
function PopCnt(AValue : Byte): Byte;
@ -880,7 +880,7 @@ implementation
end;
function ispowerof2(value: Tconstexprint; out power: longint): boolean;
function ispowerof2(const value: Tconstexprint; out power: longint): boolean;
begin
if value.signed or
(value.uvalue<=high(int64)) then

View File

@ -62,11 +62,11 @@ interface
function get_max_value(def : tdef) : TConstExprInt;
{# Returns basetype of the specified integer range }
function range_to_basetype(l,h:TConstExprInt):tordtype;
function range_to_basetype(const l,h:TConstExprInt):tordtype;
procedure range_to_type(l,h:TConstExprInt;var def:tdef);
procedure range_to_type(const l,h:TConstExprInt;var def:tdef);
procedure int_to_type(v:TConstExprInt;var def:tdef);
procedure int_to_type(const v:TConstExprInt;var def:tdef);
{# Returns true, if definition defines an integer type }
function is_integer(def : tdef) : boolean;
@ -404,7 +404,7 @@ implementation
end;
function range_to_basetype(l,h:TConstExprInt):tordtype;
function range_to_basetype(const l,h:TConstExprInt):tordtype;
begin
{ prefer signed over unsigned }
if (l>=int64(-128)) and (h<=127) then
@ -426,7 +426,7 @@ implementation
end;
procedure range_to_type(l,h:TConstExprInt;var def:tdef);
procedure range_to_type(const l,h:TConstExprInt;var def:tdef);
begin
{ prefer signed over unsigned }
if (l>=int64(-128)) and (h<=127) then
@ -448,7 +448,7 @@ implementation
end;
procedure int_to_type(v:TConstExprInt;var def:tdef);
procedure int_to_type(const v:TConstExprInt;var def:tdef);
begin
range_to_type(v,v,def);
end;

View File

@ -2500,7 +2500,7 @@ implementation
We do this on 64 bit CPUs as well, they benefit from it as well }
function checkremovebiginttypeconvs(n: tnode; out gotsint: boolean;validints : tordtypeset;l,h : Tconstexprint): boolean;
function checkremovebiginttypeconvs(n: tnode; out gotsint: boolean;validints : tordtypeset;const l,h : Tconstexprint): boolean;
var
gotdivmod: boolean;

View File

@ -61,7 +61,7 @@ interface
_rangecheck determines if the value of the ordinal should be checked
against the ranges of the type definition.
}
constructor create(v : tconstexprint;def:tdef; _rangecheck : boolean);virtual;
constructor create(const v : tconstexprint;def:tdef; _rangecheck : boolean);virtual;
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
procedure buildderefimpl;override;
@ -173,7 +173,7 @@ interface
cguidconstnode : tguidconstnodeclass = tguidconstnode;
cnilnode : tnilnodeclass=tnilnode;
function genintconstnode(v : TConstExprInt) : tordconstnode;
function genintconstnode(const v : TConstExprInt) : tordconstnode;
function genenumnode(v : tenumsym) : tordconstnode;
{ some helper routines }
@ -194,7 +194,7 @@ implementation
cpubase,cgbase,
nld;
function genintconstnode(v : TConstExprInt) : tordconstnode;
function genintconstnode(const v : TConstExprInt) : tordconstnode;
var
htype : tdef;
begin
@ -486,7 +486,7 @@ implementation
TORDCONSTNODE
*****************************************************************************}
constructor tordconstnode.create(v : tconstexprint;def:tdef;_rangecheck : boolean);
constructor tordconstnode.create(const v : tconstexprint;def:tdef;_rangecheck : boolean);
begin
inherited create(ordconstn);

View File

@ -104,7 +104,7 @@ interface
function pass_1 : tnode;override;
function simplify(forinline:boolean):tnode;override;
function docompare(p: tnode): boolean; override;
procedure addlabel(blockid:longint;l,h : TConstExprInt); overload;
procedure addlabel(blockid:longint;const l,h : TConstExprInt); overload;
procedure addlabel(blockid:longint;l,h : tstringconstnode); overload;
procedure addblock(blockid:longint;instr:tnode);
procedure addelseblock(instr:tnode);
@ -1032,7 +1032,7 @@ implementation
end;
procedure tcasenode.addlabel(blockid:longint;l,h : TConstExprInt);
procedure tcasenode.addlabel(blockid:longint;const l,h : TConstExprInt);
var
hcaselabel : pcaselabel;

View File

@ -93,7 +93,7 @@ interface
which was determined during an earlier typecheck pass (because the value
may e.g. be a parameter to a call, which needs to be of the declared
parameter type) }
function create_simplified_ord_const(value: tconstexprint; def: tdef; forinline: boolean): tnode;
function create_simplified_ord_const(const value: tconstexprint; def: tdef; forinline: boolean): tnode;
{ returns true if n is only a tree of administrative nodes
containing no code }
@ -1072,7 +1072,7 @@ implementation
end;
function create_simplified_ord_const(value: tconstexprint; def: tdef; forinline: boolean): tnode;
function create_simplified_ord_const(const value: tconstexprint; def: tdef; forinline: boolean): tnode;
begin
if not forinline then
result:=genintconstnode(value)

View File

@ -175,10 +175,10 @@ interface
function empty:boolean;
function getcopy: tpropaccesslist;
procedure addsym(slt:tsltype;p:tsym);
procedure addconst(slt:tsltype;v:TConstExprInt;d:tdef);
procedure addconst(slt:tsltype;const v:TConstExprInt;d:tdef);
procedure addtype(slt:tsltype;d:tdef);
procedure addsymderef(slt:tsltype;d:tderef);
procedure addconstderef(slt:tsltype;v:TConstExprInt;d:tderef);
procedure addconstderef(slt:tsltype;const v:TConstExprInt;d:tderef);
procedure addtypederef(slt:tsltype;d:tderef);
procedure clear;
procedure resolve;
@ -609,7 +609,7 @@ implementation
end;
procedure tpropaccesslist.addconst(slt:tsltype;v:TConstExprInt;d:tdef);
procedure tpropaccesslist.addconst(slt:tsltype;const v:TConstExprInt;d:tdef);
var
hp : ppropaccesslistitem;
begin
@ -651,7 +651,7 @@ implementation
end;
procedure tpropaccesslist.addconstderef(slt:tsltype;v:TConstExprInt;d:tderef);
procedure tpropaccesslist.addconstderef(slt:tsltype;const v:TConstExprInt;d:tderef);
begin
addconst(slt,v,nil);
lastsym^.valuedefderef:=d;