|
@@ -310,102 +310,58 @@ unit nmem;
|
|
TASSIGNMENTNODE
|
|
TASSIGNMENTNODE
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
- constructor tassignmentnode.init(l,r : pnode);
|
|
|
|
|
|
+ procedure loadansistring;
|
|
|
|
|
|
begin
|
|
begin
|
|
- inherited init(l,r);
|
|
|
|
- concat_string:=false;
|
|
|
|
- assigntyp:=at_normal;
|
|
|
|
|
|
+ { !!! }
|
|
end;
|
|
end;
|
|
|
|
|
|
- destructor tassignmentnode.done;
|
|
|
|
|
|
+ procedure loadansi2short(right,left: pnode);
|
|
|
|
|
|
begin
|
|
begin
|
|
- inherited done;
|
|
|
|
|
|
+ { !!! }
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tassignmentnode.det_temp;
|
|
|
|
|
|
+ procedure loadshortstring;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ { !!! }
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tassignmentnode.det_resulttype;
|
|
|
|
|
|
+ constructor tassignmentnode.init(l,r : pnode);
|
|
|
|
|
|
begin
|
|
begin
|
|
- inherited det_resulttype;
|
|
|
|
- resulttype:=voiddef;
|
|
|
|
- { assignements to open arrays aren't allowed }
|
|
|
|
- if is_open_array(left^.resulttype) then
|
|
|
|
- CGMessage(type_e_mismatch);
|
|
|
|
|
|
+ inherited init(l,r);
|
|
|
|
+{ concat_string:=false; }
|
|
|
|
+ assigntyp:=at_normal;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { updated from old cg on 29.2.00 by FK }
|
|
|
|
- procedure generic_p2_stringassignment(p : passignmentnode);
|
|
|
|
|
|
+ destructor tassignmentnode.done;
|
|
|
|
|
|
begin
|
|
begin
|
|
- if is_ansistring(left^.resulttype) then
|
|
|
|
- begin
|
|
|
|
- { the source and destinations are released
|
|
|
|
- in loadansistring, because an ansi string can
|
|
|
|
- also be in a register
|
|
|
|
- }
|
|
|
|
- loadansistring;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- if is_shortstring(left^.resulttype) then
|
|
|
|
- begin
|
|
|
|
- if is_ansistring(right^.resulttype) then
|
|
|
|
- begin
|
|
|
|
- if (right^.treetype=stringconstn) and
|
|
|
|
- (pstringconstnode(right)^.length=0) then
|
|
|
|
- begin
|
|
|
|
- cg^.a_load_const_ref(list,OS_8,0,left^.location.reference);
|
|
|
|
- tg.del_reference(left^.location.reference);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- loadansi2short(right,left);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- { we do not need destination anymore }
|
|
|
|
- tg.del_reference(left^.location.reference);
|
|
|
|
- { tg.del_reference(right^.location.reference);
|
|
|
|
- done in loadshortstring }
|
|
|
|
- loadshortstring;
|
|
|
|
- tg.ungetiftemp(right^.location.reference);
|
|
|
|
- end;
|
|
|
|
- end
|
|
|
|
- else if is_longstring(left^.resulttype) then
|
|
|
|
- begin
|
|
|
|
- abstract;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- { its the only thing we have to do }
|
|
|
|
- tg.del_reference(right^.location.reference);
|
|
|
|
- end
|
|
|
|
|
|
+ inherited done;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure generic_p2_assignment_int64_reg(p : passignmentnode);
|
|
|
|
|
|
+ procedure tassignmentnode.det_temp;
|
|
|
|
|
|
begin
|
|
begin
|
|
- { we don't know it better here }
|
|
|
|
- generic_p2_assignment(p);
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
- { updated from old cg on 29.2.00 by FK }
|
|
|
|
- procedure generic_p2_assignment_flags(p : passignmentnode);
|
|
|
|
|
|
+ procedure tassignmentnode.det_resulttype;
|
|
|
|
|
|
begin
|
|
begin
|
|
- { for example the alpha doesn't have flags }
|
|
|
|
- abstract;
|
|
|
|
|
|
+ inherited det_resulttype;
|
|
|
|
+ resulttype:=voiddef;
|
|
|
|
+ { assignements to open arrays aren't allowed }
|
|
|
|
+ if is_open_array(left^.resulttype) then
|
|
|
|
+ CGMessage(type_e_mismatch);
|
|
end;
|
|
end;
|
|
|
|
|
|
{ updated from old cg on 29.2.00 by FK }
|
|
{ updated from old cg on 29.2.00 by FK }
|
|
procedure generic_p2_assignment(p : passignmentnode);
|
|
procedure generic_p2_assignment(p : passignmentnode);
|
|
|
|
|
|
var
|
|
var
|
|
- opsize : topsize;
|
|
|
|
|
|
+ opsize : tcgsize;
|
|
otlabel,hlabel,oflabel : pasmlabel;
|
|
otlabel,hlabel,oflabel : pasmlabel;
|
|
fputyp : tfloattype;
|
|
fputyp : tfloattype;
|
|
loc : tloc;
|
|
loc : tloc;
|
|
@@ -414,8 +370,8 @@ unit nmem;
|
|
op : tasmop;
|
|
op : tasmop;
|
|
|
|
|
|
begin
|
|
begin
|
|
- loc:=left^.location.loc;
|
|
|
|
- case right^.location.loc of
|
|
|
|
|
|
+ loc:= p^.left^.location.loc;
|
|
|
|
+ case p^.right^.location.loc of
|
|
LOC_REFERENCE,
|
|
LOC_REFERENCE,
|
|
LOC_MEM : begin
|
|
LOC_MEM : begin
|
|
{ extra handling for ordinal constants }
|
|
{ extra handling for ordinal constants }
|
|
@@ -430,10 +386,10 @@ unit nmem;
|
|
end;
|
|
end;
|
|
if loc=LOC_CREGISTER then
|
|
if loc=LOC_CREGISTER then
|
|
begin
|
|
begin
|
|
- emit_ref_reg(A_MOV,opsize,
|
|
|
|
- newreference(p^.right^.location.reference),
|
|
|
|
|
|
+ cg^.a_load_ref_reg(p^.list,opsize,
|
|
|
|
+ p^.right^.location.reference,
|
|
p^.left^.location.register);
|
|
p^.left^.location.register);
|
|
-
|
|
|
|
|
|
+{$ifdef dummy}
|
|
!!!!!!!!!!!! only 32 bit cpus
|
|
!!!!!!!!!!!! only 32 bit cpus
|
|
if is_64bitint(p^.right^.resulttype) then
|
|
if is_64bitint(p^.right^.resulttype) then
|
|
begin
|
|
begin
|
|
@@ -442,14 +398,16 @@ unit nmem;
|
|
emit_ref_reg(A_MOV,opsize,r,
|
|
emit_ref_reg(A_MOV,opsize,r,
|
|
p^.left^.location.registerhigh);
|
|
p^.left^.location.registerhigh);
|
|
end;
|
|
end;
|
|
- tg.del_reference(right^.location.reference);
|
|
|
|
|
|
+{$endif dummy}
|
|
|
|
+ tg.del_reference(p^.right^.location.reference);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- emit_const_ref(A_MOV,opsize,
|
|
|
|
|
|
+ cg^.a_load_const_ref(p^.list,opsize,
|
|
p^.right^.location.reference.offset,
|
|
p^.right^.location.reference.offset,
|
|
- newreference(p^.left^.location.reference));
|
|
|
|
|
|
+ p^.left^.location.reference);
|
|
|
|
|
|
|
|
+{$ifdef dummy}
|
|
!!!!!!!!!!!! only 32 bit cpus
|
|
!!!!!!!!!!!! only 32 bit cpus
|
|
if is_64bitint(p^.right^.resulttype) then
|
|
if is_64bitint(p^.right^.resulttype) then
|
|
begin
|
|
begin
|
|
@@ -458,11 +416,13 @@ unit nmem;
|
|
emit_const_ref(A_MOV,opsize,
|
|
emit_const_ref(A_MOV,opsize,
|
|
0,r);
|
|
0,r);
|
|
end;
|
|
end;
|
|
- del_reference(left^.location.reference);
|
|
|
|
|
|
+{$endif dummy}
|
|
|
|
+ tg.del_reference(p^.left^.location.reference);
|
|
end;
|
|
end;
|
|
|
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+{$ifdef i386}
|
|
!!!!!!!!!!!! only 386
|
|
!!!!!!!!!!!! only 386
|
|
else if loc=LOC_CFPUREGISTER then
|
|
else if loc=LOC_CFPUREGISTER then
|
|
begin
|
|
begin
|
|
@@ -472,11 +432,13 @@ unit nmem;
|
|
emit_reg(A_FSTP,S_NO,
|
|
emit_reg(A_FSTP,S_NO,
|
|
correct_fpuregister(p^.left^.location.register,fpuvaroffset+1));
|
|
correct_fpuregister(p^.left^.location.register,fpuvaroffset+1));
|
|
end
|
|
end
|
|
|
|
+{$endif i386}
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- if (right^.resulttype^.needs_inittable) and
|
|
|
|
- ((right^.resulttype^.deftype<>objectdef) or
|
|
|
|
- not(pobjectdef(right^.resulttype)^.is_class)) then
|
|
|
|
|
|
+{$ifdef dummy}
|
|
|
|
+ if (p^.right^.resulttype^.needs_inittable) and
|
|
|
|
+ ((p^.right^.resulttype^.deftype<>objectdef) or
|
|
|
|
+ not(pobjectdef(p^.right^.resulttype)^.is_class)) then
|
|
begin
|
|
begin
|
|
{ this would be a problem }
|
|
{ this would be a problem }
|
|
if not(left^.resulttype^.needs_inittable) then
|
|
if not(left^.resulttype^.needs_inittable) then
|
|
@@ -498,15 +460,15 @@ unit nmem;
|
|
emitpushreferenceaddr(p^.left^.location.reference);
|
|
emitpushreferenceaddr(p^.left^.location.reference);
|
|
emitcall('FPC_DECREF');
|
|
emitcall('FPC_DECREF');
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+{$endif dummy}
|
|
{$ifdef regallocfix}
|
|
{$ifdef regallocfix}
|
|
- concatcopy(p^.right^.location.reference,
|
|
|
|
|
|
+ cg^.concatcopy(p^.list,p^.right^.location.reference,
|
|
p^.left^.location.reference,p^.left^.resulttype^.size,true,false);
|
|
p^.left^.location.reference,p^.left^.resulttype^.size,true,false);
|
|
ungetiftemp(p^.right^.location.reference);
|
|
ungetiftemp(p^.right^.location.reference);
|
|
{$Else regallocfix}
|
|
{$Else regallocfix}
|
|
- concatcopy(p^.right^.location.reference,
|
|
|
|
- p^.left^.location.reference,p^.left^.resulttype^.size,false,false);
|
|
|
|
- ungetiftemp(p^.right^.location.reference);
|
|
|
|
|
|
+ cg^.g_concatcopy(p^.list,p^.right^.location.reference,
|
|
|
|
+ p^.left^.location.reference,p^.left^.resulttype^.size,false);
|
|
|
|
+ tg.ungetiftemp(p^.right^.location.reference);
|
|
{$endif regallocfix}
|
|
{$endif regallocfix}
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -533,19 +495,21 @@ unit nmem;
|
|
{ simplified with op_reg_loc }
|
|
{ simplified with op_reg_loc }
|
|
if loc=LOC_CREGISTER then
|
|
if loc=LOC_CREGISTER then
|
|
begin
|
|
begin
|
|
- emit_reg_reg(A_MOV,opsize,
|
|
|
|
|
|
+ cg^.a_load_reg_reg(p^.list,opsize,
|
|
p^.right^.location.register,
|
|
p^.right^.location.register,
|
|
p^.left^.location.register);
|
|
p^.left^.location.register);
|
|
- ungetregister(p^.right^.location.register);
|
|
|
|
|
|
+ tg.ungetregister(p^.right^.location.register);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Begin
|
|
Begin
|
|
- emit_reg_ref(A_MOV,opsize,
|
|
|
|
|
|
+ cg^.a_load_reg_ref(p^.list,opsize,
|
|
p^.right^.location.register,
|
|
p^.right^.location.register,
|
|
- newreference(p^.left^.location.reference));
|
|
|
|
- ungetregister(p^.right^.location.register);
|
|
|
|
- del_reference(p^.left^.location.reference);
|
|
|
|
|
|
+ p^.left^.location.reference);
|
|
|
|
+ tg.ungetregister(p^.right^.location.register);
|
|
|
|
+ tg.del_reference(p^.left^.location.reference);
|
|
end;
|
|
end;
|
|
|
|
+{$ifdef dummy}
|
|
|
|
+ !!!! only for 32bit processors
|
|
if is_64bitint(p^.right^.resulttype) then
|
|
if is_64bitint(p^.right^.resulttype) then
|
|
begin
|
|
begin
|
|
{ simplified with op_reg_loc }
|
|
{ simplified with op_reg_loc }
|
|
@@ -561,7 +525,9 @@ unit nmem;
|
|
p^.right^.location.registerhigh,r);
|
|
p^.right^.location.registerhigh,r);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
+{$endif dummy}
|
|
end;
|
|
end;
|
|
|
|
+{$ifdef dummy}
|
|
LOC_FPU : begin
|
|
LOC_FPU : begin
|
|
if (p^.left^.resulttype^.deftype=floatdef) then
|
|
if (p^.left^.resulttype^.deftype=floatdef) then
|
|
fputyp:=pfloatdef(p^.left^.resulttype)^.typ
|
|
fputyp:=pfloatdef(p^.left^.resulttype)^.typ
|
|
@@ -587,7 +553,7 @@ unit nmem;
|
|
internalerror(48991);
|
|
internalerror(48991);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+{$ifdef i386}
|
|
!!!!!!!!!!!! only 386
|
|
!!!!!!!!!!!! only 386
|
|
LOC_CFPUREGISTER: begin
|
|
LOC_CFPUREGISTER: begin
|
|
if (p^.left^.resulttype^.deftype=floatdef) then
|
|
if (p^.left^.resulttype^.deftype=floatdef) then
|
|
@@ -617,6 +583,8 @@ unit nmem;
|
|
internalerror(48992);
|
|
internalerror(48992);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
+{$endif i386}
|
|
|
|
+{$endif dummy}
|
|
LOC_JUMP : begin
|
|
LOC_JUMP : begin
|
|
{ support every type of boolean here }
|
|
{ support every type of boolean here }
|
|
case p^.right^.resulttype^.size of
|
|
case p^.right^.resulttype^.size of
|
|
@@ -628,26 +596,26 @@ unit nmem;
|
|
8 : opsize:=OS_64;
|
|
8 : opsize:=OS_64;
|
|
end;
|
|
end;
|
|
getlabel(hlabel);
|
|
getlabel(hlabel);
|
|
- a_label(p^.list,p^.truelabel);
|
|
|
|
|
|
+ cg^.a_label(p^.list,p^.truelabel);
|
|
if loc=LOC_CREGISTER then
|
|
if loc=LOC_CREGISTER then
|
|
- a_load_const_reg(p^.list,opsize,1,
|
|
|
|
|
|
+ cg^.a_load_const_reg(p^.list,opsize,1,
|
|
p^.left^.location.register)
|
|
p^.left^.location.register)
|
|
else
|
|
else
|
|
- a_load_const_ref(p^.list,opsize,1,
|
|
|
|
- newreference(p^.left^.location.reference));
|
|
|
|
- a_jmp_cond(p^.list,C_None,hlabel);
|
|
|
|
- a_label(p^.list,p^.falselabel);
|
|
|
|
|
|
+ cg^.a_load_const_ref(p^.list,opsize,1,
|
|
|
|
+ p^.left^.location.reference);
|
|
|
|
+ cg^.a_jmp_cond(p^.list,OC_None,hlabel);
|
|
|
|
+ cg^.a_label(p^.list,p^.falselabel);
|
|
|
|
|
|
if loc=LOC_CREGISTER then
|
|
if loc=LOC_CREGISTER then
|
|
- a_load_const_reg(p^.list,opsize,0,
|
|
|
|
- p^.left^.location.register);
|
|
|
|
|
|
+ cg^.a_load_const_reg(p^.list,opsize,0,
|
|
|
|
+ p^.left^.location.register)
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- a_load_const_ref(p^.list,opsize,0,
|
|
|
|
- newreference(p^.left^.location.reference));
|
|
|
|
|
|
+ cg^.a_load_const_ref(p^.list,opsize,0,
|
|
|
|
+ p^.left^.location.reference);
|
|
tg.del_reference(p^.left^.location.reference);
|
|
tg.del_reference(p^.left^.location.reference);
|
|
end;
|
|
end;
|
|
- a_label(p^.list,hlabel);
|
|
|
|
|
|
+ cg^.a_label(p^.list,hlabel);
|
|
end;
|
|
end;
|
|
LOC_FLAGS:
|
|
LOC_FLAGS:
|
|
p2_assignment_flags(p);
|
|
p2_assignment_flags(p);
|
|
@@ -655,6 +623,70 @@ unit nmem;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ { updated from old cg on 29.2.00 by FK }
|
|
|
|
+ procedure generic_p2_assignment_string(p : passignmentnode);
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ with p^ do
|
|
|
|
+ if is_ansistring(left^.resulttype) then
|
|
|
|
+ begin
|
|
|
|
+ { the source and destinations are released
|
|
|
|
+ in loadansistring, because an ansi string can
|
|
|
|
+ also be in a register
|
|
|
|
+ }
|
|
|
|
+ loadansistring;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ if is_shortstring(left^.resulttype) then
|
|
|
|
+ begin
|
|
|
|
+ if is_ansistring(right^.resulttype) then
|
|
|
|
+ begin
|
|
|
|
+ if (right^.treetype=stringconstn) and
|
|
|
|
+ (pstringconstnode(right)^.length=0) then
|
|
|
|
+ begin
|
|
|
|
+ cg^.a_load_const_ref(list,OS_8,0,left^.location.reference);
|
|
|
|
+ tg.del_reference(left^.location.reference);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ loadansi2short(right,left);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ { we do not need destination anymore }
|
|
|
|
+ tg.del_reference(left^.location.reference);
|
|
|
|
+ { tg.del_reference(right^.location.reference);
|
|
|
|
+ done in loadshortstring }
|
|
|
|
+ loadshortstring;
|
|
|
|
+ tg.ungetiftemp(right^.location.reference);
|
|
|
|
+ end;
|
|
|
|
+ end
|
|
|
|
+ else if is_longstring(left^.resulttype) then
|
|
|
|
+ begin
|
|
|
|
+ abstract;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ { its the only thing we have to do }
|
|
|
|
+ tg.del_reference(right^.location.reference);
|
|
|
|
+ end
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ procedure generic_p2_assignment_int64_reg(p : passignmentnode);
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ { we don't know it better here }
|
|
|
|
+ generic_p2_assignment(p);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ { updated from old cg on 29.2.00 by FK }
|
|
|
|
+ procedure generic_p2_assignment_flags(p : passignmentnode);
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ { for example the alpha doesn't have flags }
|
|
|
|
+ abstract;
|
|
|
|
+ end;
|
|
|
|
+
|
|
procedure tassignmentnode.secondpass;
|
|
procedure tassignmentnode.secondpass;
|
|
|
|
|
|
var
|
|
var
|
|
@@ -668,14 +700,13 @@ unit nmem;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
if left^.resulttype^.deftype=stringdef then
|
|
if left^.resulttype^.deftype=stringdef then
|
|
- p2_assignment_string(@self);
|
|
|
|
|
|
+ p2_assignment_string(@self)
|
|
{ if is an int64 which has to do with registers, we
|
|
{ if is an int64 which has to do with registers, we
|
|
need to call probably a procedure for 32 bit processors
|
|
need to call probably a procedure for 32 bit processors
|
|
}
|
|
}
|
|
else if is_64bitint(left^.resulttype) and
|
|
else if is_64bitint(left^.resulttype) and
|
|
- ((left^.location in [LOC_REGISGTER,LOC_CREGISTER) or
|
|
|
|
- (left^.location in [LOC_REGISGTER,LOC_CREGISTER)) then
|
|
|
|
- else
|
|
|
|
|
|
+ ((left^.location.loc in [LOC_REGISTER,LOC_CREGISTER]) or
|
|
|
|
+ (left^.location.loc in [LOC_REGISTER,LOC_CREGISTER])) then
|
|
p2_assignment_int64_reg(@self)
|
|
p2_assignment_int64_reg(@self)
|
|
else
|
|
else
|
|
p2_assignment(@self);
|
|
p2_assignment(@self);
|
|
@@ -683,13 +714,16 @@ unit nmem;
|
|
|
|
|
|
begin
|
|
begin
|
|
p2_assignment:=@generic_p2_assignment;
|
|
p2_assignment:=@generic_p2_assignment;
|
|
- p2_assignment_flags:=p2_assignment_flags;
|
|
|
|
|
|
+ p2_assignment_flags:=@generic_p2_assignment_flags;
|
|
p2_assignment_string:=@generic_p2_assignment_string;
|
|
p2_assignment_string:=@generic_p2_assignment_string;
|
|
p2_assignment_int64_reg:=@generic_p2_assignment_int64_reg;
|
|
p2_assignment_int64_reg:=@generic_p2_assignment_int64_reg;
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.17 2000-03-01 15:36:13 florian
|
|
|
|
|
|
+ Revision 1.18 2000-04-29 09:01:06 jonas
|
|
|
|
+ * nmem compiles again (at least for powerpc)
|
|
|
|
+
|
|
|
|
+ Revision 1.17 2000/03/01 15:36:13 florian
|
|
* some new stuff for the new cg
|
|
* some new stuff for the new cg
|
|
|
|
|
|
Revision 1.16 2000/01/07 01:14:53 peter
|
|
Revision 1.16 2000/01/07 01:14:53 peter
|