mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-09 10:19:33 +01:00
* string type st_ fixed
This commit is contained in:
parent
6396267185
commit
9050cab930
@ -38,7 +38,7 @@ unit cg68k;
|
|||||||
interface
|
interface
|
||||||
{***************************************************************************}
|
{***************************************************************************}
|
||||||
|
|
||||||
uses objects,verbose,cobjects,systems,globals,tree,
|
uses objects,verbose,cobjects,comphook,systems,globals,tree,
|
||||||
symtable,types,strings,pass_1,hcodegen,temp_gen,
|
symtable,types,strings,pass_1,hcodegen,temp_gen,
|
||||||
aasm,m68k,tgen68k,files,cga68k,cg68k2,link
|
aasm,m68k,tgen68k,files,cga68k,cg68k2,link
|
||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
@ -752,7 +752,7 @@ implementation
|
|||||||
{ move to FPU }
|
{ move to FPU }
|
||||||
floatload(pfloatdef(p^.left^.resulttype)^.typ,
|
floatload(pfloatdef(p^.left^.resulttype)^.typ,
|
||||||
p^.left^.location.reference,p^.location);
|
p^.left^.location.reference,p^.location);
|
||||||
if (cs_fp_emulation) in aktswitches then
|
if (cs_fp_emulation) in aktmoduleswitches then
|
||||||
{ if in emulation mode change sign manually }
|
{ if in emulation mode change sign manually }
|
||||||
exprasmlist^.concat(new(pai68k,op_const_reg(A_BCHG,S_L,31,
|
exprasmlist^.concat(new(pai68k,op_const_reg(A_BCHG,S_L,31,
|
||||||
p^.location.fpureg)))
|
p^.location.fpureg)))
|
||||||
@ -772,7 +772,7 @@ implementation
|
|||||||
LOC_FPU : begin
|
LOC_FPU : begin
|
||||||
p^.location.loc:=LOC_FPU;
|
p^.location.loc:=LOC_FPU;
|
||||||
p^.location.fpureg := p^.left^.location.fpureg;
|
p^.location.fpureg := p^.left^.location.fpureg;
|
||||||
if (cs_fp_emulation) in aktswitches then
|
if (cs_fp_emulation) in aktmoduleswitches then
|
||||||
exprasmlist^.concat(new(pai68k,op_const_reg(A_BCHG,S_L,31,p^.location.fpureg)))
|
exprasmlist^.concat(new(pai68k,op_const_reg(A_BCHG,S_L,31,p^.location.fpureg)))
|
||||||
else
|
else
|
||||||
exprasmlist^.concat(new(pai68k,op_reg(A_FNEG,S_FX,p^.location.fpureg)));
|
exprasmlist^.concat(new(pai68k,op_reg(A_FNEG,S_FX,p^.location.fpureg)));
|
||||||
@ -1259,7 +1259,7 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ quick hack, to overcome Delphi 2 }
|
{ quick hack, to overcome Delphi 2 }
|
||||||
if (cs_maxoptimieren in aktswitches) and
|
if (cs_maxoptimize in aktglobalswitches) and
|
||||||
(p^.left^.resulttype^.deftype=arraydef) then
|
(p^.left^.resulttype^.deftype=arraydef) then
|
||||||
begin
|
begin
|
||||||
extraoffset:=0;
|
extraoffset:=0;
|
||||||
@ -1359,7 +1359,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ produce possible range check code: }
|
{ produce possible range check code: }
|
||||||
if cs_rangechecking in aktswitches then
|
if cs_check_range in aktlocalswitches then
|
||||||
begin
|
begin
|
||||||
if p^.left^.resulttype^.deftype=arraydef then
|
if p^.left^.resulttype^.deftype=arraydef then
|
||||||
begin
|
begin
|
||||||
@ -1469,9 +1469,9 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
{ range checking is different for u32bit }
|
{ range checking is different for u32bit }
|
||||||
{ lets try to generate it allways }
|
{ lets try to generate it allways }
|
||||||
if (cs_rangechecking in aktswitches) and
|
if (cs_check_range in aktlocalswitches) and
|
||||||
{ with $R+ explicit type conversations in TP aren't range checked! }
|
{ with $R+ explicit type conversations in TP aren't range checked! }
|
||||||
(not(p^.explizit) or not(cs_tp_compatible in aktswitches)) and
|
(not(p^.explizit) or not(cs_tp_compatible in aktmoduleswitches)) and
|
||||||
((porddef(p1)^.low>porddef(p2)^.low) or
|
((porddef(p1)^.low>porddef(p2)^.low) or
|
||||||
(porddef(p1)^.high<porddef(p2)^.high) or
|
(porddef(p1)^.high<porddef(p2)^.high) or
|
||||||
(porddef(p1)^.typ=u32bit) or
|
(porddef(p1)^.typ=u32bit) or
|
||||||
@ -1978,7 +1978,7 @@ implementation
|
|||||||
+ else}
|
+ else}
|
||||||
p^.location.loc := LOC_FPU;
|
p^.location.loc := LOC_FPU;
|
||||||
{ get floating point register. }
|
{ get floating point register. }
|
||||||
if (cs_fp_emulation in aktswitches) then
|
if (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
p^.location.fpureg := getregister32;
|
p^.location.fpureg := getregister32;
|
||||||
exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE, S_L, r, R_D0)));
|
exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE, S_L, r, R_D0)));
|
||||||
@ -2011,7 +2011,7 @@ implementation
|
|||||||
{ instead of allocating reserved registers. }
|
{ instead of allocating reserved registers. }
|
||||||
if (p^.left^.location.loc<>LOC_FPU) then
|
if (p^.left^.location.loc<>LOC_FPU) then
|
||||||
begin
|
begin
|
||||||
if (cs_fp_emulation in aktswitches) then
|
if (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),R_D0)));
|
exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),R_D0)));
|
||||||
exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,65536,R_D1)));
|
exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,65536,R_D1)));
|
||||||
@ -2027,7 +2027,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if (cs_fp_emulation in aktswitches) then
|
if (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
|
exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
|
||||||
exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,65536,R_D1)));
|
exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,65536,R_D1)));
|
||||||
@ -2182,7 +2182,7 @@ implementation
|
|||||||
reset_reference(r);
|
reset_reference(r);
|
||||||
r.base:=R_SP;
|
r.base:=R_SP;
|
||||||
|
|
||||||
if (cs_fp_emulation in aktswitches) then
|
if (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
p^.location.loc:=LOC_FPU;
|
p^.location.loc:=LOC_FPU;
|
||||||
p^.location.fpureg := getregister32;
|
p^.location.fpureg := getregister32;
|
||||||
@ -2275,8 +2275,8 @@ implementation
|
|||||||
((porddef(p^.resulttype)^.low>porddef(hp^.resulttype)^.low) or
|
((porddef(p^.resulttype)^.low>porddef(hp^.resulttype)^.low) or
|
||||||
(porddef(p^.resulttype)^.high<porddef(hp^.resulttype)^.high)) then
|
(porddef(p^.resulttype)^.high<porddef(hp^.resulttype)^.high)) then
|
||||||
begin
|
begin
|
||||||
if (cs_rangechecking in aktswitches) and
|
if (cs_check_range in aktlocalswitches) and
|
||||||
(not(p^.explizit) or not(cs_tp_compatible in aktswitches)) then
|
(not(p^.explizit) or not(cs_tp_compatible in aktmoduleswitches)) then
|
||||||
porddef(p^.resulttype)^.genrangecheck;
|
porddef(p^.resulttype)^.genrangecheck;
|
||||||
if porddef(hp^.resulttype)^.typ=s32bit then
|
if porddef(hp^.resulttype)^.typ=s32bit then
|
||||||
begin
|
begin
|
||||||
@ -2316,8 +2316,8 @@ implementation
|
|||||||
end
|
end
|
||||||
else internalerror(6);
|
else internalerror(6);
|
||||||
|
|
||||||
if (cs_rangechecking in aktswitches) and
|
if (cs_check_range in aktlocalswitches) and
|
||||||
(not(p^.explizit) or not(cs_tp_compatible in aktswitches)) then
|
(not(p^.explizit) or not(cs_tp_compatible in aktmoduleswitches)) then
|
||||||
Begin
|
Begin
|
||||||
new(hpp);
|
new(hpp);
|
||||||
reset_reference(hpp^);
|
reset_reference(hpp^);
|
||||||
@ -2702,7 +2702,7 @@ implementation
|
|||||||
reset_reference(r^);
|
reset_reference(r^);
|
||||||
r^.base:=R_SP;
|
r^.base:=R_SP;
|
||||||
s:=getfloatsize(pfloatdef(p^.left^.resulttype)^.typ);
|
s:=getfloatsize(pfloatdef(p^.left^.resulttype)^.typ);
|
||||||
if (cs_fp_emulation in aktswitches) or (s=S_FS) then
|
if (cs_fp_emulation in aktmoduleswitches) or (s=S_FS) then
|
||||||
begin
|
begin
|
||||||
{ when in emulation mode... }
|
{ when in emulation mode... }
|
||||||
{ only single supported!!! }
|
{ only single supported!!! }
|
||||||
@ -2930,7 +2930,7 @@ implementation
|
|||||||
((p^.procdefinition^.options and povirtualmethod)=0) then
|
((p^.procdefinition^.options and povirtualmethod)=0) then
|
||||||
begin
|
begin
|
||||||
if ((p^.procdefinition^.options and poiocheck)<>0)
|
if ((p^.procdefinition^.options and poiocheck)<>0)
|
||||||
and (cs_iocheck in aktswitches) then
|
and (cs_check_io in aktlocalswitches) then
|
||||||
begin
|
begin
|
||||||
getlabel(iolabel);
|
getlabel(iolabel);
|
||||||
emitl(A_LABEL,iolabel);
|
emitl(A_LABEL,iolabel);
|
||||||
@ -3302,7 +3302,7 @@ implementation
|
|||||||
if p^.procdefinition^.extnumber=-1 then
|
if p^.procdefinition^.extnumber=-1 then
|
||||||
internalerror($Da);
|
internalerror($Da);
|
||||||
r^.offset:=p^.procdefinition^.extnumber*4+12;
|
r^.offset:=p^.procdefinition^.extnumber*4+12;
|
||||||
if (cs_rangechecking in aktswitches) then
|
if (cs_check_range in aktlocalswitches) then
|
||||||
begin
|
begin
|
||||||
{ If the base is already A0, the no instruction will }
|
{ If the base is already A0, the no instruction will }
|
||||||
{ be emitted! }
|
{ be emitted! }
|
||||||
@ -3462,7 +3462,7 @@ implementation
|
|||||||
p^.location.fpureg:=hregister;
|
p^.location.fpureg:=hregister;
|
||||||
end;
|
end;
|
||||||
s64bit,s64real,s80real: begin
|
s64bit,s64real,s80real: begin
|
||||||
if cs_fp_emulation in aktswitches then
|
if cs_fp_emulation in aktmoduleswitches then
|
||||||
begin
|
begin
|
||||||
p^.location.loc:=LOC_FPU;
|
p^.location.loc:=LOC_FPU;
|
||||||
hregister:=getregister32;
|
hregister:=getregister32;
|
||||||
@ -3593,7 +3593,7 @@ implementation
|
|||||||
new(r);
|
new(r);
|
||||||
reset_reference(r^);
|
reset_reference(r^);
|
||||||
r^.symbol:=stringdup('U_'+upper(target_info.system_unit)+io[byte(doread)]);
|
r^.symbol:=stringdup('U_'+upper(target_info.system_unit)+io[byte(doread)]);
|
||||||
if not (cs_compilesystem in aktswitches) then
|
if not (cs_compilesystem in aktmoduleswitches) then
|
||||||
concat_external(r^.symbol^,EXT_NEAR);
|
concat_external(r^.symbol^,EXT_NEAR);
|
||||||
|
|
||||||
exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,r,R_A0)))
|
exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,r,R_A0)))
|
||||||
@ -3609,7 +3609,7 @@ implementation
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{ I/O check }
|
{ I/O check }
|
||||||
if cs_iocheck in aktswitches then
|
if cs_check_io in aktlocalswitches then
|
||||||
begin
|
begin
|
||||||
getlabel(iolabel);
|
getlabel(iolabel);
|
||||||
emitl(A_LABEL,iolabel);
|
emitl(A_LABEL,iolabel);
|
||||||
@ -3782,18 +3782,18 @@ implementation
|
|||||||
{ push maximum string length }
|
{ push maximum string length }
|
||||||
push_int(pstringdef(pararesult)^.len);
|
push_int(pstringdef(pararesult)^.len);
|
||||||
case pstringdef(pararesult)^.string_typ of
|
case pstringdef(pararesult)^.string_typ of
|
||||||
shortstring: emitcall ('READ_TEXT_STRING',true);
|
st_shortstring: emitcall ('READ_TEXT_STRING',true);
|
||||||
ansistring : emitcall ('READ_TEXT_ANSISTRING',true);
|
st_ansistring : emitcall ('READ_TEXT_ANSISTRING',true);
|
||||||
longstring : emitcall ('READ_TEXT_LONGSTRING',true);
|
st_longstring : emitcall ('READ_TEXT_LONGSTRING',true);
|
||||||
widestring : emitcall ('READ_TEXT_ANSISTRING',true);
|
st_widestring : emitcall ('READ_TEXT_ANSISTRING',true);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Case pstringdef(Pararesult)^.string_typ of
|
Case pstringdef(Pararesult)^.string_typ of
|
||||||
shortstring: emitcall ('WRITE_TEXT_STRING',true);
|
st_shortstring: emitcall ('WRITE_TEXT_STRING',true);
|
||||||
ansistring : emitcall ('WRITE_TEXT_ANSISTRING',true);
|
st_ansistring : emitcall ('WRITE_TEXT_ANSISTRING',true);
|
||||||
longstring : emitcall ('WRITE_TEXT_LONGSTRING',true);
|
st_longstring : emitcall ('WRITE_TEXT_LONGSTRING',true);
|
||||||
widestring : emitcall ('WRITE_TEXT_ANSISTRING',true);
|
st_widestring : emitcall ('WRITE_TEXT_ANSISTRING',true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
pointerdef : begin
|
pointerdef : begin
|
||||||
@ -4620,7 +4620,7 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ single values are in the floating point registers }
|
{ single values are in the floating point registers }
|
||||||
if cs_fp_emulation in aktswitches then
|
if cs_fp_emulation in aktmoduleswitches then
|
||||||
emit_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)
|
emit_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)
|
||||||
else
|
else
|
||||||
exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,S_FS,
|
exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,S_FS,
|
||||||
@ -4878,14 +4878,14 @@ do_jmp:
|
|||||||
hr^.base:=getaddressreg;
|
hr^.base:=getaddressreg;
|
||||||
emit_reg_reg(A_MOVE,S_L,hregister,hr^.base);
|
emit_reg_reg(A_MOVE,S_L,hregister,hr^.base);
|
||||||
exprasmlist^.concat(new(pai68k,op_ref(A_JMP,S_NO,hr)));
|
exprasmlist^.concat(new(pai68k,op_ref(A_JMP,S_NO,hr)));
|
||||||
{ if not(cs_littlesize in aktswitches^ ) then
|
{ if not(cs_littlesize in aktglobalswitches^ ) then
|
||||||
datasegment^.concat(new(pai68k,op_const(A_ALIGN,S_NO,4))); }
|
datasegment^.concat(new(pai68k,op_const(A_ALIGN,S_NO,4))); }
|
||||||
datasegment^.concat(new(pai_label,init(table)));
|
datasegment^.concat(new(pai_label,init(table)));
|
||||||
last:=min_;
|
last:=min_;
|
||||||
genitem(hp);
|
genitem(hp);
|
||||||
if hr^.base <> R_NO then ungetregister(hr^.base);
|
if hr^.base <> R_NO then ungetregister(hr^.base);
|
||||||
{ !!!!!!!
|
{ !!!!!!!
|
||||||
if not(cs_littlesize in aktswitches^ ) then
|
if not(cs_littlesize in aktglobalswitches^ ) then
|
||||||
exprasmlist^.concat(new(pai68k,op_const(A_ALIGN,S_NO,4)));
|
exprasmlist^.concat(new(pai68k,op_const(A_ALIGN,S_NO,4)));
|
||||||
}
|
}
|
||||||
end;
|
end;
|
||||||
@ -4929,7 +4929,7 @@ do_jmp:
|
|||||||
else internalerror(2002);
|
else internalerror(2002);
|
||||||
end;
|
end;
|
||||||
{ now generate the jumps }
|
{ now generate the jumps }
|
||||||
if cs_optimize in aktswitches then
|
if cs_optimize in aktglobalswitches then
|
||||||
begin
|
begin
|
||||||
{ procedures are empirically passed on }
|
{ procedures are empirically passed on }
|
||||||
{ consumption can also be calculated }
|
{ consumption can also be calculated }
|
||||||
@ -4946,7 +4946,7 @@ do_jmp:
|
|||||||
jumptable_no_range:=(lv=min_label) and (hv=max_label);
|
jumptable_no_range:=(lv=min_label) and (hv=max_label);
|
||||||
|
|
||||||
{ optimize for size ? }
|
{ optimize for size ? }
|
||||||
if cs_littlesize in aktswitches then
|
if cs_littlesize in aktglobalswitches then
|
||||||
begin
|
begin
|
||||||
if (labels<=2) or ((max_label-min_label)>3*labels) then
|
if (labels<=2) or ((max_label-min_label)>3*labels) then
|
||||||
{ a linear list is always smaller than a jump tree }
|
{ a linear list is always smaller than a jump tree }
|
||||||
@ -5035,6 +5035,47 @@ do_jmp:
|
|||||||
exprasmlist^.concat(new(pai_labeled,init(A_JMP,quickexitlabel)));
|
exprasmlist^.concat(new(pai_labeled,init(A_JMP,quickexitlabel)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure secondon(var p : ptree);
|
||||||
|
|
||||||
|
var
|
||||||
|
nextonlabel,myendexceptlabel : plabel;
|
||||||
|
ref : treference;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{ !!!!!!!!!!!!!!! }
|
||||||
|
(* getlabel(nextonlabel);
|
||||||
|
{ push the vmt }
|
||||||
|
exprasmlist^.concat(new(pai386,op_csymbol(A_PUSH,S_L,
|
||||||
|
newcsymbol(p^.excepttype^.vmt_mangledname,0))));
|
||||||
|
maybe_concat_external(p^.excepttype^.owner,
|
||||||
|
p^.excepttype^.vmt_mangledname);
|
||||||
|
|
||||||
|
emitcall('FPC_CATCHES',true);
|
||||||
|
exprasmlist^.concat(new(pai386,
|
||||||
|
op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
|
||||||
|
emitl(A_JE,nextonlabel);
|
||||||
|
ref.symbol:=nil;
|
||||||
|
gettempofsizereference(4,ref);
|
||||||
|
|
||||||
|
{ what a hack ! }
|
||||||
|
if assigned(p^.exceptsymtable) then
|
||||||
|
pvarsym(p^.exceptsymtable^.root)^.address:=ref.offset;
|
||||||
|
|
||||||
|
exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,
|
||||||
|
R_EAX,newreference(ref))));
|
||||||
|
|
||||||
|
if assigned(p^.right) then
|
||||||
|
secondpass(p^.right);
|
||||||
|
{ clear some stuff }
|
||||||
|
ungetiftemp(ref);
|
||||||
|
emitl(A_JMP,endexceptlabel);
|
||||||
|
emitl(A_LABEL,nextonlabel);
|
||||||
|
{ next on node }
|
||||||
|
if assigned(p^.left) then
|
||||||
|
secondpass(p^.left); *)
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure secondas(var p : ptree);
|
procedure secondas(var p : ptree);
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -5163,22 +5204,23 @@ end;
|
|||||||
secondstatement,secondnothing,secondifn,secondbreakn,
|
secondstatement,secondnothing,secondifn,secondbreakn,
|
||||||
secondcontinuen,second_while_repeatn,second_while_repeatn,secondfor,
|
secondcontinuen,second_while_repeatn,second_while_repeatn,secondfor,
|
||||||
secondexitn,secondwith,secondcase,secondlabel,
|
secondexitn,secondwith,secondcase,secondlabel,
|
||||||
secondgoto,secondsimplenewdispose,secondtryexcept,secondraise,
|
secondgoto,secondsimplenewdispose,secondtryexcept,
|
||||||
secondnothing,secondtryfinally,secondis,secondas,seconderror,
|
secondraise,
|
||||||
|
secondnothing,secondtryfinally,secondon,secondis,
|
||||||
|
secondas,seconderror,
|
||||||
secondfail,secondadd,secondprocinline,
|
secondfail,secondadd,secondprocinline,
|
||||||
secondnothing,secondloadvmt);
|
secondnothing,secondloadvmt);
|
||||||
var
|
var
|
||||||
oldcodegenerror : boolean;
|
oldcodegenerror : boolean;
|
||||||
oldswitches : Tcswitches;
|
oldlocalswitches : tlocalswitches;
|
||||||
oldpos : tfileposinfo;
|
oldpos : tfileposinfo;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
oldcodegenerror:=codegenerror;
|
oldcodegenerror:=codegenerror;
|
||||||
oldswitches:=aktswitches;
|
oldlocalswitches:=aktlocalswitches;
|
||||||
oldpos:=aktfilepos;
|
oldpos:=aktfilepos;
|
||||||
|
|
||||||
aktfilepos:=p^.fileinfo;
|
aktfilepos:=p^.fileinfo;
|
||||||
aktswitches:=p^.pragmas;
|
aktlocalswitches:=p^.localswitches;
|
||||||
if not(p^.error) then
|
if not(p^.error) then
|
||||||
begin
|
begin
|
||||||
codegenerror:=false;
|
codegenerror:=false;
|
||||||
@ -5188,13 +5230,13 @@ end;
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
codegenerror:=true;
|
codegenerror:=true;
|
||||||
aktswitches:=oldswitches;
|
|
||||||
|
aktlocalswitches:=oldlocalswitches;
|
||||||
aktfilepos:=oldpos;
|
aktfilepos:=oldpos;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function do_secondpass(var p : ptree) : boolean;
|
function do_secondpass(var p : ptree) : boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
codegenerror:=false;
|
codegenerror:=false;
|
||||||
if not(p^.error) then
|
if not(p^.error) then
|
||||||
@ -5202,6 +5244,7 @@ end;
|
|||||||
do_secondpass:=codegenerror;
|
do_secondpass:=codegenerror;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
regvars : array[1..maxvarregs] of pvarsym;
|
regvars : array[1..maxvarregs] of pvarsym;
|
||||||
regvars_para : array[1..maxvarregs] of boolean;
|
regvars_para : array[1..maxvarregs] of boolean;
|
||||||
@ -5231,7 +5274,7 @@ end;
|
|||||||
{ parameter get a less value }
|
{ parameter get a less value }
|
||||||
if parasym then
|
if parasym then
|
||||||
begin
|
begin
|
||||||
if cs_littlesize in aktswitches then
|
if cs_littlesize in aktglobalswitches then
|
||||||
dec(j,1)
|
dec(j,1)
|
||||||
else
|
else
|
||||||
dec(j,100);
|
dec(j,100);
|
||||||
@ -5266,7 +5309,7 @@ end;
|
|||||||
begin
|
begin
|
||||||
cleartempgen;
|
cleartempgen;
|
||||||
{ when size optimization only count occurrence }
|
{ when size optimization only count occurrence }
|
||||||
if cs_littlesize in aktswitches then
|
if cs_littlesize in aktglobalswitches then
|
||||||
t_times:=1
|
t_times:=1
|
||||||
else
|
else
|
||||||
{ reference for repetition is 100 }
|
{ reference for repetition is 100 }
|
||||||
@ -5284,7 +5327,7 @@ end;
|
|||||||
begin
|
begin
|
||||||
{ max. optimizations }
|
{ max. optimizations }
|
||||||
{ only if no asm is used }
|
{ only if no asm is used }
|
||||||
if (cs_maxoptimieren in aktswitches) and
|
if (cs_maxoptimize in aktglobalswitches) and
|
||||||
((procinfo.flags and pi_uses_asm)=0) then
|
((procinfo.flags and pi_uses_asm)=0) then
|
||||||
begin
|
begin
|
||||||
{ can we omit the stack frame ? }
|
{ can we omit the stack frame ? }
|
||||||
@ -5404,7 +5447,7 @@ end;
|
|||||||
{ dummy }
|
{ dummy }
|
||||||
regsize:=S_W;
|
regsize:=S_W;
|
||||||
end;
|
end;
|
||||||
if (verbosity and v_debug)=v_debug then
|
if (status.verbosity and v_debug)=v_debug then
|
||||||
begin
|
begin
|
||||||
for i:=1 to maxvarregs do
|
for i:=1 to maxvarregs do
|
||||||
begin
|
begin
|
||||||
@ -5432,7 +5475,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.12 1998-07-15 16:41:01 jonas
|
Revision 1.13 1998-08-10 14:43:14 peter
|
||||||
|
* string type st_ fixed
|
||||||
|
|
||||||
|
Revision 1.12 1998/07/15 16:41:01 jonas
|
||||||
* fixed bug that caused the stackframe never to be omitted
|
* fixed bug that caused the stackframe never to be omitted
|
||||||
|
|
||||||
Revision 1.11 1998/07/14 14:46:43 peter
|
Revision 1.11 1998/07/14 14:46:43 peter
|
||||||
|
|||||||
@ -746,7 +746,7 @@ Implementation
|
|||||||
{ fpu_reg = right(FP1) / fpu_reg }
|
{ fpu_reg = right(FP1) / fpu_reg }
|
||||||
{ fpu_reg = right(FP1) - fpu_reg }
|
{ fpu_reg = right(FP1) - fpu_reg }
|
||||||
begin
|
begin
|
||||||
if (cs_fp_emulation in aktswitches) then
|
if (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
{ fpu_reg = right / D1 }
|
{ fpu_reg = right / D1 }
|
||||||
{ fpu_reg = right - D1 }
|
{ fpu_reg = right - D1 }
|
||||||
@ -814,7 +814,7 @@ Implementation
|
|||||||
{ fpu_reg = fpu_reg / right }
|
{ fpu_reg = fpu_reg / right }
|
||||||
{ fpu_reg = fpu_reg - right }
|
{ fpu_reg = fpu_reg - right }
|
||||||
{ + commutative ops }
|
{ + commutative ops }
|
||||||
if cs_fp_emulation in aktswitches then
|
if cs_fp_emulation in aktmoduleswitches then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{ load value into D7 }
|
{ load value into D7 }
|
||||||
@ -1478,7 +1478,7 @@ Implementation
|
|||||||
too much comparisions. 8 comparisions are, however, still
|
too much comparisions. 8 comparisions are, however, still
|
||||||
smalller than emitting the set.}
|
smalller than emitting the set.}
|
||||||
maxcompares:=5;
|
maxcompares:=5;
|
||||||
if cs_littlesize in aktswitches then
|
if cs_littlesize in aktglobalswitches then
|
||||||
maxcompares:=8;
|
maxcompares:=8;
|
||||||
for i:=0 to 255 do
|
for i:=0 to 255 do
|
||||||
if i in byteset(Aset^) then
|
if i in byteset(Aset^) then
|
||||||
@ -1960,7 +1960,10 @@ Implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 1998-07-10 10:51:00 peter
|
Revision 1.7 1998-08-10 14:43:17 peter
|
||||||
|
* string type st_ fixed
|
||||||
|
|
||||||
|
Revision 1.6 1998/07/10 10:51:00 peter
|
||||||
* m68k updates
|
* m68k updates
|
||||||
|
|
||||||
Revision 1.5 1998/06/08 13:13:37 pierre
|
Revision 1.5 1998/06/08 13:13:37 pierre
|
||||||
|
|||||||
@ -312,7 +312,7 @@ unit cga68k;
|
|||||||
begin
|
begin
|
||||||
exprasmlist^.concat(new(pai68k,op_csymbol(A_JSR,S_NO,newcsymbol(routine,0))));
|
exprasmlist^.concat(new(pai68k,op_csymbol(A_JSR,S_NO,newcsymbol(routine,0))));
|
||||||
if add_to_externals and
|
if add_to_externals and
|
||||||
not (cs_compilesystem in aktswitches) then
|
not (cs_compilesystem in aktmoduleswitches) then
|
||||||
concat_external(routine,EXT_NEAR);
|
concat_external(routine,EXT_NEAR);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ unit cga68k;
|
|||||||
hl : plabel;
|
hl : plabel;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if cs_check_overflow in aktswitches then
|
if cs_check_overflow in aktlocalswitches then
|
||||||
begin
|
begin
|
||||||
getlabel(hl);
|
getlabel(hl);
|
||||||
if not ((p^.resulttype^.deftype=pointerdef) or
|
if not ((p^.resulttype^.deftype=pointerdef) or
|
||||||
@ -389,7 +389,7 @@ unit cga68k;
|
|||||||
R_D6, R_SPPUSH)));
|
R_D6, R_SPPUSH)));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not(cs_littlesize in aktswitches) and (l >= -128) and (l <= 127) then
|
if not(cs_littlesize in aktglobalswitches) and (l >= -128) and (l <= 127) then
|
||||||
begin
|
begin
|
||||||
exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVEQ,S_L,l,R_D6)));
|
exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVEQ,S_L,l,R_D6)));
|
||||||
exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D6,R_SPPUSH)));
|
exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D6,R_SPPUSH)));
|
||||||
@ -465,7 +465,7 @@ begin
|
|||||||
if (aktprocsym^.definition^.options and poproginit<>0) then
|
if (aktprocsym^.definition^.options and poproginit<>0) then
|
||||||
begin
|
begin
|
||||||
{Init the stack checking.}
|
{Init the stack checking.}
|
||||||
if (cs_check_stack in aktswitches) and
|
if (cs_check_stack in aktlocalswitches) and
|
||||||
(target_info.target=target_linux) then
|
(target_info.target=target_linux) then
|
||||||
begin
|
begin
|
||||||
procinfo.aktentrycode^.insert(new(pai68k,
|
procinfo.aktentrycode^.insert(new(pai68k,
|
||||||
@ -529,10 +529,10 @@ begin
|
|||||||
nostackframe:=false;
|
nostackframe:=false;
|
||||||
if stackframe<>0 then
|
if stackframe<>0 then
|
||||||
begin
|
begin
|
||||||
if cs_littlesize in aktswitches then
|
if cs_littlesize in aktglobalswitches then
|
||||||
begin
|
begin
|
||||||
if (cs_check_stack in aktswitches) and
|
if (cs_check_stack in aktlocalswitches) and
|
||||||
(target_info.target<>target_linux) then
|
(target_info.target<>target_linux) then
|
||||||
begin
|
begin
|
||||||
procinfo.aktentrycode^.insert(new(pai68k,
|
procinfo.aktentrycode^.insert(new(pai68k,
|
||||||
op_csymbol(A_JSR,S_NO,newcsymbol('STACKCHECK',0))));
|
op_csymbol(A_JSR,S_NO,newcsymbol('STACKCHECK',0))));
|
||||||
@ -554,7 +554,7 @@ begin
|
|||||||
if (stackframe > -32767) and (stackframe < 32769) then
|
if (stackframe > -32767) and (stackframe < 32769) then
|
||||||
begin
|
begin
|
||||||
procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_SUB,S_L,stackframe,R_SP)));
|
procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_SUB,S_L,stackframe,R_SP)));
|
||||||
if (cs_check_stack in aktswitches) then
|
if (cs_check_stack in aktlocalswitches) then
|
||||||
begin
|
begin
|
||||||
procinfo.aktentrycode^.insert(new(pai68k,
|
procinfo.aktentrycode^.insert(new(pai68k,
|
||||||
op_csymbol(A_JSR,S_NO,newcsymbol('STACKCHECK',0))));
|
op_csymbol(A_JSR,S_NO,newcsymbol('STACKCHECK',0))));
|
||||||
@ -588,7 +588,7 @@ begin
|
|||||||
hs:=proc_names.get;
|
hs:=proc_names.get;
|
||||||
|
|
||||||
{$IfDef GDB}
|
{$IfDef GDB}
|
||||||
if (cs_debuginfo in aktswitches) and target_os.use_function_relative_addresses then
|
if (cs_debuginfo in aktmoduleswitches) and target_os.use_function_relative_addresses then
|
||||||
stab_function_name := new(pai_stab_function_name,init(strpnew(hs)));
|
stab_function_name := new(pai_stab_function_name,init(strpnew(hs)));
|
||||||
oldaktprocname:=aktprocsym^.name;
|
oldaktprocname:=aktprocsym^.name;
|
||||||
{$EndIf GDB}
|
{$EndIf GDB}
|
||||||
@ -601,7 +601,7 @@ begin
|
|||||||
else
|
else
|
||||||
procinfo.aktentrycode^.insert(new(pai_symbol,init(hs)));
|
procinfo.aktentrycode^.insert(new(pai_symbol,init(hs)));
|
||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
if (cs_debuginfo in aktswitches) and
|
if (cs_debuginfo in aktmoduleswitches) and
|
||||||
target_os.use_function_relative_addresses then
|
target_os.use_function_relative_addresses then
|
||||||
begin
|
begin
|
||||||
procinfo.aktentrycode^.insert(new(pai_stab_function_name,init(strpnew(hs))));
|
procinfo.aktentrycode^.insert(new(pai_stab_function_name,init(strpnew(hs))));
|
||||||
@ -615,7 +615,7 @@ begin
|
|||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
aktprocsym^.setname(oldaktprocname);
|
aktprocsym^.setname(oldaktprocname);
|
||||||
|
|
||||||
if (cs_debuginfo in aktswitches) then
|
if (cs_debuginfo in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
if target_os.use_function_relative_addresses then
|
if target_os.use_function_relative_addresses then
|
||||||
procinfo.aktentrycode^.insert(stab_function_name);
|
procinfo.aktentrycode^.insert(stab_function_name);
|
||||||
@ -712,14 +712,14 @@ begin
|
|||||||
{ how the return value is handled }
|
{ how the return value is handled }
|
||||||
{ if in FPU mode, return in FP0 }
|
{ if in FPU mode, return in FP0 }
|
||||||
if (pfloatdef(procinfo.retdef)^.typ = s32real)
|
if (pfloatdef(procinfo.retdef)^.typ = s32real)
|
||||||
and (cs_fp_emulation in aktswitches) then
|
and (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,
|
procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,
|
||||||
S_L,hr,R_D0)))
|
S_L,hr,R_D0)))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if cs_fp_emulation in aktswitches then
|
if cs_fp_emulation in aktmoduleswitches then
|
||||||
procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,
|
procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,
|
||||||
S_L,hr,R_D0)))
|
S_L,hr,R_D0)))
|
||||||
else
|
else
|
||||||
@ -787,7 +787,7 @@ begin
|
|||||||
A_RTS,S_NO)))
|
A_RTS,S_NO)))
|
||||||
end;
|
end;
|
||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
if cs_debuginfo in aktswitches then
|
if cs_debuginfo in aktmoduleswitches then
|
||||||
begin
|
begin
|
||||||
aktprocsym^.concatstabto(procinfo.aktexitcode);
|
aktprocsym^.concatstabto(procinfo.aktexitcode);
|
||||||
if assigned(procinfo._class) then
|
if assigned(procinfo._class) then
|
||||||
@ -831,7 +831,7 @@ end;
|
|||||||
del_reference(source);
|
del_reference(source);
|
||||||
|
|
||||||
{ from 12 bytes movs is being used }
|
{ from 12 bytes movs is being used }
|
||||||
if (size<=8) or (not(cs_littlesize in aktswitches) and (size<=12)) then
|
if (size<=8) or (not(cs_littlesize in aktglobalswitches) and (size<=12)) then
|
||||||
begin
|
begin
|
||||||
helpsize:=size div 4;
|
helpsize:=size div 4;
|
||||||
{ move a dword x times }
|
{ move a dword x times }
|
||||||
@ -1086,7 +1086,7 @@ end;
|
|||||||
end;
|
end;
|
||||||
end; { end case }
|
end; { end case }
|
||||||
location.loc := LOC_FPU;
|
location.loc := LOC_FPU;
|
||||||
if not ((cs_fp_emulation) in aktswitches) then
|
if not ((cs_fp_emulation) in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
location.fpureg := getfloatreg;
|
location.fpureg := getfloatreg;
|
||||||
exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,s,newreference(ref),location.fpureg)))
|
exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,s,newreference(ref),location.fpureg)))
|
||||||
@ -1152,7 +1152,7 @@ end;
|
|||||||
Message(cg_f_unknown_float_type);
|
Message(cg_f_unknown_float_type);
|
||||||
end;
|
end;
|
||||||
end; { end case }
|
end; { end case }
|
||||||
if not ((cs_fp_emulation) in aktswitches) then
|
if not ((cs_fp_emulation) in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
exprasmlist^.concat(new(pai68k,op_reg_ref(A_FMOVE,s,location.fpureg,newreference(ref))));
|
exprasmlist^.concat(new(pai68k,op_reg_ref(A_FMOVE,s,location.fpureg,newreference(ref))));
|
||||||
ungetregister(location.fpureg);
|
ungetregister(location.fpureg);
|
||||||
@ -1220,7 +1220,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 1998-07-10 10:51:01 peter
|
Revision 1.8 1998-08-10 14:43:16 peter
|
||||||
|
* string type st_ fixed
|
||||||
|
|
||||||
|
Revision 1.7 1998/07/10 10:51:01 peter
|
||||||
* m68k updates
|
* m68k updates
|
||||||
|
|
||||||
Revision 1.6 1998/06/08 13:13:39 pierre
|
Revision 1.6 1998/06/08 13:13:39 pierre
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user