mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-21 05:23:05 +01:00
* factored out the check regarding whether the index of a vecn needs to be
loaded into a register because of its size
o by default, also allow if the size is the same as OS_ADDR but with a
different sign
git-svn-id: trunk@29827 -
This commit is contained in:
parent
73a9dc8077
commit
67c9d60b72
@ -329,6 +329,13 @@ interface
|
|||||||
OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M256,OS_M8,OS_M16,OS_M32,
|
OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M256,OS_M8,OS_M16,OS_M32,
|
||||||
OS_M64,OS_M128,OS_M256);
|
OS_M64,OS_M128,OS_M256);
|
||||||
|
|
||||||
|
tcgsize2signed : array[tcgsize] of tcgsize = (OS_NO,
|
||||||
|
OS_S8,OS_S16,OS_S32,OS_S64,OS_S128,OS_S8,OS_S16,OS_S32,OS_S64,OS_S128,
|
||||||
|
OS_F32,OS_F64,OS_F80,OS_C64,OS_F128,
|
||||||
|
OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M256,OS_M8,OS_M16,OS_M32,
|
||||||
|
OS_M64,OS_M128,OS_M256);
|
||||||
|
|
||||||
|
|
||||||
tcgloc2str : array[TCGLoc] of string[12] = (
|
tcgloc2str : array[TCGLoc] of string[12] = (
|
||||||
'LOC_INVALID',
|
'LOC_INVALID',
|
||||||
'LOC_VOID',
|
'LOC_VOID',
|
||||||
|
|||||||
@ -71,6 +71,7 @@ interface
|
|||||||
procedure update_reference_reg_packed(maybe_const_reg:tregister;l:aint);virtual;
|
procedure update_reference_reg_packed(maybe_const_reg:tregister;l:aint);virtual;
|
||||||
procedure second_wideansistring;virtual;
|
procedure second_wideansistring;virtual;
|
||||||
procedure second_dynamicarray;virtual;
|
procedure second_dynamicarray;virtual;
|
||||||
|
function valid_index_size(size: tcgsize): boolean;virtual;
|
||||||
public
|
public
|
||||||
procedure pass_generate_code;override;
|
procedure pass_generate_code;override;
|
||||||
end;
|
end;
|
||||||
@ -708,6 +709,13 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tcgvecnode.valid_index_size(size: tcgsize): boolean;
|
||||||
|
begin
|
||||||
|
result:=
|
||||||
|
tcgsize2signed[size]=tcgsize2signed[OS_ADDR];
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tcgvecnode.rangecheck_array;
|
procedure tcgvecnode.rangecheck_array;
|
||||||
var
|
var
|
||||||
hightree : tnode;
|
hightree : tnode;
|
||||||
@ -1067,7 +1075,8 @@ implementation
|
|||||||
secondpass(right);
|
secondpass(right);
|
||||||
|
|
||||||
{ if mulsize = 1, we won't have to modify the index }
|
{ if mulsize = 1, we won't have to modify the index }
|
||||||
if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) or (right.location.size<>OS_ADDR) then
|
if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) or
|
||||||
|
not valid_index_size(right.location.size) then
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,ptruinttype,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,ptruinttype,true);
|
||||||
|
|
||||||
if isjump then
|
if isjump then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user