* don't waste a register for inc/dec(<pointer>,const);

git-svn-id: trunk@11812 -
This commit is contained in:
florian 2008-09-21 17:42:53 +00:00
parent fc6ae58b9b
commit 0a8f621a6b
2 changed files with 10 additions and 0 deletions

View File

@ -444,6 +444,8 @@ implementation
{ when constant, just multiply the addvalue }
if is_constintnode(tcallparanode(tcallparanode(left).right).left) then
addvalue:=addvalue*get_ordinal_value(tcallparanode(tcallparanode(left).right).left)
else if is_constpointernode(tcallparanode(tcallparanode(left).right).left) then
addvalue:=addvalue*tpointerconstnode(tcallparanode(tcallparanode(left).right).left).value
else
begin
location_force_reg(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,cgsize,addvalue<=1);

View File

@ -460,6 +460,7 @@ interface
function is_constboolnode(p : tnode) : boolean;
function is_constenumnode(p : tnode) : boolean;
function is_constwidecharnode(p : tnode) : boolean;
function is_constpointernode(p : tnode) : boolean;
implementation
@ -670,6 +671,13 @@ implementation
is_constenumnode:=(p.nodetype=ordconstn) and (p.resultdef.typ=enumdef);
end;
function is_constpointernode(p : tnode) : boolean;
begin
is_constpointernode:=(p.nodetype=pointerconstn);
end;
{****************************************************************************
TNODE
****************************************************************************}