mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 18:09:12 +02:00
* Cleaner implementation of pointer index to open array, codegen changes
no longer necessary and therefore reverted. git-svn-id: trunk@5037 -
This commit is contained in:
parent
3ba85ce96d
commit
068c0f7952
@ -378,14 +378,23 @@ type
|
||||
{Array slice using .. operator.}
|
||||
with Trangenode(Tvecnode(p).right) do
|
||||
begin
|
||||
{Because the bounds are also needed to calculate the pointer,
|
||||
we take copies instead of clearing the original.}
|
||||
l:=left.getcopy; {Get lower bound.}
|
||||
r:=right.getcopy; {Get upper bound.}
|
||||
l:=left; {Get lower bound.}
|
||||
r:=right; {Get upper bound.}
|
||||
end;
|
||||
{In the procedure the array range is 0..(upper_bound-lower_bound).}
|
||||
hightree:=caddnode.create(subn,r,l);
|
||||
resulttypepass(gen_high_tree);
|
||||
|
||||
{Replace the rangnode in the tree by its lower_bound, and
|
||||
dispose the rangenode.}
|
||||
temp:=Tvecnode(p).right;
|
||||
Tvecnode(p).right:=l.getcopy;
|
||||
with Trangenode(temp) do
|
||||
begin
|
||||
left:=nil;
|
||||
right:=nil;
|
||||
end;
|
||||
temp.free;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
@ -83,7 +83,7 @@ implementation
|
||||
symconst,symdef,symsym,symtable,defutil,paramgr,
|
||||
aasmbase,aasmtai,aasmdata,
|
||||
procinfo,pass_2,parabase,
|
||||
pass_1,nld,ncon,nadd,nutils,nset,
|
||||
pass_1,nld,ncon,nadd,nutils,
|
||||
cgutils,cgobj,
|
||||
tgobj,ncgutil
|
||||
;
|
||||
@ -698,8 +698,7 @@ implementation
|
||||
ispowerof2(mulsize div 8,temp))) then
|
||||
dec(location.reference.offset,bytemulsize*tarraydef(left.resulttype.def).lowrange);
|
||||
|
||||
case right.nodetype of
|
||||
ordconstn:
|
||||
if right.nodetype=ordconstn then
|
||||
begin
|
||||
{ offset can only differ from 0 if arraydef }
|
||||
case left.resulttype.def.deftype of
|
||||
@ -797,25 +796,10 @@ implementation
|
||||
location.loc := LOC_CSUBSETREF;
|
||||
location.sref := subsetref;
|
||||
end;
|
||||
end;
|
||||
rangen:
|
||||
begin
|
||||
{Pbyte[0..9] syntax.
|
||||
The .. operator by itself does not generate code, it only determines
|
||||
the type of the resulting array. So we immediately call the second past
|
||||
of the lower bound, which determines the address.}
|
||||
|
||||
{Get lower array bound.}
|
||||
secondpass(Trangenode(right).left);
|
||||
{If mulsize = 1, we won't have to modify the index }
|
||||
location_force_reg(current_asmdata.CurrAsmList,
|
||||
Trangenode(right).left.location,
|
||||
OS_ADDR,
|
||||
mulsize=1);
|
||||
update_reference_reg_mul(Trangenode(right).left.location.register,mulsize)
|
||||
end;
|
||||
end
|
||||
else
|
||||
{ not nodetype in [ordconstn,rangen] }
|
||||
{ not nodetype=ordconstn }
|
||||
begin
|
||||
if (cs_opt_level1 in aktoptimizerswitches) and
|
||||
{ if we do range checking, we don't }
|
||||
{ need that fancy code (it would be }
|
||||
|
Loading…
Reference in New Issue
Block a user