mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-06 07:27:35 +01:00
+ pass_2 for cg386
* Message() -> CGMessage() for pass_1/pass_2
This commit is contained in:
parent
7108da4331
commit
c72691c843
@ -31,9 +31,10 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,
|
||||
symtable,aasm,i386,types,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen;
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
Helpers
|
||||
@ -266,7 +267,7 @@ implementation
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
end;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
SetResultLocation(cmpop,true,p);
|
||||
end;
|
||||
@ -382,7 +383,7 @@ implementation
|
||||
p^.location.reference:=href;
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
SetResultLocation(cmpop,true,p);
|
||||
end;
|
||||
@ -493,7 +494,7 @@ implementation
|
||||
falselabel:=ofl;
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
secondpass(p^.right);
|
||||
maketojumpbool(p^.right);
|
||||
@ -511,7 +512,7 @@ implementation
|
||||
goto do_normal;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -637,7 +638,7 @@ implementation
|
||||
unsigned:=false;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
muln : begin
|
||||
if is_set then
|
||||
@ -679,7 +680,7 @@ implementation
|
||||
orn : op:=A_OR;
|
||||
andn : op:=A_AND;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
|
||||
{ left and right no register? }
|
||||
@ -904,7 +905,7 @@ implementation
|
||||
ltn,lten,gtn,gten,
|
||||
equaln,unequaln :
|
||||
cmpop:=true;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
unsigned:=true;
|
||||
{ left and right no register? }
|
||||
@ -989,7 +990,7 @@ implementation
|
||||
op:=A_FCOMPP;
|
||||
cmpop:=true;
|
||||
end;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
|
||||
if (p^.right^.location.loc<>LOC_FPU) then
|
||||
@ -1155,7 +1156,7 @@ implementation
|
||||
op:=A_POR;
|
||||
andn:
|
||||
op:=A_PAND;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
{ left and right no register? }
|
||||
{ then one must be demanded }
|
||||
@ -1268,7 +1269,7 @@ implementation
|
||||
end;
|
||||
end
|
||||
{$endif SUPPORT_MMX}
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
SetResultLocation(cmpop,unsigned,p);
|
||||
end;
|
||||
@ -1277,7 +1278,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 1998-09-14 10:43:44 peter
|
||||
Revision 1.13 1998-09-17 09:42:09 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.12 1998/09/14 10:43:44 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.11 1998/09/07 18:45:52 peter
|
||||
@ -1289,7 +1294,7 @@ end.
|
||||
we need an new version of STRCAT which takes a length parameter
|
||||
|
||||
Revision 1.9 1998/09/04 08:41:36 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.8 1998/08/28 10:54:18 peter
|
||||
* fixed smallset generation from elements, it has never worked before!
|
||||
|
||||
@ -36,10 +36,9 @@ implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,systems,
|
||||
aasm,i386,types,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen,
|
||||
cg386ld;
|
||||
|
||||
aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386,cg386ld;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondCallParaN
|
||||
@ -133,7 +132,7 @@ implementation
|
||||
else
|
||||
begin
|
||||
if not(p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
|
||||
Message(type_e_mismatch)
|
||||
CGMessage(type_e_mismatch)
|
||||
else
|
||||
begin
|
||||
if inlined then
|
||||
@ -153,7 +152,7 @@ implementation
|
||||
else if (defcoll^.paratyp=vs_var) then
|
||||
begin
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) then
|
||||
Message(cg_e_var_must_be_reference);
|
||||
CGMessage(cg_e_var_must_be_reference);
|
||||
maybe_push_open_array_high;
|
||||
inc(pushedparasize,4);
|
||||
if inlined then
|
||||
@ -171,7 +170,7 @@ implementation
|
||||
begin
|
||||
tempdeftype:=p^.resulttype^.deftype;
|
||||
if tempdeftype=filedef then
|
||||
Message(cg_e_file_must_call_by_reference);
|
||||
CGMessage(cg_e_file_must_call_by_reference);
|
||||
if (defcoll^.paratyp=vs_const) and
|
||||
dont_copy_const_param(p^.resulttype) then
|
||||
begin
|
||||
@ -463,7 +462,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
end;
|
||||
end;
|
||||
LOC_JUMP:
|
||||
@ -760,7 +759,7 @@ implementation
|
||||
{ direct call to inherited method }
|
||||
if (p^.procdefinition^.options and poabstractmethod)<>0 then
|
||||
begin
|
||||
Message(cg_e_cant_call_abstract_method);
|
||||
CGMessage(cg_e_cant_call_abstract_method);
|
||||
goto dont_call;
|
||||
end;
|
||||
{ generate no virtual call }
|
||||
@ -798,7 +797,7 @@ implementation
|
||||
if not ((aktprocsym^.definition^.options
|
||||
and (poconstructor or podestructor))<>0) then
|
||||
|
||||
Message(cg_w_member_cd_call_from_method);
|
||||
CGMessage(cg_w_member_cd_call_from_method);
|
||||
end;
|
||||
if is_con_or_destructor then
|
||||
push_int(0)
|
||||
@ -926,7 +925,7 @@ implementation
|
||||
{ always be placed wrong }
|
||||
if is_con_or_destructor then
|
||||
begin
|
||||
Message(cg_w_member_cd_call_from_method);
|
||||
CGMessage(cg_w_member_cd_call_from_method);
|
||||
push_int(0);
|
||||
end;
|
||||
end;
|
||||
@ -989,7 +988,7 @@ implementation
|
||||
Why? Bp7 Allows it (PFV)
|
||||
|
||||
if (p^.procdefinition^.options and poexports)<>0 then
|
||||
Message(cg_e_dont_call_exported_direct); }
|
||||
CGMessage(cg_e_dont_call_exported_direct); }
|
||||
|
||||
if (not inlined) and ((pushedparasize mod 4)<>0) then
|
||||
begin
|
||||
@ -1406,11 +1405,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 1998-09-14 10:43:45 peter
|
||||
Revision 1.24 1998-09-17 09:42:10 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.23 1998/09/14 10:43:45 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.22 1998/09/04 08:41:37 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.21 1998/09/01 12:47:57 peter
|
||||
* use pdef^.size instead of orddef^.typ
|
||||
|
||||
@ -37,9 +37,10 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,
|
||||
symtable,aasm,i386,types,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen;
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondTypeConv
|
||||
@ -614,7 +615,7 @@ implementation
|
||||
parraydef(p^.left^.resulttype)^.lowrange+1;
|
||||
|
||||
if l>255 then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
{ write the length }
|
||||
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_B,l,
|
||||
@ -1252,7 +1253,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.19 1998-09-14 10:43:46 peter
|
||||
Revision 1.20 1998-09-17 09:42:12 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.19 1998/09/14 10:43:46 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.18 1998/09/11 12:29:40 pierre
|
||||
@ -1262,7 +1267,7 @@ end.
|
||||
* removed explicit range_check was buggy
|
||||
|
||||
Revision 1.17 1998/09/04 08:41:38 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.16 1998/09/03 17:39:03 florian
|
||||
+ better code for type conversation longint/dword to real type
|
||||
|
||||
@ -40,9 +40,10 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,
|
||||
symtable,aasm,i386,types,
|
||||
hcodegen,cgai386,temp_gen,tgeni386,cgi386;
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondRealConst
|
||||
@ -316,7 +317,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.13 1998-09-07 18:45:53 peter
|
||||
Revision 1.14 1998-09-17 09:42:13 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.13 1998/09/07 18:45:53 peter
|
||||
* update smartlinking, uses getdatalabel
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
|
||||
@ -45,8 +45,9 @@ implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,i386,types,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen;
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
Second_While_RepeatN
|
||||
@ -193,7 +194,7 @@ implementation
|
||||
cleartempgen;
|
||||
secondpass(p^.t2);
|
||||
if not(simple_loadn) then
|
||||
Message(cg_e_illegal_count_var);
|
||||
CGMessage(cg_e_illegal_count_var);
|
||||
|
||||
{ produce start assignment }
|
||||
cleartempgen;
|
||||
@ -466,7 +467,7 @@ do_jmp:
|
||||
if aktbreaklabel<>nil then
|
||||
emitl(A_JMP,aktbreaklabel)
|
||||
else
|
||||
Message(cg_e_break_not_allowed);
|
||||
CGMessage(cg_e_break_not_allowed);
|
||||
end;
|
||||
|
||||
|
||||
@ -479,7 +480,7 @@ do_jmp:
|
||||
if aktcontinuelabel<>nil then
|
||||
emitl(A_JMP,aktcontinuelabel)
|
||||
else
|
||||
Message(cg_e_continue_not_allowed);
|
||||
CGMessage(cg_e_continue_not_allowed);
|
||||
end;
|
||||
|
||||
|
||||
@ -541,7 +542,7 @@ do_jmp:
|
||||
emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
|
||||
LOC_CREGISTER,LOC_REGISTER : exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,
|
||||
p^.left^.location.register)));
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
emitcall('FPC_RAISEEXCEPTION',true);
|
||||
end
|
||||
@ -733,11 +734,15 @@ do_jmp:
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 1998-09-14 10:43:48 peter
|
||||
Revision 1.17 1998-09-17 09:42:14 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.16 1998/09/14 10:43:48 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.15 1998/09/04 08:41:39 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.14 1998/09/03 17:08:39 pierre
|
||||
* better lines for stabs
|
||||
@ -753,25 +758,6 @@ end.
|
||||
|
||||
Revision 1.11 1998/08/05 16:00:10 florian
|
||||
* some fixes for ansi strings
|
||||
* $log$ to $Log$
|
||||
* $log$ to Revision 1.16 1998-09-14 10:43:48 peter
|
||||
* $log$ to * all internal RTL functions start with FPC_
|
||||
* $log$ to
|
||||
* $log$ to Revision 1.15 1998/09/04 08:41:39 peter
|
||||
* $log$ to * updated some error messages
|
||||
* $log$ to
|
||||
* $log$ to Revision 1.14 1998/09/03 17:08:39 pierre
|
||||
* $log$ to * better lines for stabs
|
||||
* $log$ to (no scroll back to if before else part
|
||||
* $log$ to no return to case line at jump outside case)
|
||||
* $log$ to + source lines also if not in order
|
||||
* $log$ to
|
||||
* $log$ to Revision 1.13 1998/09/01 12:47:58 peter
|
||||
* $log$ to * use pdef^.size instead of orddef^.typ
|
||||
* $log$ to
|
||||
* $log$ to Revision 1.12 1998/08/28 10:56:58 peter
|
||||
* $log$ to * removed warnings
|
||||
* $log$ to changed
|
||||
|
||||
Revision 1.10 1998/08/04 16:26:26 jonas
|
||||
* converted // comment to TP comment
|
||||
|
||||
@ -33,9 +33,9 @@ implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,systems,
|
||||
aasm,i386,types,symtable,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen,
|
||||
cg386ld,cg386cal;
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386,cg386ld,cg386cal;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
@ -160,7 +160,7 @@ implementation
|
||||
{ save reference in temporary variables }
|
||||
if node^.left^.location.loc<>LOC_REFERENCE then
|
||||
begin
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -199,7 +199,7 @@ implementation
|
||||
node:=node^.right;
|
||||
hp^.right:=nil;
|
||||
if hp^.is_colon_para then
|
||||
Message(parser_e_illegal_colon_qualifier);
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
if ft=ft_typed then
|
||||
never_copy_const_param:=true;
|
||||
secondcallparan(hp,@dummycoll,false,false,0);
|
||||
@ -263,7 +263,7 @@ implementation
|
||||
secondcallparan(hp,@dummycoll,false,false,0);
|
||||
hp^.right:=node;
|
||||
if pararesult^.deftype<>floatdef then
|
||||
Message(parser_e_illegal_colon_qualifier);
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
if codegenerror then
|
||||
exit;
|
||||
end
|
||||
@ -352,7 +352,7 @@ implementation
|
||||
bool8bit,
|
||||
bool16bit,
|
||||
bool32bit : if doread then
|
||||
Message(parser_e_illegal_parameter_list)
|
||||
CGMessage(parser_e_illegal_parameter_list)
|
||||
else
|
||||
emitcall('FPC_WRITE_TEXT_BOOLEAN',true);
|
||||
end;
|
||||
@ -399,7 +399,7 @@ implementation
|
||||
begin
|
||||
p^.left:=reversparameter(p^.left);
|
||||
if npara<>nb_para then
|
||||
Message(cg_f_internal_error_in_secondinline);
|
||||
CGMessage(cg_f_internal_error_in_secondinline);
|
||||
hp:=p^.left;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
@ -929,7 +929,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:43:49 peter
|
||||
Revision 1.5 1998-09-17 09:42:15 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:43:49 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/05 23:03:57 florian
|
||||
@ -940,7 +944,7 @@ end.
|
||||
const parameters only if they are passed by reference !
|
||||
|
||||
Revision 1.2 1998/09/04 08:41:40 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.1 1998/08/31 12:22:14 peter
|
||||
* secondinline moved to cg386inl
|
||||
|
||||
@ -45,9 +45,10 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,types,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen;
|
||||
hcodegen,temp_gen,pass_2,
|
||||
cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondLoad
|
||||
@ -292,7 +293,7 @@ implementation
|
||||
loc:=LOC_CMMXREGISTER;
|
||||
else
|
||||
begin
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -551,7 +552,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.14 1998-09-14 10:43:50 peter
|
||||
Revision 1.15 1998-09-17 09:42:16 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.14 1998/09/14 10:43:50 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.13 1998/09/04 12:24:24 florian
|
||||
|
||||
@ -35,9 +35,10 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,
|
||||
symtable,aasm,i386,
|
||||
types,cgi386,cgai386,tgeni386,hcodegen;
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondModDiv
|
||||
@ -558,7 +559,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1998-09-09 14:37:37 florian
|
||||
Revision 1.7 1998-09-17 09:42:17 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.6 1998/09/09 14:37:37 florian
|
||||
* mod/div for cardinal type fixed
|
||||
|
||||
Revision 1.5 1998/08/23 16:07:20 florian
|
||||
|
||||
@ -44,8 +44,9 @@ implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,i386,types,
|
||||
cgi386,cgai386,temp_gen,tgeni386,hcodegen;
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondLoadVMT
|
||||
@ -407,7 +408,7 @@ implementation
|
||||
begin
|
||||
if (p^.right^.value>parraydef(p^.left^.resulttype)^.highrange) or
|
||||
(p^.right^.value<parraydef(p^.left^.resulttype)^.lowrange) then
|
||||
Message(parser_e_range_check_error);
|
||||
CGMessage(parser_e_range_check_error);
|
||||
|
||||
dec(p^.left^.location.reference.offset,
|
||||
get_mul_size*parraydef(p^.left^.resulttype)^.lowrange);
|
||||
@ -478,7 +479,7 @@ implementation
|
||||
{ calculate from left to right }
|
||||
if (p^.location.loc<>LOC_REFERENCE) and
|
||||
(p^.location.loc<>LOC_MEM) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
pushed:=maybe_push(p^.right^.registers32,p);
|
||||
secondpass(p^.right);
|
||||
if pushed then restore(p);
|
||||
@ -643,7 +644,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 1998-09-14 10:43:52 peter
|
||||
Revision 1.11 1998-09-17 09:42:18 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.10 1998/09/14 10:43:52 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.9 1998/09/03 16:03:15 florian
|
||||
|
||||
@ -35,8 +35,9 @@ implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,globals,systems,
|
||||
symtable,aasm,i386,types,
|
||||
cgi386,cgai386,tgeni386,temp_gen,hcodegen;
|
||||
symtable,aasm,types,
|
||||
hcodegen,temp_gen,pass_2,
|
||||
i386,cgai386,tgeni386;
|
||||
|
||||
const
|
||||
bytes2Sxx:array[1..4] of Topsize=(S_B,S_W,S_NO,S_L);
|
||||
@ -783,7 +784,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 1998-09-14 10:43:53 peter
|
||||
Revision 1.17 1998-09-17 09:42:20 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.16 1998/09/14 10:43:53 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.15 1998/09/09 17:51:59 florian
|
||||
|
||||
@ -341,7 +341,7 @@ implementation
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
end; { end this case }
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end; { end case }
|
||||
|
||||
SetResultLocation(cmpop,true,p);
|
||||
@ -458,7 +458,7 @@ implementation
|
||||
p^.location.reference:=href;
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
SetResultLocation(cmpop,true,p);
|
||||
end;
|
||||
@ -567,7 +567,7 @@ implementation
|
||||
falselabel:=ofl;
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
secondpass(p^.right);
|
||||
maketojumpbool(p^.right);
|
||||
@ -585,7 +585,7 @@ implementation
|
||||
goto do_normal;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -691,7 +691,7 @@ implementation
|
||||
unsigned:=false;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
muln : begin
|
||||
if is_set then
|
||||
@ -733,7 +733,7 @@ implementation
|
||||
orn : op:=A_OR;
|
||||
andn : op:=A_AND;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
|
||||
{ left and right no register? }
|
||||
@ -863,7 +863,7 @@ implementation
|
||||
end
|
||||
else
|
||||
if (op=A_MULU) and (opsize = S_L) and (aktoptprocessor=MC68000) then
|
||||
Message(cg_f_32bit_not_supported_in_68000)
|
||||
CGMessage(cg_f_32bit_not_supported_in_68000)
|
||||
else
|
||||
emit_reg_reg(op,opsize,p^.right^.location.register,
|
||||
p^.location.register);
|
||||
@ -892,7 +892,7 @@ implementation
|
||||
end
|
||||
else
|
||||
if (op=A_MULU) and (opsize = S_L) and (aktoptprocessor=MC68000) then
|
||||
Message(cg_f_32bit_not_supported_in_68000)
|
||||
CGMessage(cg_f_32bit_not_supported_in_68000)
|
||||
else
|
||||
{ When one of the source/destination is a memory reference }
|
||||
{ and the operator is EOR, the we must load it into the }
|
||||
@ -946,7 +946,7 @@ implementation
|
||||
end
|
||||
else
|
||||
if (op=A_MULU) and (opsize = S_L) and (aktoptprocessor=MC68000) then
|
||||
Message(cg_f_32bit_not_supported_in_68000)
|
||||
CGMessage(cg_f_32bit_not_supported_in_68000)
|
||||
else
|
||||
|
||||
exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,
|
||||
@ -978,7 +978,7 @@ implementation
|
||||
ltn,lten,gtn,gten,
|
||||
equaln,unequaln :
|
||||
cmpop:=true;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
unsigned:=true;
|
||||
{ left and right no register? }
|
||||
@ -1063,7 +1063,7 @@ implementation
|
||||
op:=A_FCMP;
|
||||
cmpop:=true;
|
||||
end;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
|
||||
if (p^.left^.location.loc <> LOC_FPU) and
|
||||
@ -1254,7 +1254,7 @@ implementation
|
||||
end
|
||||
|
||||
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
SetResultLocation(cmpop,unsigned,p);
|
||||
end;
|
||||
@ -1263,7 +1263,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:43:54 peter
|
||||
Revision 1.5 1998-09-17 09:42:21 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:43:54 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/07 18:45:55 peter
|
||||
@ -1271,7 +1275,7 @@ end.
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
Revision 1.2 1998/09/04 08:41:42 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.1 1998/09/01 09:07:09 peter
|
||||
* m68k fixes, splitted cg68k like cgi386
|
||||
|
||||
@ -111,7 +111,7 @@ implementation
|
||||
begin
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) and
|
||||
(p^.left^.location.loc<>LOC_MEM) then
|
||||
Message(type_e_mismatch)
|
||||
CGMessage(type_e_mismatch)
|
||||
else
|
||||
begin
|
||||
emitpushreferenceaddr(p^.left^.location.reference);
|
||||
@ -124,7 +124,7 @@ implementation
|
||||
else if (defcoll^.paratyp=vs_var) then
|
||||
begin
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) then
|
||||
Message(cg_e_var_must_be_reference);
|
||||
CGMessage(cg_e_var_must_be_reference);
|
||||
maybe_push_open_array_high;
|
||||
inc(pushedparasize,4);
|
||||
emitpushreferenceaddr(p^.left^.location.reference);
|
||||
@ -134,7 +134,7 @@ implementation
|
||||
begin
|
||||
tempdeftype:=p^.resulttype^.deftype;
|
||||
if tempdeftype=filedef then
|
||||
Message(cg_e_file_must_call_by_reference);
|
||||
CGMessage(cg_e_file_must_call_by_reference);
|
||||
if (defcoll^.paratyp=vs_const) and
|
||||
dont_copy_const_param(p^.resulttype) then
|
||||
begin
|
||||
@ -287,7 +287,7 @@ implementation
|
||||
end;
|
||||
{$endif}
|
||||
s80real : begin
|
||||
Message(cg_f_extended_cg68k_not_supported);
|
||||
CGMessage(cg_f_extended_cg68k_not_supported);
|
||||
{ inc(tempreference.offset,6);
|
||||
emit_push_mem(tempreference);
|
||||
dec(tempreference.offset,4);
|
||||
@ -349,7 +349,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
else Message(cg_e_illegal_expression);
|
||||
else CGMessage(cg_e_illegal_expression);
|
||||
end;
|
||||
end;
|
||||
LOC_JUMP : begin
|
||||
@ -528,7 +528,7 @@ implementation
|
||||
{ direct call to inherited method }
|
||||
if (p^.procdefinition^.options and poabstractmethod)<>0 then
|
||||
begin
|
||||
Message(cg_e_cant_call_abstract_method);
|
||||
CGMessage(cg_e_cant_call_abstract_method);
|
||||
goto dont_call;
|
||||
end;
|
||||
{ generate no virtual call }
|
||||
@ -565,7 +565,7 @@ implementation
|
||||
begin
|
||||
if not ((aktprocsym^.definition^.options
|
||||
and (poconstructor or podestructor))<>0) then
|
||||
Message(cg_w_member_cd_call_from_method);
|
||||
CGMessage(cg_w_member_cd_call_from_method);
|
||||
end;
|
||||
{ con- and destructors need a pointer to the vmt }
|
||||
if is_con_or_destructor then
|
||||
@ -704,7 +704,7 @@ implementation
|
||||
{ always be placed wrong }
|
||||
if is_con_or_destructor then
|
||||
begin
|
||||
Message(cg_w_member_cd_call_from_method);
|
||||
CGMessage(cg_w_member_cd_call_from_method);
|
||||
{ not insert VMT pointer } { VMT-Zeiger nicht eintragen }
|
||||
push_int(0);
|
||||
end;
|
||||
@ -766,7 +766,7 @@ implementation
|
||||
|
||||
{ exported methods should be never called direct }
|
||||
if (p^.procdefinition^.options and poexports)<>0 then
|
||||
Message(cg_e_dont_call_exported_direct);
|
||||
CGMessage(cg_e_dont_call_exported_direct);
|
||||
|
||||
if ((p^.procdefinition^.options and povirtualmethod)<>0) and
|
||||
not(no_virtual_call) then
|
||||
@ -1044,11 +1044,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:43:55 peter
|
||||
Revision 1.5 1998-09-17 09:42:22 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:43:55 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/04 08:41:43 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.2 1998/09/01 12:47:59 peter
|
||||
* use pdef^.size instead of orddef^.typ
|
||||
|
||||
@ -680,7 +680,7 @@ implementation
|
||||
parraydef(p^.left^.resulttype)^.lowrange+1;
|
||||
|
||||
if l>255 then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
{ write the length }
|
||||
exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,S_B,l,
|
||||
@ -1376,7 +1376,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:43:56 peter
|
||||
Revision 1.5 1998-09-17 09:42:23 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:43:56 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/11 12:29:43 pierre
|
||||
|
||||
@ -195,7 +195,7 @@ implementation
|
||||
cleartempgen;
|
||||
secondpass(p^.t2);
|
||||
if not(simple_loadn) then
|
||||
Message(cg_e_illegal_count_var);
|
||||
CGMessage(cg_e_illegal_count_var);
|
||||
|
||||
{ produce start assignment }
|
||||
cleartempgen;
|
||||
@ -499,7 +499,7 @@ do_jmp:
|
||||
if aktbreaklabel<>nil then
|
||||
emitl(A_JMP,aktbreaklabel)
|
||||
else
|
||||
Message(cg_e_break_not_allowed);
|
||||
CGMessage(cg_e_break_not_allowed);
|
||||
end;
|
||||
|
||||
|
||||
@ -512,7 +512,7 @@ do_jmp:
|
||||
if aktcontinuelabel<>nil then
|
||||
emitl(A_JMP,aktcontinuelabel)
|
||||
else
|
||||
Message(cg_e_continue_not_allowed);
|
||||
CGMessage(cg_e_continue_not_allowed);
|
||||
end;
|
||||
|
||||
|
||||
@ -574,7 +574,7 @@ do_jmp:
|
||||
LOC_MEM,LOC_REFERENCE : emitpushreferenceaddr(p^.left^.location.reference);
|
||||
LOC_CREGISTER,LOC_REGISTER : exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
|
||||
p^.left^.location.register,R_SPPUSH)));
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
emitcall('FPC_RAISEEXCEPTION',true);
|
||||
end
|
||||
@ -769,7 +769,11 @@ do_jmp:
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:43:58 peter
|
||||
Revision 1.5 1998-09-17 09:42:24 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:43:58 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/04 08:41:47 peter
|
||||
|
||||
@ -159,7 +159,7 @@ implementation
|
||||
{ save reference in temporary variables }
|
||||
if node^.left^.location.loc<>LOC_REFERENCE then
|
||||
begin
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -198,7 +198,7 @@ implementation
|
||||
node:=node^.right;
|
||||
hp^.right:=nil;
|
||||
if hp^.is_colon_para then
|
||||
Message(parser_e_illegal_colon_qualifier);
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
if ft=ft_typed then
|
||||
never_copy_const_param:=true;
|
||||
secondcallparan(hp,@dummycoll,false);
|
||||
@ -262,7 +262,7 @@ implementation
|
||||
secondcallparan(hp,@dummycoll,false);
|
||||
hp^.right:=node;
|
||||
if pararesult^.deftype<>floatdef then
|
||||
Message(parser_e_illegal_colon_qualifier);
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
if codegenerror then
|
||||
exit;
|
||||
end
|
||||
@ -351,7 +351,7 @@ implementation
|
||||
bool8bit,
|
||||
bool16bit,
|
||||
bool32bit : if doread then
|
||||
Message(parser_e_illegal_parameter_list)
|
||||
CGMessage(parser_e_illegal_parameter_list)
|
||||
else
|
||||
emitcall('FPC_WRITE_TEXT_BOOLEAN',true);
|
||||
end;
|
||||
@ -398,7 +398,7 @@ implementation
|
||||
begin
|
||||
p^.left:=reversparameter(p^.left);
|
||||
if npara<>nb_para then
|
||||
Message(cg_f_internal_error_in_secondinline);
|
||||
CGMessage(cg_f_internal_error_in_secondinline);
|
||||
hp:=p^.left;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
@ -903,11 +903,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-09-14 10:43:59 peter
|
||||
Revision 1.4 1998-09-17 09:42:26 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.3 1998/09/14 10:43:59 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.2 1998/09/04 08:41:48 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.1 1998/09/01 09:07:09 peter
|
||||
* m68k fixes, splitted cg68k like cgi386
|
||||
|
||||
@ -277,7 +277,7 @@ implementation
|
||||
LOC_CREGISTER : loc:=LOC_CREGISTER;
|
||||
else
|
||||
begin
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -442,7 +442,7 @@ implementation
|
||||
begin
|
||||
clear_reference(p^.location.reference);
|
||||
hr_valid:=false;
|
||||
{ !!!!!!! }
|
||||
{ !!!!!!! }
|
||||
|
||||
(* if @procinfo<>pprocinfo(p^.funcretprocinfo) then
|
||||
begin
|
||||
@ -480,7 +480,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-09-01 09:07:09 peter
|
||||
Revision 1.2 1998-09-17 09:42:27 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.1 1998/09/01 09:07:09 peter
|
||||
* m68k fixes, splitted cg68k like cgi386
|
||||
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ implementation
|
||||
begin
|
||||
if (p^.right^.value>parraydef(p^.left^.resulttype)^.highrange) or
|
||||
(p^.right^.value<parraydef(p^.left^.resulttype)^.lowrange) then
|
||||
Message(parser_e_range_check_error);
|
||||
CGMessage(parser_e_range_check_error);
|
||||
|
||||
dec(p^.left^.location.reference.offset,
|
||||
p^.resulttype^.size*parraydef(p^.left^.resulttype)^.lowrange);
|
||||
@ -496,7 +496,7 @@ implementation
|
||||
{ calculate from left to right }
|
||||
if (p^.location.loc<>LOC_REFERENCE) and
|
||||
(p^.location.loc<>LOC_MEM) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
pushed:=maybe_push(p^.right^.registers32,p);
|
||||
secondpass(p^.right);
|
||||
@ -568,7 +568,7 @@ implementation
|
||||
if assigned(p^.location.reference.symbol) then
|
||||
begin
|
||||
if p^.location.reference.base <> R_NO then
|
||||
Message(cg_f_secondvecn_base_defined_twice);
|
||||
CGMessage(cg_f_secondvecn_base_defined_twice);
|
||||
p^.location.reference.base:=getaddressreg;
|
||||
exprasmlist^.concat(new(pai68k,op_csymbol_reg(A_LEA,S_L,newcsymbol(p^.location.reference.symbol^,0),
|
||||
p^.location.reference.base)));
|
||||
@ -691,7 +691,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:44:02 peter
|
||||
Revision 1.5 1998-09-17 09:42:28 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:44:02 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/11 12:29:44 pierre
|
||||
|
||||
@ -812,7 +812,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1998-09-14 10:44:03 peter
|
||||
Revision 1.5 1998-09-17 09:42:29 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.4 1998/09/14 10:44:03 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.3 1998/09/07 18:45:59 peter
|
||||
@ -820,7 +824,7 @@ end.
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
Revision 1.2 1998/09/04 08:41:49 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.1 1998/09/01 09:07:09 peter
|
||||
* m68k fixes, splitted cg68k like cgi386
|
||||
|
||||
@ -189,7 +189,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -377,7 +377,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
|
||||
procedure emitoverflowcheck(p: ptree);
|
||||
@ -595,7 +595,7 @@ begin
|
||||
{ omit stack frame ? }
|
||||
if procinfo.framepointer=stack_pointer then
|
||||
begin
|
||||
Message(cg_d_stackframe_omited);
|
||||
CGMessage(cg_d_stackframe_omited);
|
||||
nostackframe:=true;
|
||||
if (aktprocsym^.definition^.options and (pounitinit or poproginit)<>0) then
|
||||
parasize:=0
|
||||
@ -631,7 +631,7 @@ begin
|
||||
if (stackframe > -32767) and (stackframe < 32769) then
|
||||
procinfo.aktentrycode^.insert(new(pai68k,op_reg_const(A_LINK,S_W,R_A6,-stackframe)))
|
||||
else
|
||||
Message(cg_e_stacklimit_in_local_routine);
|
||||
CGMessage(cg_e_stacklimit_in_local_routine);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -655,7 +655,7 @@ begin
|
||||
procinfo.aktentrycode^.insert(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A6,R_SPPUSH)));
|
||||
end
|
||||
else
|
||||
Message(cg_e_stacklimit_in_local_routine);
|
||||
CGMessage(cg_e_stacklimit_in_local_routine);
|
||||
end;
|
||||
end {endif stackframe<>0 }
|
||||
else
|
||||
@ -762,7 +762,7 @@ begin
|
||||
if procinfo.retdef<>pdef(voiddef) then
|
||||
begin
|
||||
if not procinfo.funcret_is_valid then
|
||||
Message(sym_w_function_result_not_set);
|
||||
CGMessage(sym_w_function_result_not_set);
|
||||
new(hr);
|
||||
reset_reference(hr^);
|
||||
hr^.offset:=procinfo.retoffset;
|
||||
@ -1191,7 +1191,7 @@ end;
|
||||
s80real : s := S_FX;
|
||||
else
|
||||
begin
|
||||
Message(cg_f_unknown_float_type);
|
||||
CGMessage(cg_f_unknown_float_type);
|
||||
end;
|
||||
end; { end case }
|
||||
location.loc := LOC_FPU;
|
||||
@ -1210,7 +1210,7 @@ end;
|
||||
end
|
||||
else
|
||||
{ other floating types are not supported in emulation mode }
|
||||
Message(sym_e_type_id_not_defined);
|
||||
CGMessage(sym_e_type_id_not_defined);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1258,7 +1258,7 @@ end;
|
||||
s80real : s := S_FX;
|
||||
else
|
||||
begin
|
||||
Message(cg_f_unknown_float_type);
|
||||
CGMessage(cg_f_unknown_float_type);
|
||||
end;
|
||||
end; { end case }
|
||||
if not ((cs_fp_emulation) in aktmoduleswitches) then
|
||||
@ -1286,7 +1286,7 @@ end;
|
||||
end
|
||||
else
|
||||
{ other floating types are not supported in emulation mode }
|
||||
Message(sym_e_type_id_not_defined);
|
||||
CGMessage(sym_e_type_id_not_defined);
|
||||
end;
|
||||
location.fpureg:=R_NO; { no register in LOC_FPU now }
|
||||
end;
|
||||
@ -1345,7 +1345,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 1998-09-14 10:44:04 peter
|
||||
Revision 1.17 1998-09-17 09:42:30 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.16 1998/09/14 10:44:04 peter
|
||||
* all internal RTL functions start with FPC_
|
||||
|
||||
Revision 1.15 1998/09/07 18:46:00 peter
|
||||
@ -1353,7 +1357,7 @@ end.
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
Revision 1.14 1998/09/04 08:41:50 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.13 1998/09/01 12:48:02 peter
|
||||
* use pdef^.size instead of orddef^.typ
|
||||
|
||||
@ -1,756 +0,0 @@
|
||||
{
|
||||
$Id$
|
||||
Copyright (c) 1993-98 by Florian Klaempfl
|
||||
|
||||
This unit generates i386 (or better) assembler from the parse tree
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
****************************************************************************
|
||||
}
|
||||
{$ifdef TP}
|
||||
{$E+,F+,N+,D+,L+,Y+}
|
||||
{$endif}
|
||||
unit cgi386;
|
||||
interface
|
||||
|
||||
uses
|
||||
tree;
|
||||
|
||||
{ produces assembler for the expression in variable p }
|
||||
{ and produces an assembler node at the end }
|
||||
procedure generatecode(var p : ptree);
|
||||
|
||||
{ produces the actual code }
|
||||
function do_secondpass(var p : ptree) : boolean;
|
||||
procedure secondpass(var p : ptree);
|
||||
|
||||
|
||||
{$ifdef test_dest_loc}
|
||||
|
||||
const
|
||||
{ used to avoid temporary assignments }
|
||||
dest_loc_known : boolean = false;
|
||||
in_dest_loc : boolean = false;
|
||||
dest_loc_tree : ptree = nil;
|
||||
|
||||
var
|
||||
dest_loc : tlocation;
|
||||
|
||||
procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
|
||||
{$endif test_dest_loc}
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
cobjects,verbose,comphook,systems,globals,files,
|
||||
symtable,types,aasm,scanner,
|
||||
pass_1,hcodegen,temp_gen
|
||||
{$ifdef GDB}
|
||||
,gdb
|
||||
{$endif}
|
||||
{$ifdef i386}
|
||||
,i386,tgeni386,cgai386
|
||||
,cg386con,cg386mat,cg386cnv,cg386set,cg386add
|
||||
,cg386mem,cg386cal,cg386ld,cg386flw,cg386inl
|
||||
{$endif}
|
||||
;
|
||||
|
||||
{$ifdef test_dest_loc}
|
||||
procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
|
||||
begin
|
||||
if (dest_loc.loc=LOC_CREGISTER) or (dest_loc.loc=LOC_REGISTER) then
|
||||
begin
|
||||
emit_reg_reg(A_MOV,s,reg,dest_loc.register);
|
||||
p^.location:=dest_loc;
|
||||
in_dest_loc:=true;
|
||||
end
|
||||
else
|
||||
if (dest_loc.loc=LOC_REFERENCE) or (dest_loc.loc=LOC_MEM) then
|
||||
begin
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,s,reg,newreference(dest_loc.reference))));
|
||||
p^.location:=dest_loc;
|
||||
in_dest_loc:=true;
|
||||
end
|
||||
else
|
||||
internalerror(20080);
|
||||
end;
|
||||
|
||||
{$endif test_dest_loc}
|
||||
|
||||
|
||||
procedure message(const t : tmsgconst);
|
||||
|
||||
var
|
||||
olderrorcount : longint;
|
||||
|
||||
begin
|
||||
if not(codegenerror) then
|
||||
begin
|
||||
olderrorcount:=status.errorcount;
|
||||
verbose.Message(t);
|
||||
codegenerror:=olderrorcount<>status.errorcount;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure message1(const t : tmsgconst;const s : string);
|
||||
|
||||
var
|
||||
olderrorcount : longint;
|
||||
|
||||
begin
|
||||
if not(codegenerror) then
|
||||
begin
|
||||
olderrorcount:=status.errorcount;
|
||||
verbose.Message1(t,s);
|
||||
codegenerror:=olderrorcount<>status.errorcount;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure message2(const t : tmsgconst;const s1,s2 : string);
|
||||
|
||||
var
|
||||
olderrorcount : longint;
|
||||
|
||||
begin
|
||||
if not(codegenerror) then
|
||||
begin
|
||||
olderrorcount:=status.errorcount;
|
||||
verbose.Message2(t,s1,s2);
|
||||
codegenerror:=olderrorcount<>status.errorcount;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure message3(const t : tmsgconst;const s1,s2,s3 : string);
|
||||
|
||||
var
|
||||
olderrorcount : longint;
|
||||
|
||||
begin
|
||||
if not(codegenerror) then
|
||||
begin
|
||||
olderrorcount:=status.errorcount;
|
||||
verbose.Message3(t,s1,s2,s3);
|
||||
codegenerror:=olderrorcount<>status.errorcount;
|
||||
end;
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondPass
|
||||
*****************************************************************************}
|
||||
|
||||
type
|
||||
secondpassproc = procedure(var p : ptree);
|
||||
|
||||
procedure secondnothing(var p : ptree);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure seconderror(var p : ptree);
|
||||
|
||||
begin
|
||||
p^.error:=true;
|
||||
codegenerror:=true;
|
||||
end;
|
||||
|
||||
|
||||
procedure secondstatement(var p : ptree);
|
||||
var
|
||||
hp : ptree;
|
||||
begin
|
||||
hp:=p;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
if assigned(hp^.right) then
|
||||
begin
|
||||
cleartempgen;
|
||||
secondpass(hp^.right);
|
||||
end;
|
||||
hp:=hp^.left;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure secondblockn(var p : ptree);
|
||||
begin
|
||||
{ do second pass on left node }
|
||||
if assigned(p^.left) then
|
||||
secondpass(p^.left);
|
||||
end;
|
||||
|
||||
|
||||
procedure secondasm(var p : ptree);
|
||||
begin
|
||||
exprasmlist^.concatlist(p^.p_asm);
|
||||
if not p^.object_preserved then
|
||||
maybe_loadesi;
|
||||
end;
|
||||
|
||||
|
||||
procedure secondpass(var p : ptree);
|
||||
const
|
||||
procedures : array[ttreetyp] of secondpassproc =
|
||||
(secondadd,secondadd,secondadd,secondmoddiv,secondadd,
|
||||
secondmoddiv,secondassignment,secondload,secondnothing,
|
||||
secondadd,secondadd,secondadd,secondadd,
|
||||
secondadd,secondadd,secondin,secondadd,
|
||||
secondadd,secondshlshr,secondshlshr,secondadd,
|
||||
secondadd,secondsubscriptn,secondderef,secondaddr,
|
||||
seconddoubleaddr,
|
||||
secondordconst,secondtypeconv,secondcalln,secondnothing,
|
||||
secondrealconst,secondfixconst,secondumminus,
|
||||
secondasm,secondvecn,
|
||||
secondstringconst,secondfuncret,secondselfn,
|
||||
secondnot,secondinline,secondniln,seconderror,
|
||||
secondnothing,secondhnewn,secondhdisposen,secondnewn,
|
||||
secondsimplenewdispose,secondsetelement,secondsetconst,secondblockn,
|
||||
secondstatement,secondnothing,secondifn,secondbreakn,
|
||||
secondcontinuen,second_while_repeatn,second_while_repeatn,secondfor,
|
||||
secondexitn,secondwith,secondcase,secondlabel,
|
||||
secondgoto,secondsimplenewdispose,secondtryexcept,
|
||||
secondraise,
|
||||
secondnothing,secondtryfinally,secondon,secondis,
|
||||
secondas,seconderror,
|
||||
secondfail,secondadd,secondprocinline,
|
||||
secondnothing,secondloadvmt);
|
||||
var
|
||||
oldcodegenerror : boolean;
|
||||
oldlocalswitches : tlocalswitches;
|
||||
oldpos : tfileposinfo;
|
||||
begin
|
||||
oldcodegenerror:=codegenerror;
|
||||
oldlocalswitches:=aktlocalswitches;
|
||||
oldpos:=aktfilepos;
|
||||
|
||||
aktfilepos:=p^.fileinfo;
|
||||
aktlocalswitches:=p^.localswitches;
|
||||
if not(p^.error) then
|
||||
begin
|
||||
codegenerror:=false;
|
||||
procedures[p^.treetype](p);
|
||||
p^.error:=codegenerror;
|
||||
codegenerror:=codegenerror or oldcodegenerror;
|
||||
end
|
||||
else
|
||||
codegenerror:=true;
|
||||
|
||||
aktlocalswitches:=oldlocalswitches;
|
||||
aktfilepos:=oldpos;
|
||||
end;
|
||||
|
||||
|
||||
function do_secondpass(var p : ptree) : boolean;
|
||||
begin
|
||||
codegenerror:=false;
|
||||
if not(p^.error) then
|
||||
secondpass(p);
|
||||
do_secondpass:=codegenerror;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
var
|
||||
regvars : array[1..maxvarregs] of pvarsym;
|
||||
regvars_para : array[1..maxvarregs] of boolean;
|
||||
regvars_refs : array[1..maxvarregs] of longint;
|
||||
parasym : boolean;
|
||||
|
||||
procedure searchregvars(p : psym);
|
||||
|
||||
var
|
||||
i,j,k : longint;
|
||||
|
||||
begin
|
||||
if (p^.typ=varsym) and ((pvarsym(p)^.var_options and vo_regable)<>0) then
|
||||
begin
|
||||
{ walk through all momentary register variables }
|
||||
for i:=1 to maxvarregs do
|
||||
begin
|
||||
{ free register ? }
|
||||
if regvars[i]=nil then
|
||||
begin
|
||||
regvars[i]:=pvarsym(p);
|
||||
regvars_para[i]:=parasym;
|
||||
break;
|
||||
end;
|
||||
{ else throw out a variable ? }
|
||||
j:=pvarsym(p)^.refs;
|
||||
{ parameter get a less value }
|
||||
if parasym then
|
||||
begin
|
||||
if cs_littlesize in aktglobalswitches then
|
||||
dec(j,1)
|
||||
else
|
||||
dec(j,100);
|
||||
end;
|
||||
if (j>regvars_refs[i]) and (j>0) then
|
||||
begin
|
||||
for k:=maxvarregs-1 downto i do
|
||||
begin
|
||||
regvars[k+1]:=regvars[k];
|
||||
regvars_para[k+1]:=regvars_para[k];
|
||||
end;
|
||||
{ calc the new refs
|
||||
pvarsym(p)^.refs:=j; }
|
||||
regvars[i]:=pvarsym(p);
|
||||
regvars_para[i]:=parasym;
|
||||
regvars_refs[i]:=j;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure generatecode(var p : ptree);
|
||||
|
||||
var
|
||||
i : longint;
|
||||
regsize : topsize;
|
||||
regi : tregister;
|
||||
hr : preference;
|
||||
|
||||
label
|
||||
nextreg;
|
||||
|
||||
begin
|
||||
cleartempgen;
|
||||
{ when size optimization only count occurrence }
|
||||
if cs_littlesize in aktglobalswitches then
|
||||
t_times:=1
|
||||
else
|
||||
{ reference for repetition is 100 }
|
||||
t_times:=100;
|
||||
{ clear register count }
|
||||
{$ifdef SUPPORT_MMX}
|
||||
for regi:=R_EAX to R_MM6 do
|
||||
begin
|
||||
reg_pushes[regi]:=0;
|
||||
is_reg_var[regi]:=false;
|
||||
end;
|
||||
{$else SUPPORT_MMX}
|
||||
for regi:=R_EAX to R_EDI do
|
||||
begin
|
||||
reg_pushes[regi]:=0;
|
||||
is_reg_var[regi]:=false;
|
||||
end;
|
||||
{$endif SUPPORT_MMX}
|
||||
use_esp_stackframe:=false;
|
||||
|
||||
if not(do_firstpass(p)) then
|
||||
begin
|
||||
{ max. optimizations }
|
||||
{ only if no asm is used }
|
||||
{ and no try statement }
|
||||
if (cs_regalloc in aktglobalswitches) and
|
||||
((procinfo.flags and (pi_uses_asm or pi_uses_exceptions))=0) then
|
||||
begin
|
||||
{ can we omit the stack frame ? }
|
||||
{ conditions:
|
||||
1. procedure (not main block)
|
||||
2. no constructor or destructor
|
||||
3. no call to other procedures
|
||||
4. no interrupt handler
|
||||
}
|
||||
if assigned(aktprocsym) then
|
||||
begin
|
||||
if (aktprocsym^.definition^.options and
|
||||
(poconstructor+podestructor{+poinline}+pointerrupt)=0) and
|
||||
((procinfo.flags and pi_do_call)=0) and (lexlevel>1) then
|
||||
begin
|
||||
{ use ESP as frame pointer }
|
||||
procinfo.framepointer:=R_ESP;
|
||||
use_esp_stackframe:=true;
|
||||
|
||||
{ calc parameter distance new }
|
||||
dec(procinfo.framepointer_offset,4);
|
||||
dec(procinfo.ESI_offset,4);
|
||||
|
||||
{ is this correct ???}
|
||||
{ retoffset can be negativ for results in eax !! }
|
||||
{ the value should be decreased only if positive }
|
||||
if procinfo.retoffset>=0 then
|
||||
dec(procinfo.retoffset,4);
|
||||
|
||||
dec(procinfo.call_offset,4);
|
||||
aktprocsym^.definition^.parast^.call_offset:=procinfo.call_offset;
|
||||
end;
|
||||
end;
|
||||
if (p^.registers32<4) then
|
||||
begin
|
||||
for i:=1 to maxvarregs do
|
||||
regvars[i]:=nil;
|
||||
parasym:=false;
|
||||
{$ifdef tp}
|
||||
symtablestack^.foreach(searchregvars);
|
||||
{$else}
|
||||
symtablestack^.foreach(@searchregvars);
|
||||
{$endif}
|
||||
{ copy parameter into a register ? }
|
||||
parasym:=true;
|
||||
{$ifdef tp}
|
||||
symtablestack^.next^.foreach(searchregvars);
|
||||
{$else}
|
||||
symtablestack^.next^.foreach(@searchregvars);
|
||||
{$endif}
|
||||
{ hold needed registers free }
|
||||
for i:=maxvarregs downto maxvarregs-p^.registers32+1 do
|
||||
regvars[i]:=nil;
|
||||
{ now assign register }
|
||||
for i:=1 to maxvarregs-p^.registers32 do
|
||||
begin
|
||||
if assigned(regvars[i]) then
|
||||
begin
|
||||
{ it is nonsens, to copy the variable to }
|
||||
{ a register because we need then much }
|
||||
{ pushes ? }
|
||||
if reg_pushes[varregs[i]]>=regvars[i]^.refs then
|
||||
begin
|
||||
regvars[i]:=nil;
|
||||
goto nextreg;
|
||||
end;
|
||||
|
||||
{ register is no longer available for }
|
||||
{ expressions }
|
||||
{ search the register which is the most }
|
||||
{ unused }
|
||||
usableregs:=usableregs-[varregs[i]];
|
||||
is_reg_var[varregs[i]]:=true;
|
||||
dec(c_usableregs);
|
||||
|
||||
{ possibly no 32 bit register are needed }
|
||||
|
||||
{ call by reference/const ? }
|
||||
if (regvars[i]^.varspez=vs_var) or
|
||||
((regvars[i]^.varspez=vs_const) and
|
||||
dont_copy_const_param(regvars[i]^.definition)
|
||||
) then
|
||||
begin
|
||||
regvars[i]^.reg:=varregs[i];
|
||||
regsize:=S_L;
|
||||
end
|
||||
else if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.typ in [bool8bit,uchar,u8bit,s8bit]) then
|
||||
begin
|
||||
regvars[i]^.reg:=reg32toreg8(varregs[i]);
|
||||
regsize:=S_B;
|
||||
end
|
||||
else if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.typ in [bool16bit,u16bit,s16bit]) then
|
||||
begin
|
||||
regvars[i]^.reg:=reg32toreg16(varregs[i]);
|
||||
regsize:=S_W;
|
||||
end
|
||||
else
|
||||
begin
|
||||
regvars[i]^.reg:=varregs[i];
|
||||
regsize:=S_L;
|
||||
end;
|
||||
{ parameter must be load }
|
||||
if regvars_para[i] then
|
||||
begin
|
||||
{ procinfo is there actual, }
|
||||
{ because we can't never be in a }
|
||||
{ nested procedure }
|
||||
{ when loading parameter to reg }
|
||||
new(hr);
|
||||
reset_reference(hr^);
|
||||
hr^.offset:=pvarsym(regvars[i])^.address+procinfo.call_offset;
|
||||
hr^.base:=procinfo.framepointer;
|
||||
procinfo.aktentrycode^.concat(new(pai386,op_ref_reg(A_MOV,regsize,
|
||||
hr,regvars[i]^.reg)));
|
||||
unused:=unused - [regvars[i]^.reg];
|
||||
end;
|
||||
{ procedure uses this register }
|
||||
usedinproc:=usedinproc or ($80 shr byte(varregs[i]));
|
||||
end;
|
||||
nextreg:
|
||||
{ dummy }
|
||||
regsize:=S_W;
|
||||
end;
|
||||
if (status.verbosity and v_debug)=v_debug then
|
||||
begin
|
||||
for i:=1 to maxvarregs do
|
||||
begin
|
||||
if assigned(regvars[i]) then
|
||||
Message3(cg_d_register_weight,reg2str(regvars[i]^.reg),
|
||||
tostr(regvars[i]^.refs),regvars[i]^.name);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if assigned(aktprocsym) and
|
||||
((aktprocsym^.definition^.options and poinline)<>0) then
|
||||
make_const_global:=true;
|
||||
do_secondpass(p);
|
||||
|
||||
{$ifdef StoreFPULevel}
|
||||
procinfo.def^.fpu_used:=p^.registersfpu;
|
||||
{$endif StoreFPULevel}
|
||||
{ all registers can be used again }
|
||||
usableregs:=[R_EAX,R_EBX,R_ECX,R_EDX];
|
||||
{$ifdef SUPPORT_MMX}
|
||||
usableregs:=usableregs+[R_MM0..R_MM6];
|
||||
{$endif SUPPORT_MMX}
|
||||
c_usableregs:=4;
|
||||
end;
|
||||
procinfo.aktproccode^.concatlist(exprasmlist);
|
||||
make_const_global:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.53 1998-09-07 18:46:03 peter
|
||||
* update smartlinking, uses getdatalabel
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
Revision 1.52 1998/09/05 23:03:58 florian
|
||||
* some fixes to get -Or work:
|
||||
- inc/dec didn't take care of CREGISTER
|
||||
- register calculcation of inc/dec was wrong
|
||||
- var/const parameters get now assigned 32 bit register, but
|
||||
const parameters only if they are passed by reference !
|
||||
|
||||
Revision 1.51 1998/08/31 12:22:14 peter
|
||||
* secondinline moved to cg386inl
|
||||
|
||||
Revision 1.50 1998/08/28 10:54:20 peter
|
||||
* fixed smallset generation from elements, it has never worked before!
|
||||
|
||||
Revision 1.49 1998/08/19 16:07:42 jonas
|
||||
* changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
|
||||
|
||||
Revision 1.48 1998/08/14 18:18:43 peter
|
||||
+ dynamic set contruction
|
||||
* smallsets are now working (always longint size)
|
||||
|
||||
Revision 1.47 1998/08/10 14:49:53 peter
|
||||
+ localswitches, moduleswitches, globalswitches splitting
|
||||
|
||||
Revision 1.46 1998/08/10 10:18:23 peter
|
||||
+ Compiler,Comphook unit which are the new interface units to the
|
||||
compiler
|
||||
|
||||
Revision 1.45 1998/07/30 13:30:34 florian
|
||||
* final implemenation of exception support, maybe it needs
|
||||
some fixes :)
|
||||
|
||||
Revision 1.44 1998/07/30 11:18:15 florian
|
||||
+ first implementation of try ... except on .. do end;
|
||||
* limitiation of 65535 bytes parameters for cdecl removed
|
||||
|
||||
Revision 1.43 1998/07/28 21:52:50 florian
|
||||
+ implementation of raise and try..finally
|
||||
+ some misc. exception stuff
|
||||
|
||||
Revision 1.42 1998/07/15 16:06:44 jonas
|
||||
* fixed bug that caused the stackframe never to be omitted
|
||||
|
||||
Revision 1.41 1998/07/14 14:46:44 peter
|
||||
* released NEWINPUT
|
||||
|
||||
Revision 1.40 1998/07/07 11:19:52 peter
|
||||
+ NEWINPUT for a better inputfile and scanner object
|
||||
|
||||
Revision 1.39 1998/06/12 10:32:23 pierre
|
||||
* column problem hopefully solved
|
||||
+ C vars declaration changed
|
||||
|
||||
Revision 1.38 1998/06/09 16:01:37 pierre
|
||||
+ added procedure directive parsing for procvars
|
||||
(accepted are popstack cdecl and pascal)
|
||||
+ added C vars with the following syntax
|
||||
var C calias 'true_c_name';(can be followed by external)
|
||||
reason is that you must add the Cprefix
|
||||
|
||||
which is target dependent
|
||||
|
||||
Revision 1.37 1998/06/08 13:13:41 pierre
|
||||
+ temporary variables now in temp_gen.pas unit
|
||||
because it is processor independent
|
||||
* mppc68k.bat modified to undefine i386 and support_mmx
|
||||
(which are defaults for i386)
|
||||
|
||||
Revision 1.36 1998/06/05 17:49:54 peter
|
||||
* cleanup of cgai386
|
||||
|
||||
Revision 1.35 1998/06/05 16:13:32 pierre
|
||||
* fix for real and string consts inside inlined procs
|
||||
|
||||
Revision 1.34 1998/06/05 14:37:27 pierre
|
||||
* fixes for inline for operators
|
||||
* inline procedure more correctly restricted
|
||||
|
||||
Revision 1.33 1998/06/04 23:51:37 peter
|
||||
* m68k compiles
|
||||
+ .def file creation moved to gendef.pas so it could also be used
|
||||
for win32
|
||||
|
||||
Revision 1.32 1998/06/04 09:55:35 pierre
|
||||
* demangled name of procsym reworked to become independant of the mangling scheme
|
||||
|
||||
Revision 1.31 1998/06/03 22:48:52 peter
|
||||
+ wordbool,longbool
|
||||
* rename bis,von -> high,low
|
||||
* moved some systemunit loading/creating to psystem.pas
|
||||
|
||||
Revision 1.30 1998/06/02 17:03:00 pierre
|
||||
* with node corrected for objects
|
||||
* small bugs for SUPPORT_MMX fixed
|
||||
|
||||
Revision 1.29 1998/06/01 16:50:18 peter
|
||||
+ boolean -> ord conversion
|
||||
* fixed ord -> boolean conversion
|
||||
|
||||
Revision 1.28 1998/05/28 17:26:47 peter
|
||||
* fixed -R switch, it didn't work after my previous akt/init patch
|
||||
* fixed bugs 110,130,136
|
||||
|
||||
Revision 1.27 1998/05/25 17:11:38 pierre
|
||||
* firstpasscount bug fixed
|
||||
now all is already set correctly the first time
|
||||
under EXTDEBUG try -gp to skip all other firstpasses
|
||||
it works !!
|
||||
* small bug fixes
|
||||
- for smallsets with -dTESTSMALLSET
|
||||
- some warnings removed (by correcting code !)
|
||||
|
||||
Revision 1.26 1998/05/23 01:21:03 peter
|
||||
+ aktasmmode, aktoptprocessor, aktoutputformat
|
||||
+ smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
|
||||
+ $LIBNAME to set the library name where the unit will be put in
|
||||
* splitted cgi386 a bit (codeseg to large for bp7)
|
||||
* nasm, tasm works again. nasm moved to ag386nsm.pas
|
||||
|
||||
Revision 1.25 1998/05/21 19:33:31 peter
|
||||
+ better procedure directive handling and only one table
|
||||
|
||||
Revision 1.24 1998/05/20 09:42:33 pierre
|
||||
+ UseTokenInfo now default
|
||||
* unit in interface uses and implementation uses gives error now
|
||||
* only one error for unknown symbol (uses lastsymknown boolean)
|
||||
the problem came from the label code !
|
||||
+ first inlined procedures and function work
|
||||
(warning there might be allowed cases were the result is still wrong !!)
|
||||
* UseBrower updated gives a global list of all position of all used symbols
|
||||
with switch -gb
|
||||
|
||||
Revision 1.23 1998/05/12 10:46:58 peter
|
||||
* moved printstatus to verb_def
|
||||
+ V_Normal which is between V_Error and V_Warning and doesn't have a
|
||||
prefix like error: warning: and is included in V_Default
|
||||
* fixed some messages
|
||||
* first time parameter scan is only for -v and -T
|
||||
- removed old style messages
|
||||
|
||||
Revision 1.22 1998/05/07 00:17:00 peter
|
||||
* smartlinking for sets
|
||||
+ consts labels are now concated/generated in hcodegen
|
||||
* moved some cpu code to cga and some none cpu depended code from cga
|
||||
to tree and hcodegen and cleanup of hcodegen
|
||||
* assembling .. output reduced for smartlinking ;)
|
||||
|
||||
Revision 1.21 1998/05/06 08:38:36 pierre
|
||||
* better position info with UseTokenInfo
|
||||
UseTokenInfo greatly simplified
|
||||
+ added check for changed tree after first time firstpass
|
||||
(if we could remove all the cases were it happen
|
||||
we could skip all firstpass if firstpasscount > 1)
|
||||
Only with ExtDebug
|
||||
|
||||
Revision 1.20 1998/05/01 16:38:44 florian
|
||||
* handling of private and protected fixed
|
||||
+ change_keywords_to_tp implemented to remove
|
||||
keywords which aren't supported by tp
|
||||
* break and continue are now symbols of the system unit
|
||||
+ widestring, longstring and ansistring type released
|
||||
|
||||
Revision 1.19 1998/04/30 15:59:39 pierre
|
||||
* GDB works again better :
|
||||
correct type info in one pass
|
||||
+ UseTokenInfo for better source position
|
||||
* fixed one remaining bug in scanner for line counts
|
||||
* several little fixes
|
||||
|
||||
Revision 1.18 1998/04/29 10:33:48 pierre
|
||||
+ added some code for ansistring (not complete nor working yet)
|
||||
* corrected operator overloading
|
||||
* corrected nasm output
|
||||
+ started inline procedures
|
||||
+ added starstarn : use ** for exponentiation (^ gave problems)
|
||||
+ started UseTokenInfo cond to get accurate positions
|
||||
|
||||
Revision 1.17 1998/04/27 23:10:27 peter
|
||||
+ new scanner
|
||||
* $makelib -> if smartlink
|
||||
* small filename fixes pmodule.setfilename
|
||||
* moved import from files.pas -> import.pas
|
||||
|
||||
Revision 1.16 1998/04/23 21:52:08 florian
|
||||
* fixes of Jonas applied
|
||||
|
||||
Revision 1.15 1998/04/22 21:06:49 florian
|
||||
* last fixes before the release:
|
||||
- veryyyy slow firstcall fixed
|
||||
|
||||
Revision 1.14 1998/04/21 10:16:47 peter
|
||||
* patches from strasbourg
|
||||
* objects is not used anymore in the fpc compiled version
|
||||
|
||||
Revision 1.13 1998/04/14 23:27:02 florian
|
||||
+ exclude/include with constant second parameter added
|
||||
|
||||
Revision 1.12 1998/04/13 21:15:41 florian
|
||||
* error handling of pass_1 and cgi386 fixed
|
||||
* the following bugs fixed: 0117, 0118, 0119 and 0129, 0122 was already
|
||||
fixed, verified
|
||||
|
||||
Revision 1.11 1998/04/13 08:42:51 florian
|
||||
* call by reference and call by value open arrays fixed
|
||||
|
||||
Revision 1.10 1998/04/12 22:39:43 florian
|
||||
* problem with read access to properties solved
|
||||
* correct handling of hidding methods via virtual (COM)
|
||||
* correct result type of constructor calls (COM), the resulttype
|
||||
depends now on the type of the class reference
|
||||
|
||||
Revision 1.9 1998/04/10 21:36:55 florian
|
||||
+ some stuff to support method pointers (procedure of object) added
|
||||
(declaration, parameter handling)
|
||||
|
||||
Revision 1.8 1998/04/09 22:16:33 florian
|
||||
* problem with previous REGALLOC solved
|
||||
* improved property support
|
||||
|
||||
Revision 1.7 1998/04/09 14:28:05 jonas
|
||||
+ basic k6 and 6x86 optimizing support (-O7 and -O8)
|
||||
|
||||
Revision 1.6 1998/04/08 11:34:20 peter
|
||||
* nasm works (linux only tested)
|
||||
|
||||
Revision 1.5 1998/04/07 22:45:04 florian
|
||||
* bug0092, bug0115 and bug0121 fixed
|
||||
+ packed object/class/array
|
||||
|
||||
Revision 1.4 1998/04/07 13:19:42 pierre
|
||||
* bugfixes for reset_gdb_info
|
||||
in MEM parsing for go32v2
|
||||
better external symbol creation
|
||||
support for rhgdb.exe (lowercase file names)
|
||||
}
|
||||
@ -190,10 +190,7 @@ Var
|
||||
|
||||
Implementation
|
||||
|
||||
Uses globals, systems, strings, verbose, hcodegen,
|
||||
{$ifdef i386}
|
||||
cgi386;
|
||||
{$endif i386}
|
||||
Uses globals, systems, strings, verbose, hcodegen;
|
||||
|
||||
Const AsmInstr: Array[tasmop] Of TAsmInstrucProp = (
|
||||
{MOV} (Ch: (C_Op2, C_None, C_None)),
|
||||
@ -591,7 +588,7 @@ Procedure FindLoHiLabels(AsmL: PAasmOutput; Var LowLabel, HighLabel, LabelDif: L
|
||||
{Walks through the paasmlist to find the lowest and highest label number;
|
||||
Since 0.9.3: also removes unused labels}
|
||||
Var LabelFound: Boolean;
|
||||
P, hp1: Pai;
|
||||
P{, hp1}: Pai;
|
||||
Begin
|
||||
LabelFound := False;
|
||||
LowLabel := MaxLongint;
|
||||
@ -1472,7 +1469,11 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 1998-09-16 18:00:01 jonas
|
||||
Revision 1.13 1998-09-17 09:42:36 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.12 1998/09/16 18:00:01 jonas
|
||||
* optimizer now completely dependant on GetNext/GetLast instruction, works again with -dRegAlloc
|
||||
|
||||
Revision 1.11 1998/09/15 14:05:27 jonas
|
||||
|
||||
@ -122,10 +122,10 @@ unit hcodegen;
|
||||
codegenerror : boolean;
|
||||
|
||||
{ message calls with codegenerror support }
|
||||
procedure message(const t : tmsgconst);
|
||||
procedure message1(const t : tmsgconst;const s : string);
|
||||
procedure message2(const t : tmsgconst;const s1,s2 : string);
|
||||
procedure message3(const t : tmsgconst;const s1,s2,s3 : string);
|
||||
procedure cgmessage(const t : tmsgconst);
|
||||
procedure cgmessage1(const t : tmsgconst;const s : string);
|
||||
procedure cgmessage2(const t : tmsgconst;const s1,s2 : string);
|
||||
procedure cgmessage3(const t : tmsgconst;const s1,s2,s3 : string);
|
||||
|
||||
|
||||
{ initialize respectively terminates the code generator }
|
||||
@ -167,7 +167,7 @@ implementation
|
||||
override the message calls to set codegenerror
|
||||
*****************************************************************************}
|
||||
|
||||
procedure message(const t : tmsgconst);
|
||||
procedure cgmessage(const t : tmsgconst);
|
||||
var
|
||||
olderrorcount : longint;
|
||||
begin
|
||||
@ -179,7 +179,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure message1(const t : tmsgconst;const s : string);
|
||||
procedure cgmessage1(const t : tmsgconst;const s : string);
|
||||
var
|
||||
olderrorcount : longint;
|
||||
begin
|
||||
@ -191,7 +191,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure message2(const t : tmsgconst;const s1,s2 : string);
|
||||
procedure cgmessage2(const t : tmsgconst;const s1,s2 : string);
|
||||
var
|
||||
olderrorcount : longint;
|
||||
begin
|
||||
@ -203,7 +203,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure message3(const t : tmsgconst;const s1,s2,s3 : string);
|
||||
procedure cgmessage3(const t : tmsgconst;const s1,s2,s3 : string);
|
||||
var
|
||||
olderrorcount : longint;
|
||||
begin
|
||||
@ -383,7 +383,11 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 1998-09-07 18:46:04 peter
|
||||
Revision 1.17 1998-09-17 09:42:37 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.16 1998/09/07 18:46:04 peter
|
||||
* update smartlinking, uses getdatalabel
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
|
||||
@ -131,10 +131,10 @@ unit pass_1;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ error message, if more than 8 floating point }
|
||||
{ error CGMessage, if more than 8 floating point }
|
||||
{ registers are needed }
|
||||
if p^.registersfpu>8 then
|
||||
Message(cg_e_too_complex_expr);
|
||||
CGMessage(cg_e_too_complex_expr);
|
||||
end;
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ unit pass_1;
|
||||
if (pfloatdef(def_to)^.typ=s64bit) and
|
||||
(pfloatdef(def_from)^.typ<>s64bit) and
|
||||
not (explicit) then
|
||||
Message(type_w_convert_real_2_comp);
|
||||
CGMessage(type_w_convert_real_2_comp);
|
||||
{$endif}
|
||||
end;
|
||||
b:=true;
|
||||
@ -635,7 +635,7 @@ unit pass_1;
|
||||
if pvarsym(p^.symtableentry)^.is_valid=2 then
|
||||
if (assigned(pvarsym(p^.symtableentry)^.owner) and assigned(aktprocsym)
|
||||
and (pvarsym(p^.symtableentry)^.owner = aktprocsym^.definition^.localst)) then
|
||||
Message1(sym_n_uninitialized_local_variable,pvarsym(p^.symtableentry)^.name);
|
||||
CGMessage1(sym_n_uninitialized_local_variable,pvarsym(p^.symtableentry)^.name);
|
||||
end;
|
||||
if count_ref then
|
||||
begin
|
||||
@ -662,7 +662,7 @@ unit pass_1;
|
||||
procsym :
|
||||
begin
|
||||
if assigned(pprocsym(p^.symtableentry)^.definition^.nextoverloaded) then
|
||||
Message(parser_e_no_overloaded_procvars);
|
||||
CGMessage(parser_e_no_overloaded_procvars);
|
||||
p^.resulttype:=pprocsym(p^.symtableentry)^.definition;
|
||||
end;
|
||||
else internalerror(3);
|
||||
@ -777,7 +777,7 @@ unit pass_1;
|
||||
t^.left:=gencallparanode(p^.left,nil);
|
||||
t^.left:=gencallparanode(p^.right,t^.left);
|
||||
if t^.symtableprocentry=nil then
|
||||
Message(parser_e_operator_not_overloaded);
|
||||
CGMessage(parser_e_operator_not_overloaded);
|
||||
if p^.treetype=unequaln then
|
||||
t:=gensinglenode(notn,t);
|
||||
firstpass(t);
|
||||
@ -829,7 +829,7 @@ unit pass_1;
|
||||
firstpass(t);
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
disposetree(p);
|
||||
firstpass(t);
|
||||
@ -855,7 +855,7 @@ unit pass_1;
|
||||
equaln : t:=genordinalconstnode(ord(lvd=rvd),booldef);
|
||||
unequaln : t:=genordinalconstnode(ord(lvd<>rvd),booldef);
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
disposetree(p);
|
||||
p:=t;
|
||||
@ -1023,7 +1023,7 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1077,11 +1077,11 @@ unit pass_1;
|
||||
{ right site must also be a setdef, unless addn is used }
|
||||
if not(p^.treetype in [subn,symdifn,addn,muln,equaln,unequaln]) or
|
||||
((rd^.deftype<>setdef) and (p^.treetype<>addn)) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
if ((rd^.deftype=setdef) and not(is_equal(rd,ld))) and
|
||||
not((rt=setelementn) and is_equal(psetdef(ld)^.setof,rd)) then
|
||||
Message(type_e_set_element_are_not_comp);
|
||||
CGMessage(type_e_set_element_are_not_comp);
|
||||
|
||||
{ ranges require normsets }
|
||||
if (psetdef(ld)^.settype=smallset) and
|
||||
@ -1221,16 +1221,16 @@ unit pass_1;
|
||||
ltn,lten,gtn,gten:
|
||||
begin
|
||||
if not(cs_extsyntax in aktmoduleswitches) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
subn:
|
||||
begin
|
||||
if not(cs_extsyntax in aktmoduleswitches) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
p^.resulttype:=s32bitdef;
|
||||
exit;
|
||||
end;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1249,7 +1249,7 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1268,7 +1268,7 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1284,7 +1284,7 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1299,7 +1299,7 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1312,7 +1312,7 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1326,7 +1326,7 @@ unit pass_1;
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1341,10 +1341,10 @@ unit pass_1;
|
||||
if p^.treetype=addn then
|
||||
begin
|
||||
if not(cs_extsyntax in aktmoduleswitches) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
convdone:=true;
|
||||
end
|
||||
else
|
||||
@ -1357,9 +1357,9 @@ unit pass_1;
|
||||
calcregisters(p,1,0,0);
|
||||
case p^.treetype of
|
||||
addn,subn : if not(cs_extsyntax in aktmoduleswitches) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1372,7 +1372,7 @@ unit pass_1;
|
||||
case p^.treetype of
|
||||
equaln,unequaln : ;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end
|
||||
@ -1391,9 +1391,9 @@ unit pass_1;
|
||||
muln:
|
||||
if not(mmx_type(p^.left^.resulttype) in
|
||||
[mmxu16bit,mmxs16bit,mmxfixed16]) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
p^.location.loc:=LOC_MMXREGISTER;
|
||||
calcregisters(p,0,0,1);
|
||||
@ -1408,7 +1408,7 @@ unit pass_1;
|
||||
case p^.treetype of
|
||||
equaln,unequaln,
|
||||
ltn,lten,gtn,gten : ;
|
||||
else Message(type_e_mismatch);
|
||||
else CGMessage(type_e_mismatch);
|
||||
end;
|
||||
convdone:=true;
|
||||
end;
|
||||
@ -1419,8 +1419,8 @@ unit pass_1;
|
||||
{ but an int/int gives real/real! }
|
||||
if p^.treetype=slashn then
|
||||
begin
|
||||
Message(type_w_int_slash_int);
|
||||
Message(type_h_use_div_for_int);
|
||||
CGMessage(type_w_int_slash_int);
|
||||
CGMessage(type_h_use_div_for_int);
|
||||
p^.right:=gentypeconvnode(p^.right,c64floatdef);
|
||||
p^.left:=gentypeconvnode(p^.left,c64floatdef);
|
||||
firstpass(p^.left);
|
||||
@ -1683,7 +1683,7 @@ unit pass_1;
|
||||
if (cs_mmx_saturation in aktlocalswitches^) and
|
||||
(porddef(parraydef(p^.resulttype)^.definition)^.typ in
|
||||
[s32bit,u32bit]) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
}
|
||||
end
|
||||
{$endif SUPPORT_MMX}
|
||||
@ -1724,7 +1724,7 @@ unit pass_1;
|
||||
end;
|
||||
minusdef:=minusdef^.nextoverloaded;
|
||||
end;
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1793,7 +1793,7 @@ unit pass_1;
|
||||
{ we should allow loc_mem for @string }
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) and
|
||||
(p^.left^.location.loc<>LOC_MEM) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
p^.registers32:=p^.left^.registers32;
|
||||
p^.registersfpu:=p^.left^.registersfpu;
|
||||
@ -1813,13 +1813,13 @@ unit pass_1;
|
||||
if p^.resulttype=nil then
|
||||
p^.resulttype:=voidpointerdef;
|
||||
if (p^.left^.resulttype^.deftype)<>procvardef then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
p^.registers32:=p^.left^.registers32;
|
||||
p^.registersfpu:=p^.left^.registersfpu;
|
||||
@ -1917,7 +1917,7 @@ unit pass_1;
|
||||
|
||||
{ assignements to open arrays aren't allowed }
|
||||
if is_open_array(p^.left^.resulttype) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
{ test if we can avoid copying string to temp
|
||||
as in s:=s+...; (PM) }
|
||||
{$ifdef dummyi386}
|
||||
@ -2053,7 +2053,7 @@ unit pass_1;
|
||||
{$endif SUPPORT_MMX}
|
||||
|
||||
if p^.left^.resulttype^.deftype<>pointerdef then
|
||||
Message(cg_e_invalid_qualifier);
|
||||
CGMessage(cg_e_invalid_qualifier);
|
||||
|
||||
p^.resulttype:=ppointerdef(p^.left^.resulttype)^.definition;
|
||||
p^.location.loc:=LOC_REFERENCE;
|
||||
@ -2072,7 +2072,7 @@ unit pass_1;
|
||||
{ both types must be compatible }
|
||||
if not(is_equal(p^.left^.resulttype,p^.right^.resulttype)) and
|
||||
not(isconvertable(p^.left^.resulttype,p^.right^.resulttype,ct,ordconstn,false)) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
{ Check if only when its a constant set }
|
||||
if (p^.left^.treetype=ordconstn) and (p^.right^.treetype=ordconstn) then
|
||||
begin
|
||||
@ -2080,7 +2080,7 @@ unit pass_1;
|
||||
{ not if u32bit }
|
||||
if (p^.left^.value>p^.right^.value) and
|
||||
(( p^.left^.value<0) or (p^.right^.value>=0)) then
|
||||
Message(cg_e_upper_lower_than_lower);
|
||||
CGMessage(cg_e_upper_lower_than_lower);
|
||||
end;
|
||||
left_right_max(p);
|
||||
p^.resulttype:=p^.left^.resulttype;
|
||||
@ -2109,7 +2109,7 @@ unit pass_1;
|
||||
ct,ordconstn,false)) and
|
||||
not(is_equal(p^.right^.resulttype,
|
||||
parraydef(p^.left^.resulttype)^.rangedef)) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
{ Never convert a boolean or a char !}
|
||||
{ maybe type conversion }
|
||||
@ -2155,7 +2155,7 @@ unit pass_1;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
{ the register calculation is easy if a const index is used }
|
||||
if p^.right^.treetype=ordconstn then
|
||||
begin
|
||||
@ -2450,7 +2450,7 @@ unit pass_1;
|
||||
exit;
|
||||
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
p^.registers32:=p^.left^.registers32;
|
||||
if p^.registers32<1 then
|
||||
@ -2661,7 +2661,7 @@ unit pass_1;
|
||||
firstpass(p^.left);
|
||||
if not is_equal(p^.left^.resulttype,p^.resulttype) then
|
||||
begin
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
exit;
|
||||
end
|
||||
else
|
||||
@ -2701,13 +2701,13 @@ unit pass_1;
|
||||
if not is_equal(aprocdef,p^.resulttype) then
|
||||
begin
|
||||
aprocdef^.deftype:=proctype;
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
aprocdef^.deftype:=proctype;
|
||||
firstconvert[p^.convtyp](p);
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
exit;
|
||||
end
|
||||
else
|
||||
@ -2744,7 +2744,7 @@ unit pass_1;
|
||||
begin
|
||||
if not isconvertable(s32bitdef,p^.resulttype,p^.convtyp,
|
||||
ordconstn { nur Dummy},false ) then
|
||||
Message(cg_e_illegal_type_conversion);
|
||||
CGMessage(cg_e_illegal_type_conversion);
|
||||
end;
|
||||
|
||||
end
|
||||
@ -2765,7 +2765,7 @@ unit pass_1;
|
||||
begin
|
||||
if not isconvertable(p^.left^.resulttype,s32bitdef,p^.convtyp,
|
||||
ordconstn { nur Dummy},false ) then
|
||||
Message(cg_e_illegal_type_conversion);
|
||||
CGMessage(cg_e_illegal_type_conversion);
|
||||
end;
|
||||
end
|
||||
{Are we typecasting an ordconst to a char?}
|
||||
@ -2787,7 +2787,7 @@ unit pass_1;
|
||||
if not isconvertable(p^.left^.resulttype,s32bitdef,p^.convtyp,ordconstn nur Dummy ) then }
|
||||
if not isconvertable(p^.left^.resulttype,u8bitdef,
|
||||
p^.convtyp,ordconstn { nur Dummy},false ) then
|
||||
Message(cg_e_illegal_type_conversion);
|
||||
CGMessage(cg_e_illegal_type_conversion);
|
||||
end;
|
||||
end
|
||||
{ only if the same size or formal def }
|
||||
@ -2799,7 +2799,7 @@ unit pass_1;
|
||||
(is_equal(p^.left^.resulttype,voiddef) and
|
||||
(p^.left^.treetype=derefn))
|
||||
) then
|
||||
Message(cg_e_illegal_type_conversion);
|
||||
CGMessage(cg_e_illegal_type_conversion);
|
||||
{ the conversion into a strutured type is only }
|
||||
{ possible, if the source is no register }
|
||||
if ((p^.resulttype^.deftype in [recorddef,stringdef,arraydef]) or
|
||||
@ -2807,10 +2807,10 @@ unit pass_1;
|
||||
) and (p^.left^.location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
|
||||
{it also works if the assignment is overloaded }
|
||||
not is_assignment_overloaded(p^.left^.resulttype,p^.resulttype) then
|
||||
Message(cg_e_illegal_type_conversion);
|
||||
CGMessage(cg_e_illegal_type_conversion);
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -2849,7 +2849,7 @@ unit pass_1;
|
||||
((sym^.owner^.symtabletype=unitsymtable) or
|
||||
((sym^.owner^.symtabletype=objectsymtable) and
|
||||
(pobjectdef(sym^.owner^.defowner)^.owner^.symtabletype=unitsymtable))) then
|
||||
Message(parser_e_cant_access_protected_member);
|
||||
CGMessage(parser_e_cant_access_protected_member);
|
||||
end;
|
||||
|
||||
procedure test_protected(p : ptree);
|
||||
@ -2968,7 +2968,7 @@ unit pass_1;
|
||||
(pfiledef(p^.left^.resulttype)^.filetype = ft_typed)
|
||||
) and
|
||||
not(is_equal(p^.left^.resulttype,defcoll^.data))) then
|
||||
Message(parser_e_call_by_ref_without_typeconv);
|
||||
CGMessage(parser_e_call_by_ref_without_typeconv);
|
||||
{ don't generate an type conversion for open arrays }
|
||||
{ else we loss the ranges }
|
||||
if not(is_open_array(defcoll^.data)) then
|
||||
@ -2988,7 +2988,7 @@ unit pass_1;
|
||||
is_shortstring(defcoll^.data) and
|
||||
(defcoll^.paratyp=vs_var) and
|
||||
not(is_equal(p^.left^.resulttype,defcoll^.data)) then
|
||||
Message(type_e_strict_var_string_violation);
|
||||
CGMessage(type_e_strict_var_string_violation);
|
||||
{ Variablen, die call by reference <20>bergeben werden, }
|
||||
{ k”nnen nicht in ein Register kopiert werden }
|
||||
{ is this usefull here ? }
|
||||
@ -3123,7 +3123,7 @@ unit pass_1;
|
||||
pdc:=pdc^.next;
|
||||
end;
|
||||
if assigned(pt) or assigned(pdc) then
|
||||
Message(parser_e_illegal_parameter_list);
|
||||
CGMessage(parser_e_illegal_parameter_list);
|
||||
{ insert type conversions }
|
||||
if assigned(p^.left) then
|
||||
begin
|
||||
@ -3221,7 +3221,7 @@ unit pass_1;
|
||||
if not assigned(procs) and
|
||||
((parsing_para_level=0) or assigned(p^.left)) then
|
||||
begin
|
||||
Message(parser_e_wrong_parameter_size);
|
||||
CGMessage(parser_e_wrong_parameter_size);
|
||||
actprocsym^.write_parameter_lists;
|
||||
exit;
|
||||
end;
|
||||
@ -3320,7 +3320,7 @@ unit pass_1;
|
||||
wrong size is already checked (PFV) }
|
||||
if (parsing_para_level=0) or (p^.left<>nil) then
|
||||
begin
|
||||
Message(parser_e_wrong_parameter_type);
|
||||
CGMessage(parser_e_wrong_parameter_type);
|
||||
actprocsym^.write_parameter_lists;
|
||||
exit;
|
||||
end
|
||||
@ -3447,7 +3447,7 @@ unit pass_1;
|
||||
{$ifndef CHAINPROCSYMS}
|
||||
if assigned(procs^.next) then
|
||||
begin
|
||||
Message(cg_e_cant_choose_overload_function);
|
||||
CGMessage(cg_e_cant_choose_overload_function);
|
||||
actprocsym^.write_parameter_lists;
|
||||
end;
|
||||
{$else CHAINPROCSYMS}
|
||||
@ -3475,7 +3475,7 @@ unit pass_1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Message(cg_e_cant_choose_overload_function);
|
||||
CGMessage(cg_e_cant_choose_overload_function);
|
||||
actprocsym^.write_parameter_lists;
|
||||
error(too_much_matches);
|
||||
end;
|
||||
@ -3540,16 +3540,16 @@ unit pass_1;
|
||||
if (p^.procdefinition^.options and poinline)<>0 then
|
||||
begin
|
||||
if assigned(p^.methodpointer) then
|
||||
Message(cg_e_unable_inline_object_methods);
|
||||
CGMessage(cg_e_unable_inline_object_methods);
|
||||
if assigned(p^.right) and (p^.right^.treetype<>procinlinen) then
|
||||
Message(cg_e_unable_inline_procvar);
|
||||
CGMessage(cg_e_unable_inline_procvar);
|
||||
{ p^.treetype:=procinlinen; }
|
||||
if not assigned(p^.right) then
|
||||
begin
|
||||
if assigned(p^.procdefinition^.code) then
|
||||
inlinecode:=genprocinlinenode(p,ptree(p^.procdefinition^.code))
|
||||
else
|
||||
Message(cg_e_no_code_for_inline_stored);
|
||||
CGMessage(cg_e_no_code_for_inline_stored);
|
||||
if assigned(inlinecode) then
|
||||
begin
|
||||
{ consider it has not inlined if called
|
||||
@ -3703,7 +3703,7 @@ unit pass_1;
|
||||
if must_be_valid and
|
||||
(@procinfo=pprocinfo(p^.funcretprocinfo)) and
|
||||
not procinfo.funcret_is_valid then
|
||||
Message(sym_w_function_result_not_set);
|
||||
CGMessage(sym_w_function_result_not_set);
|
||||
if count_ref then
|
||||
pprocinfo(p^.funcretprocinfo)^.funcret_is_valid:=true;
|
||||
end;
|
||||
@ -3819,25 +3819,25 @@ unit pass_1;
|
||||
end;
|
||||
in_const_odd : begin
|
||||
if isreal then
|
||||
Message(type_e_integer_expr_expected)
|
||||
CGMessage(type_e_integer_expr_expected)
|
||||
else
|
||||
hp:=genordinalconstnode(byte(odd(vl)),booldef);
|
||||
end;
|
||||
in_const_swap_word : begin
|
||||
if isreal then
|
||||
Message(type_e_integer_expr_expected)
|
||||
CGMessage(type_e_integer_expr_expected)
|
||||
else
|
||||
hp:=genordinalconstnode((vl and $ff) shl 8+(vl shr 8),p^.left^.resulttype);
|
||||
end;
|
||||
in_const_swap_long : begin
|
||||
if isreal then
|
||||
Message(type_e_mismatch)
|
||||
CGMessage(type_e_mismatch)
|
||||
else
|
||||
hp:=genordinalconstnode((vl and $ffff) shl 16+(vl shr 16),p^.left^.resulttype);
|
||||
end;
|
||||
in_const_ptr : begin
|
||||
if isreal then
|
||||
Message(type_e_mismatch)
|
||||
CGMessage(type_e_mismatch)
|
||||
else
|
||||
hp:=genordinalconstnode(vl,voidpointerdef);
|
||||
end;
|
||||
@ -3862,7 +3862,7 @@ unit pass_1;
|
||||
p^.resulttype:=u16bitdef;
|
||||
p^.location.loc:=LOC_REGISTER;
|
||||
if not is_integer(p^.left^.resulttype) then
|
||||
Message(type_e_mismatch)
|
||||
CGMessage(type_e_mismatch)
|
||||
else
|
||||
begin
|
||||
if p^.left^.treetype=ordconstn then
|
||||
@ -3927,7 +3927,7 @@ unit pass_1;
|
||||
end
|
||||
{ can this happen ? }
|
||||
else if (porddef(p^.left^.resulttype)^.typ=uvoid) then
|
||||
Message(type_e_mismatch)
|
||||
CGMessage(type_e_mismatch)
|
||||
else
|
||||
{ all other orddef need no transformation }
|
||||
begin
|
||||
@ -3946,7 +3946,7 @@ unit pass_1;
|
||||
else
|
||||
begin
|
||||
{ can anything else be ord() ?}
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -4000,12 +4000,12 @@ unit pass_1;
|
||||
p^.resulttype:=p^.left^.resulttype;
|
||||
p^.location.loc:=LOC_REGISTER;
|
||||
if not is_ordinal(p^.resulttype) then
|
||||
Message(type_e_ordinal_expr_expected)
|
||||
CGMessage(type_e_ordinal_expr_expected)
|
||||
else
|
||||
begin
|
||||
if (p^.resulttype^.deftype=enumdef) and
|
||||
(penumdef(p^.resulttype)^.has_jumps) then
|
||||
Message(type_e_succ_and_pred_enums_with_assign_not_possible)
|
||||
CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible)
|
||||
else
|
||||
if p^.left^.treetype=ordconstn then
|
||||
begin
|
||||
@ -4030,7 +4030,7 @@ unit pass_1;
|
||||
exit;
|
||||
{ first param must be var }
|
||||
if is_constnode(p^.left^.left) then
|
||||
Message(type_e_variable_id_expected);
|
||||
CGMessage(type_e_variable_id_expected);
|
||||
{ check type }
|
||||
if (p^.left^.resulttype^.deftype in [enumdef,pointerdef]) or
|
||||
is_ordinal(p^.left^.resulttype) then
|
||||
@ -4051,14 +4051,14 @@ unit pass_1;
|
||||
inc(p^.registers32);
|
||||
|
||||
if assigned(p^.left^.right^.right) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Message(type_e_ordinal_expr_expected);
|
||||
CGMessage(type_e_ordinal_expr_expected);
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
in_read_x,
|
||||
in_readln_x,
|
||||
@ -4091,9 +4091,9 @@ unit pass_1;
|
||||
while (hpp<>hp) do
|
||||
begin
|
||||
if (hpp^.left^.treetype=typen) then
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
if not is_equal(hpp^.resulttype,pfiledef(hp^.resulttype)^.typed_as) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
hpp:=hpp^.right;
|
||||
end;
|
||||
end;
|
||||
@ -4107,7 +4107,7 @@ unit pass_1;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
if (hp^.left^.treetype=typen) then
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
if assigned(hp^.left^.resulttype) then
|
||||
begin
|
||||
isreal:=false;
|
||||
@ -4115,12 +4115,12 @@ unit pass_1;
|
||||
filedef : begin
|
||||
{ only allowed as first parameter }
|
||||
if assigned(hp^.right) then
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
end;
|
||||
stringdef : ;
|
||||
pointerdef : begin
|
||||
if not is_equal(ppointerdef(hp^.left^.resulttype)^.definition,cchardef) then
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
end;
|
||||
floatdef : begin
|
||||
isreal:=true;
|
||||
@ -4136,9 +4136,9 @@ unit pass_1;
|
||||
bool16bit,bool32bit : if dowrite then
|
||||
hp^.left:=gentypeconvnode(hp^.left,booldef)
|
||||
else
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
else
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
end;
|
||||
end;
|
||||
arraydef : begin
|
||||
@ -4153,11 +4153,11 @@ unit pass_1;
|
||||
(porddef(parraydef(hp^.left^.resulttype)^.definition)^.typ=uchar) then
|
||||
hp^.left:=gentypeconvnode(hp^.left,cstringdef)
|
||||
else
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Message(type_e_cant_read_write_type);
|
||||
CGMessage(type_e_cant_read_write_type);
|
||||
end;
|
||||
|
||||
{ some format options ? }
|
||||
@ -4168,7 +4168,7 @@ unit pass_1;
|
||||
if assigned(hpp) and hpp^.is_colon_para then
|
||||
begin
|
||||
if (not is_integer(hpp^.resulttype)) then
|
||||
Message(type_e_integer_expr_expected)
|
||||
CGMessage(type_e_integer_expr_expected)
|
||||
else
|
||||
hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
|
||||
hpp:=hpp^.right;
|
||||
@ -4177,12 +4177,12 @@ unit pass_1;
|
||||
if isreal then
|
||||
begin
|
||||
if (not is_integer(hpp^.resulttype)) then
|
||||
Message(type_e_integer_expr_expected)
|
||||
CGMessage(type_e_integer_expr_expected)
|
||||
else
|
||||
hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
|
||||
end
|
||||
else
|
||||
Message(parser_e_illegal_colon_qualifier);
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
end;
|
||||
end; *)
|
||||
|
||||
@ -4246,14 +4246,14 @@ unit pass_1;
|
||||
(hp^.left^.resulttype^.deftype<>stringdef) or
|
||||
(hp^.right=nil) or
|
||||
(hp^.left^.location.loc<>LOC_REFERENCE) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
{ !!!! check length of string }
|
||||
|
||||
while assigned(hp^.right) do
|
||||
hp:=hp^.right;
|
||||
{ check and convert the first param }
|
||||
if hp^.is_colon_para then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
isreal:=false;
|
||||
case hp^.resulttype^.deftype of
|
||||
@ -4263,14 +4263,14 @@ unit pass_1;
|
||||
u8bit,s8bit,
|
||||
u16bit,s16bit : hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
|
||||
else
|
||||
Message(type_e_integer_or_real_expr_expected);
|
||||
CGMessage(type_e_integer_or_real_expr_expected);
|
||||
end;
|
||||
end;
|
||||
floatdef : begin
|
||||
isreal:=true;
|
||||
end;
|
||||
else
|
||||
Message(type_e_integer_or_real_expr_expected);
|
||||
CGMessage(type_e_integer_or_real_expr_expected);
|
||||
end;
|
||||
|
||||
{ some format options ? }
|
||||
@ -4278,7 +4278,7 @@ unit pass_1;
|
||||
if assigned(hpp) and hpp^.is_colon_para then
|
||||
begin
|
||||
if (not is_integer(hpp^.resulttype)) then
|
||||
Message(type_e_integer_expr_expected)
|
||||
CGMessage(type_e_integer_expr_expected)
|
||||
else
|
||||
hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
|
||||
hpp:=hpp^.right;
|
||||
@ -4287,12 +4287,12 @@ unit pass_1;
|
||||
if isreal then
|
||||
begin
|
||||
if (not is_integer(hpp^.resulttype)) then
|
||||
Message(type_e_integer_expr_expected)
|
||||
CGMessage(type_e_integer_expr_expected)
|
||||
else
|
||||
hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
|
||||
end
|
||||
else
|
||||
Message(parser_e_illegal_colon_qualifier);
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -4301,7 +4301,7 @@ unit pass_1;
|
||||
count_ref:=true;
|
||||
end
|
||||
else
|
||||
Message(parser_e_illegal_parameter_list);
|
||||
CGMessage(parser_e_illegal_parameter_list);
|
||||
{ pass all parameters again for the typeconversions }
|
||||
if codegenerror then
|
||||
exit;
|
||||
@ -4325,7 +4325,7 @@ unit pass_1;
|
||||
{ first param must be var }
|
||||
if (p^.left^.left^.location.loc<>LOC_REFERENCE) and
|
||||
(p^.left^.left^.location.loc<>LOC_CREGISTER) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
{ check type }
|
||||
if (p^.left^.resulttype^.deftype=setdef) then
|
||||
begin
|
||||
@ -4341,14 +4341,14 @@ unit pass_1;
|
||||
firstpass(p^.left^.right^.left);
|
||||
{ only three parameters are allowed }
|
||||
if assigned(p^.left^.right^.right) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
in_low_x,in_high_x:
|
||||
begin
|
||||
@ -4406,11 +4406,11 @@ unit pass_1;
|
||||
firstpass(p);
|
||||
end;
|
||||
else
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Message(type_e_varid_or_typeid_expected);
|
||||
CGMessage(type_e_varid_or_typeid_expected);
|
||||
end
|
||||
else internalerror(8);
|
||||
end;
|
||||
@ -4433,7 +4433,7 @@ unit pass_1;
|
||||
{ this must be done in the parser
|
||||
if count_ref and not must_be_valid then
|
||||
if (p^.vs^.properties and sp_protected)<>0 then
|
||||
Message(parser_e_cant_write_protected_member);
|
||||
CGMessage(parser_e_cant_write_protected_member);
|
||||
}
|
||||
p^.registers32:=p^.left^.registers32;
|
||||
p^.registersfpu:=p^.left^.registersfpu;
|
||||
@ -4452,7 +4452,7 @@ unit pass_1;
|
||||
begin
|
||||
if (p^.left^.location.loc<>LOC_MEM) and
|
||||
(p^.left^.location.loc<>LOC_REFERENCE) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
set_location(p^.location,p^.left^.location);
|
||||
end;
|
||||
end;
|
||||
@ -4499,7 +4499,7 @@ unit pass_1;
|
||||
p^.registers32:=1;
|
||||
{
|
||||
if p^.left^.location.loc<>LOC_REFERENCE then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
}
|
||||
p^.location.loc:=LOC_REFERENCE;
|
||||
p^.resulttype:=ppointerdef(p^.left^.resulttype)^.definition;
|
||||
@ -4533,11 +4533,11 @@ unit pass_1;
|
||||
|
||||
{ check the type }
|
||||
if (p^.left^.resulttype=nil) or (p^.left^.resulttype^.deftype<>pointerdef) then
|
||||
Message(type_e_pointer_type_expected);
|
||||
CGMessage(type_e_pointer_type_expected);
|
||||
|
||||
if (p^.left^.location.loc<>LOC_REFERENCE) {and
|
||||
(p^.left^.location.loc<>LOC_CREGISTER)} then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
p^.registers32:=p^.left^.registers32;
|
||||
p^.registersfpu:=p^.left^.registersfpu;
|
||||
@ -4585,7 +4585,7 @@ unit pass_1;
|
||||
exit;
|
||||
|
||||
if p^.right^.resulttype^.deftype<>setdef then
|
||||
Message(sym_e_set_expected);
|
||||
CGMessage(sym_e_set_expected);
|
||||
|
||||
firstpass(p^.left);
|
||||
if codegenerror then
|
||||
@ -4625,7 +4625,7 @@ unit pass_1;
|
||||
if (not (cs_extsyntax in aktmoduleswitches)) and
|
||||
assigned(p^.right^.resulttype) and
|
||||
(p^.right^.resulttype<>pdef(voiddef)) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
if codegenerror then
|
||||
exit;
|
||||
p^.registers32:=p^.right^.registers32;
|
||||
@ -4673,7 +4673,7 @@ unit pass_1;
|
||||
(hp^.right^.left^.treetype=funcretn) then
|
||||
begin
|
||||
if assigned(hp^.left^.right^.left) then
|
||||
Message(cg_n_inefficient_code)
|
||||
CGMessage(cg_n_inefficient_code)
|
||||
else
|
||||
begin
|
||||
hp^.left^.right^.left:=getcopy(hp^.right^.right);
|
||||
@ -4691,7 +4691,7 @@ unit pass_1;
|
||||
aktfilepos:=hp^.left^.fileinfo;
|
||||
disposetree(hp^.left);
|
||||
hp^.left:=nil;
|
||||
Message(cg_w_unreachable_code);
|
||||
CGMessage(cg_w_unreachable_code);
|
||||
{ old lines }
|
||||
aktfilepos:=hp^.right^.fileinfo;
|
||||
end;
|
||||
@ -4703,7 +4703,7 @@ unit pass_1;
|
||||
if (not (cs_extsyntax in aktmoduleswitches)) and
|
||||
assigned(hp^.right^.resulttype) and
|
||||
(hp^.right^.resulttype<>pdef(voiddef)) then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
@ -4750,7 +4750,7 @@ unit pass_1;
|
||||
if not((p^.left^.resulttype^.deftype=orddef) and
|
||||
(porddef(p^.left^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) then
|
||||
begin
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -4798,7 +4798,7 @@ unit pass_1;
|
||||
if not((p^.left^.resulttype^.deftype=orddef) and
|
||||
(porddef(p^.left^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) then
|
||||
begin
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -4936,17 +4936,17 @@ unit pass_1;
|
||||
{$endif SUPPORT_MMX}
|
||||
|
||||
if p^.left^.treetype<>assignn then
|
||||
Message(cg_e_illegal_expression);
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
|
||||
{ Laufvariable retten }
|
||||
p^.t2:=getcopy(p^.left^.left);
|
||||
|
||||
{ Check count var }
|
||||
if (p^.t2^.treetype<>loadn) then
|
||||
Message(cg_e_illegal_count_var);
|
||||
CGMessage(cg_e_illegal_count_var);
|
||||
|
||||
if (not(is_ordinal(p^.t2^.resulttype))) then
|
||||
Message(type_e_ordinal_expr_expected);
|
||||
CGMessage(type_e_ordinal_expr_expected);
|
||||
|
||||
cleartempgen;
|
||||
must_be_valid:=false;
|
||||
@ -5150,7 +5150,7 @@ unit pass_1;
|
||||
firstpass(p^.right);
|
||||
|
||||
if (p^.right^.resulttype^.deftype<>classrefdef) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
@ -5159,14 +5159,14 @@ unit pass_1;
|
||||
{ left must be a class }
|
||||
if (p^.left^.resulttype^.deftype<>objectdef) or
|
||||
not(pobjectdef(p^.left^.resulttype)^.isclass) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
{ the operands must be related }
|
||||
if (not(pobjectdef(p^.left^.resulttype)^.isrelated(
|
||||
pobjectdef(pclassrefdef(p^.right^.resulttype)^.definition)))) and
|
||||
(not(pobjectdef(pclassrefdef(p^.right^.resulttype)^.definition)^.isrelated(
|
||||
pobjectdef(p^.left^.resulttype)))) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
p^.location.loc:=LOC_FLAGS;
|
||||
p^.resulttype:=booldef;
|
||||
@ -5178,7 +5178,7 @@ unit pass_1;
|
||||
firstpass(p^.right);
|
||||
firstpass(p^.left);
|
||||
if (p^.right^.resulttype^.deftype<>classrefdef) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
if codegenerror then
|
||||
exit;
|
||||
@ -5188,14 +5188,14 @@ unit pass_1;
|
||||
{ left must be a class }
|
||||
if (p^.left^.resulttype^.deftype<>objectdef) or
|
||||
not(pobjectdef(p^.left^.resulttype)^.isclass) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
{ the operands must be related }
|
||||
if (not(pobjectdef(p^.left^.resulttype)^.isrelated(
|
||||
pobjectdef(pclassrefdef(p^.right^.resulttype)^.definition)))) and
|
||||
(not(pobjectdef(pclassrefdef(p^.right^.resulttype)^.definition)^.isrelated(
|
||||
pobjectdef(p^.left^.resulttype)))) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
p^.location:=p^.left^.location;
|
||||
p^.resulttype:=pclassrefdef(p^.right^.resulttype)^.definition;
|
||||
@ -5226,7 +5226,7 @@ unit pass_1;
|
||||
{ this must be a _class_ }
|
||||
if (p^.left^.resulttype^.deftype<>objectdef) or
|
||||
((pobjectdef(p^.left^.resulttype)^.options and oois_class)=0) then
|
||||
Message(type_e_mismatch);
|
||||
CGMessage(type_e_mismatch);
|
||||
|
||||
p^.registersfpu:=p^.left^.registersfpu;
|
||||
p^.registers32:=p^.left^.registers32;
|
||||
@ -5502,7 +5502,11 @@ unit pass_1;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.84 1998-09-16 01:06:17 carl
|
||||
Revision 1.85 1998-09-17 09:42:38 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.84 1998/09/16 01:06:17 carl
|
||||
* bugfix of crash with firstaddr on valid code!
|
||||
|
||||
Revision 1.83 1998/09/11 15:40:21 pierre
|
||||
@ -5558,13 +5562,13 @@ end.
|
||||
* problem with -Or fixed
|
||||
|
||||
Revision 1.70 1998/09/04 08:42:00 peter
|
||||
* updated some error messages
|
||||
* updated some error CGMessages
|
||||
|
||||
Revision 1.69 1998/09/01 17:39:47 peter
|
||||
+ internal constant functions
|
||||
|
||||
Revision 1.68 1998/09/01 09:02:52 peter
|
||||
* moved message() to hcodegen, so pass_2 also uses them
|
||||
* moved CGMessage() to hcodegen, so pass_2 also uses them
|
||||
|
||||
Revision 1.67 1998/09/01 07:54:20 pierre
|
||||
* UseBrowser a little updated (might still be buggy !!)
|
||||
@ -5673,7 +5677,7 @@ end.
|
||||
+ switch $H partial implemented
|
||||
|
||||
Revision 1.39 1998/07/14 21:46:47 peter
|
||||
* updated messages file
|
||||
* updated CGMessages file
|
||||
|
||||
Revision 1.38 1998/07/14 14:46:50 peter
|
||||
* released NEWINPUT
|
||||
|
||||
@ -108,12 +108,12 @@ implementation
|
||||
exprasmlist^.concatlist(p^.p_asm);
|
||||
if not p^.object_preserved then
|
||||
begin
|
||||
{$ifdef i386}
|
||||
{$ifdef i386}
|
||||
maybe_loadesi;
|
||||
{$endif}
|
||||
{$ifdef m68k}
|
||||
maybe_loada5;
|
||||
{$endif}
|
||||
{$endif}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -215,7 +215,7 @@ implementation
|
||||
codegenerror:=false;
|
||||
procedures[p^.treetype](p);
|
||||
p^.error:=codegenerror;
|
||||
|
||||
|
||||
codegenerror:=codegenerror or oldcodegenerror;
|
||||
aktlocalswitches:=oldlocalswitches;
|
||||
aktfilepos:=oldpos;
|
||||
@ -290,7 +290,6 @@ implementation
|
||||
var
|
||||
i : longint;
|
||||
regsize : topsize;
|
||||
regi : tregister;
|
||||
hr : preference;
|
||||
label
|
||||
nextreg;
|
||||
@ -388,22 +387,31 @@ implementation
|
||||
dec(c_usableregs);
|
||||
|
||||
{ possibly no 32 bit register are needed }
|
||||
if (regvars[i]^.definition^.deftype=orddef) and
|
||||
{ call by reference/const ? }
|
||||
if (regvars[i]^.varspez=vs_var) or
|
||||
((regvars[i]^.varspez=vs_const) and
|
||||
dont_copy_const_param(regvars[i]^.definition)) then
|
||||
begin
|
||||
regvars[i]^.reg:=varregs[i];
|
||||
regsize:=S_L;
|
||||
end
|
||||
else
|
||||
if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.typ in [bool8bit,uchar,u8bit,s8bit]) then
|
||||
begin
|
||||
{$ifdef i386}
|
||||
{$ifdef i386}
|
||||
|
||||
regvars[i]^.reg:=reg32toreg8(varregs[i]);
|
||||
{$endif}
|
||||
{$endif}
|
||||
regsize:=S_B;
|
||||
end
|
||||
else if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.typ in [bool16bit,u16bit,s16bit]) then
|
||||
begin
|
||||
{$ifdef i386}
|
||||
{$ifdef i386}
|
||||
|
||||
regvars[i]^.reg:=reg32toreg16(varregs[i]);
|
||||
{$endif}
|
||||
{$endif}
|
||||
regsize:=S_W;
|
||||
end
|
||||
else
|
||||
@ -429,7 +437,7 @@ implementation
|
||||
{$ifdef m68k}
|
||||
procinfo.aktentrycode^.concat(new(pai68k,op_ref_reg(A_MOVE,regsize,
|
||||
hr,regvars[i]^.reg)));
|
||||
{$endif m68k}
|
||||
{$endif m68k}
|
||||
|
||||
unused:=unused - [regvars[i]^.reg];
|
||||
end;
|
||||
@ -439,7 +447,7 @@ implementation
|
||||
{$endif i386}
|
||||
{$ifdef m68k}
|
||||
usedinproc:=usedinproc or ($800 shr word(varregs[i]));
|
||||
{$endif m68k}
|
||||
{$endif m68k}
|
||||
|
||||
end;
|
||||
nextreg:
|
||||
@ -475,7 +483,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-09-07 18:46:07 peter
|
||||
Revision 1.3 1998-09-17 09:42:40 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.2 1998/09/07 18:46:07 peter
|
||||
* update smartlinking, uses getdatalabel
|
||||
* renamed ptree.value vars to value_str,value_real,value_set
|
||||
|
||||
|
||||
@ -114,6 +114,7 @@ uses
|
||||
{$O globals}
|
||||
{$O hcodegen}
|
||||
{$O pass_1}
|
||||
{$O pass_2}
|
||||
{$O tree}
|
||||
{$O types}
|
||||
{$O objects}
|
||||
@ -153,45 +154,66 @@ uses
|
||||
{$endif gdb}
|
||||
{$ifdef i386}
|
||||
{$O opts386}
|
||||
{$O cgi386}
|
||||
{$O i386}
|
||||
{$O cgai386}
|
||||
{$O tgeni386}
|
||||
{$O cg386add}
|
||||
{$O cg386cal}
|
||||
{$O cg386cnv}
|
||||
{$O cg386con}
|
||||
{$O cg386flw}
|
||||
{$O cg386ld}
|
||||
{$O cg386inl}
|
||||
{$O cg386mat}
|
||||
{$O cg386set}
|
||||
{$ifndef NOOPT}
|
||||
{$O aopt386}
|
||||
{$endif NOOPT}
|
||||
{$O cgai386}
|
||||
{$O i386}
|
||||
{$IfNDef Nora386dir}
|
||||
{$O ra386dir}
|
||||
{$endif Nora386dir}
|
||||
{$IfNDef Nora386int}
|
||||
{$O ra386int}
|
||||
{$endif Nora386int}
|
||||
{$IfNDef Nora386att}
|
||||
{$O ra386att}
|
||||
{$endif Nora386att}
|
||||
{$O tgeni386}
|
||||
{$ifndef NoAg386Int}
|
||||
{$O ag386int}
|
||||
{$endif NoAg386Int}
|
||||
{$O ag386att}
|
||||
{$ifndef NoAg386Nsm}
|
||||
{$O ag386nsm}
|
||||
{$endif}
|
||||
{$ifndef NOOPT}
|
||||
{$O aopt386}
|
||||
{$endif}
|
||||
{$IfNDef Nora386dir}
|
||||
{$O ra386dir}
|
||||
{$endif}
|
||||
{$IfNDef Nora386int}
|
||||
{$O ra386int}
|
||||
{$endif}
|
||||
{$IfNDef Nora386att}
|
||||
{$O ra386att}
|
||||
{$endif}
|
||||
{$ifndef NoAg386Int}
|
||||
{$O ag386int}
|
||||
{$endif}
|
||||
{$ifndef NoAg386Att}
|
||||
{$O ag386att}
|
||||
{$endif}
|
||||
{$ifndef NoAg386Nsm}
|
||||
{$O ag386nsm}
|
||||
{$endif}
|
||||
{$endif}
|
||||
{$ifdef m68k}
|
||||
{$O opts68k}
|
||||
{$O cg68k}
|
||||
{$O ra68kmot}
|
||||
{$O ag68kgas}
|
||||
{$O ag68kmot}
|
||||
{$O ag68kmit}
|
||||
{$O m68k}
|
||||
{$O cga68k}
|
||||
{$O tgen68k}
|
||||
{$O cg68kadd}
|
||||
{$O cg68kcal}
|
||||
{$O cg68kcnv}
|
||||
{$O cg68kcon}
|
||||
{$O cg68kflw}
|
||||
{$O cg68kld}
|
||||
{$O cg68kinl}
|
||||
{$O cg68kmat}
|
||||
{$O cg68kset}
|
||||
{$IfNDef Nora68kMot}
|
||||
{$O ra68kmot}
|
||||
{$endif}
|
||||
{$IfNDef Noag68kGas}
|
||||
{$O ag68kgas}
|
||||
{$endif}
|
||||
{$IfNDef Noag68kMot}
|
||||
{$O ag68kmot}
|
||||
{$endif}
|
||||
{$IfNDef Noag68kMit}
|
||||
{$O ag68kmit}
|
||||
{$endif}
|
||||
{$endif}
|
||||
{$endif useoverlay}
|
||||
|
||||
@ -234,7 +256,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 1998-08-26 15:31:17 peter
|
||||
Revision 1.29 1998-09-17 09:42:41 peter
|
||||
+ pass_2 for cg386
|
||||
* Message() -> CGMessage() for pass_1/pass_2
|
||||
|
||||
Revision 1.28 1998/08/26 15:31:17 peter
|
||||
* heapblocks for >0.99.5
|
||||
|
||||
Revision 1.27 1998/08/11 00:00:00 peter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user