* 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:
Jonas Maebe 2015-02-23 22:48:08 +00:00
parent 73a9dc8077
commit 67c9d60b72
2 changed files with 17 additions and 1 deletions

View File

@ -329,6 +329,13 @@ interface
OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M256,OS_M8,OS_M16,OS_M32,
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] = (
'LOC_INVALID',
'LOC_VOID',

View File

@ -71,6 +71,7 @@ interface
procedure update_reference_reg_packed(maybe_const_reg:tregister;l:aint);virtual;
procedure second_wideansistring;virtual;
procedure second_dynamicarray;virtual;
function valid_index_size(size: tcgsize): boolean;virtual;
public
procedure pass_generate_code;override;
end;
@ -708,6 +709,13 @@ implementation
end;
function tcgvecnode.valid_index_size(size: tcgsize): boolean;
begin
result:=
tcgsize2signed[size]=tcgsize2signed[OS_ADDR];
end;
procedure tcgvecnode.rangecheck_array;
var
hightree : tnode;
@ -1067,7 +1075,8 @@ implementation
secondpass(right);
{ 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);
if isjump then