+ 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:
peter 1998-10-28 00:08:45 +00:00
parent 3a46ae8390
commit e06ac8e64f
3 changed files with 94 additions and 48 deletions

View File

@ -964,50 +964,50 @@ end;
SearchIConstant := FALSE;
{ check for TRUE or FALSE reserved words first }
if s = 'TRUE' then
Begin
Begin
SearchIConstant := TRUE;
l := 1;
end
end
else
if s = 'FALSE' then
Begin
SearchIConstant := TRUE;
l := 0;
end
else
if assigned(aktprocsym) then
Begin
if assigned(aktprocsym^.definition) then
if s = 'FALSE' then
Begin
{ Check the local constants }
if assigned(aktprocsym^.definition^.localst) then
sym := aktprocsym^.definition^.localst^.search(s)
SearchIConstant := TRUE;
l := 0;
end
else
sym := nil;
if assigned(sym) then
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;
if assigned(aktprocsym) then
Begin
if assigned(aktprocsym^.definition) then
Begin
{ Check the local constants }
if assigned(aktprocsym^.definition^.localst) then
sym := aktprocsym^.definition^.localst^.search(s)
else
sym := nil;
if assigned(sym) then
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;
{ Check the global constants }
getsym(s,false);
if srsym <> nil then
Begin
if (srsym^.typ=constsym) and (pconstsym(srsym)^.consttype in
[constord,constint,constchar,constbool]) then
Begin
l:=pconstsym(srsym)^.value;
SearchIConstant := TRUE;
exit;
end;
end;
Begin
if (srsym^.typ=constsym) and
(pconstsym(srsym)^.consttype in [constord,constint,constchar,constbool]) then
Begin
l:=pconstsym(srsym)^.value;
SearchIConstant := TRUE;
exit;
end;
end;
end;
@ -1521,10 +1521,19 @@ end;
instr.operands[operandnum].size := S_NO;
end; { end case }
end;
{ ok, finished for thir variable. }
{ ok, finished for this var }
CreateVarInstr := TRUE;
Exit;
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
{ free the memory before changing the symbol name. }
if assigned(instr.operands[operandnum].ref.symbol) then
@ -1596,8 +1605,7 @@ end;
typedconstsym : Begin
{ free the memory before changing the symbol name. }
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].ref.symbol:=newpasstr(sym^.mangledname);
{ the current size is NOT overriden if it already }
{ exists, such as in the case of a byte ptr, in }
@ -1636,6 +1644,15 @@ end;
CreateVarInstr := TRUE;
Exit;
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
if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
Message(assem_w_calling_overload_func);
@ -1643,6 +1660,7 @@ end;
if assigned(instr.operands[operandnum].ref.symbol) then
FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
instr.operands[operandnum].operandtype:=OPR_SYMBOL;
instr.operands[operandnum].size:=S_L;
instr.operands[operandnum].symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);
CreateVarInstr := TRUE;
Exit;
@ -1884,7 +1902,12 @@ end;
end.
{
$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
* m68k version compiles with -duseansistrings

View File

@ -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_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_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_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),
@ -1078,7 +1078,7 @@ unit i386;
dispose(r);
r:=nil;
end;
function newreference(const r : treference) : preference;
var
p : preference;
@ -1724,7 +1724,12 @@ unit i386;
end.
{
$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
Revision 1.12 1998/10/08 17:17:20 pierre

View File

@ -3135,6 +3135,13 @@ const
instr.operands[operandnum].ref.offset:=BuildRefExpression;
BuildReference(instr);
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. // }
AS_ID: Begin
{ // Local label. // }
@ -3245,9 +3252,14 @@ const
else
Message1(assem_e_unknown_id,actasmpattern);
end;
expr := actasmpattern;
Consume(AS_ID);
case actasmtoken of
{ constant expression? }
if instr.operands[operandnum].operandtype=OPR_CONSTANT then
instr.operands[operandnum].val := BuildExpression
else
begin
expr := actasmpattern;
Consume(AS_ID);
case actasmtoken of
AS_LPAREN: Begin
{ indexing }
previous_was_id:=FALSE;
@ -3257,9 +3269,10 @@ const
BuildRecordOffset(expr,instr);
end;
AS_SEPARATOR,AS_COMMA: ;
else
else
Message(assem_e_syntax_error);
end; { end case }
end; { end case }
end;
{ restore normal context }
previous_was_id := FALSE;
end; { end if }
@ -3844,7 +3857,12 @@ end.
{
$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
for m68k (I had to reinsert some ifdefs)
* removed several memory leaks under m68k