mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 08:08:36 +02:00
+ <pointer> - <pointer> result is divided by the pointer element size now
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
This commit is contained in:
parent
99f47575b4
commit
b5bf8cefad
@ -51,7 +51,6 @@ Unit Ra386int;
|
||||
prevasmtoken : tasmtoken;
|
||||
ActOpsize : topsize;
|
||||
constructor create;override;
|
||||
destructor destroy;override;
|
||||
function is_asmopcode(const s: string):boolean;
|
||||
function is_asmoperator(const s: string):boolean;
|
||||
function is_asmdirective(const s: string):boolean;
|
||||
@ -151,12 +150,6 @@ Unit Ra386int;
|
||||
end;
|
||||
|
||||
|
||||
destructor ti386intreader.destroy;
|
||||
begin
|
||||
if assigned(iasmops) then
|
||||
iasmops.Free;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------}
|
||||
{ Routines for the tokenizing }
|
||||
{---------------------------------------------------------------------}
|
||||
@ -1977,7 +1970,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.71 2004-03-02 17:32:12 florian
|
||||
Revision 1.72 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.71 2004/03/02 17:32:12 florian
|
||||
* make cycle fixed
|
||||
+ pic support for darwin
|
||||
+ support of importing vars from shared libs on darwin implemented
|
||||
|
@ -1072,7 +1072,8 @@ unit cgcpu;
|
||||
{ point to nowhere! }
|
||||
|
||||
{ save the PC counter (pop it from the stack) }
|
||||
hregister:=getaddressregister(list);
|
||||
hregister:=NR_A3;
|
||||
a_reg_alloc(list,hregister);
|
||||
reference_reset_base(ref,NR_STACK_POINTER_REG,0);
|
||||
ref.direction:=dir_inc;
|
||||
list.concat(taicpu.op_ref_reg(A_MOVE,S_L,ref,hregister));
|
||||
@ -1087,11 +1088,10 @@ unit cgcpu;
|
||||
reference_reset_base(ref,NR_STACK_POINTER_REG,0);
|
||||
ref.direction:=dir_dec;
|
||||
list.concat(taicpu.op_reg_ref(A_MOVE,S_L,hregister,ref));
|
||||
a_reg_alloc(list,hregister);
|
||||
list.concat(taicpu.op_none(A_RTS,S_NO));
|
||||
ungetregister(list,hregister);
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
@ -1313,7 +1313,11 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.26 2004-05-06 22:01:54 florian
|
||||
Revision 1.27 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.26 2004/05/06 22:01:54 florian
|
||||
* register numbers for address registers fixed
|
||||
|
||||
Revision 1.25 2004/05/06 20:30:51 florian
|
||||
|
@ -29,23 +29,24 @@ unit cpupi;
|
||||
interface
|
||||
|
||||
uses
|
||||
procinfo,cgbase;
|
||||
procinfo,cgbase,psub;
|
||||
|
||||
type
|
||||
tm68kprocinfo = class(tprocinfo)
|
||||
end;
|
||||
tm68kprocinfo = class(tcgprocinfo)
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
verbose;
|
||||
|
||||
begin
|
||||
cprocinfo:=tm68kprocinfo;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2004-05-01 23:29:01 florian
|
||||
Revision 1.4 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.3 2004/05/01 23:29:01 florian
|
||||
* continued to fix m68k compiler compilation
|
||||
|
||||
Revision 1.2 2002/08/18 09:02:12 florian
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -319,7 +319,10 @@ implementation
|
||||
else
|
||||
t := cpointerconstnode.create(lv+rv,left.resulttype);
|
||||
subn :
|
||||
if (lt <> pointerconstn) or (rt = pointerconstn) then
|
||||
if (lt=pointerconstn) and (rt=pointerconstn) and
|
||||
(tpointerdef(rd).pointertype.def.size>1) then
|
||||
t := genintconstnode((lv-rv) div tpointerdef(left.resulttype.def).pointertype.def.size)
|
||||
else if (lt <> pointerconstn) or (rt = pointerconstn) then
|
||||
t := genintconstnode(lv-rv)
|
||||
else
|
||||
t := cpointerconstnode.create(lv-rv,left.resulttype);
|
||||
@ -935,16 +938,24 @@ implementation
|
||||
subn:
|
||||
begin
|
||||
if (cs_extsyntax in aktmoduleswitches) then
|
||||
begin
|
||||
if is_voidpointer(right.resulttype.def) then
|
||||
inserttypeconv(right,left.resulttype)
|
||||
else if is_voidpointer(left.resulttype.def) then
|
||||
inserttypeconv(left,right.resulttype)
|
||||
else if not(equal_defs(ld,rd)) then
|
||||
IncompatibleTypes(ld,rd);
|
||||
end
|
||||
begin
|
||||
if is_voidpointer(right.resulttype.def) then
|
||||
inserttypeconv(right,left.resulttype)
|
||||
else if is_voidpointer(left.resulttype.def) then
|
||||
inserttypeconv(left,right.resulttype)
|
||||
else if not(equal_defs(ld,rd)) then
|
||||
IncompatibleTypes(ld,rd);
|
||||
end
|
||||
else
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
|
||||
if not(nf_has_pointerdiv in flags) and
|
||||
(tpointerdef(rd).pointertype.def.size>1) then
|
||||
begin
|
||||
hp:=getcopy;
|
||||
include(hp.flags,nf_has_pointerdiv);
|
||||
result:=cmoddivnode.create(divn,hp,cordconstnode.create(tpointerdef(rd).pointertype.def.size,sinttype,false));
|
||||
end;
|
||||
resulttype:=sinttype;
|
||||
exit;
|
||||
end;
|
||||
@ -953,14 +964,14 @@ implementation
|
||||
if (cs_extsyntax in aktmoduleswitches) then
|
||||
begin
|
||||
if is_voidpointer(right.resulttype.def) then
|
||||
inserttypeconv(right,left.resulttype)
|
||||
inserttypeconv(right,left.resulttype)
|
||||
else if is_voidpointer(left.resulttype.def) then
|
||||
inserttypeconv(left,right.resulttype)
|
||||
inserttypeconv(left,right.resulttype)
|
||||
else if not(equal_defs(ld,rd)) then
|
||||
IncompatibleTypes(ld,rd);
|
||||
IncompatibleTypes(ld,rd);
|
||||
end
|
||||
else
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
resulttype:=sinttype;
|
||||
exit;
|
||||
end;
|
||||
@ -1155,26 +1166,26 @@ implementation
|
||||
end
|
||||
|
||||
else if (ld.deftype=pointerdef) or is_zero_based_array(ld) then
|
||||
begin
|
||||
if is_zero_based_array(ld) then
|
||||
begin
|
||||
resulttype.setdef(tpointerdef.create(tarraydef(ld).elementtype));
|
||||
inserttypeconv(left,resulttype);
|
||||
end;
|
||||
inserttypeconv(right,sinttype);
|
||||
if nodetype in [addn,subn] then
|
||||
begin
|
||||
if not(cs_extsyntax in aktmoduleswitches) or
|
||||
(not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
if (ld.deftype=pointerdef) and
|
||||
(tpointerdef(ld).pointertype.def.size>1) then
|
||||
right:=caddnode.create(muln,right,
|
||||
cordconstnode.create(tpointerdef(ld).pointertype.def.size,sinttype,true));
|
||||
end
|
||||
else
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
end
|
||||
begin
|
||||
if is_zero_based_array(ld) then
|
||||
begin
|
||||
resulttype.setdef(tpointerdef.create(tarraydef(ld).elementtype));
|
||||
inserttypeconv(left,resulttype);
|
||||
end;
|
||||
inserttypeconv(right,sinttype);
|
||||
if nodetype in [addn,subn] then
|
||||
begin
|
||||
if not(cs_extsyntax in aktmoduleswitches) or
|
||||
(not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
if (ld.deftype=pointerdef) and
|
||||
(tpointerdef(ld).pointertype.def.size>1) then
|
||||
right:=caddnode.create(muln,right,
|
||||
cordconstnode.create(tpointerdef(ld).pointertype.def.size,sinttype,true));
|
||||
end
|
||||
else
|
||||
CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
|
||||
end
|
||||
|
||||
else if (rd.deftype=procvardef) and
|
||||
(ld.deftype=procvardef) and
|
||||
@ -1937,7 +1948,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.118 2004-05-19 23:29:26 peter
|
||||
Revision 1.119 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.118 2004/05/19 23:29:26 peter
|
||||
* don't change sign for unsigned shl/shr operations
|
||||
* cleanup for u32bit
|
||||
|
||||
|
@ -229,6 +229,7 @@ interface
|
||||
|
||||
{ taddnode }
|
||||
nf_is_currency,
|
||||
nf_has_pointerdiv,
|
||||
|
||||
{ tassignmentnode }
|
||||
nf_concat_string,
|
||||
@ -1087,7 +1088,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.81 2004-02-03 22:32:54 peter
|
||||
Revision 1.82 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.81 2004/02/03 22:32:54 peter
|
||||
* renamed xNNbittype to xNNinttype
|
||||
* renamed registers32 to registersint
|
||||
* replace some s32bit,u32bit with torddef([su]inttype).def.typ
|
||||
|
@ -33,7 +33,7 @@ interface
|
||||
symdef,procinfo;
|
||||
|
||||
type
|
||||
tcgprocinfo=class(tprocinfo)
|
||||
tcgprocinfo = class(tprocinfo)
|
||||
{ code for the subroutine as tree }
|
||||
code : tnode;
|
||||
{ positions in the tree for init/final }
|
||||
@ -1345,7 +1345,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.189 2004-05-19 22:25:56 jonas
|
||||
Revision 1.190 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.189 2004/05/19 22:25:56 jonas
|
||||
* fixed web bug 3104: if stack checking is on, procedures pi_do_call
|
||||
must be set
|
||||
|
||||
|
@ -71,6 +71,7 @@ interface
|
||||
,asmmode_arm_gas
|
||||
,asmmode_sparc_gas
|
||||
,asmmode_x86_64_gas
|
||||
,asmmode_m68k_mot
|
||||
);
|
||||
|
||||
(* IMPORTANT NOTE:
|
||||
@ -694,7 +695,11 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.87 2004-03-20 22:57:42 florian
|
||||
Revision 1.88 2004-05-20 21:54:33 florian
|
||||
+ <pointer> - <pointer> result is divided by the pointer element size now
|
||||
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
|
||||
|
||||
Revision 1.87 2004/03/20 22:57:42 florian
|
||||
+ cpu2str added
|
||||
|
||||
Revision 1.86 2004/02/22 16:51:50 peter
|
||||
|
Loading…
Reference in New Issue
Block a user