mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-07 12:00:36 +01:00
* some errors fix to get more stuff compilable
This commit is contained in:
parent
1045eb6419
commit
426905c464
@ -53,12 +53,15 @@ interface
|
||||
destructor destroy;override;
|
||||
function pass_1 : tnode;override;
|
||||
procedure gen_high_tree(openstring:boolean);
|
||||
{ tcallparanode doesn't use pass_1 }
|
||||
{ tcallnode takes care of this }
|
||||
procedure firstcallparan(defcoll : pparaitem;do_count : boolean);virtual;
|
||||
end;
|
||||
|
||||
tprocinlinenode = class(tnode)
|
||||
inlinetree : tnode;
|
||||
inlineprocsym : pprocsym;
|
||||
retoffset,para_offset,para_size : longint
|
||||
retoffset,para_offset,para_size : longint;
|
||||
function pass_1 : tnode;override;
|
||||
end;
|
||||
|
||||
@ -74,6 +77,25 @@ interface
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
cutils,globtype,systems,
|
||||
cobjects,verbose,globals,
|
||||
symconst,aasm,types,
|
||||
htypechk,pass_1,cpubase
|
||||
{$ifdef newcg}
|
||||
,cgbase
|
||||
,tgobj
|
||||
{$else newcg}
|
||||
,hcodegen
|
||||
{$ifdef i386}
|
||||
,tgeni386
|
||||
{$endif}
|
||||
{$ifdef m68k}
|
||||
,tgen68k
|
||||
{$endif m68k}
|
||||
{$endif newcg}
|
||||
;
|
||||
|
||||
function gencallnode(v : pprocsym;st : psymtable) : tnode;
|
||||
|
||||
begin
|
||||
@ -92,7 +114,7 @@ interface
|
||||
p : tnode;
|
||||
|
||||
begin
|
||||
p:=create.cprocinlinenode(callp,code);
|
||||
p:=cprocinlinenode.create(callp,code);
|
||||
genprocinlinenode:=p;
|
||||
end;
|
||||
|
||||
@ -115,7 +137,7 @@ interface
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
procedure firstcallparan(var p : ptree;defcoll : pparaitem;do_count : boolean);
|
||||
procedure tcallparanode.firstcallparan(defcoll : pparaitem;do_count : boolean);
|
||||
var
|
||||
old_get_para_resulttype : boolean;
|
||||
old_array_constructor : boolean;
|
||||
@ -1434,7 +1456,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2000-09-24 20:17:44 florian
|
||||
Revision 1.5 2000-09-24 21:15:34 florian
|
||||
* some errors fix to get more stuff compilable
|
||||
|
||||
Revision 1.4 2000/09/24 20:17:44 florian
|
||||
* more conversion work done
|
||||
|
||||
Revision 1.3 2000/09/24 15:06:19 peter
|
||||
|
||||
@ -27,7 +27,7 @@ unit ncon;
|
||||
interface
|
||||
|
||||
uses
|
||||
node;
|
||||
globtype,node,aasm,cpuinfo,symconst;
|
||||
|
||||
type
|
||||
trealconstnode = class(tnode)
|
||||
@ -59,14 +59,14 @@ interface
|
||||
value_str : pchar;
|
||||
length : longint;
|
||||
lab_str : pasmlabel;
|
||||
stringtype : tstringtype
|
||||
stringtype : tstringtype;
|
||||
// !!!!!!! needs at least create, getcopy, destroy
|
||||
function pass_1 : tnode;override;
|
||||
end;
|
||||
|
||||
tsetconstnode = class(tnode)
|
||||
value_set : pconstset;
|
||||
lab_set : pasmlabel
|
||||
lab_set : pasmlabel;
|
||||
// !!!!!!! needs at least create, getcopy
|
||||
function pass_1 : tnode;override;
|
||||
end;
|
||||
@ -80,15 +80,16 @@ implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,systems,
|
||||
symconst,symtable,aasm,types,
|
||||
symtable,types,
|
||||
hcodegen,pass_1,cpubase;
|
||||
|
||||
{*****************************************************************************
|
||||
TREALCONSTNODE
|
||||
*****************************************************************************}
|
||||
|
||||
function tpointerconstnode.pass_1 : tnode;
|
||||
function trealconstnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
if (value_real=1.0) or (value_real=0.0) then
|
||||
begin
|
||||
location.loc:=LOC_FPU;
|
||||
@ -103,8 +104,9 @@ implementation
|
||||
TFIXCONSTNODE
|
||||
*****************************************************************************}
|
||||
|
||||
function tpointerconstnode.pass_1 : tnode;
|
||||
function tfixconstnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
location.loc:=LOC_MEM;
|
||||
end;
|
||||
|
||||
@ -113,8 +115,9 @@ implementation
|
||||
TORDCONSTNODE
|
||||
*****************************************************************************}
|
||||
|
||||
function tpointerconstnode.pass_1 : tnode;
|
||||
function tordconstnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
location.loc:=LOC_MEM;
|
||||
end;
|
||||
|
||||
@ -125,6 +128,7 @@ implementation
|
||||
|
||||
function tpointerconstnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
location.loc:=LOC_MEM;
|
||||
end;
|
||||
|
||||
@ -135,6 +139,7 @@ implementation
|
||||
|
||||
function tstringconstnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
{ if cs_ansistrings in aktlocalswitches then
|
||||
resulttype:=cansistringdef
|
||||
else
|
||||
@ -159,6 +164,7 @@ implementation
|
||||
|
||||
function tsetconstnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
location.loc:=LOC_MEM;
|
||||
end;
|
||||
|
||||
@ -168,6 +174,7 @@ implementation
|
||||
|
||||
function tnilnode.pass_1 : tnode;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
resulttype:=voidpointerdef;
|
||||
location.loc:=LOC_MEM;
|
||||
end;
|
||||
@ -175,10 +182,13 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2000-09-24 15:06:19 peter
|
||||
Revision 1.3 2000-09-24 21:15:34 florian
|
||||
* some errors fix to get more stuff compilable
|
||||
|
||||
Revision 1.2 2000/09/24 15:06:19 peter
|
||||
* use defines.inc
|
||||
|
||||
Revision 1.1 2000/09/22 21:44:48 florian
|
||||
+ initial revision
|
||||
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ implementation
|
||||
uses
|
||||
globtype,systems,
|
||||
cutils,cobjects,verbose,globals,
|
||||
symconst,types,htypechk,pass_1
|
||||
symconst,types,htypechk,pass_1,ncon,nmem
|
||||
{$ifdef newcg}
|
||||
,tgobj
|
||||
,tgcpu
|
||||
@ -368,7 +368,7 @@ implementation
|
||||
if left.nodetype=ordconstn then
|
||||
begin
|
||||
{ optimize }
|
||||
if left.value=1 then
|
||||
if tordconstnode(left).value=1 then
|
||||
begin
|
||||
left.free;
|
||||
hp:=right;
|
||||
@ -388,7 +388,7 @@ implementation
|
||||
right.free;
|
||||
{ we cannot set p to nil !!! }
|
||||
if assigned(hp) then
|
||||
pass_1:=hp;
|
||||
pass_1:=hp
|
||||
else
|
||||
pass_1:=cnothingnode.create;
|
||||
end;
|
||||
@ -405,7 +405,7 @@ implementation
|
||||
constructor tfornode.create(l,r,_t1,_t2 : tnode;back : boolean);
|
||||
|
||||
begin
|
||||
inherited create(forn,l,r,_t1_,t2);
|
||||
inherited create(forn,l,r,_t1,_t2);
|
||||
if back then
|
||||
include(flags,nf_backward);
|
||||
end;
|
||||
@ -421,11 +421,15 @@ implementation
|
||||
old_t_times:=t_times;
|
||||
if not(cs_littlesize in aktglobalswitches) then
|
||||
t_times:=t_times*8;
|
||||
{ save counter var }
|
||||
t2:=left.left.getcopy;
|
||||
|
||||
if left.treetype<>assignn then
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
if left.nodetype<>assignn then
|
||||
begin
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
exit;
|
||||
end;
|
||||
{ save counter var }
|
||||
{ tbinarynode should be tassignnode! }
|
||||
t2:=tbinarynode(left).left.getcopy;
|
||||
|
||||
{$ifdef newcg}
|
||||
tg.cleartempgen;
|
||||
@ -433,7 +437,7 @@ implementation
|
||||
cleartempgen;
|
||||
{$endif newcg}
|
||||
firstpass(left);
|
||||
set_varstate(left,false);
|
||||
left.set_varstate(false);
|
||||
|
||||
{$ifdef newcg}
|
||||
tg.cleartempgen;
|
||||
@ -447,8 +451,8 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
|
||||
registers32:=t1^.registers32;
|
||||
registersfpu:=t1^.registersfpu;
|
||||
registers32:=t1.registers32;
|
||||
registersfpu:=t1.registersfpu;
|
||||
{$ifdef SUPPORT_MMX}
|
||||
registersmmx:=left.registersmmx;
|
||||
{$endif SUPPORT_MMX}
|
||||
@ -468,14 +472,14 @@ implementation
|
||||
cleartempgen;
|
||||
{$endif newcg}
|
||||
firstpass(t2);
|
||||
set_varstate(t2,true);
|
||||
t2.set_varstate(true);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
{ Check count var, record fields are also allowed in tp7 }
|
||||
hp:=t2;
|
||||
while (hp.treetype=subscriptn) do
|
||||
hp:=hp.left;
|
||||
while (hp.nodetype=subscriptn) do
|
||||
hp:=tsubscriptnode(hp).left;
|
||||
{ we need a simple loadn, but the load must be in a global symtable or
|
||||
in the same lexlevel }
|
||||
if (hp.treetype=funcretn) or
|
||||
@ -506,7 +510,7 @@ implementation
|
||||
cleartempgen;
|
||||
{$endif newcg}
|
||||
firstpass(right);
|
||||
set_varstate(right,true);
|
||||
right.set_varstate(true);
|
||||
if right.treetype<>ordconstn then
|
||||
begin
|
||||
right:=gentypeconvnode(right,t2^.resulttype);
|
||||
@ -639,7 +643,7 @@ implementation
|
||||
((left.resulttype^.deftype<>objectdef) or
|
||||
not(pobjectdef(left.resulttype)^.is_class)) then
|
||||
CGMessage(type_e_mismatch);
|
||||
set_varstate(left,true);
|
||||
left.set_varstate(left);
|
||||
if codegenerror then
|
||||
exit;
|
||||
{ insert needed typeconvs for addr,frame }
|
||||
@ -751,7 +755,7 @@ implementation
|
||||
aktexceptblock:=left;
|
||||
firstpass(left);
|
||||
aktexceptblock:=oldexceptblock;
|
||||
set_varstate(left,true);
|
||||
left.set_varstate(true);
|
||||
{$ifdef newcg}
|
||||
tg.cleartempgen;
|
||||
{$else newcg}
|
||||
@ -761,7 +765,7 @@ implementation
|
||||
aktexceptblock:=right;
|
||||
firstpass(right);
|
||||
aktexceptblock:=oldexceptblock;
|
||||
set_varstate(right,true);
|
||||
right.set_varstate(true);
|
||||
if codegenerror then
|
||||
exit;
|
||||
left_right_max(p);
|
||||
@ -842,10 +846,13 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2000-09-24 15:06:19 peter
|
||||
Revision 1.3 2000-09-24 21:15:34 florian
|
||||
* some errors fix to get more stuff compilable
|
||||
|
||||
Revision 1.2 2000/09/24 15:06:19 peter
|
||||
* use defines.inc
|
||||
|
||||
Revision 1.1 2000/09/22 22:46:03 florian
|
||||
+ initial revision
|
||||
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,6 @@
|
||||
{ this will be used mainly for the newcg }
|
||||
tnodeflags = (
|
||||
nf_needs_truefalselabel,
|
||||
nf_callunique,
|
||||
nf_swapable, { tbinop operands can be swaped }
|
||||
nf_swaped, { tbinop operands are swaped }
|
||||
nf_error,
|
||||
@ -187,7 +186,15 @@
|
||||
|
||||
{ flags used by loop nodes }
|
||||
nf_backward, { set if it is a for ... downto ... do loop }
|
||||
nf_varstate { do we need to parse childs to set var state }
|
||||
nf_varstate, { do we need to parse childs to set var state }
|
||||
|
||||
{ taddrnode }
|
||||
nf_procvarload,
|
||||
|
||||
{ tvecnode }
|
||||
nf_memindex,
|
||||
nf_memseg,
|
||||
nf_callunique
|
||||
);
|
||||
|
||||
tnodeflagset = set of tnodeflags;
|
||||
@ -303,7 +310,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2000-09-22 21:45:36 florian
|
||||
Revision 1.4 2000-09-24 21:15:34 florian
|
||||
* some errors fix to get more stuff compilable
|
||||
|
||||
Revision 1.3 2000/09/22 21:45:36 florian
|
||||
* some updates e.g. getcopy added
|
||||
|
||||
Revision 1.2 2000/09/20 21:52:38 florian
|
||||
|
||||
@ -425,7 +425,7 @@ implementation
|
||||
globtype,systems,
|
||||
cutils,cobjects,verbose,globals,
|
||||
aasm,symtable,types,
|
||||
htypechk,
|
||||
htypechk,nflw,
|
||||
cpubase,cpuasm
|
||||
{$ifdef newcg}
|
||||
,cgbase
|
||||
@ -538,12 +538,12 @@ implementation
|
||||
|
||||
function tblocknode.pass_1 : tnode;
|
||||
var
|
||||
hp : tnode;
|
||||
hp : tstatementnode;
|
||||
count : longint;
|
||||
begin
|
||||
pass_1:=nil;
|
||||
count:=0;
|
||||
hp:=left;
|
||||
hp:=tstatementnode(left);
|
||||
while assigned(hp) do
|
||||
begin
|
||||
if cs_regalloc in aktglobalswitches then
|
||||
@ -555,18 +555,19 @@ implementation
|
||||
result types !!! }
|
||||
if ret_in_acc(procinfo^.returntype.def) and
|
||||
assigned(hp.left) and
|
||||
assigned(hp.left.right) and
|
||||
(hp.left.right.treetype=exitn) and
|
||||
(hp.right.treetype=assignn) and
|
||||
(hp.right.left.treetype=funcretn) then
|
||||
assigned(tstatementnode(hp.left).right) and
|
||||
(tstatementnode(hp.left).right.nodetype=exitn) and
|
||||
(hp.right.nodetype=assignn) and
|
||||
{ !!!! this tbinarynode should be tassignmentnode }
|
||||
(tbinarynode(hp.right).left.nodetype=funcretn) then
|
||||
begin
|
||||
if assigned(hp.left.right.left) then
|
||||
if assigned(texitnode(tstatmentnode(hp.left).right).left) then
|
||||
CGMessage(cg_n_inefficient_code)
|
||||
else
|
||||
begin
|
||||
hp.left.right.left:=hp.right.right;
|
||||
hp.right.right:=nil;
|
||||
disposetree(hp.right);
|
||||
hp.right.free;
|
||||
hp.right:=nil;
|
||||
end;
|
||||
end
|
||||
@ -581,7 +582,7 @@ implementation
|
||||
begin
|
||||
{ use correct line number }
|
||||
aktfilepos:=hp.left.fileinfo;
|
||||
disposetree(hp.left);
|
||||
hp.left.free;
|
||||
hp.left:=nil;
|
||||
CGMessage(cg_w_unreachable_code);
|
||||
{ old lines }
|
||||
@ -675,7 +676,7 @@ implementation
|
||||
not_first:=false;
|
||||
{$endif extdebug}
|
||||
|
||||
if not nf_error in p.flags then
|
||||
if not(nf_error in p.flags) then
|
||||
begin
|
||||
codegenerror:=false;
|
||||
aktfilepos:=p.fileinfo;
|
||||
@ -733,7 +734,10 @@ end.
|
||||
{$endif cg11}
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2000-09-24 15:06:21 peter
|
||||
Revision 1.5 2000-09-24 21:15:34 florian
|
||||
* some errors fix to get more stuff compilable
|
||||
|
||||
Revision 1.4 2000/09/24 15:06:21 peter
|
||||
* use defines.inc
|
||||
|
||||
Revision 1.3 2000/09/19 23:09:07 pierre
|
||||
@ -742,4 +746,4 @@ end.
|
||||
Revision 1.2 2000/07/13 11:32:44 michael
|
||||
+ removed logs
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user