+ implemented huge pointer arithmetic

git-svn-id: trunk@28139 -
This commit is contained in:
nickysn 2014-07-03 16:53:22 +00:00
parent da77535631
commit d9e94ffab7

View File

@ -35,6 +35,8 @@ interface
ti8086addnode = class(tx86addnode)
function simplify(forinline: boolean) : tnode;override;
function use_generic_mul32to64: boolean; override;
function first_addpointer: tnode; override;
function first_addhugepointer: tnode;
procedure second_addordinal; override;
procedure second_add64bit;override;
procedure second_addfarpointer;
@ -48,11 +50,11 @@ interface
uses
globtype,systems,
cutils,verbose,globals,constexp,
cutils,verbose,globals,constexp,pass_1,
symconst,symdef,symtype,paramgr,defutil,
aasmbase,aasmtai,aasmdata,aasmcpu,
cgbase,procinfo,
ncon,nset,cgutils,tgobj,
ncal,ncon,nset,cgutils,tgobj,
cga,ncgutil,cgobj,cg64f32,cgx86,
hlcgobj;
@ -308,6 +310,47 @@ interface
end;
function ti8086addnode.first_addpointer: tnode;
begin
if is_hugepointer(left.resultdef) xor is_hugepointer(right.resultdef) then
result:=first_addhugepointer
else
result:=inherited;
end;
function ti8086addnode.first_addhugepointer: tnode;
var
procname:string;
begin
result:=nil;
case nodetype of
addn:
procname:='fpc_hugeptr_add_longint';
subn:
procname:='fpc_hugeptr_sub_longint';
else
internalerror(2014070301);
end;
if cs_hugeptr_normalization in current_settings.localswitches then
procname:=procname+'_normalized';
if is_hugepointer(left.resultdef) then
result := ccallnode.createintern(procname,
ccallparanode.create(right,
ccallparanode.create(left,nil)))
else
result := ccallnode.createintern(procname,
ccallparanode.create(left,
ccallparanode.create(right,nil)));
left := nil;
right := nil;
firstpass(result);
end;
procedure ti8086addnode.second_addfarpointer;
var
tmpreg : tregister;