mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:29:14 +02:00
+ leal procsym,eax is now allowed
+ constants are now handled also when starting an expression + call *pointer is now allowed
This commit is contained in:
parent
3a46ae8390
commit
e06ac8e64f
@ -964,50 +964,50 @@ end;
|
|||||||
SearchIConstant := FALSE;
|
SearchIConstant := FALSE;
|
||||||
{ check for TRUE or FALSE reserved words first }
|
{ check for TRUE or FALSE reserved words first }
|
||||||
if s = 'TRUE' then
|
if s = 'TRUE' then
|
||||||
Begin
|
Begin
|
||||||
SearchIConstant := TRUE;
|
SearchIConstant := TRUE;
|
||||||
l := 1;
|
l := 1;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if s = 'FALSE' then
|
if s = 'FALSE' then
|
||||||
Begin
|
|
||||||
SearchIConstant := TRUE;
|
|
||||||
l := 0;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if assigned(aktprocsym) then
|
|
||||||
Begin
|
|
||||||
if assigned(aktprocsym^.definition) then
|
|
||||||
Begin
|
Begin
|
||||||
{ Check the local constants }
|
SearchIConstant := TRUE;
|
||||||
if assigned(aktprocsym^.definition^.localst) then
|
l := 0;
|
||||||
sym := aktprocsym^.definition^.localst^.search(s)
|
end
|
||||||
else
|
else
|
||||||
sym := nil;
|
if assigned(aktprocsym) then
|
||||||
if assigned(sym) then
|
Begin
|
||||||
Begin
|
if assigned(aktprocsym^.definition) then
|
||||||
if (sym^.typ = constsym) and (pconstsym(sym)^.consttype in
|
Begin
|
||||||
[constord,constint,constchar,constbool]) then
|
{ Check the local constants }
|
||||||
Begin
|
if assigned(aktprocsym^.definition^.localst) then
|
||||||
l:=pconstsym(sym)^.value;
|
sym := aktprocsym^.definition^.localst^.search(s)
|
||||||
SearchIConstant := TRUE;
|
else
|
||||||
exit;
|
sym := nil;
|
||||||
end;
|
if assigned(sym) then
|
||||||
end;
|
Begin
|
||||||
|
if (sym^.typ = constsym) and
|
||||||
|
(pconstsym(sym)^.consttype in [constord,constint,constchar,constbool]) then
|
||||||
|
Begin
|
||||||
|
l:=pconstsym(sym)^.value;
|
||||||
|
SearchIConstant := TRUE;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
{ Check the global constants }
|
{ Check the global constants }
|
||||||
getsym(s,false);
|
getsym(s,false);
|
||||||
if srsym <> nil then
|
if srsym <> nil then
|
||||||
Begin
|
Begin
|
||||||
if (srsym^.typ=constsym) and (pconstsym(srsym)^.consttype in
|
if (srsym^.typ=constsym) and
|
||||||
[constord,constint,constchar,constbool]) then
|
(pconstsym(srsym)^.consttype in [constord,constint,constchar,constbool]) then
|
||||||
Begin
|
Begin
|
||||||
l:=pconstsym(srsym)^.value;
|
l:=pconstsym(srsym)^.value;
|
||||||
SearchIConstant := TRUE;
|
SearchIConstant := TRUE;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1521,10 +1521,19 @@ end;
|
|||||||
instr.operands[operandnum].size := S_NO;
|
instr.operands[operandnum].size := S_NO;
|
||||||
end; { end case }
|
end; { end case }
|
||||||
end;
|
end;
|
||||||
{ ok, finished for thir variable. }
|
{ ok, finished for this var }
|
||||||
CreateVarInstr := TRUE;
|
CreateVarInstr := TRUE;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
constsym : begin
|
||||||
|
if pconstsym(sym)^.consttype in [constint,constchar,constbool] then
|
||||||
|
begin
|
||||||
|
instr.operands[operandnum].operandtype:=OPR_CONSTANT;
|
||||||
|
instr.operands[operandnum].val:=pconstsym(sym)^.value;
|
||||||
|
CreateVarInstr := TRUE;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
procsym : begin
|
procsym : begin
|
||||||
{ free the memory before changing the symbol name. }
|
{ free the memory before changing the symbol name. }
|
||||||
if assigned(instr.operands[operandnum].ref.symbol) then
|
if assigned(instr.operands[operandnum].ref.symbol) then
|
||||||
@ -1596,8 +1605,7 @@ end;
|
|||||||
typedconstsym : Begin
|
typedconstsym : Begin
|
||||||
{ free the memory before changing the symbol name. }
|
{ free the memory before changing the symbol name. }
|
||||||
if assigned(instr.operands[operandnum].ref.symbol) then
|
if assigned(instr.operands[operandnum].ref.symbol) then
|
||||||
FreeMem(instr.operands[operandnum].ref.symbol,
|
FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
|
||||||
length(instr.operands[operandnum].ref.symbol^)+1);
|
|
||||||
instr.operands[operandnum].ref.symbol:=newpasstr(sym^.mangledname);
|
instr.operands[operandnum].ref.symbol:=newpasstr(sym^.mangledname);
|
||||||
{ the current size is NOT overriden if it already }
|
{ the current size is NOT overriden if it already }
|
||||||
{ exists, such as in the case of a byte ptr, in }
|
{ exists, such as in the case of a byte ptr, in }
|
||||||
@ -1636,6 +1644,15 @@ end;
|
|||||||
CreateVarInstr := TRUE;
|
CreateVarInstr := TRUE;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
constsym : begin
|
||||||
|
if pconstsym(sym)^.consttype in [constint,constchar,constbool] then
|
||||||
|
begin
|
||||||
|
instr.operands[operandnum].operandtype:=OPR_CONSTANT;
|
||||||
|
instr.operands[operandnum].val:=pconstsym(sym)^.value;
|
||||||
|
CreateVarInstr := TRUE;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
procsym : begin
|
procsym : begin
|
||||||
if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
|
if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
|
||||||
Message(assem_w_calling_overload_func);
|
Message(assem_w_calling_overload_func);
|
||||||
@ -1643,6 +1660,7 @@ end;
|
|||||||
if assigned(instr.operands[operandnum].ref.symbol) then
|
if assigned(instr.operands[operandnum].ref.symbol) then
|
||||||
FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
|
FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
|
||||||
instr.operands[operandnum].operandtype:=OPR_SYMBOL;
|
instr.operands[operandnum].operandtype:=OPR_SYMBOL;
|
||||||
|
instr.operands[operandnum].size:=S_L;
|
||||||
instr.operands[operandnum].symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);
|
instr.operands[operandnum].symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);
|
||||||
CreateVarInstr := TRUE;
|
CreateVarInstr := TRUE;
|
||||||
Exit;
|
Exit;
|
||||||
@ -1884,7 +1902,12 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.12 1998-10-14 11:28:13 florian
|
Revision 1.13 1998-10-28 00:08:45 peter
|
||||||
|
+ leal procsym,eax is now allowed
|
||||||
|
+ constants are now handled also when starting an expression
|
||||||
|
+ call *pointer is now allowed
|
||||||
|
|
||||||
|
Revision 1.12 1998/10/14 11:28:13 florian
|
||||||
* emitpushreferenceaddress gets now the asmlist as parameter
|
* emitpushreferenceaddress gets now the asmlist as parameter
|
||||||
* m68k version compiles with -duseansistrings
|
* m68k version compiles with -duseansistrings
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ unit i386;
|
|||||||
(i : A_IN;ops : 2;oc : $ec;eb : ao_none;m : af_w or NoModrm;o1 : ao_inoutportreg;o2 : ao_acc;o3 : 0 ),
|
(i : A_IN;ops : 2;oc : $ec;eb : ao_none;m : af_w or NoModrm;o1 : ao_inoutportreg;o2 : ao_acc;o3 : 0 ),
|
||||||
(i : A_OUT;ops : 2;oc : $e6;eb : ao_none;m : af_w or NoModrm;o1 : ao_acc;o2 : ao_imm8;o3 : 0 ),
|
(i : A_OUT;ops : 2;oc : $e6;eb : ao_none;m : af_w or NoModrm;o1 : ao_acc;o2 : ao_imm8;o3 : 0 ),
|
||||||
(i : A_OUT;ops : 2;oc : $ee;eb : ao_none;m : af_w or NoModrm;o1 : ao_acc;o2 : ao_inoutportreg;o3 : 0 ),
|
(i : A_OUT;ops : 2;oc : $ee;eb : ao_none;m : af_w or NoModrm;o1 : ao_acc;o2 : ao_inoutportreg;o3 : 0 ),
|
||||||
(i : A_LEA;ops : 2;oc : $8d;eb : ao_none;m : Modrm;o1 : ao_wordmem;o2 : ao_wordreg;o3 : 0 ),
|
(i : A_LEA;ops : 2;oc : $8d;eb : ao_none;m : Modrm;o1 : ao_wordmem or ao_jumpabsolute;o2 : ao_wordreg;o3 : 0 ),
|
||||||
(i : A_LDS;ops : 2;oc : $c5;eb : ao_none;m : Modrm;o1 : ao_mem;o2 : ao_reg32;o3 : 0),
|
(i : A_LDS;ops : 2;oc : $c5;eb : ao_none;m : Modrm;o1 : ao_mem;o2 : ao_reg32;o3 : 0),
|
||||||
(i : A_LES;ops : 2;oc : $c4;eb : ao_none;m : Modrm;o1 : ao_mem;o2 : ao_reg32;o3 : 0),
|
(i : A_LES;ops : 2;oc : $c4;eb : ao_none;m : Modrm;o1 : ao_mem;o2 : ao_reg32;o3 : 0),
|
||||||
(i : A_LFS;ops : 2;oc : $0fb4;eb : ao_none;m : Modrm;o1 : ao_mem;o2 : ao_reg32;o3 : 0),
|
(i : A_LFS;ops : 2;oc : $0fb4;eb : ao_none;m : Modrm;o1 : ao_mem;o2 : ao_reg32;o3 : 0),
|
||||||
@ -1078,7 +1078,7 @@ unit i386;
|
|||||||
dispose(r);
|
dispose(r);
|
||||||
r:=nil;
|
r:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function newreference(const r : treference) : preference;
|
function newreference(const r : treference) : preference;
|
||||||
var
|
var
|
||||||
p : preference;
|
p : preference;
|
||||||
@ -1724,7 +1724,12 @@ unit i386;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 1998-10-14 08:47:17 pierre
|
Revision 1.14 1998-10-28 00:08:47 peter
|
||||||
|
+ leal procsym,eax is now allowed
|
||||||
|
+ constants are now handled also when starting an expression
|
||||||
|
+ call *pointer is now allowed
|
||||||
|
|
||||||
|
Revision 1.13 1998/10/14 08:47:17 pierre
|
||||||
* bugs in secondfuncret for result in subprocedures removed
|
* bugs in secondfuncret for result in subprocedures removed
|
||||||
|
|
||||||
Revision 1.12 1998/10/08 17:17:20 pierre
|
Revision 1.12 1998/10/08 17:17:20 pierre
|
||||||
|
@ -3135,6 +3135,13 @@ const
|
|||||||
instr.operands[operandnum].ref.offset:=BuildRefExpression;
|
instr.operands[operandnum].ref.offset:=BuildRefExpression;
|
||||||
BuildReference(instr);
|
BuildReference(instr);
|
||||||
end;
|
end;
|
||||||
|
{ // Call from memory address // }
|
||||||
|
AS_STAR: Begin
|
||||||
|
Consume(AS_STAR);
|
||||||
|
InitAsmRef(instr);
|
||||||
|
if not CreateVarInstr(instr,actasmpattern,operandnum) then
|
||||||
|
Message(assem_e_syn_opcode_operand);
|
||||||
|
end;
|
||||||
{ // A constant expression, or a Variable ref. // }
|
{ // A constant expression, or a Variable ref. // }
|
||||||
AS_ID: Begin
|
AS_ID: Begin
|
||||||
{ // Local label. // }
|
{ // Local label. // }
|
||||||
@ -3245,9 +3252,14 @@ const
|
|||||||
else
|
else
|
||||||
Message1(assem_e_unknown_id,actasmpattern);
|
Message1(assem_e_unknown_id,actasmpattern);
|
||||||
end;
|
end;
|
||||||
expr := actasmpattern;
|
{ constant expression? }
|
||||||
Consume(AS_ID);
|
if instr.operands[operandnum].operandtype=OPR_CONSTANT then
|
||||||
case actasmtoken of
|
instr.operands[operandnum].val := BuildExpression
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
expr := actasmpattern;
|
||||||
|
Consume(AS_ID);
|
||||||
|
case actasmtoken of
|
||||||
AS_LPAREN: Begin
|
AS_LPAREN: Begin
|
||||||
{ indexing }
|
{ indexing }
|
||||||
previous_was_id:=FALSE;
|
previous_was_id:=FALSE;
|
||||||
@ -3257,9 +3269,10 @@ const
|
|||||||
BuildRecordOffset(expr,instr);
|
BuildRecordOffset(expr,instr);
|
||||||
end;
|
end;
|
||||||
AS_SEPARATOR,AS_COMMA: ;
|
AS_SEPARATOR,AS_COMMA: ;
|
||||||
else
|
else
|
||||||
Message(assem_e_syntax_error);
|
Message(assem_e_syntax_error);
|
||||||
end; { end case }
|
end; { end case }
|
||||||
|
end;
|
||||||
{ restore normal context }
|
{ restore normal context }
|
||||||
previous_was_id := FALSE;
|
previous_was_id := FALSE;
|
||||||
end; { end if }
|
end; { end if }
|
||||||
@ -3844,7 +3857,12 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.15 1998-10-13 16:50:16 pierre
|
Revision 1.16 1998-10-28 00:08:48 peter
|
||||||
|
+ leal procsym,eax is now allowed
|
||||||
|
+ constants are now handled also when starting an expression
|
||||||
|
+ call *pointer is now allowed
|
||||||
|
|
||||||
|
Revision 1.15 1998/10/13 16:50:16 pierre
|
||||||
* undid some changes of Peter that made the compiler wrong
|
* undid some changes of Peter that made the compiler wrong
|
||||||
for m68k (I had to reinsert some ifdefs)
|
for m68k (I had to reinsert some ifdefs)
|
||||||
* removed several memory leaks under m68k
|
* removed several memory leaks under m68k
|
||||||
|
Loading…
Reference in New Issue
Block a user