mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-22 05:18:41 +02:00
* added error checking to spilling_create_load/store
git-svn-id: trunk@29844 -
This commit is contained in:
parent
92b644a19f
commit
19d47610ad
@ -222,8 +222,8 @@ uses
|
|||||||
{ nothing to add }
|
{ nothing to add }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function spilling_create_load(const ref:treference;r:tregister):Taicpu;
|
function spilling_create_load(const ref: treference; r: tregister): taicpu;
|
||||||
function spilling_create_store(r:tregister; const ref:treference):Taicpu;
|
function spilling_create_store(r: tregister; const ref: treference): taicpu;
|
||||||
|
|
||||||
function setoppostfix(i : taicpu;pf : toppostfix) : taicpu;
|
function setoppostfix(i : taicpu;pf : toppostfix) : taicpu;
|
||||||
function setcondition(i : taicpu;c : tasmcond) : taicpu;
|
function setcondition(i : taicpu;c : tasmcond) : taicpu;
|
||||||
@ -474,53 +474,57 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function spilling_create_load(const ref:treference;r:tregister):Taicpu;
|
function spilling_create_op(op: tasmop; const ref: treference; r: tregister): taicpu;
|
||||||
|
const
|
||||||
|
{ invalid sizes for aarch64 are 0 }
|
||||||
|
subreg2bytesize: array[TSubRegister] of byte =
|
||||||
|
(0,0,0,0,4,8,0,0,0,4,8,0,0,0);
|
||||||
var
|
var
|
||||||
op: tasmop;
|
scalefactor: byte;
|
||||||
begin
|
begin
|
||||||
|
scalefactor:=subreg2bytesize[getsubreg(r)];
|
||||||
|
if scalefactor=0 then
|
||||||
|
internalerror(2014120301);
|
||||||
|
if (ref.offset>4095*scalefactor) or
|
||||||
|
((ref.offset>255) and
|
||||||
|
((ref.offset mod scalefactor)<>0)) or
|
||||||
|
(ref.offset<-256) then
|
||||||
|
internalerror(2014120302);
|
||||||
case getregtype(r) of
|
case getregtype(r) of
|
||||||
R_INTREGISTER :
|
R_INTREGISTER,
|
||||||
result:=taicpu.op_reg_ref(A_LDR,r,ref);
|
|
||||||
R_MMREGISTER:
|
R_MMREGISTER:
|
||||||
begin
|
|
||||||
case getsubreg(r) of
|
|
||||||
R_SUBFD:
|
|
||||||
op:=A_LDR;
|
|
||||||
R_SUBFS:
|
|
||||||
op:=A_LDR;
|
|
||||||
else
|
|
||||||
internalerror(2009112905);
|
|
||||||
end;
|
|
||||||
result:=taicpu.op_reg_ref(op,r,ref);
|
result:=taicpu.op_reg_ref(op,r,ref);
|
||||||
end;
|
|
||||||
else
|
else
|
||||||
internalerror(200401041);
|
internalerror(200401041);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function spilling_create_store(r:tregister; const ref:treference):Taicpu;
|
function spilling_create_load(const ref: treference; r: tregister): taicpu;
|
||||||
var
|
var
|
||||||
op: tasmop;
|
op: tasmop;
|
||||||
begin
|
begin
|
||||||
case getregtype(r) of
|
if (ref.index<>NR_NO) or
|
||||||
R_INTREGISTER :
|
(ref.offset<-256) or
|
||||||
result:=taicpu.op_reg_ref(A_STR,r,ref);
|
(ref.offset>255) then
|
||||||
R_MMREGISTER :
|
op:=A_LDR
|
||||||
|
else
|
||||||
|
op:=A_LDUR;
|
||||||
|
result:=spilling_create_op(op,ref,r);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function spilling_create_store(r: tregister; const ref: treference): taicpu;
|
||||||
|
var
|
||||||
|
op: tasmop;
|
||||||
begin
|
begin
|
||||||
case getsubreg(r) of
|
if (ref.index<>NR_NO) or
|
||||||
R_SUBFD:
|
(ref.offset<-256) or
|
||||||
op:=A_STR;
|
(ref.offset>255) then
|
||||||
R_SUBFS:
|
op:=A_STR
|
||||||
op:=A_STR;
|
|
||||||
else
|
else
|
||||||
internalerror(2009112904);
|
op:=A_STUR;
|
||||||
end;
|
result:=spilling_create_op(op,ref,r);
|
||||||
result:=taicpu.op_reg_ref(op,r,ref);
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
internalerror(200401041);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user