fpc/compiler/cgutils.pas
florian fabb9c33ac * 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
2004-02-27 10:21:04 +00:00

96 lines
2.9 KiB
ObjectPascal

{
$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
}