mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-22 09:45:22 +02:00
* top_symbol killed
+ refaddr to treference added + refsymbol to treference added * top_local stuff moved to an extra record to save memory + aint introduced * tppufile.get/putint64/aint implemented
This commit is contained in:
parent
72324a4283
commit
fabb9c33ac
@ -36,7 +36,7 @@ interface
|
||||
cutils,cclasses,
|
||||
globtype,globals,systems,
|
||||
cpuinfo,cpubase,
|
||||
cgbase,
|
||||
cgbase,cgutils,
|
||||
symtype,
|
||||
aasmbase;
|
||||
|
||||
@ -140,7 +140,7 @@ interface
|
||||
|
||||
type
|
||||
{ Types of operand }
|
||||
toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_bool,top_local,
|
||||
toptype=(top_none,top_reg,top_ref,top_const,top_bool,top_local,
|
||||
{ ARM only }
|
||||
top_regset,
|
||||
top_shifterop,
|
||||
@ -150,24 +150,33 @@ interface
|
||||
{ kinds of operations that an instruction can perform on an operand }
|
||||
topertype = (operand_read,operand_write,operand_readwrite);
|
||||
|
||||
toper=record
|
||||
tlocaloper = record
|
||||
localsym : pointer;
|
||||
localsymderef : tderef;
|
||||
localsymofs : longint;
|
||||
localindexreg : tregister;
|
||||
localscale : byte;
|
||||
localgetoffset : boolean
|
||||
end;
|
||||
plocaloper = ^tlocaloper;
|
||||
|
||||
{ please keep the size of this record <=12 bytes and keep it properly aligned }
|
||||
toper = record
|
||||
ot : longint;
|
||||
case typ : toptype of
|
||||
top_none : ();
|
||||
top_reg : (reg:tregister);
|
||||
top_ref : (ref:preference);
|
||||
top_const : (val:aword);
|
||||
top_symbol : (sym:tasmsymbol;symofs:longint);
|
||||
top_bool : (b:boolean);
|
||||
{ local varsym that will be inserted in pass_2 }
|
||||
top_local : (localsym:pointer;localsymderef:tderef;localsymofs:longint;localindexreg:tregister;
|
||||
localscale:byte;localgetoffset:boolean);
|
||||
top_none : ();
|
||||
top_reg : (reg:tregister);
|
||||
top_ref : (ref:preference);
|
||||
top_const : (val:aword);
|
||||
top_bool : (b:boolean);
|
||||
{ local varsym that will be inserted in pass_2 }
|
||||
top_local : (localoper:plocaloper);
|
||||
{$ifdef arm}
|
||||
top_regset : (regset:^tcpuregisterset);
|
||||
top_shifterop : (shifterop : pshifterop);
|
||||
top_regset : (regset:^tcpuregisterset);
|
||||
top_shifterop : (shifterop : pshifterop);
|
||||
{$endif arm}
|
||||
{$ifdef m68k}
|
||||
top_regset : (regset:^tcpuregisterset);
|
||||
top_regset : (regset:^tcpuregisterset);
|
||||
{$endif m68k}
|
||||
end;
|
||||
poper=^toper;
|
||||
@ -1657,19 +1666,12 @@ implementation
|
||||
|
||||
|
||||
procedure taicpu_abstract.loadsymbol(opidx:longint;s:tasmsymbol;sofs:longint);
|
||||
var
|
||||
r : treference;
|
||||
begin
|
||||
if not assigned(s) then
|
||||
internalerror(200204251);
|
||||
allocate_oper(opidx+1);
|
||||
with oper[opidx]^ do
|
||||
begin
|
||||
if typ<>top_symbol then
|
||||
clearop(opidx);
|
||||
sym:=s;
|
||||
symofs:=sofs;
|
||||
typ:=top_symbol;
|
||||
end;
|
||||
s.increfs;
|
||||
reference_reset_symbol(r,s,sofs);
|
||||
r.refaddr:=addr_full;
|
||||
loadref(opidx,r);
|
||||
end;
|
||||
|
||||
|
||||
@ -1681,12 +1683,18 @@ implementation
|
||||
with oper[opidx]^ do
|
||||
begin
|
||||
if typ<>top_local then
|
||||
clearop(opidx);
|
||||
localsym:=s;
|
||||
localsymofs:=sofs;
|
||||
localindexreg:=indexreg;
|
||||
localscale:=scale;
|
||||
localgetoffset:=getoffset;
|
||||
begin
|
||||
clearop(opidx);
|
||||
new(localoper);
|
||||
end;
|
||||
with oper[opidx]^.localoper^ do
|
||||
begin
|
||||
localsym:=s;
|
||||
localsymofs:=sofs;
|
||||
localindexreg:=indexreg;
|
||||
localscale:=scale;
|
||||
localgetoffset:=getoffset;
|
||||
end;
|
||||
typ:=top_local;
|
||||
end;
|
||||
end;
|
||||
@ -1791,6 +1799,8 @@ implementation
|
||||
case typ of
|
||||
top_ref:
|
||||
dispose(ref);
|
||||
top_local:
|
||||
dispose(localoper);
|
||||
{$ifdef ARM}
|
||||
top_shifterop:
|
||||
dispose(shifterop);
|
||||
@ -1992,10 +2002,20 @@ implementation
|
||||
inherited InsertAfter(Item,Loc);
|
||||
end;
|
||||
|
||||
begin
|
||||
writeln(sizeof(toper));
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.72 2004-02-26 16:16:38 peter
|
||||
Revision 1.73 2004-02-27 10:21:04 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.72 2004/02/26 16:16:38 peter
|
||||
* tai_const.create_ptr added
|
||||
|
||||
Revision 1.71 2004/02/08 23:10:21 jonas
|
||||
|
@ -1192,10 +1192,8 @@ Implementation
|
||||
begin
|
||||
if assigned(ref^.symbol) then
|
||||
objectlibrary.UsedAsmSymbolListInsert(ref^.symbol);
|
||||
end;
|
||||
top_symbol :
|
||||
begin
|
||||
objectlibrary.UsedAsmSymbolListInsert(sym);
|
||||
if assigned(ref^.relsymbol) then
|
||||
objectlibrary.UsedAsmSymbolListInsert(ref^.symbol);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -1661,7 +1659,15 @@ Implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.61 2004-01-31 17:45:17 peter
|
||||
Revision 1.62 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.61 2004/01/31 17:45:17 peter
|
||||
* Change several $ifdef i386 to x86
|
||||
* Change several OS_32 to OS_INT/OS_ADDR
|
||||
|
||||
|
@ -54,6 +54,10 @@ interface
|
||||
LOC_CMMREGISTER
|
||||
);
|
||||
|
||||
{ since we have only 16 offsets, we need to be able to specify the high
|
||||
and low 16 bits of the address of a symbol }
|
||||
trefaddr = (addr_no,addr_full,addr_hi,addr_lo);
|
||||
|
||||
{# Generic opcodes, which must be supported by all processors
|
||||
}
|
||||
topcg =
|
||||
@ -583,7 +587,15 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.87 2004-02-09 22:14:17 peter
|
||||
Revision 1.88 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.87 2004/02/09 22:14:17 peter
|
||||
* more x86_64 parameter fixes
|
||||
* tparalocation.lochigh is now used to indicate if registerhigh
|
||||
is used and what the type is
|
||||
|
@ -504,21 +504,7 @@ unit cgobj;
|
||||
procedure g_rangecheck64(list: taasmoutput; const l:tlocation; fromdef,todef: tdef);virtual;abstract;
|
||||
end;
|
||||
|
||||
|
||||
{ trerefence handling }
|
||||
|
||||
{# Clear to zero a treference }
|
||||
procedure reference_reset(var ref : treference);
|
||||
{# Clear to zero a treference, and set is base address
|
||||
to base register.
|
||||
}
|
||||
procedure reference_reset_base(var ref : treference;base : tregister;offset : longint);
|
||||
procedure reference_reset_symbol(var ref : treference;sym : tasmsymbol;offset : longint);
|
||||
procedure reference_release(list: taasmoutput; const ref : treference);
|
||||
{ This routine verifies if two references are the same, and
|
||||
if so, returns TRUE, otherwise returns false.
|
||||
}
|
||||
function references_equal(sref : treference;dref : treference) : boolean;
|
||||
|
||||
{ tlocation handling }
|
||||
|
||||
@ -541,7 +527,8 @@ implementation
|
||||
uses
|
||||
globals,globtype,options,systems,
|
||||
verbose,defutil,paramgr,
|
||||
tgobj,cutils;
|
||||
tgobj,cutils,
|
||||
cgutils;
|
||||
|
||||
const
|
||||
{ Please leave this here, this module should NOT use
|
||||
@ -2049,43 +2036,12 @@ implementation
|
||||
TReference
|
||||
****************************************************************************}
|
||||
|
||||
procedure reference_reset(var ref : treference);
|
||||
begin
|
||||
FillChar(ref,sizeof(treference),0);
|
||||
{$ifdef arm}
|
||||
ref.signindex:=1;
|
||||
{$endif arm}
|
||||
end;
|
||||
|
||||
|
||||
procedure reference_reset_base(var ref : treference;base : tregister;offset : longint);
|
||||
begin
|
||||
reference_reset(ref);
|
||||
ref.base:=base;
|
||||
ref.offset:=offset;
|
||||
end;
|
||||
|
||||
|
||||
procedure reference_reset_symbol(var ref : treference;sym : tasmsymbol;offset : longint);
|
||||
begin
|
||||
reference_reset(ref);
|
||||
ref.symbol:=sym;
|
||||
ref.offset:=offset;
|
||||
end;
|
||||
|
||||
|
||||
procedure reference_release(list: taasmoutput; const ref : treference);
|
||||
begin
|
||||
cg.ungetreference(list,ref);
|
||||
end;
|
||||
|
||||
|
||||
function references_equal(sref : treference;dref : treference):boolean;
|
||||
begin
|
||||
references_equal:=CompareByte(sref,dref,sizeof(treference))=0;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
TLocation
|
||||
****************************************************************************}
|
||||
@ -2153,7 +2109,15 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.158 2004-02-20 22:16:34 florian
|
||||
Revision 1.159 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.158 2004/02/20 22:16:34 florian
|
||||
* handling of float parameters passed in mm registers fixed
|
||||
|
||||
Revision 1.157 2004/02/12 15:54:03 peter
|
||||
|
95
compiler/cgutils.pas
Normal file
95
compiler/cgutils.pas
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
$Id$
|
||||
Copyright (c) 1998-2004 by Florian Klaempfl
|
||||
|
||||
Some basic types and constants for the code generation
|
||||
|
||||
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.
|
||||
|
||||
****************************************************************************
|
||||
}
|
||||
{ This unit exports some helper routines which are used across the code generator }
|
||||
unit cgutils;
|
||||
|
||||
{$i fpcdefs.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
aasmbase,
|
||||
cgbase,
|
||||
cpubase;
|
||||
|
||||
{ trerefence handling }
|
||||
|
||||
{# Clear to zero a treference }
|
||||
procedure reference_reset(var ref : treference);
|
||||
{# Clear to zero a treference, and set is base address
|
||||
to base register.
|
||||
}
|
||||
procedure reference_reset_base(var ref : treference;base : tregister;offset : longint);
|
||||
procedure reference_reset_symbol(var ref : treference;sym : tasmsymbol;offset : longint);
|
||||
{ This routine verifies if two references are the same, and
|
||||
if so, returns TRUE, otherwise returns false.
|
||||
}
|
||||
function references_equal(sref : treference;dref : treference) : boolean;
|
||||
|
||||
implementation
|
||||
|
||||
{****************************************************************************
|
||||
TReference
|
||||
****************************************************************************}
|
||||
|
||||
procedure reference_reset(var ref : treference);
|
||||
begin
|
||||
FillChar(ref,sizeof(treference),0);
|
||||
{$ifdef arm}
|
||||
ref.signindex:=1;
|
||||
{$endif arm}
|
||||
end;
|
||||
|
||||
|
||||
procedure reference_reset_base(var ref : treference;base : tregister;offset : longint);
|
||||
begin
|
||||
reference_reset(ref);
|
||||
ref.base:=base;
|
||||
ref.offset:=offset;
|
||||
end;
|
||||
|
||||
|
||||
procedure reference_reset_symbol(var ref : treference;sym : tasmsymbol;offset : longint);
|
||||
begin
|
||||
reference_reset(ref);
|
||||
ref.symbol:=sym;
|
||||
ref.offset:=offset;
|
||||
end;
|
||||
|
||||
|
||||
function references_equal(sref : treference;dref : treference):boolean;
|
||||
begin
|
||||
references_equal:=CompareByte(sref,dref,sizeof(treference))=0;
|
||||
end;
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
}
|
@ -42,6 +42,8 @@ interface
|
||||
{# Returns the maximum value between @var(a) and @var(b) }
|
||||
function max(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif}
|
||||
{# Returns the value in @var(x) swapped to different endian }
|
||||
Function SwapInt64(x : int64): int64;{$ifdef USEINLINE}inline;{$endif}
|
||||
{# Returns the value in @var(x) swapped to different endian }
|
||||
function SwapLong(x : longint): longint;{$ifdef USEINLINE}inline;{$endif}
|
||||
{# Returns the value in @va(x) swapped to different endian }
|
||||
function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif}
|
||||
@ -174,6 +176,13 @@ uses
|
||||
End;
|
||||
|
||||
|
||||
Function SwapInt64(x : int64): int64;{$ifdef USEINLINE}inline;{$endif}
|
||||
Begin
|
||||
result:=swaplong(hi(x));
|
||||
result:=result or (swaplong(lo(x)) shl 32);
|
||||
End;
|
||||
|
||||
|
||||
Function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif}
|
||||
var
|
||||
z : byte;
|
||||
@ -829,7 +838,7 @@ uses
|
||||
inc(len);
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
|
||||
{Second pass, writeout stabstring.}
|
||||
getmem(r,len+1);
|
||||
string_evaluate:=r;
|
||||
@ -1127,7 +1136,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.35 2004-02-22 22:13:27 daniel
|
||||
Revision 1.36 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.35 2004/02/22 22:13:27 daniel
|
||||
* Escape newlines in constant string stabs
|
||||
|
||||
Revision 1.34 2004/01/26 22:08:20 daniel
|
||||
|
@ -55,7 +55,8 @@ implementation
|
||||
{$endif}
|
||||
cutils,globtype,globals,systems,cclasses,
|
||||
verbose,finput,fmodule,script,cpuinfo,
|
||||
itx86int
|
||||
itx86int,
|
||||
cgbase
|
||||
;
|
||||
|
||||
const
|
||||
@ -211,51 +212,54 @@ implementation
|
||||
AsmWrite(masm_regname(o.reg));
|
||||
top_const :
|
||||
AsmWrite(tostr(longint(o.val)));
|
||||
top_symbol :
|
||||
begin
|
||||
AsmWrite('offset ');
|
||||
if assigned(o.sym) then
|
||||
AsmWrite(o.sym.name);
|
||||
if o.symofs>0 then
|
||||
AsmWrite('+'+tostr(o.symofs))
|
||||
else
|
||||
if o.symofs<0 then
|
||||
AsmWrite(tostr(o.symofs))
|
||||
else
|
||||
if not(assigned(o.sym)) then
|
||||
AsmWrite('0');
|
||||
end;
|
||||
top_ref :
|
||||
begin
|
||||
if ((opcode <> A_LGS) and (opcode <> A_LSS) and
|
||||
(opcode <> A_LFS) and (opcode <> A_LDS) and
|
||||
(opcode <> A_LES)) then
|
||||
Begin
|
||||
case s of
|
||||
S_B : AsmWrite('byte ptr ');
|
||||
S_W : AsmWrite('word ptr ');
|
||||
S_L : AsmWrite('dword ptr ');
|
||||
S_IS : AsmWrite('word ptr ');
|
||||
S_IL : AsmWrite('dword ptr ');
|
||||
S_IQ : AsmWrite('qword ptr ');
|
||||
S_FS : AsmWrite('dword ptr ');
|
||||
S_FL : AsmWrite('qword ptr ');
|
||||
S_FX : AsmWrite('tbyte ptr ');
|
||||
S_BW : if dest then
|
||||
AsmWrite('word ptr ')
|
||||
else
|
||||
AsmWrite('byte ptr ');
|
||||
S_BL : if dest then
|
||||
AsmWrite('dword ptr ')
|
||||
else
|
||||
AsmWrite('byte ptr ');
|
||||
S_WL : if dest then
|
||||
AsmWrite('dword ptr ')
|
||||
else
|
||||
AsmWrite('word ptr ');
|
||||
end;
|
||||
end;
|
||||
WriteReference(o.ref^);
|
||||
if o.ref^.refaddr=addr_no then
|
||||
begin
|
||||
if ((opcode <> A_LGS) and (opcode <> A_LSS) and
|
||||
(opcode <> A_LFS) and (opcode <> A_LDS) and
|
||||
(opcode <> A_LES)) then
|
||||
Begin
|
||||
case s of
|
||||
S_B : AsmWrite('byte ptr ');
|
||||
S_W : AsmWrite('word ptr ');
|
||||
S_L : AsmWrite('dword ptr ');
|
||||
S_IS : AsmWrite('word ptr ');
|
||||
S_IL : AsmWrite('dword ptr ');
|
||||
S_IQ : AsmWrite('qword ptr ');
|
||||
S_FS : AsmWrite('dword ptr ');
|
||||
S_FL : AsmWrite('qword ptr ');
|
||||
S_FX : AsmWrite('tbyte ptr ');
|
||||
S_BW : if dest then
|
||||
AsmWrite('word ptr ')
|
||||
else
|
||||
AsmWrite('byte ptr ');
|
||||
S_BL : if dest then
|
||||
AsmWrite('dword ptr ')
|
||||
else
|
||||
AsmWrite('byte ptr ');
|
||||
S_WL : if dest then
|
||||
AsmWrite('dword ptr ')
|
||||
else
|
||||
AsmWrite('word ptr ');
|
||||
end;
|
||||
end;
|
||||
WriteReference(o.ref^);
|
||||
end
|
||||
else
|
||||
begin
|
||||
AsmWrite('offset ');
|
||||
if assigned(o.ref^.symbol) then
|
||||
AsmWrite(o.ref^.symbol.name);
|
||||
if o.ref^.offset>0 then
|
||||
AsmWrite('+'+tostr(o.ref^.offset))
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
AsmWrite(tostr(o.ref^.offset))
|
||||
else
|
||||
if not(assigned(o.ref^.symbol)) then
|
||||
AsmWrite('0');
|
||||
end;
|
||||
end;
|
||||
else
|
||||
internalerror(10001);
|
||||
@ -270,26 +274,29 @@ implementation
|
||||
AsmWrite(masm_regname(o.reg));
|
||||
top_const :
|
||||
AsmWrite(tostr(longint(o.val)));
|
||||
top_symbol :
|
||||
begin
|
||||
AsmWrite(o.sym.name);
|
||||
if o.symofs>0 then
|
||||
AsmWrite('+'+tostr(o.symofs))
|
||||
else
|
||||
if o.symofs<0 then
|
||||
AsmWrite(tostr(o.symofs));
|
||||
end;
|
||||
top_ref :
|
||||
{ what about lcall or ljmp ??? }
|
||||
begin
|
||||
if (aktoutputformat <> as_i386_tasm) then
|
||||
if o.ref^.refaddr=addr_no then
|
||||
begin
|
||||
if s=S_FAR then
|
||||
AsmWrite('far ptr ')
|
||||
if (aktoutputformat <> as_i386_tasm) then
|
||||
begin
|
||||
if s=S_FAR then
|
||||
AsmWrite('far ptr ')
|
||||
else
|
||||
AsmWrite('dword ptr ');
|
||||
end;
|
||||
WriteReference(o.ref^);
|
||||
end
|
||||
else
|
||||
begin
|
||||
AsmWrite(o.ref^.symbol.name);
|
||||
if o.ref^.offset>0 then
|
||||
AsmWrite('+'+tostr(o.ref^.offset))
|
||||
else
|
||||
AsmWrite('dword ptr ');
|
||||
if o.ref^.offset<0 then
|
||||
AsmWrite(tostr(o.ref^.offset));
|
||||
end;
|
||||
WriteReference(o.ref^);
|
||||
end;
|
||||
else
|
||||
internalerror(10001);
|
||||
@ -875,7 +882,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.45 2003-12-15 15:58:17 peter
|
||||
Revision 1.46 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.45 2003/12/15 15:58:17 peter
|
||||
* wasm args fix from wiktor
|
||||
|
||||
Revision 1.44 2003/12/14 22:42:39 peter
|
||||
|
@ -280,29 +280,32 @@ interface
|
||||
AsmWrite(sizestr(s,dest));
|
||||
AsmWrite(tostr(longint(o.val)));
|
||||
end;
|
||||
top_symbol :
|
||||
begin
|
||||
asmwrite('dword ');
|
||||
if assigned(o.sym) then
|
||||
begin
|
||||
asmwrite(o.sym.name);
|
||||
if o.symofs=0 then
|
||||
exit;
|
||||
end;
|
||||
if o.symofs>0 then
|
||||
asmwrite('+');
|
||||
asmwrite(tostr(o.symofs))
|
||||
end;
|
||||
top_ref :
|
||||
begin
|
||||
if not ((opcode = A_LEA) or (opcode = A_LGS) or
|
||||
(opcode = A_LSS) or (opcode = A_LFS) or
|
||||
(opcode = A_LES) or (opcode = A_LDS) or
|
||||
(opcode = A_SHR) or (opcode = A_SHL) or
|
||||
(opcode = A_SAR) or (opcode = A_SAL) or
|
||||
(opcode = A_OUT) or (opcode = A_IN)) then
|
||||
AsmWrite(sizestr(s,dest));
|
||||
WriteReference(o.ref^);
|
||||
if o.ref^.refaddr=addr_no then
|
||||
begin
|
||||
if not ((opcode = A_LEA) or (opcode = A_LGS) or
|
||||
(opcode = A_LSS) or (opcode = A_LFS) or
|
||||
(opcode = A_LES) or (opcode = A_LDS) or
|
||||
(opcode = A_SHR) or (opcode = A_SHL) or
|
||||
(opcode = A_SAR) or (opcode = A_SAL) or
|
||||
(opcode = A_OUT) or (opcode = A_IN)) then
|
||||
AsmWrite(sizestr(s,dest));
|
||||
WriteReference(o.ref^);
|
||||
end
|
||||
else
|
||||
begin
|
||||
asmwrite('dword ');
|
||||
if assigned(o.ref^.symbol) then
|
||||
begin
|
||||
asmwrite(o.ref^.symbol.name);
|
||||
if o.ref^.offset=0 then
|
||||
exit;
|
||||
end;
|
||||
if o.ref^.offset>0 then
|
||||
asmwrite('+');
|
||||
asmwrite(tostr(o.ref^.offset));
|
||||
end;
|
||||
end;
|
||||
else
|
||||
internalerror(10001);
|
||||
@ -316,25 +319,26 @@ interface
|
||||
top_reg :
|
||||
AsmWrite(nasm_regname(o.reg));
|
||||
top_ref :
|
||||
WriteReference(o.ref^);
|
||||
if o.ref^.refaddr=addr_no then
|
||||
WriteReference(o.ref^)
|
||||
else
|
||||
begin
|
||||
if not(
|
||||
(op=A_JCXZ) or (op=A_JECXZ) or
|
||||
(op=A_LOOP) or (op=A_LOOPE) or
|
||||
(op=A_LOOPNE) or (op=A_LOOPNZ) or
|
||||
(op=A_LOOPZ)
|
||||
) then
|
||||
AsmWrite('NEAR ');
|
||||
AsmWrite(o.ref^.symbol.name);
|
||||
if o.ref^.offset>0 then
|
||||
AsmWrite('+'+tostr(o.ref^.offset))
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
AsmWrite(tostr(o.ref^.offset));
|
||||
end;
|
||||
top_const :
|
||||
AsmWrite(tostr(longint(o.val)));
|
||||
top_symbol :
|
||||
begin
|
||||
if not(
|
||||
(op=A_JCXZ) or (op=A_JECXZ) or
|
||||
(op=A_LOOP) or (op=A_LOOPE) or
|
||||
(op=A_LOOPNE) or (op=A_LOOPNZ) or
|
||||
(op=A_LOOPZ)
|
||||
) then
|
||||
AsmWrite('NEAR ');
|
||||
AsmWrite(o.sym.name);
|
||||
if o.symofs>0 then
|
||||
AsmWrite('+'+tostr(o.symofs))
|
||||
else
|
||||
if o.symofs<0 then
|
||||
AsmWrite(tostr(o.symofs));
|
||||
end;
|
||||
AsmWrite(tostr(aint(o.val)));
|
||||
else
|
||||
internalerror(10001);
|
||||
end;
|
||||
@ -920,7 +924,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.43 2003-12-14 22:42:39 peter
|
||||
Revision 1.44 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.43 2003/12/14 22:42:39 peter
|
||||
* fixed range check errors
|
||||
|
||||
Revision 1.42 2003/11/29 15:53:06 florian
|
||||
|
@ -61,7 +61,8 @@ unit cgcpu;
|
||||
uses
|
||||
globtype,globals,verbose,systems,cutils,
|
||||
symdef,symsym,defutil,paramgr,procinfo,
|
||||
rgcpu,rgx86,tgobj;
|
||||
rgcpu,rgx86,tgobj,
|
||||
cgutils;
|
||||
|
||||
procedure Tcg386.init_register_allocators;
|
||||
begin
|
||||
@ -388,7 +389,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.46 2004-02-22 16:48:09 florian
|
||||
Revision 1.47 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.46 2004/02/22 16:48:09 florian
|
||||
* x86_64 uses generic concatcopy_valueopenarray for now
|
||||
|
||||
Revision 1.45 2004/02/04 22:01:13 peter
|
||||
|
@ -32,6 +32,7 @@ Interface
|
||||
Type
|
||||
{ Natural integer register type and size for the target machine }
|
||||
AWord = longword;
|
||||
AInt = longint;
|
||||
PAWord = ^AWord;
|
||||
|
||||
{ This must be an ordinal type with the same size as a pointer
|
||||
@ -123,7 +124,15 @@ Implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.22 2003-12-25 12:01:35 florian
|
||||
Revision 1.23 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.22 2003/12/25 12:01:35 florian
|
||||
+ possible sse2 unit usage for double calculations
|
||||
* some sse2 assembler issues fixed
|
||||
|
||||
|
@ -1864,7 +1864,7 @@ begin
|
||||
getNextInstruction(p,p);
|
||||
end;
|
||||
end;
|
||||
top_symbol,Top_Const:
|
||||
top_Const:
|
||||
begin
|
||||
case taicpu(p).oper[1]^.typ of
|
||||
Top_Reg:
|
||||
@ -2115,7 +2115,15 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.60 2004-02-25 20:39:58 jonas
|
||||
Revision 1.61 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.60 2004/02/25 20:39:58 jonas
|
||||
* fixed bugs that caused pasjpeg crashes
|
||||
|
||||
Revision 1.59 2003/12/20 22:53:33 jonas
|
||||
|
@ -1384,8 +1384,6 @@ begin {checks whether the two ops are equal}
|
||||
OpsEqual := RefsEqual(o1.ref^, o2.ref^);
|
||||
Top_Const :
|
||||
OpsEqual:=o1.val=o2.val;
|
||||
Top_Symbol :
|
||||
OpsEqual:=(o1.sym=o2.sym) and (o1.symofs=o2.symofs);
|
||||
Top_None :
|
||||
OpsEqual := True
|
||||
end;
|
||||
@ -1590,7 +1588,6 @@ begin
|
||||
case o.typ Of
|
||||
top_reg: readreg(p, getsupreg(o.reg));
|
||||
top_ref: readref(p, o.ref);
|
||||
top_symbol : ;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1880,7 +1877,6 @@ begin
|
||||
readref(ptaiprop(taiObj.OptInfo), o.ref);
|
||||
DestroyRefs(taiObj, o.ref^, RS_INVALID);
|
||||
end;
|
||||
top_symbol:;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2454,7 +2450,7 @@ begin
|
||||
DestroyRefs(p, taicpu(p).oper[1]^.ref^, RS_INVALID);
|
||||
end;
|
||||
end;
|
||||
top_symbol,Top_Const:
|
||||
top_Const:
|
||||
begin
|
||||
case taicpu(p).oper[1]^.typ Of
|
||||
top_reg:
|
||||
@ -2713,7 +2709,15 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.64 2003-12-23 19:52:55 peter
|
||||
Revision 1.65 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.64 2003/12/23 19:52:55 peter
|
||||
* more byte->word
|
||||
|
||||
Revision 1.63 2003/12/22 23:11:41 peter
|
||||
|
@ -55,7 +55,7 @@ implementation
|
||||
symdef,paramgr,
|
||||
aasmtai,
|
||||
nld,ncon,nadd,
|
||||
cgobj;
|
||||
cgutils,cgobj;
|
||||
|
||||
{*****************************************************************************
|
||||
TI386ADDRNODE
|
||||
@ -144,7 +144,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.59 2003-10-21 15:13:27 peter
|
||||
Revision 1.60 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.59 2003/10/21 15:13:27 peter
|
||||
* fix vecnode code that caused to much register conflicts
|
||||
|
||||
Revision 1.58 2003/10/10 17:48:14 peter
|
||||
|
@ -37,7 +37,7 @@ uses
|
||||
fmodule,
|
||||
nobj,
|
||||
cpuinfo,cpubase,
|
||||
cga,cgobj;
|
||||
cga,cgutils,cgobj;
|
||||
|
||||
type
|
||||
ti386classheader=class(tclassheader)
|
||||
@ -235,7 +235,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.29 2003-12-23 23:12:44 peter
|
||||
Revision 1.30 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.29 2003/12/23 23:12:44 peter
|
||||
* extnumber failure is $ffff instead of -1
|
||||
* fix non-vmt call for register calling on i386
|
||||
|
||||
|
@ -48,7 +48,7 @@ implementation
|
||||
cgbase,pass_2,
|
||||
ncon,
|
||||
cpubase,cpuinfo,procinfo,
|
||||
cga,cgobj,ncgutil,
|
||||
cga,cgutils,cgobj,ncgutil,
|
||||
cgx86;
|
||||
|
||||
|
||||
@ -224,7 +224,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.72 2004-02-22 12:04:04 florian
|
||||
Revision 1.73 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.72 2004/02/22 12:04:04 florian
|
||||
+ nx86set added
|
||||
* some more x86-64 fixes
|
||||
|
||||
|
@ -42,7 +42,7 @@ uses
|
||||
{$ifdef finaldestdebug}
|
||||
cobjects,
|
||||
{$endif finaldestdebug}
|
||||
cpuinfo,cpubase,cgobj,daopt386,rgobj;
|
||||
cpuinfo,cpubase,cgutils,daopt386,rgobj;
|
||||
|
||||
function RegUsedAfterInstruction(reg: Tregister; p: tai; var UsedRegs: TRegSet): Boolean;
|
||||
var
|
||||
@ -465,7 +465,7 @@ var
|
||||
if level > 20 then
|
||||
exit;
|
||||
GetfinalDestination := false;
|
||||
p1 := dfa.getlabelwithsym(tasmlabel(hp.oper[0]^.sym));
|
||||
p1 := dfa.getlabelwithsym(tasmlabel(hp.oper[0]^.ref^.symbol));
|
||||
if assigned(p1) then
|
||||
begin
|
||||
SkipLabels(p1,p1);
|
||||
@ -487,14 +487,14 @@ var
|
||||
SkipLabels(p1,p1)) then
|
||||
begin
|
||||
{ quick check for loops of the form "l5: ; jmp l5 }
|
||||
if (tasmlabel(taicpu(p1).oper[0]^.sym).labelnr =
|
||||
tasmlabel(hp.oper[0]^.sym).labelnr) then
|
||||
if (tasmlabel(taicpu(p1).oper[0]^.ref^.symbol).labelnr =
|
||||
tasmlabel(hp.oper[0]^.ref^.symbol).labelnr) then
|
||||
exit;
|
||||
if not GetFinalDestination(asml, taicpu(p1),succ(level)) then
|
||||
exit;
|
||||
tasmlabel(hp.oper[0]^.sym).decrefs;
|
||||
hp.oper[0]^.sym:=taicpu(p1).oper[0]^.sym;
|
||||
tasmlabel(hp.oper[0]^.sym).increfs;
|
||||
tasmlabel(hp.oper[0]^.ref^.symbol).decrefs;
|
||||
hp.oper[0]^.ref^.symbol:=taicpu(p1).oper[0]^.ref^.symbol;
|
||||
tasmlabel(hp.oper[0]^.ref^.symbol).increfs;
|
||||
end
|
||||
else
|
||||
if (taicpu(p1).condition = inverse_cond[hp.condition]) then
|
||||
@ -506,8 +506,8 @@ var
|
||||
{$endif finaldestdebug}
|
||||
objectlibrary.getlabel(l);
|
||||
insertllitem(asml,p1,p1.next,tai_label.Create(l));
|
||||
tasmlabel(taicpu(hp).oper[0]^.sym).decrefs;
|
||||
hp.oper[0]^.sym := l;
|
||||
tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs;
|
||||
hp.oper[0]^.ref^.symbol := l;
|
||||
l.increfs;
|
||||
{ this won't work, since the new label isn't in the labeltable }
|
||||
{ so it will fail the rangecheck. Labeltable should become a }
|
||||
@ -521,7 +521,7 @@ var
|
||||
strpnew('next label reused'))));
|
||||
{$endif finaldestdebug}
|
||||
l.increfs;
|
||||
hp.oper[0]^.sym := l;
|
||||
hp.oper[0]^.ref^.symbol := l;
|
||||
if not GetFinalDestination(asml, hp,succ(level)) then
|
||||
exit;
|
||||
end;
|
||||
@ -602,7 +602,7 @@ begin
|
||||
{ remove jumps to a label coming right after them }
|
||||
if GetNextInstruction(p, hp1) then
|
||||
begin
|
||||
if FindLabel(tasmlabel(taicpu(p).oper[0]^.sym), hp1) and
|
||||
if FindLabel(tasmlabel(taicpu(p).oper[0]^.ref^.symbol), hp1) and
|
||||
{$warning FIXME removing the first instruction fails}
|
||||
(p<>blockstart) then
|
||||
begin
|
||||
@ -619,14 +619,14 @@ begin
|
||||
if (tai(hp1).typ=ait_instruction) and
|
||||
(taicpu(hp1).opcode=A_JMP) and
|
||||
GetNextInstruction(hp1, hp2) and
|
||||
FindLabel(tasmlabel(taicpu(p).oper[0]^.sym), hp2) then
|
||||
FindLabel(tasmlabel(taicpu(p).oper[0]^.ref^.symbol), hp2) then
|
||||
begin
|
||||
if taicpu(p).opcode=A_Jcc then
|
||||
begin
|
||||
taicpu(p).condition:=inverse_cond[taicpu(p).condition];
|
||||
tai_label(hp2).l.decrefs;
|
||||
taicpu(p).oper[0]^.sym:=taicpu(hp1).oper[0]^.sym;
|
||||
taicpu(p).oper[0]^.sym.increfs;
|
||||
taicpu(p).oper[0]^.ref^.symbol:=taicpu(hp1).oper[0]^.ref^.symbol;
|
||||
taicpu(p).oper[0]^.ref^.symbol.increfs;
|
||||
asml.remove(hp1);
|
||||
hp1.free;
|
||||
GetFinalDestination(asml, taicpu(p),0);
|
||||
@ -705,7 +705,7 @@ begin
|
||||
(taicpu(hp3).is_jmp) and
|
||||
(taicpu(hp3).opcode = A_JMP) and
|
||||
GetNextInstruction(hp3, hp4) and
|
||||
FindLabel(tasmlabel(taicpu(hp1).oper[0]^.sym),hp4) then
|
||||
FindLabel(tasmlabel(taicpu(hp1).oper[0]^.ref^.symbol),hp4) then
|
||||
begin
|
||||
taicpu(hp2).Opcode := A_SUB;
|
||||
taicpu(hp2).Loadoper(1,taicpu(hp2).oper[0]^);
|
||||
@ -1751,7 +1751,7 @@ begin
|
||||
begin
|
||||
if (taicpu(p).ops >= 2) and
|
||||
((taicpu(p).oper[0]^.typ = top_const) or
|
||||
(taicpu(p).oper[0]^.typ = top_symbol)) and
|
||||
((taicpu(p).oper[0]^.typ = top_ref) and (taicpu(p).oper[0]^.ref^.refaddr=addr_full))) and
|
||||
(taicpu(p).oper[1]^.typ = top_reg) and
|
||||
((taicpu(p).ops = 2) or
|
||||
((taicpu(p).oper[2]^.typ = top_reg) and
|
||||
@ -1857,9 +1857,9 @@ begin
|
||||
GetNextInstruction(p, hp1) and
|
||||
(hp1.typ = ait_instruction) and
|
||||
(taicpu(hp1).opcode = A_JMP) and
|
||||
(taicpu(hp1).oper[0]^.typ = top_symbol) then
|
||||
((taicpu(hp1).oper[0]^.typ=top_ref) and (taicpu(p).oper[0]^.ref^.refaddr=addr_full)) then
|
||||
begin
|
||||
hp2 := taicpu.Op_sym(A_PUSH,S_L,taicpu(hp1).oper[0]^.sym);
|
||||
hp2 := taicpu.Op_sym(A_PUSH,S_L,taicpu(hp1).oper[0]^.ref^.symbol);
|
||||
InsertLLItem(asml, p.previous, p, hp2);
|
||||
taicpu(p).opcode := A_JMP;
|
||||
taicpu(p).is_jmp := true;
|
||||
@ -1999,7 +1999,15 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.56 2004-02-03 21:19:40 peter
|
||||
Revision 1.57 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.56 2004/02/03 21:19:40 peter
|
||||
* remove previous commit
|
||||
|
||||
Revision 1.55 2004/02/03 16:53:37 peter
|
||||
|
@ -35,7 +35,8 @@ implementation
|
||||
|
||||
uses
|
||||
{$ifdef replaceregdebug}cutils,{$endif}
|
||||
verbose,globals,cpubase,daopt386,csopt386,rgobj, cgbase, cgobj;
|
||||
verbose,globals,cpubase,daopt386,csopt386,rgobj,
|
||||
cgbase,cgutils,cgobj;
|
||||
|
||||
function canBeFirstSwitch(p: taicpu; supreg: tsuperregister): boolean;
|
||||
{ checks whether an operation on reg can be switched to another reg without an }
|
||||
@ -54,7 +55,7 @@ begin
|
||||
(p.oper[0]^.typ <> top_ref) and
|
||||
(not pTaiprop(p.optinfo)^.FlagsUsed);
|
||||
A_INC,A_DEC:
|
||||
canBeFirstSwitch :=
|
||||
canBeFirstSwitch :=
|
||||
(p.oper[0]^.typ = top_reg) and
|
||||
(p.opsize = S_L) and
|
||||
(not pTaiprop(p.optinfo)^.FlagsUsed);
|
||||
@ -159,8 +160,11 @@ begin
|
||||
if p.opcode = A_SUB then
|
||||
tmpref.offset := - tmpRef.offset;
|
||||
end;
|
||||
top_symbol:
|
||||
tmpref.symbol := p.oper[0]^.sym;
|
||||
top_ref:
|
||||
if (p.oper[0]^.ref^.refaddr=addr_full) then
|
||||
tmpref.symbol := p.oper[0]^.ref^.symbol
|
||||
else
|
||||
internalerror(200402261);
|
||||
top_reg:
|
||||
begin
|
||||
tmpref.index := p.oper[0]^.reg;
|
||||
@ -360,7 +364,15 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.25 2003-12-15 16:08:16 jonas
|
||||
Revision 1.26 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.25 2003/12/15 16:08:16 jonas
|
||||
- disable removal of dead loads before a call, because register
|
||||
parameters are released before a call
|
||||
* fix storeback of registers in case of different sizes (e.g., first
|
||||
|
@ -72,7 +72,10 @@ interface
|
||||
aasmbase,aasmtai,aasmcpu,symsym,
|
||||
defutil,
|
||||
nflw,pass_2,
|
||||
cgbase,procinfo,cgobj,tgobj
|
||||
cgbase,
|
||||
cgutils,cgobj,
|
||||
procinfo,
|
||||
tgobj
|
||||
;
|
||||
|
||||
{*****************************************************************************
|
||||
@ -142,13 +145,13 @@ interface
|
||||
begin
|
||||
if (op.typ=top_local) then
|
||||
begin
|
||||
sofs:=op.localsymofs;
|
||||
indexreg:=op.localindexreg;
|
||||
sofs:=op.localoper^.localsymofs;
|
||||
indexreg:=op.localoper^.localindexreg;
|
||||
{$ifdef x86}
|
||||
scale:=op.localscale;
|
||||
scale:=op.localoper^.localscale;
|
||||
{$endif x86}
|
||||
getoffset:=op.localgetoffset;
|
||||
sym:=tvarsym(pointer(op.localsym));
|
||||
getoffset:=op.localoper^.localgetoffset;
|
||||
sym:=tvarsym(pointer(op.localoper^.localsym));
|
||||
case sym.localloc.loc of
|
||||
LOC_REFERENCE :
|
||||
begin
|
||||
@ -249,10 +252,12 @@ interface
|
||||
begin
|
||||
case typ of
|
||||
top_ref :
|
||||
if assigned(ref^.symbol) then
|
||||
ReLabel(ref^.symbol);
|
||||
top_symbol :
|
||||
ReLabel(sym);
|
||||
begin
|
||||
if assigned(ref^.symbol) then
|
||||
ReLabel(ref^.symbol);
|
||||
if assigned(ref^.relsymbol) then
|
||||
ReLabel(ref^.symbol);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -469,7 +474,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.55 2004-02-04 18:45:29 jonas
|
||||
Revision 1.56 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.55 2004/02/04 18:45:29 jonas
|
||||
+ some more usage of register temps
|
||||
|
||||
Revision 1.54 2004/02/03 19:48:06 jonas
|
||||
|
@ -92,7 +92,8 @@ implementation
|
||||
{$ifdef x86}
|
||||
cga,cgx86,
|
||||
{$endif x86}
|
||||
ncgutil,cgobj,tgobj,
|
||||
ncgutil,
|
||||
cgutils,cgobj,tgobj,
|
||||
procinfo;
|
||||
|
||||
|
||||
@ -1241,7 +1242,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.159 2004-02-26 16:12:04 peter
|
||||
Revision 1.160 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.159 2004/02/26 16:12:04 peter
|
||||
* support typecasts for passing @var to formal const
|
||||
|
||||
Revision 1.158 2004/02/22 13:01:15 daniel
|
||||
|
@ -63,7 +63,7 @@ interface
|
||||
cpubase,cpuinfo,systems,
|
||||
pass_2,
|
||||
procinfo,cgbase,
|
||||
cgobj,
|
||||
cgutils,cgobj,
|
||||
ncgutil,
|
||||
tgobj
|
||||
;
|
||||
@ -535,7 +535,15 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.54 2004-02-05 01:24:08 florian
|
||||
Revision 1.55 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.54 2004/02/05 01:24:08 florian
|
||||
* several fixes to compile x86-64 system
|
||||
|
||||
Revision 1.53 2004/01/31 17:45:17 peter
|
||||
|
@ -91,7 +91,8 @@ implementation
|
||||
nld,ncon,
|
||||
ncgutil,
|
||||
tgobj,paramgr,
|
||||
regvars,cgobj
|
||||
regvars,
|
||||
cgutils,cgobj
|
||||
{$ifndef cpu64bit}
|
||||
,cg64f32
|
||||
{$endif cpu64bit}
|
||||
@ -1461,7 +1462,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.92 2004-02-12 15:54:03 peter
|
||||
Revision 1.93 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.92 2004/02/12 15:54:03 peter
|
||||
* make extcycle is working again
|
||||
|
||||
Revision 1.91 2004/02/05 18:28:37 peter
|
||||
|
@ -61,7 +61,9 @@ implementation
|
||||
cgbase,pass_1,pass_2,
|
||||
cpuinfo,cpubase,paramgr,procinfo,
|
||||
nbas,ncon,ncal,ncnv,nld,
|
||||
tgobj,ncgutil,cgobj,rgobj
|
||||
tgobj,ncgutil,
|
||||
cgutils,cgobj,
|
||||
rgobj
|
||||
{$ifndef cpu64bit}
|
||||
,cg64f32
|
||||
{$endif cpu64bit}
|
||||
@ -676,7 +678,15 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.54 2004-02-05 16:58:43 florian
|
||||
Revision 1.55 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.54 2004/02/05 16:58:43 florian
|
||||
* fixed (hopefully) the ansistring length bug
|
||||
|
||||
Revision 1.53 2004/02/05 01:24:08 florian
|
||||
|
@ -56,7 +56,9 @@ implementation
|
||||
cgbase,pass_2,
|
||||
procinfo,
|
||||
cpubase,cpuinfo,
|
||||
tgobj,ncgutil,cgobj,ncgbas;
|
||||
tgobj,ncgutil,
|
||||
cgutils,cgobj,
|
||||
ncgbas;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondLoad
|
||||
@ -906,7 +908,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.111 2004-02-22 16:48:09 florian
|
||||
Revision 1.112 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.111 2004/02/22 16:48:09 florian
|
||||
* x86_64 uses generic concatcopy_valueopenarray for now
|
||||
|
||||
Revision 1.110 2004/02/22 16:30:37 florian
|
||||
@ -1355,4 +1365,4 @@ end.
|
||||
* bugfix of hdisponen (base must be set, not index)
|
||||
* more portability fixes
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ implementation
|
||||
aasmbase,aasmtai,
|
||||
procinfo,pass_2,
|
||||
pass_1,nld,ncon,nadd,nutils,
|
||||
cgobj,tgobj,ncgutil,symbase
|
||||
cgutils,cgobj,
|
||||
tgobj,ncgutil,symbase
|
||||
;
|
||||
|
||||
|
||||
@ -881,7 +882,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.87 2004-02-20 21:55:59 peter
|
||||
Revision 1.88 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.87 2004/02/20 21:55:59 peter
|
||||
* procvar cleanup
|
||||
|
||||
Revision 1.86 2004/02/03 22:32:54 peter
|
||||
|
@ -90,7 +90,8 @@ implementation
|
||||
paramgr,
|
||||
pass_2,
|
||||
nbas,ncon,nflw,
|
||||
ncgutil,regvars,cpuinfo;
|
||||
ncgutil,regvars,cpuinfo,
|
||||
cgutils;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
@ -990,7 +991,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.59 2004-02-08 14:51:04 jonas
|
||||
Revision 1.60 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.59 2004/02/08 14:51:04 jonas
|
||||
* fixed for regvars + simplification
|
||||
|
||||
Revision 1.58 2004/02/05 19:35:27 florian
|
||||
|
@ -120,7 +120,7 @@ implementation
|
||||
gdb,
|
||||
{$endif GDB}
|
||||
ncon,
|
||||
tgobj,cgobj;
|
||||
tgobj,cgutils,cgobj;
|
||||
|
||||
|
||||
const
|
||||
@ -2141,7 +2141,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.193 2004-02-22 18:27:21 florian
|
||||
Revision 1.194 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.193 2004/02/22 18:27:21 florian
|
||||
* fixed exception reason size for 64 bit systems
|
||||
|
||||
Revision 1.192 2004/02/08 17:48:59 jonas
|
||||
|
@ -154,7 +154,7 @@ implementation
|
||||
{$endif GDB}
|
||||
aasmcpu,
|
||||
cpubase,cgbase,
|
||||
cgobj
|
||||
cgutils,cgobj
|
||||
;
|
||||
|
||||
|
||||
@ -1380,7 +1380,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.63 2004-02-26 16:16:38 peter
|
||||
Revision 1.64 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.63 2004/02/26 16:16:38 peter
|
||||
* tai_const.create_ptr added
|
||||
|
||||
Revision 1.62 2004/02/19 17:07:42 florian
|
||||
|
@ -107,8 +107,8 @@ unit agppcgas;
|
||||
);
|
||||
|
||||
|
||||
symaddr2str: array[trefsymaddr] of string[3] = ('','@ha','@l');
|
||||
symaddr2str_darwin: array[trefsymaddr] of string[4] = ('','ha16','lo16');
|
||||
refaddr2str: array[trefaddr] of string[3] = ('','','@ha','@l');
|
||||
refaddr2str_darwin: array[trefaddr] of string[4] = ('','','ha16','lo16');
|
||||
|
||||
|
||||
function getreferencestring(var ref : treference) : string;
|
||||
@ -117,16 +117,15 @@ unit agppcgas;
|
||||
begin
|
||||
with ref do
|
||||
begin
|
||||
inc(offset,offsetfixup);
|
||||
if ((offset < -32768) or (offset > 32767)) and
|
||||
(symaddr = refs_full) then
|
||||
(refaddr = addr_no) then
|
||||
internalerror(19991);
|
||||
if (symaddr = refs_full) then
|
||||
if (refaddr = addr_no) then
|
||||
s := ''
|
||||
else
|
||||
begin
|
||||
if target_info.system = system_powerpc_darwin then
|
||||
s := symaddr2str_darwin[symaddr]
|
||||
s := refaddr2str_darwin[refaddr]
|
||||
else
|
||||
s :='';
|
||||
s := s+'(';
|
||||
@ -144,11 +143,11 @@ unit agppcgas;
|
||||
s:=s+tostr(offset);
|
||||
end;
|
||||
|
||||
if (symaddr <> refs_full) then
|
||||
if (refaddr in [addr_lo,addr_hi]) then
|
||||
begin
|
||||
s := s+')';
|
||||
if (target_info.system <> system_powerpc_darwin) then
|
||||
s := s+symaddr2str[symaddr];
|
||||
s := s+refaddr2str[refaddr];
|
||||
end;
|
||||
|
||||
if (index=NR_NO) and (base<>NR_NO) then
|
||||
@ -187,14 +186,16 @@ unit agppcgas;
|
||||
{ no top_ref jumping for powerpc }
|
||||
top_const :
|
||||
getopstr_jmp:=tostr(o.val);
|
||||
top_symbol :
|
||||
top_ref :
|
||||
begin
|
||||
hs:=o.sym.name;
|
||||
if o.symofs>0 then
|
||||
hs:=hs+'+'+tostr(o.symofs)
|
||||
if o.ref^.refaddr<>addr_full then
|
||||
internalerror(200402262);
|
||||
hs:=o.ref^.symbol.name;
|
||||
if o.ref^.offset>0 then
|
||||
hs:=hs+'+'+tostr(o.ref^.offset)
|
||||
else
|
||||
if o.symofs<0 then
|
||||
hs:=hs+tostr(o.symofs);
|
||||
if o.ref^.offset<0 then
|
||||
hs:=hs+tostr(o.ref^.offset);
|
||||
getopstr_jmp:=hs;
|
||||
end;
|
||||
top_none:
|
||||
@ -214,17 +215,18 @@ unit agppcgas;
|
||||
top_const:
|
||||
getopstr:=tostr(longint(o.val));
|
||||
top_ref:
|
||||
getopstr:=getreferencestring(o.ref^);
|
||||
top_symbol:
|
||||
begin
|
||||
hs:=o.sym.name;
|
||||
if o.symofs>0 then
|
||||
hs:=hs+'+'+tostr(o.symofs)
|
||||
else
|
||||
if o.symofs<0 then
|
||||
hs:=hs+tostr(o.symofs);
|
||||
getopstr:=hs;
|
||||
end;
|
||||
if o.ref^.refaddr=addr_full then
|
||||
begin
|
||||
hs:=o.ref^.symbol.name;
|
||||
if o.ref^.offset>0 then
|
||||
hs:=hs+'+'+tostr(o.ref^.offset)
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
hs:=hs+tostr(o.ref^.offset);
|
||||
getopstr:=hs;
|
||||
end
|
||||
else
|
||||
getopstr:=getreferencestring(o.ref^);
|
||||
else
|
||||
internalerror(2002070604);
|
||||
end;
|
||||
@ -328,7 +330,7 @@ unit agppcgas;
|
||||
else
|
||||
begin
|
||||
s:=cond2str(op,taicpu(hp).condition);
|
||||
if (s[length(s)] <> #9) and
|
||||
if (s[length(s)] <> #9) and
|
||||
(taicpu(hp).ops>0) then
|
||||
s := s + ',';
|
||||
end;
|
||||
@ -373,7 +375,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.40 2004-01-04 21:17:51 jonas
|
||||
Revision 1.41 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.40 2004/01/04 21:17:51 jonas
|
||||
+ added log message for last commit
|
||||
|
||||
Revision 1.39 2004/01/04 21:12:47 jonas
|
||||
|
@ -114,9 +114,7 @@ var
|
||||
begin
|
||||
with ref do
|
||||
begin
|
||||
inc(offset,offsetfixup);
|
||||
|
||||
if (symaddr <> refs_full) then
|
||||
if (refaddr <> addr_no) then
|
||||
InternalError(2002110301)
|
||||
else if ((offset < -32768) or (offset > 32767)) then
|
||||
InternalError(19991);
|
||||
@ -180,28 +178,33 @@ var
|
||||
{ no top_ref jumping for powerpc }
|
||||
top_const :
|
||||
getopstr_jmp:=tostr(o.val);
|
||||
top_symbol :
|
||||
top_ref :
|
||||
begin
|
||||
hs:=o.sym.name;
|
||||
ReplaceForbiddenChars(hs);
|
||||
case o.sym.typ of
|
||||
AT_FUNCTION:
|
||||
begin
|
||||
if hs[1] <> '@' then {if not local label}
|
||||
if use_PR then
|
||||
hs:= '.'+hs+'[PR]'
|
||||
else
|
||||
hs:= '.'+hs
|
||||
end
|
||||
else
|
||||
;
|
||||
end;
|
||||
if o.symofs>0 then
|
||||
hs:=hs+'+'+tostr(o.symofs)
|
||||
if o.ref^.refaddr=addr_full then
|
||||
begin
|
||||
hs:=o.ref^.symbol.name;
|
||||
ReplaceForbiddenChars(hs);
|
||||
case o.ref^.symbol.typ of
|
||||
AT_FUNCTION:
|
||||
begin
|
||||
if hs[1] <> '@' then {if not local label}
|
||||
if use_PR then
|
||||
hs:= '.'+hs+'[PR]'
|
||||
else
|
||||
hs:= '.'+hs
|
||||
end
|
||||
else
|
||||
;
|
||||
end;
|
||||
if o.ref^.offset>0 then
|
||||
hs:=hs+'+'+tostr(o.ref^.offset)
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
hs:=hs+tostr(o.ref^.offset);
|
||||
getopstr_jmp:=hs;
|
||||
end
|
||||
else
|
||||
if o.symofs<0 then
|
||||
hs:=hs+tostr(o.symofs);
|
||||
getopstr_jmp:=hs;
|
||||
internalerror(200402263);
|
||||
end;
|
||||
top_none:
|
||||
getopstr_jmp:='';
|
||||
@ -220,18 +223,19 @@ var
|
||||
top_const:
|
||||
getopstr:=tostr(longint(o.val));
|
||||
top_ref:
|
||||
getopstr:=getreferencestring(o.ref^);
|
||||
top_symbol:
|
||||
begin
|
||||
hs:=o.sym.name;
|
||||
ReplaceForbiddenChars(hs);
|
||||
if o.symofs>0 then
|
||||
hs:=hs+'+'+tostr(o.symofs)
|
||||
else
|
||||
if o.symofs<0 then
|
||||
hs:=hs+tostr(o.symofs);
|
||||
getopstr:=hs;
|
||||
end;
|
||||
if o.ref^.refaddr=addr_no then
|
||||
getopstr:=getreferencestring(o.ref^)
|
||||
else
|
||||
begin
|
||||
hs:=o.ref^.symbol.name;
|
||||
ReplaceForbiddenChars(hs);
|
||||
if o.ref^.offset>0 then
|
||||
hs:=hs+'+'+tostr(o.ref^.offset)
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
hs:=hs+tostr(o.ref^.offset);
|
||||
getopstr:=hs;
|
||||
end;
|
||||
else
|
||||
internalerror(2002070604);
|
||||
end;
|
||||
@ -1382,7 +1386,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.30 2004-02-04 15:28:24 olle
|
||||
Revision 1.31 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.30 2004/02/04 15:28:24 olle
|
||||
* made more in phase with agppcgas.pas
|
||||
|
||||
Revision 1.29 2004/01/12 00:08:03 olle
|
||||
|
@ -158,7 +158,8 @@ const
|
||||
uses
|
||||
globtype,globals,verbose,systems,cutils,
|
||||
symconst,symdef,symsym,
|
||||
rgobj,tgobj,cpupi,procinfo,paramgr;
|
||||
rgobj,tgobj,cpupi,procinfo,paramgr,
|
||||
cgutils;
|
||||
|
||||
|
||||
procedure tcgppc.init_register_allocators;
|
||||
@ -172,11 +173,19 @@ const
|
||||
RS_R14,RS_R13],first_int_imreg,[]);
|
||||
case target_info.abi of
|
||||
abi_powerpc_aix:
|
||||
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
|
||||
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
|
||||
RS_F10,RS_F11,RS_F12,RS_F13,RS_F31,RS_F30,RS_F29,RS_F28,RS_F27,
|
||||
RS_F26,RS_F25,RS_F24,RS_F23,RS_F22,RS_F21,RS_F20,RS_F19,RS_F18,
|
||||
RS_F17,RS_F16,RS_F15,RS_F14],first_fpu_imreg,[]);
|
||||
{ darwin uses R10 as got }
|
||||
if target_info.system=system_powerpc_darwin then
|
||||
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
|
||||
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
|
||||
RS_F11,RS_F12,RS_F13,RS_F31,RS_F30,RS_F29,RS_F28,RS_F27,
|
||||
RS_F26,RS_F25,RS_F24,RS_F23,RS_F22,RS_F21,RS_F20,RS_F19,RS_F18,
|
||||
RS_F17,RS_F16,RS_F15,RS_F14],first_fpu_imreg,[])
|
||||
else
|
||||
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
|
||||
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
|
||||
RS_F10,RS_F11,RS_F12,RS_F13,RS_F31,RS_F30,RS_F29,RS_F28,RS_F27,
|
||||
RS_F26,RS_F25,RS_F24,RS_F23,RS_F22,RS_F21,RS_F20,RS_F19,RS_F18,
|
||||
RS_F17,RS_F16,RS_F15,RS_F14],first_fpu_imreg,[]);
|
||||
abi_powerpc_sysv:
|
||||
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
|
||||
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
|
||||
@ -951,6 +960,7 @@ const
|
||||
usesfpr,usesgpr,gotgot : boolean;
|
||||
parastart : aword;
|
||||
// r,r2,rsp:Tregister;
|
||||
l : tasmlabel;
|
||||
regcounter2, firstfpureg: Tsuperregister;
|
||||
hp: tparaitem;
|
||||
|
||||
@ -1153,13 +1163,24 @@ const
|
||||
if cs_create_pic in aktmoduleswitches then
|
||||
begin
|
||||
{ if we didn't get the GOT pointer till now, we've to calculate it now }
|
||||
if not(gotgot) then
|
||||
begin
|
||||
{!!!!!!!!!!!!!}
|
||||
end;
|
||||
a_reg_alloc(list,NR_R31);
|
||||
{ place GOT ptr in r31 }
|
||||
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R31,NR_LR));
|
||||
if not(gotgot) and (pi_needs_got in current_procinfo.flags) then
|
||||
case target_info.system of
|
||||
system_powerpc_darwin:
|
||||
begin
|
||||
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R0,NR_LR));
|
||||
objectlibrary.getlabel(l);
|
||||
list.concat(taicpu.op_const_const_sym(A_BCL,20,31,l));
|
||||
a_label(list,l);
|
||||
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R10,NR_LR));
|
||||
list.concat(taicpu.op_reg_reg(A_MTSPR,NR_R0,NR_LR));
|
||||
end;
|
||||
else
|
||||
begin
|
||||
a_reg_alloc(list,NR_R31);
|
||||
{ place GOT ptr in r31 }
|
||||
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R31,NR_LR));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ save the CR if necessary ( !!! always done currently ) }
|
||||
{ still need to find out where this has to be done for SystemV
|
||||
@ -1332,7 +1353,7 @@ const
|
||||
var regcounter,firstregfpu,firstreggpr: TSuperRegister;
|
||||
usesfpr,usesgpr: boolean;
|
||||
href : treference;
|
||||
offset: integer;
|
||||
offset: aint;
|
||||
regcounter2, firstfpureg: Tsuperregister;
|
||||
begin
|
||||
usesfpr:=false;
|
||||
@ -1678,7 +1699,7 @@ const
|
||||
reference_reset(tmpref);
|
||||
tmpref.offset := ref2.offset;
|
||||
tmpref.symbol := ref2.symbol;
|
||||
tmpref.symaddr := refs_ha;
|
||||
tmpref.refaddr := addr_hi;
|
||||
if ref2.base<> NR_NO then
|
||||
begin
|
||||
list.concat(taicpu.op_reg_reg_ref(A_ADDIS,r,
|
||||
@ -1692,7 +1713,7 @@ const
|
||||
else
|
||||
list.concat(taicpu.op_reg_ref(A_LIS,r,tmpref));
|
||||
tmpref.base := NR_NO;
|
||||
tmpref.symaddr := refs_l;
|
||||
tmpref.refaddr := addr_lo;
|
||||
{ can be folded with one of the next instructions by the }
|
||||
{ optimizer probably }
|
||||
list.concat(taicpu.op_reg_reg_ref(A_ADDI,r,r,tmpref));
|
||||
@ -2154,14 +2175,14 @@ const
|
||||
reference_reset(tmpref);
|
||||
tmpref.symbol := ref.symbol;
|
||||
tmpref.offset := ref.offset;
|
||||
tmpref.symaddr := refs_ha;
|
||||
tmpref.refaddr := addr_hi;
|
||||
if ref.base <> NR_NO then
|
||||
list.concat(taicpu.op_reg_reg_ref(A_ADDIS,tmpreg,
|
||||
ref.base,tmpref))
|
||||
else
|
||||
list.concat(taicpu.op_reg_ref(A_LIS,tmpreg,tmpref));
|
||||
ref.base := tmpreg;
|
||||
ref.symaddr := refs_l;
|
||||
ref.refaddr := addr_lo;
|
||||
list.concat(taicpu.op_reg_ref(op,reg,ref));
|
||||
end
|
||||
else
|
||||
@ -2300,7 +2321,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.163 2004-02-09 22:45:49 florian
|
||||
Revision 1.164 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.163 2004/02/09 22:45:49 florian
|
||||
* compilation fixed
|
||||
|
||||
Revision 1.162 2004/02/09 20:44:40 olle
|
||||
|
@ -240,10 +240,6 @@ uses
|
||||
type
|
||||
trefoptions=(ref_none,ref_parafixup,ref_localfixup,ref_selffixup);
|
||||
|
||||
{ since we have only 16 offsets, we need to be able to specify the high }
|
||||
{ and low 16 bits of the address of a symbol }
|
||||
trefsymaddr = (refs_full,refs_ha,refs_l);
|
||||
|
||||
{ reference record }
|
||||
preference = ^treference;
|
||||
treference = packed record
|
||||
@ -252,18 +248,13 @@ uses
|
||||
{ index register, R_NO if none }
|
||||
index : tregister;
|
||||
{ offset, 0 if none }
|
||||
offset : longint;
|
||||
offset : aint;
|
||||
{ symbol this reference refers to, nil if none }
|
||||
symbol : tasmsymbol;
|
||||
{ used in conjunction with symbols and offsets: refs_full means }
|
||||
{ means a full 32bit reference, refs_ha means the upper 16 bits }
|
||||
{ and refs_l the lower 16 bits of the address }
|
||||
symaddr : trefsymaddr;
|
||||
{ changed when inlining and possibly in other cases, don't }
|
||||
{ set manually }
|
||||
offsetfixup : longint;
|
||||
{ used in conjunction with the previous field }
|
||||
options : trefoptions;
|
||||
{ symbol the symbol of this reference is relative to, nil if none }
|
||||
relsymbol : tasmsymbol;
|
||||
{ reference type addr or symbol itself }
|
||||
refaddr : trefaddr;
|
||||
{ alignment this reference is guaranteed to have }
|
||||
alignment : byte;
|
||||
end;
|
||||
@ -276,7 +267,7 @@ uses
|
||||
end;
|
||||
|
||||
const
|
||||
symaddr2str: array[trefsymaddr] of string[3] = ('','@ha','@l');
|
||||
symaddr2str: array[trefaddr] of string[3] = ('','','@ha','@l');
|
||||
|
||||
const
|
||||
{ MacOS only. Whether the direct data area (TOC) directly contain
|
||||
@ -632,7 +623,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.85 2004-02-09 22:45:49 florian
|
||||
Revision 1.86 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.85 2004/02/09 22:45:49 florian
|
||||
* compilation fixed
|
||||
|
||||
Revision 1.84 2004/02/08 18:08:59 jonas
|
||||
|
@ -23,6 +23,7 @@ Interface
|
||||
Type
|
||||
{ Architecture word - Native unsigned type }
|
||||
AWord = Longword;
|
||||
AInt = Longint;
|
||||
PAWord = ^AWord;
|
||||
|
||||
{ this must be an ordinal type with the same size as a pointer }
|
||||
@ -100,7 +101,15 @@ Implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 2003-11-12 16:05:40 florian
|
||||
Revision 1.17 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.16 2003/11/12 16:05:40 florian
|
||||
* assembler readers OOPed
|
||||
+ typed currency constants
|
||||
+ typed 128 bit float constants if the CPU supports it
|
||||
|
@ -37,7 +37,7 @@ uses
|
||||
fmodule,
|
||||
nobj,
|
||||
cpuinfo,cpubase,
|
||||
cgobj;
|
||||
cgutils,cgobj;
|
||||
|
||||
type
|
||||
tppcclassheader=class(tclassheader)
|
||||
@ -167,7 +167,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2003-12-28 15:14:14 jonas
|
||||
Revision 1.4 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.3 2003/12/28 15:14:14 jonas
|
||||
* hopefully fixed interfaces (untested)
|
||||
|
||||
Revision 1.2 2003/12/23 23:12:44 peter
|
||||
|
@ -38,7 +38,7 @@ Unit rappcgas;
|
||||
procedure BuildOpCode(instr : tppcinstruction);
|
||||
procedure ReadAt(oper : tppcoperand);
|
||||
procedure ReadSym(oper : tppcoperand);
|
||||
procedure ConvertCalljmp(instr : tppcinstruction);
|
||||
{ procedure ConvertCalljmp(instr : tppcinstruction); }
|
||||
end;
|
||||
|
||||
|
||||
@ -104,9 +104,9 @@ Unit rappcgas;
|
||||
if actasmtoken=AS_ID then
|
||||
begin
|
||||
if upper(actasmpattern)='L' then
|
||||
oper.opr.ref.symaddr:=refs_l
|
||||
oper.opr.ref.refaddr:=addr_lo
|
||||
else if upper(actasmpattern)='HA' then
|
||||
oper.opr.ref.symaddr:=refs_ha
|
||||
oper.opr.ref.refaddr:=addr_hi
|
||||
else
|
||||
Message(asmr_e_invalid_reference_syntax);
|
||||
Consume(AS_ID);
|
||||
@ -695,7 +695,7 @@ Unit rappcgas;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
procedure tppcattreader.ConvertCalljmp(instr : tppcinstruction);
|
||||
var
|
||||
newopr : toprrec;
|
||||
@ -712,7 +712,7 @@ Unit rappcgas;
|
||||
instr.Operands[1].opr:=newopr;
|
||||
end;
|
||||
end;
|
||||
|
||||
}
|
||||
|
||||
procedure tppcattreader.handleopcode;
|
||||
var
|
||||
@ -721,8 +721,10 @@ Unit rappcgas;
|
||||
instr:=TPPCInstruction.Create(TPPCOperand);
|
||||
BuildOpcode(instr);
|
||||
instr.condition := actcondition;
|
||||
{
|
||||
if is_calljmp(instr.opcode) then
|
||||
ConvertCalljmp(instr);
|
||||
}
|
||||
{
|
||||
instr.AddReferenceSizes;
|
||||
instr.SetInstructionOpsize;
|
||||
@ -758,7 +760,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2004-02-04 15:23:28 olle
|
||||
Revision 1.10 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.9 2004/02/04 15:23:28 olle
|
||||
* uodated header comment
|
||||
|
||||
Revision 1.8 2003/11/29 22:54:32 jonas
|
||||
|
@ -26,6 +26,9 @@ unit ppu;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
cpuinfo;
|
||||
|
||||
{ Also write the ppu if only crc if done, this can be used with ppudump to
|
||||
see the differences between the intf and implementation }
|
||||
{ define INTFPPU}
|
||||
@ -217,6 +220,8 @@ type
|
||||
function getbyte:byte;
|
||||
function getword:word;
|
||||
function getlongint:longint;
|
||||
function getint64:int64;
|
||||
function getaint:aint;
|
||||
function getreal:ppureal;
|
||||
function getstring:string;
|
||||
procedure getnormalset(var b);
|
||||
@ -232,6 +237,8 @@ type
|
||||
procedure putbyte(b:byte);
|
||||
procedure putword(w:word);
|
||||
procedure putlongint(l:longint);
|
||||
procedure putint64(i:int64);
|
||||
procedure putaint(i:aint);
|
||||
procedure putreal(d:ppureal);
|
||||
procedure putstring(s:string);
|
||||
procedure putnormalset(const b);
|
||||
@ -246,7 +253,8 @@ implementation
|
||||
{$ifdef Test_Double_checksum}
|
||||
comphook,
|
||||
{$endif def Test_Double_checksum}
|
||||
crc;
|
||||
crc,
|
||||
cutils;
|
||||
|
||||
{*****************************************************************************
|
||||
Endian Handling
|
||||
@ -606,6 +614,35 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function tppufile.getint64:int64;
|
||||
var
|
||||
i : int64;
|
||||
begin
|
||||
if entryidx+8>entry.size then
|
||||
begin
|
||||
error:=true;
|
||||
result:=0;
|
||||
exit;
|
||||
end;
|
||||
readdata(i,8);
|
||||
if change_endian then
|
||||
result:=swapint64(i)
|
||||
else
|
||||
result:=i;
|
||||
inc(entryidx,8);
|
||||
end;
|
||||
|
||||
|
||||
function tppufile.getaint:aint;
|
||||
begin
|
||||
{$ifdef cpu64bit}
|
||||
result:=getint64;
|
||||
{$else cpu64bit}
|
||||
result:=getlongint;
|
||||
{$endif cpu64bit}
|
||||
end;
|
||||
|
||||
|
||||
function tppufile.getreal:ppureal;
|
||||
var
|
||||
d : ppureal;
|
||||
@ -913,6 +950,18 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure tppufile.putint64(i:int64);
|
||||
begin
|
||||
putdata(i,8);
|
||||
end;
|
||||
|
||||
|
||||
procedure tppufile.putaint(i:aint);
|
||||
begin
|
||||
putdata(i,sizeof(aint));
|
||||
end;
|
||||
|
||||
|
||||
procedure tppufile.putreal(d:ppureal);
|
||||
begin
|
||||
putdata(d,sizeof(ppureal));
|
||||
@ -993,7 +1042,15 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.45 2004-01-30 13:42:03 florian
|
||||
Revision 1.46 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.45 2004/01/30 13:42:03 florian
|
||||
* fixed more alignment issues
|
||||
|
||||
Revision 1.44 2003/11/10 22:02:52 peter
|
||||
|
@ -122,7 +122,7 @@ implementation
|
||||
|
||||
uses
|
||||
cutils,systems,
|
||||
tgobj,cgobj,
|
||||
tgobj,cgutils,cgobj,
|
||||
paramgr
|
||||
;
|
||||
|
||||
@ -181,7 +181,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 2004-02-19 17:07:42 florian
|
||||
Revision 1.13 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.12 2004/02/19 17:07:42 florian
|
||||
* fixed arg. area calculation
|
||||
|
||||
Revision 1.11 2003/12/26 14:02:30 peter
|
||||
|
@ -157,10 +157,6 @@ uses
|
||||
type
|
||||
TRefOptions=(ref_none,ref_parafixup,ref_localfixup,ref_selffixup);
|
||||
|
||||
{ since we have no full 32 bit offsets, we need to be able to specify the high
|
||||
and low bits of the address of a symbol }
|
||||
trefsymaddr = (refs_no,refs_full,refs_hi,refs_lo);
|
||||
|
||||
{ reference record }
|
||||
preference = ^treference;
|
||||
treference = packed record
|
||||
@ -552,7 +548,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.61 2004-02-25 14:25:47 mazen
|
||||
Revision 1.62 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.61 2004/02/25 14:25:47 mazen
|
||||
* fix compile problem for sparc
|
||||
|
||||
Revision 1.60 2004/01/12 22:11:39 peter
|
||||
|
@ -337,7 +337,8 @@ type
|
||||
{# procedure contains data which needs to be finalized }
|
||||
pi_needs_implicit_finally,
|
||||
{# procedure uses fpu}
|
||||
pi_uses_fpu
|
||||
pi_uses_fpu,
|
||||
pi_needs_got
|
||||
);
|
||||
tprocinfoflags=set of tprocinfoflag;
|
||||
|
||||
@ -401,7 +402,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.75 2004-02-20 21:54:47 peter
|
||||
Revision 1.76 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.75 2004/02/20 21:54:47 peter
|
||||
* use sp_internal flag to silence unused internal variable
|
||||
|
||||
Revision 1.74 2004/01/21 14:22:00 florian
|
||||
|
@ -40,7 +40,7 @@ implementation
|
||||
symconst,script,
|
||||
fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,symdef,
|
||||
import,export,link,i_bsd,
|
||||
cgobj;
|
||||
cgutils,cgbase,cgobj;
|
||||
|
||||
type
|
||||
tdarwinimported_item = class(timported_item)
|
||||
@ -223,7 +223,7 @@ implementation
|
||||
{$else powerpc}
|
||||
internalerror(2004010501);
|
||||
{$endif powerpc}
|
||||
|
||||
|
||||
importsSection.concat(Tai_section.Create(sec_data));
|
||||
importsSection.concat(Tai_direct.create(strpnew('.section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16')));
|
||||
importsSection.concat(Tai_align.Create(4));
|
||||
@ -241,9 +241,9 @@ implementation
|
||||
end;
|
||||
{$EndIf GDB}
|
||||
{$ifdef powerpc}
|
||||
href.symaddr := refs_ha;
|
||||
href.refaddr := addr_hi;
|
||||
importsSection.concat(taicpu.op_reg_ref(A_LIS,NR_R11,href));
|
||||
href.symaddr := refs_l;
|
||||
href.refaddr := addr_lo;
|
||||
href.base := NR_R11;
|
||||
importsSection.concat(taicpu.op_reg_ref(A_LWZU,NR_R12,href));
|
||||
importsSection.concat(taicpu.op_reg(A_MTCTR,NR_R12));
|
||||
@ -256,7 +256,7 @@ implementation
|
||||
importsSection.concat(Tai_symbol.Create(l1,0));
|
||||
importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+symname)));
|
||||
importsSection.concat(tai_const_symbol.createname(strpnew('dyld_stub_binding_helper')));
|
||||
|
||||
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -760,7 +760,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2004-02-15 16:34:18 marco
|
||||
Revision 1.10 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.9 2004/02/15 16:34:18 marco
|
||||
* pthread on -CURRENT related fixes.
|
||||
|
||||
Revision 1.8 2004/01/21 20:53:51 marco
|
||||
|
@ -105,6 +105,9 @@ interface
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
cgutils;
|
||||
|
||||
function DllName(Const Name : string;NdefExt:longint;DefExt:pStr4) : string;
|
||||
var n : string;
|
||||
i:longint;
|
||||
@ -1603,7 +1606,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.27 2004-01-09 13:37:17 daniel
|
||||
Revision 1.28 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.27 2004/01/09 13:37:17 daniel
|
||||
* Commented out code removed
|
||||
|
||||
Revision 1.25 2003/12/09 19:54:59 marco
|
||||
|
@ -759,7 +759,7 @@ implementation
|
||||
o.ot:=ppufile.getlongint;
|
||||
case o.typ of
|
||||
top_reg :
|
||||
ppufile.getdata(o.reg,sizeof(Tregister));
|
||||
ppufile.getdata(o.reg,sizeof(Tregister));
|
||||
top_ref :
|
||||
begin
|
||||
new(o.ref);
|
||||
@ -767,23 +767,22 @@ implementation
|
||||
ppufile.getdata(o.ref^.base,sizeof(Tregister));
|
||||
ppufile.getdata(o.ref^.index,sizeof(Tregister));
|
||||
o.ref^.scalefactor:=ppufile.getbyte;
|
||||
o.ref^.offset:=ppufile.getlongint;
|
||||
o.ref^.offset:=ppufile.getaint;
|
||||
o.ref^.symbol:=ppufile.getasmsymbol;
|
||||
o.ref^.relsymbol:=ppufile.getasmsymbol;
|
||||
end;
|
||||
top_const :
|
||||
o.val:=aword(ppufile.getlongint);
|
||||
top_symbol :
|
||||
begin
|
||||
o.sym:=ppufile.getasmsymbol;
|
||||
o.symofs:=ppufile.getlongint;
|
||||
end;
|
||||
o.val:=aword(ppufile.getaint);
|
||||
top_local :
|
||||
begin
|
||||
ppufile.getderef(o.localsymderef);
|
||||
o.localsymofs:=ppufile.getlongint;
|
||||
o.localindexreg:=tregister(ppufile.getlongint);
|
||||
o.localscale:=ppufile.getbyte;
|
||||
o.localgetoffset:=(ppufile.getbyte<>0);
|
||||
with o.localoper^ do
|
||||
begin
|
||||
ppufile.getderef(localsymderef);
|
||||
localsymofs:=ppufile.getaint;
|
||||
localindexreg:=tregister(ppufile.getlongint);
|
||||
localscale:=ppufile.getbyte;
|
||||
localgetoffset:=(ppufile.getbyte<>0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -802,23 +801,22 @@ implementation
|
||||
ppufile.putdata(o.ref^.base,sizeof(Tregister));
|
||||
ppufile.putdata(o.ref^.index,sizeof(Tregister));
|
||||
ppufile.putbyte(o.ref^.scalefactor);
|
||||
ppufile.putlongint(o.ref^.offset);
|
||||
ppufile.putaint(o.ref^.offset);
|
||||
ppufile.putasmsymbol(o.ref^.symbol);
|
||||
ppufile.putasmsymbol(o.ref^.relsymbol);
|
||||
end;
|
||||
top_const :
|
||||
ppufile.putlongint(longint(o.val));
|
||||
top_symbol :
|
||||
begin
|
||||
ppufile.putasmsymbol(o.sym);
|
||||
ppufile.putlongint(longint(o.symofs));
|
||||
end;
|
||||
ppufile.putaint(aint(o.val));
|
||||
top_local :
|
||||
begin
|
||||
ppufile.putderef(o.localsymderef);
|
||||
ppufile.putlongint(longint(o.localsymofs));
|
||||
ppufile.putlongint(longint(o.localindexreg));
|
||||
ppufile.putbyte(o.localscale);
|
||||
ppufile.putbyte(byte(o.localgetoffset));
|
||||
with o.localoper^ do
|
||||
begin
|
||||
ppufile.putderef(localsymderef);
|
||||
ppufile.putaint(aint(localsymofs));
|
||||
ppufile.putlongint(longint(localindexreg));
|
||||
ppufile.putbyte(localscale);
|
||||
ppufile.putbyte(byte(localgetoffset));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -828,7 +826,7 @@ implementation
|
||||
begin
|
||||
case o.typ of
|
||||
top_local :
|
||||
o.localsymderef.build(tvarsym(o.localsym));
|
||||
o.localoper^.localsymderef.build(tvarsym(o.localoper^.localsym));
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -839,12 +837,12 @@ implementation
|
||||
top_ref :
|
||||
begin
|
||||
if assigned(o.ref^.symbol) then
|
||||
objectlibrary.derefasmsymbol(o.ref^.symbol);
|
||||
objectlibrary.derefasmsymbol(o.ref^.symbol);
|
||||
if assigned(o.ref^.relsymbol) then
|
||||
objectlibrary.derefasmsymbol(o.ref^.relsymbol);
|
||||
end;
|
||||
top_symbol :
|
||||
objectlibrary.derefasmsymbol(o.sym);
|
||||
top_local :
|
||||
o.localsym:=tvarsym(o.localsymderef.resolve);
|
||||
o.localoper^.localsym:=tvarsym(o.localoper^.localsymderef.resolve);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -939,19 +937,45 @@ implementation
|
||||
end;
|
||||
top_ref :
|
||||
begin
|
||||
{ create ot field }
|
||||
if (ot and OT_SIZE_MASK)=0 then
|
||||
ot:=OT_MEMORY or opsize_2_type[i,opsize]
|
||||
if ref^.refaddr=addr_no then
|
||||
begin
|
||||
{ create ot field }
|
||||
if (ot and OT_SIZE_MASK)=0 then
|
||||
ot:=OT_MEMORY or opsize_2_type[i,opsize]
|
||||
else
|
||||
ot:=OT_MEMORY or (ot and OT_SIZE_MASK);
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) then
|
||||
ot:=ot or OT_MEM_OFFS;
|
||||
{ fix scalefactor }
|
||||
if (ref^.index=NR_NO) then
|
||||
ref^.scalefactor:=0
|
||||
else
|
||||
if (ref^.scalefactor=0) then
|
||||
ref^.scalefactor:=1;
|
||||
end
|
||||
else
|
||||
ot:=OT_MEMORY or (ot and OT_SIZE_MASK);
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) then
|
||||
ot:=ot or OT_MEM_OFFS;
|
||||
{ fix scalefactor }
|
||||
if (ref^.index=NR_NO) then
|
||||
ref^.scalefactor:=0
|
||||
else
|
||||
if (ref^.scalefactor=0) then
|
||||
ref^.scalefactor:=1;
|
||||
begin
|
||||
l:=ref^.offset;
|
||||
if assigned(ref^.symbol) then
|
||||
inc(l,ref^.symbol.address);
|
||||
{ when it is a forward jump we need to compensate the
|
||||
offset of the instruction since the previous time,
|
||||
because the symbol address is then still using the
|
||||
'old-style' addressing.
|
||||
For backwards jumps this is not required because the
|
||||
address of the symbol is already adjusted to the
|
||||
new offset }
|
||||
if (l>InsOffset) and (LastInsOffset<>-1) then
|
||||
inc(l,InsOffset-LastInsOffset);
|
||||
{ instruction size will then always become 2 (PFV) }
|
||||
relsize:=(InsOffset+2)-l;
|
||||
if (not assigned(ref^.symbol) or
|
||||
((ref^.symbol.currbind<>AB_EXTERNAL) and (ref^.symbol.address<>0))) and
|
||||
(relsize>=-128) and (relsize<=127) then
|
||||
ot:=OT_IMM32 or OT_SHORT
|
||||
else
|
||||
ot:=OT_IMM32 or OT_NEAR;
|
||||
end;
|
||||
end;
|
||||
top_local :
|
||||
begin
|
||||
@ -967,29 +991,8 @@ implementation
|
||||
else
|
||||
ot:=OT_IMMEDIATE or opsize_2_type[i,opsize];
|
||||
end;
|
||||
top_symbol :
|
||||
begin
|
||||
l:=symofs;
|
||||
if assigned(sym) then
|
||||
inc(l,sym.address);
|
||||
{ when it is a forward jump we need to compensate the
|
||||
offset of the instruction since the previous time,
|
||||
because the symbol address is then still using the
|
||||
'old-style' addressing.
|
||||
For backwards jumps this is not required because the
|
||||
address of the symbol is already adjusted to the
|
||||
new offset }
|
||||
if (l>InsOffset) and (LastInsOffset<>-1) then
|
||||
inc(l,InsOffset-LastInsOffset);
|
||||
{ instruction size will then always become 2 (PFV) }
|
||||
relsize:=(InsOffset+2)-l;
|
||||
if (not assigned(sym) or
|
||||
((sym.currbind<>AB_EXTERNAL) and (sym.address<>0))) and
|
||||
(relsize>=-128) and (relsize<=127) then
|
||||
ot:=OT_IMM32 or OT_SHORT
|
||||
else
|
||||
ot:=OT_IMM32 or OT_NEAR;
|
||||
end;
|
||||
else
|
||||
internalerror(200402261);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -1616,11 +1619,6 @@ implementation
|
||||
currval:=longint(oper[opidx]^.val);
|
||||
currsym:=nil;
|
||||
end;
|
||||
top_symbol :
|
||||
begin
|
||||
currval:=oper[opidx]^.symofs;
|
||||
currsym:=oper[opidx]^.sym;
|
||||
end;
|
||||
else
|
||||
Message(asmw_e_immediate_or_reference_expected);
|
||||
end;
|
||||
@ -1964,7 +1962,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.51 2004-02-09 22:14:17 peter
|
||||
Revision 1.52 2004-02-27 10:21:05 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.51 2004/02/09 22:14:17 peter
|
||||
* more x86_64 parameter fixes
|
||||
* tparalocation.lochigh is now used to indicate if registerhigh
|
||||
is used and what the type is
|
||||
|
@ -50,6 +50,7 @@ interface
|
||||
cutils,systems,
|
||||
verbose,
|
||||
itcpugas,
|
||||
cpuinfo,
|
||||
cgbase,
|
||||
aasmcpu;
|
||||
|
||||
@ -111,23 +112,24 @@ interface
|
||||
top_reg :
|
||||
AsmWrite(gas_regname(o.reg));
|
||||
top_ref :
|
||||
WriteReference(o.ref^);
|
||||
if o.ref^.refaddr=addr_no then
|
||||
WriteReference(o.ref^)
|
||||
else
|
||||
begin
|
||||
AsmWrite('$');
|
||||
if assigned(o.ref^.symbol) then
|
||||
AsmWrite(o.ref^.symbol.name);
|
||||
if o.ref^.offset>0 then
|
||||
AsmWrite('+'+tostr(o.ref^.offset))
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
AsmWrite(tostr(o.ref^.offset))
|
||||
else
|
||||
if not(assigned(o.ref^.symbol)) then
|
||||
AsmWrite('0');
|
||||
end;
|
||||
top_const :
|
||||
AsmWrite('$'+tostr(longint(o.val)));
|
||||
top_symbol :
|
||||
begin
|
||||
AsmWrite('$');
|
||||
if assigned(o.sym) then
|
||||
AsmWrite(o.sym.name);
|
||||
if o.symofs>0 then
|
||||
AsmWrite('+'+tostr(o.symofs))
|
||||
else
|
||||
if o.symofs<0 then
|
||||
AsmWrite(tostr(o.symofs))
|
||||
else
|
||||
if not(assigned(o.sym)) then
|
||||
AsmWrite('0');
|
||||
end;
|
||||
AsmWrite('$'+tostr(aint(o.val)));
|
||||
else
|
||||
internalerror(10001);
|
||||
end;
|
||||
@ -141,20 +143,23 @@ interface
|
||||
AsmWrite('*'+gas_regname(o.reg));
|
||||
top_ref :
|
||||
begin
|
||||
AsmWrite('*');
|
||||
WriteReference(o.ref^);
|
||||
if o.ref^.refaddr=addr_no then
|
||||
begin
|
||||
AsmWrite('*');
|
||||
WriteReference(o.ref^);
|
||||
end
|
||||
else
|
||||
begin
|
||||
AsmWrite(o.ref^.symbol.name);
|
||||
if o.ref^.offset>0 then
|
||||
AsmWrite('+'+tostr(o.ref^.offset))
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
AsmWrite(tostr(o.ref^.offset));
|
||||
end;
|
||||
end;
|
||||
top_const :
|
||||
AsmWrite(tostr(longint(o.val)));
|
||||
top_symbol :
|
||||
begin
|
||||
AsmWrite(o.sym.name);
|
||||
if o.symofs>0 then
|
||||
AsmWrite('+'+tostr(o.symofs))
|
||||
else
|
||||
if o.symofs<0 then
|
||||
AsmWrite(tostr(o.symofs));
|
||||
end;
|
||||
AsmWrite(tostr(aint(o.val)));
|
||||
else
|
||||
internalerror(10001);
|
||||
end;
|
||||
@ -293,7 +298,15 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 2003-12-24 00:33:10 florian
|
||||
Revision 1.13 2004-02-27 10:21:06 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.12 2003/12/24 00:33:10 florian
|
||||
* x86-64 compilation fixed
|
||||
|
||||
Revision 1.11 2003/11/12 16:05:40 florian
|
||||
|
@ -167,6 +167,7 @@ unit cgx86;
|
||||
|
||||
uses
|
||||
globtype,globals,verbose,systems,cutils,
|
||||
cgutils,
|
||||
symdef,defutil,paramgr,tgobj,procinfo;
|
||||
|
||||
const
|
||||
@ -1780,7 +1781,15 @@ unit cgx86;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.114 2004-02-22 18:27:21 florian
|
||||
Revision 1.115 2004-02-27 10:21:06 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.114 2004/02/22 18:27:21 florian
|
||||
* fixed exception reason size for 64 bit systems
|
||||
|
||||
Revision 1.113 2004/02/22 16:48:10 florian
|
||||
|
@ -226,22 +226,24 @@ uses
|
||||
*****************************************************************************}
|
||||
|
||||
type
|
||||
{ reference record }
|
||||
{ reference record, reordered for best alignment }
|
||||
preference = ^treference;
|
||||
treference = record
|
||||
offset : aint;
|
||||
symbol,
|
||||
relsymbol : tasmsymbol;
|
||||
segment,
|
||||
base,
|
||||
index : tregister;
|
||||
refaddr : trefaddr;
|
||||
scalefactor : byte;
|
||||
offset : longint;
|
||||
symbol : tasmsymbol;
|
||||
end;
|
||||
|
||||
{ reference record }
|
||||
pparareference = ^tparareference;
|
||||
tparareference = packed record
|
||||
index : tregister;
|
||||
offset : longint;
|
||||
offset : aint;
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
@ -507,7 +509,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.41 2004-02-22 18:27:21 florian
|
||||
Revision 1.42 2004-02-27 10:21:06 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.41 2004/02/22 18:27:21 florian
|
||||
* fixed exception reason size for 64 bit systems
|
||||
|
||||
Revision 1.40 2004/02/05 18:28:37 peter
|
||||
|
@ -65,7 +65,7 @@ implementation
|
||||
cgbase,cga,pass_2,
|
||||
ncon,ncal,ncnv,
|
||||
cpubase,
|
||||
cgobj,cgx86,ncgutil,
|
||||
cgutils,cgobj,cgx86,ncgutil,
|
||||
tgobj;
|
||||
|
||||
|
||||
@ -277,7 +277,15 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2004-02-05 01:24:08 florian
|
||||
Revision 1.10 2004-02-27 10:21:06 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.9 2004/02/05 01:24:08 florian
|
||||
* several fixes to compile x86-64 system
|
||||
|
||||
Revision 1.8 2003/12/26 00:32:22 florian
|
||||
|
@ -70,7 +70,7 @@ implementation
|
||||
cgbase,pass_2,
|
||||
cpuinfo,cpubase,paramgr,
|
||||
nbas,ncon,ncal,ncnv,nld,
|
||||
cga,cgx86,cgobj;
|
||||
cga,cgutils,cgx86,cgobj;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
@ -353,6 +353,14 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2004-02-05 01:24:08 florian
|
||||
Revision 1.2 2004-02-27 10:21:06 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.1 2004/02/05 01:24:08 florian
|
||||
* several fixes to compile x86-64 system
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ implementation
|
||||
cgbase,pass_2,
|
||||
ncon,
|
||||
cpubase,cpuinfo,procinfo,
|
||||
cga,cgobj,ncgutil,
|
||||
cga,cgutils,cgobj,ncgutil,
|
||||
cgx86;
|
||||
|
||||
{*****************************************************************************
|
||||
@ -495,7 +495,15 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2004-02-22 12:04:04 florian
|
||||
Revision 1.2 2004-02-27 10:21:06 florian
|
||||
* top_symbol killed
|
||||
+ refaddr to treference added
|
||||
+ refsymbol to treference added
|
||||
* top_local stuff moved to an extra record to save memory
|
||||
+ aint introduced
|
||||
* tppufile.get/putint64/aint implemented
|
||||
|
||||
Revision 1.1 2004/02/22 12:04:04 florian
|
||||
+ nx86set added
|
||||
* some more x86-64 fixes
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user