* assembler output format fixed

This commit is contained in:
mazen 2002-10-13 21:46:07 +00:00
parent fb36caedf1
commit 3a3b8a3dc4
5 changed files with 397 additions and 438 deletions

View File

@ -1,18 +1,7 @@
{*****************************************************************************} {******************************************************************************
{ File : aasmcpu.pas }
{ Author : Mazen NEIFER }
{ Project : Free Pascal Compiler (FPC) }
{ Creation date : 2002\05\01 }
{ Last modification date : 2002\08\20 }
{ Licence : GPL }
{ Bug report : mazen.neifer.01@supaero.org }
{*****************************************************************************}
{
$Id$ $Id$
Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
Contains the assembler object for the i386
* This code was inspired by the NASM sources * This code was inspired by the NASM sources
The Netwide Assembler is copyright (C) 1996 Simon Tatham and The Netwide Assembler is copyright (C) 1996 Simon Tatham and
Julian Hall. All rights reserved. Julian Hall. All rights reserved.
@ -30,71 +19,59 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************}
**************************************************************************** unit aasmcpu;
}
UNIT aasmcpu;
{$INCLUDE fpcdefs.inc} {$INCLUDE fpcdefs.inc}
INTERFACE interface
USES uses
cclasses,globals,verbose, cclasses,globals,verbose,
cpuinfo,cpubase, cpuinfo,cpubase,
symppu, symppu,
aasmbase,aasmtai; aasmbase,aasmtai;
CONST const
MaxPrefixes=4; MaxPrefixes=4;
type type
TOperandOrder = (op_intel,op_att); TOperandOrder=(op_intel,op_att);
{ alignment for operator } { alignment for operator }
tai_align = class(tai_align_abstract) tai_align=class(tai_align_abstract)
reg : tregister; reg:tregister;
constructor create(b:byte); constructor create(b:byte);
constructor create_op(b: byte; _op: byte); constructor create_op(b:byte; _op:byte);
function getfillbuf:pchar;override; function getfillbuf:pchar;override;
end; end;
taicpu = class(taicpu_abstract) taicpu = class(taicpu_abstract)
opsize : topsize; opsize:topsize;
constructor op_none(op : tasmop;_size : topsize); constructor op_none(op:tasmop;_size:topsize);
constructor op_reg(op:tasmop;_size:topsize;_op1:tregister);
constructor op_reg(op : tasmop;_size : topsize;_op1 : tregister); constructor op_const(op:tasmop;_size:topsize;_op1:aword);
constructor op_const(op : tasmop;_size : topsize;_op1 : aword); constructor op_ref(op:tasmop;_size:topsize;const _op1:treference);
constructor op_ref(op : tasmop;_size : topsize;const _op1 : treference); constructor op_reg_reg(op:tasmop;_size:topsize;_op1,_op2:tregister);
constructor op_reg_ref(op:tasmop;_size:topsize;_op1:tregister;const _op2:treference);
constructor op_reg_reg(op : tasmop;_size : topsize;_op1,_op2 : tregister); constructor op_reg_const(op:tasmop; _size:topsize; _op1:tregister; _op2:aword);
constructor op_reg_ref(op : tasmop;_size : topsize;_op1 : tregister;const _op2 : treference); constructor op_const_reg(op:tasmop;_size:topsize;_op1:aword;_op2:tregister);
constructor op_reg_const(op:tasmop; _size: topsize; _op1: tregister; _op2: aword); constructor op_const_const(op:tasmop;_size:topsize;_op1,_op2:aword);
constructor op_const_ref(op:tasmop;_size:topsize;_op1:aword;const _op2:treference);
constructor op_const_reg(op : tasmop;_size : topsize;_op1 : aword;_op2 : tregister); constructor op_ref_reg(op:tasmop;_size:topsize;const _op1:treference;_op2:tregister);
constructor op_const_const(op : tasmop;_size : topsize;_op1,_op2 : aword);
constructor op_const_ref(op : tasmop;_size : topsize;_op1 : aword;const _op2 : treference);
constructor op_ref_reg(op : tasmop;_size : topsize;const _op1 : treference;_op2 : tregister);
{ this is only allowed if _op1 is an int value (_op1^.isintvalue=true) } { this is only allowed if _op1 is an int value (_op1^.isintvalue=true) }
constructor op_ref_ref(op : tasmop;_size : topsize;const _op1,_op2 : treference); constructor op_ref_ref(op:tasmop;_size:topsize;const _op1,_op2:treference);
constructor op_reg_reg_reg(op:tasmop;_size:topsize;_op1,_op2,_op3:tregister);
constructor op_reg_reg_reg(op : tasmop;_size : topsize;_op1,_op2,_op3 : tregister);
constructor op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:aWord;_op3:tregister); constructor op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:aWord;_op3:tregister);
constructor op_const_ref_reg(op : tasmop;_size : topsize;_op1 : aword;const _op2 : treference;_op3 : tregister); constructor op_const_ref_reg(op:tasmop;_size:topsize;_op1:aword;const _op2:treference;_op3:tregister);
constructor op_reg_reg_ref(op : tasmop;_size : topsize;_op1,_op2 : tregister; const _op3 : treference); constructor op_reg_reg_ref(op:tasmop;_size:topsize;_op1,_op2:tregister; const _op3:treference);
constructor op_const_reg_ref(op : tasmop;_size : topsize;_op1 : aword;_op2 : tregister;const _op3 : treference); constructor op_const_reg_ref(op:tasmop;_size:topsize;_op1:aword;_op2:tregister;const _op3:treference);
{ this is for Jmp instructions } { this is for Jmp instructions }
constructor op_cond_sym(op : tasmop;cond:TAsmCond;_size : topsize;_op1 : tasmsymbol); constructor op_cond_sym(op:tasmop;cond:TAsmCond;_size:topsize;_op1:tasmsymbol);
constructor op_sym(op:tasmop;_size:topsize;_op1:tasmsymbol);
constructor op_sym(op : tasmop;_size : topsize;_op1 : tasmsymbol); constructor op_sym_ofs(op:tasmop;_size:topsize;_op1:tasmsymbol;_op1ofs:longint);
constructor op_sym_ofs(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint); constructor op_sym_ofs_reg(op:tasmop;_size:topsize;_op1:tasmsymbol;_op1ofs:longint;_op2:tregister);
constructor op_sym_ofs_reg(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;_op2 : tregister); constructor op_sym_ofs_ref(op:tasmop;_size:topsize;_op1:tasmsymbol;_op1ofs:longint;const _op2:treference);
constructor op_sym_ofs_ref(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference);
procedure changeopsize(siz:topsize); procedure changeopsize(siz:topsize);
function GetString:string; function GetString:string;
procedure CheckNonCommutativeOpcodes; procedure CheckNonCommutativeOpcodes;
private private
FOperandOrder : TOperandOrder; FOperandOrder:TOperandOrder;
procedure init(_size : topsize); { this need to be called by all constructor } procedure init(_size:topsize);{this need to be called by all constructor}
{$ifndef NOAG386BIN} {$ifndef NOAG386BIN}
public public
{ the next will reset all instructions that can change in pass 2 } { the next will reset all instructions that can change in pass 2 }
@ -105,10 +82,10 @@ type
procedure SetOperandOrder(order:TOperandOrder); procedure SetOperandOrder(order:TOperandOrder);
private private
{ next fields are filled in pass1, so pass2 is faster } { next fields are filled in pass1, so pass2 is faster }
insentry : PInsEntry; insentry:PInsEntry;
insoffset, insoffset,
inssize : longint; inssize:longint;
LastInsOffset : longint; { need to be public to be reset } LastInsOffset:longint; { need to be public to be reset }
function InsEnd:longint; function InsEnd:longint;
procedure create_ot; procedure create_ot;
function Matches(p:PInsEntry):longint; function Matches(p:PInsEntry):longint;
@ -120,28 +97,22 @@ type
PROCEDURE DoneAsm; PROCEDURE DoneAsm;
PROCEDURE InitAsm; PROCEDURE InitAsm;
implementation implementation
uses uses
cutils, cutils,
CpuGas; CpuGas;
{**************************************************************************** {****************************************************************************
TAI_ALIGN TAI_ALIGN
****************************************************************************} ****************************************************************************}
constructor tai_align.create(b:byte);
constructor tai_align.create(b: byte);
begin begin
inherited create(b); inherited create(b);
reg := R_NONE; reg:= R_NONE;
end; end;
constructor tai_align.create_op(b:byte; _op:byte);
constructor tai_align.create_op(b: byte; _op: byte);
begin begin
inherited create_op(b,_op); inherited create_op(b,_op);
reg := R_NONE; reg:= R_NONE;
end; end;
function tai_align.getfillbuf:pchar; function tai_align.getfillbuf:pchar;
const const
alignarray:array[0..5] of string[8]=( alignarray:array[0..5] of string[8]=(
@ -153,8 +124,8 @@ uses
#$90 #$90
); );
var var
bufptr : pchar; bufptr:pchar;
j : longint; j:longint;
begin begin
if not use_op then if not use_op then
begin begin
@ -171,19 +142,16 @@ uses
end; end;
getfillbuf:=pchar(@buf); getfillbuf:=pchar(@buf);
end; end;
{***************************************************************************** {*****************************************************************************
Taicpu Constructors Taicpu Constructors
*****************************************************************************} *****************************************************************************}
procedure taicpu.changeopsize(siz:topsize); procedure taicpu.changeopsize(siz:topsize);
begin begin
opsize:=siz; opsize:=siz;
end; end;
procedure taicpu.init(_size : topsize); procedure taicpu.init(_size:topsize);
begin begin
{ default order is att } { default order is att }
FOperandOrder:=op_att; FOperandOrder:=op_att;
@ -198,14 +166,14 @@ uses
end; end;
constructor taicpu.op_none(op : tasmop;_size : topsize); constructor taicpu.op_none(op:tasmop;_size:topsize);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
end; end;
constructor taicpu.op_reg(op : tasmop;_size : topsize;_op1 : tregister); constructor taicpu.op_reg(op:tasmop;_size:topsize;_op1:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -214,7 +182,7 @@ uses
end; end;
constructor taicpu.op_const(op : tasmop;_size : topsize;_op1 : aword); constructor taicpu.op_const(op:tasmop;_size:topsize;_op1:aword);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -223,7 +191,7 @@ uses
end; end;
constructor taicpu.op_ref(op : tasmop;_size : topsize;const _op1 : treference); constructor taicpu.op_ref(op:tasmop;_size:topsize;const _op1:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -232,7 +200,7 @@ uses
end; end;
constructor taicpu.op_reg_reg(op : tasmop;_size : topsize;_op1,_op2 : tregister); constructor taicpu.op_reg_reg(op:tasmop;_size:topsize;_op1,_op2:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -242,7 +210,7 @@ uses
end; end;
constructor taicpu.op_reg_const(op:tasmop; _size: topsize; _op1: tregister; _op2: aword); constructor taicpu.op_reg_const(op:tasmop; _size:topsize; _op1:tregister; _op2:aword);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -252,7 +220,7 @@ uses
end; end;
constructor taicpu.op_reg_ref(op : tasmop;_size : topsize;_op1 : tregister;const _op2 : treference); constructor taicpu.op_reg_ref(op:tasmop;_size:topsize;_op1:tregister;const _op2:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -262,7 +230,7 @@ uses
end; end;
constructor taicpu.op_const_reg(op : tasmop;_size : topsize;_op1 : aword;_op2 : tregister); constructor taicpu.op_const_reg(op:tasmop;_size:topsize;_op1:aword;_op2:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -272,7 +240,7 @@ uses
end; end;
constructor taicpu.op_const_const(op : tasmop;_size : topsize;_op1,_op2 : aword); constructor taicpu.op_const_const(op:tasmop;_size:topsize;_op1,_op2:aword);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -282,7 +250,7 @@ uses
end; end;
constructor taicpu.op_const_ref(op : tasmop;_size : topsize;_op1 : aword;const _op2 : treference); constructor taicpu.op_const_ref(op:tasmop;_size:topsize;_op1:aword;const _op2:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -302,7 +270,7 @@ constructor taicpu.op_ref_reg(op:tasmop;_size:topsize;const _op1:treference;_op2
end; end;
constructor taicpu.op_ref_ref(op : tasmop;_size : topsize;const _op1,_op2 : treference); constructor taicpu.op_ref_ref(op:tasmop;_size:topsize;const _op1,_op2:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -312,7 +280,7 @@ constructor taicpu.op_ref_reg(op:tasmop;_size:topsize;const _op1:treference;_op2
end; end;
constructor taicpu.op_reg_reg_reg(op : tasmop;_size : topsize;_op1,_op2,_op3 : tregister); constructor taicpu.op_reg_reg_reg(op:tasmop;_size:topsize;_op1,_op2,_op3:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -331,7 +299,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
LoadReg(2,_op3); LoadReg(2,_op3);
END; END;
constructor taicpu.op_reg_reg_ref(op : tasmop;_size : topsize;_op1,_op2 : tregister;const _op3 : treference); constructor taicpu.op_reg_reg_ref(op:tasmop;_size:topsize;_op1,_op2:tregister;const _op3:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -342,7 +310,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_const_ref_reg(op : tasmop;_size : topsize;_op1 : aword;const _op2 : treference;_op3 : tregister); constructor taicpu.op_const_ref_reg(op:tasmop;_size:topsize;_op1:aword;const _op2:treference;_op3:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -353,7 +321,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_const_reg_ref(op : tasmop;_size : topsize;_op1 : aword;_op2 : tregister;const _op3 : treference); constructor taicpu.op_const_reg_ref(op:tasmop;_size:topsize;_op1:aword;_op2:tregister;const _op3:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -364,7 +332,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_cond_sym(op : tasmop;cond:TAsmCond;_size : topsize;_op1 : tasmsymbol); constructor taicpu.op_cond_sym(op:tasmop;cond:TAsmCond;_size:topsize;_op1:tasmsymbol);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -374,7 +342,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_sym(op : tasmop;_size : topsize;_op1 : tasmsymbol); constructor taicpu.op_sym(op:tasmop;_size:topsize;_op1:tasmsymbol);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -383,7 +351,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_sym_ofs(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint); constructor taicpu.op_sym_ofs(op:tasmop;_size:topsize;_op1:tasmsymbol;_op1ofs:longint);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -392,7 +360,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_sym_ofs_reg(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;_op2 : tregister); constructor taicpu.op_sym_ofs_reg(op:tasmop;_size:topsize;_op1:tasmsymbol;_op1ofs:longint;_op2:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -402,7 +370,7 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
end; end;
constructor taicpu.op_sym_ofs_ref(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference); constructor taicpu.op_sym_ofs_ref(op:tasmop;_size:topsize;_op1:tasmsymbol;_op1ofs:longint;const _op2:treference);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
@ -413,9 +381,9 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
function taicpu.GetString:string; function taicpu.GetString:string;
var var
i : longint; i:longint;
s : string; s:string;
addsize : boolean; addsize:boolean;
begin begin
s:='['+std_op2str[opcode]; s:='['+std_op2str[opcode];
for i:=1to ops do for i:=1to ops do
@ -478,17 +446,17 @@ CONSTRUCTOR taicpu.op_reg_const_reg(op:tasmop;_size:topsize;_op1:TRegister;_op2:
procedure taicpu.Swatoperands; procedure taicpu.Swatoperands;
var var
p : TOper; p:TOper;
begin begin
{ Fix the operands which are in AT&T style and we need them in Intel style } { Fix the operands which are in AT&T style and we need them in Intel style }
case ops of case ops of
2 : begin 2:begin
{ 0,1 -> 1,0 } { 0,1 -> 1,0 }
p:=oper[0]; p:=oper[0];
oper[0]:=oper[1]; oper[0]:=oper[1];
oper[1]:=p; oper[1]:=p;
end; end;
3 : begin 3:begin
{ 0,1,2 -> 2,1,0 } { 0,1,2 -> 2,1,0 }
p:=oper[0]; p:=oper[0];
oper[0]:=oper[2]; oper[0]:=oper[2];
@ -556,11 +524,11 @@ end;
type type
ea=packed record ea=packed record
sib_present : boolean; sib_present:boolean;
bytes : byte; bytes:byte;
size : byte; size:byte;
modrm : byte; modrm:byte;
sib : byte; sib:byte;
end; end;
procedure taicpu.create_ot; procedure taicpu.create_ot;
@ -568,7 +536,7 @@ procedure taicpu.create_ot;
this function will also fix some other fields which only needs to be once this function will also fix some other fields which only needs to be once
} }
var var
i,l,relsize : longint; i,l,relsize:longint;
begin begin
if ops=0 then if ops=0 then
exit; exit;
@ -577,9 +545,9 @@ begin
with oper[i] do with oper[i] do
begin begin
case typ of case typ of
top_reg : top_reg:
{ot:=reg2type[reg]}; {ot:=reg2type[reg]};
top_ref : top_ref:
begin begin
{ create ot field } { create ot field }
if (ot and OT_SIZE_MASK)=0 then if (ot and OT_SIZE_MASK)=0 then
@ -595,14 +563,14 @@ begin
if (ref^.scalefactor=0) then if (ref^.scalefactor=0) then
ref^.scalefactor:=1; ref^.scalefactor:=1;
end; end;
top_const : top_const:
begin begin
if (opsize<>S_W) and (longint(val)>=-128) and (val<=127) then if (opsize<>S_W) and (longint(val)>=-128) and (val<=127) then
ot:=OT_IMM8 or OT_SIGNED ot:=OT_IMM8 or OT_SIGNED
else else
ot:=OT_IMMEDIATE or opsize_2_type[i,opsize]; ot:=OT_IMMEDIATE or opsize_2_type[i,opsize];
end; end;
top_symbol : top_symbol:
begin begin
if LastInsOffset=-1 then if LastInsOffset=-1 then
l:=0 l:=0
@ -632,18 +600,18 @@ end;
function taicpu.Matches(p:PInsEntry):longint; function taicpu.Matches(p:PInsEntry):longint;
{ * IF_SM stands for Size Match: any operand whose size is not { * IF_SM stands for Size Match:any operand whose size is not
* explicitly specified by the template is `really' intended to be * explicitly specified by the template is `really' intended to be
* the same size as the first size-specified operand. * the same size as the first size-specified operand.
* Non-specification is tolerated in the input instruction, but * Non-specification is tolerated in the input instruction, but
* _wrong_ specification is not. * _wrong_ specification is not.
* *
* IF_SM2 invokes Size Match on only the first _two_ operands, for * IF_SM2 invokes Size Match on only the first _two_ operands, for
* three-operand instructions such as SHLD: it implies that the * three-operand instructions such as SHLD:it implies that the
* first two operands must match in size, but that the third is * first two operands must match in size, but that the third is
* required to be _unspecified_. * required to be _unspecified_.
* *
* IF_SB invokes Size Byte: operands with unspecified size in the * IF_SB invokes Size Byte:operands with unspecified size in the
* template are really bytes, and so no non-byte specification in * template are really bytes, and so no non-byte specification in
* the input instruction will be tolerated. IF_SW similarly invokes * the input instruction will be tolerated. IF_SW similarly invokes
* Size Word, and IF_SD invokes Size Doubleword. * Size Word, and IF_SD invokes Size Doubleword.
@ -653,8 +621,8 @@ function taicpu.Matches(p:PInsEntry):longint;
* required to have unspecified size in the instruction too...) * required to have unspecified size in the instruction too...)
} }
var var
i,j,asize,oprs : longint; i,j,asize,oprs:longint;
siz : array[0..2] of longint; siz:array[0..2] of longint;
begin begin
Matches:=100; Matches:=100;
@ -782,7 +750,7 @@ end;
function taicpu.CheckIfValid:boolean; function taicpu.CheckIfValid:boolean;
var var
m,i : longint; m,i:longint;
begin begin
CheckIfValid:=false; CheckIfValid:=false;
{ Things which may only be done once, not when a second pass is done to { Things which may only be done once, not when a second pass is done to
@ -899,7 +867,7 @@ begin
end; end;
function taicpu.NeedAddrPrefix(opidx:byte):boolean; function taicpu.NeedAddrPrefix(opidx:byte):boolean;
var var
i,b : tregister; i,b:tregister;
begin begin
{ if (OT_MEMORY and (not oper[opidx].ot))=0 then { if (OT_MEMORY and (not oper[opidx].ot))=0 then
begin begin
@ -919,21 +887,21 @@ end;
function regval(r:tregister):byte; function regval(r:tregister):byte;
begin begin
{case r of {case r of
R_EAX,R_AX,R_AL,R_ES,R_CR0,R_DR0,R_ST,R_ST0,R_MM0,R_XMM0 : R_EAX,R_AX,R_AL,R_ES,R_CR0,R_DR0,R_ST,R_ST0,R_MM0,R_XMM0:
regval:=0; regval:=0;
R_ECX,R_CX,R_CL,R_CS,R_DR1,R_ST1,R_MM1,R_XMM1 : R_ECX,R_CX,R_CL,R_CS,R_DR1,R_ST1,R_MM1,R_XMM1:
regval:=1; regval:=1;
R_EDX,R_DX,R_DL,R_SS,R_CR2,R_DR2,R_ST2,R_MM2,R_XMM2 : R_EDX,R_DX,R_DL,R_SS,R_CR2,R_DR2,R_ST2,R_MM2,R_XMM2:
regval:=2; regval:=2;
R_EBX,R_BX,R_BL,R_DS,R_CR3,R_DR3,R_TR3,R_ST3,R_MM3,R_XMM3 : R_EBX,R_BX,R_BL,R_DS,R_CR3,R_DR3,R_TR3,R_ST3,R_MM3,R_XMM3:
regval:=3; regval:=3;
R_ESP,R_SP,R_AH,R_FS,R_CR4,R_TR4,R_ST4,R_MM4,R_XMM4 : R_ESP,R_SP,R_AH,R_FS,R_CR4,R_TR4,R_ST4,R_MM4,R_XMM4:
regval:=4; regval:=4;
R_EBP,R_BP,R_CH,R_GS,R_TR5,R_ST5,R_MM5,R_XMM5 : R_EBP,R_BP,R_CH,R_GS,R_TR5,R_ST5,R_MM5,R_XMM5:
regval:=5; regval:=5;
R_ESI,R_SI,R_DH,R_DR6,R_TR6,R_ST6,R_MM6,R_XMM6 : R_ESI,R_SI,R_DH,R_DR6,R_TR6,R_ST6,R_MM6,R_XMM6:
regval:=6; regval:=6;
R_EDI,R_DI,R_BH,R_DR7,R_TR7,R_ST7,R_MM7,R_XMM7 : R_EDI,R_DI,R_BH,R_DR7,R_TR7,R_ST7,R_MM7,R_XMM7:
regval:=7; regval:=7;
else} else}
begin begin
@ -946,7 +914,7 @@ end;
function process_ea(const input:toper;var output:ea;rfield:longint):boolean; function process_ea(const input:toper;var output:ea;rfield:longint):boolean;
{const {const
regs : array[0..63] of tregister=( regs:array[0..63] of tregister=(
R_MM0, R_EAX, R_AX, R_AL, R_XMM0, R_NONE, R_NONE, R_NONE, R_MM0, R_EAX, R_AX, R_AL, R_XMM0, R_NONE, R_NONE, R_NONE,
R_MM1, R_ECX, R_CX, R_CL, R_XMM1, R_NONE, R_NONE, R_NONE, R_MM1, R_ECX, R_CX, R_CL, R_XMM1, R_NONE, R_NONE, R_NONE,
R_MM2, R_EDX, R_DX, R_DL, R_XMM2, R_NONE, R_NONE, R_NONE, R_MM2, R_EDX, R_DX, R_DL, R_XMM2, R_NONE, R_NONE, R_NONE,
@ -957,12 +925,12 @@ function process_ea(const input:toper;var output:ea;rfield:longint):boolean;
R_MM7, R_EDI, R_DI, R_BH, R_XMM7, R_NONE, R_NONE, R_NONE R_MM7, R_EDI, R_DI, R_BH, R_XMM7, R_NONE, R_NONE, R_NONE
);} );}
var var
j : longint; j:longint;
i,b : tregister; i,b:tregister;
sym : tasmsymbol; sym:tasmsymbol;
md,s : byte; md,s:byte;
base,index,scalefactor, base,index,scalefactor,
o : longint; o:longint;
begin begin
process_ea:=false; process_ea:=false;
{ register ? } { register ? }
@ -1033,37 +1001,37 @@ begin
exit;} exit;}
{ base } { base }
{ case b of { case b of
R_EAX : base:=0; R_EAX:base:=0;
R_ECX : base:=1; R_ECX:base:=1;
R_EDX : base:=2; R_EDX:base:=2;
R_EBX : base:=3; R_EBX:base:=3;
R_ESP : base:=4; R_ESP:base:=4;
R_NONE, R_NONE,
R_EBP : base:=5; R_EBP:base:=5;
R_ESI : base:=6; R_ESI:base:=6;
R_EDI : base:=7; R_EDI:base:=7;
else else
exit; exit;
end;} end;}
{ index } { index }
{ case i of { case i of
R_EAX : index:=0; R_EAX:index:=0;
R_ECX : index:=1; R_ECX:index:=1;
R_EDX : index:=2; R_EDX:index:=2;
R_EBX : index:=3; R_EBX:index:=3;
R_NONE : index:=4; R_NONE:index:=4;
R_EBP : index:=5; R_EBP:index:=5;
R_ESI : index:=6; R_ESI:index:=6;
R_EDI : index:=7; R_EDI:index:=7;
else else
exit; exit;
end; end;
case s of case s of
0, 0,
1 : scalefactor:=0; 1:scalefactor:=0;
2 : scalefactor:=1; 2:scalefactor:=1;
4 : scalefactor:=2; 4:scalefactor:=2;
8 : scalefactor:=3; 8:scalefactor:=3;
else else
exit; exit;
end; end;
@ -1102,10 +1070,10 @@ end;
function taicpu.calcsize(p:PInsEntry):longint; function taicpu.calcsize(p:PInsEntry):longint;
var var
codes : pchar; codes:pchar;
c : byte; c:byte;
len : longint; len:longint;
ea_data : ea; ea_data:ea;
begin begin
len:=0; len:=0;
codes:=@p^.code; codes:=@p^.code;
@ -1113,19 +1081,19 @@ begin
c:=ord(codes^); c:=ord(codes^);
inc(codes); inc(codes);
case c of case c of
0 : 0:
break; break;
1,2,3 : 1,2,3:
begin begin
inc(codes,c); inc(codes,c);
inc(len,c); inc(len,c);
end; end;
8,9,10 : 8,9,10:
begin begin
inc(codes); inc(codes);
inc(len); inc(len);
end; end;
4,5,6,7 : 4,5,6,7:
begin begin
if opsize=S_W then if opsize=S_W then
inc(len,2) inc(len,2)
@ -1136,34 +1104,34 @@ begin
12,13,14, 12,13,14,
16,17,18, 16,17,18,
20,21,22, 20,21,22,
40,41,42 : 40,41,42:
inc(len); inc(len);
24,25,26, 24,25,26,
31, 31,
48,49,50 : 48,49,50:
inc(len,2); inc(len,2);
28,29,30, { we don't have 16 bit immediates code } 28,29,30, { we don't have 16 bit immediates code }
32,33,34, 32,33,34,
52,53,54, 52,53,54,
56,57,58 : 56,57,58:
inc(len,4); inc(len,4);
192,193,194 : 192,193,194:
if NeedAddrPrefix(c-192) then if NeedAddrPrefix(c-192) then
inc(len); inc(len);
208 : 208:
inc(len); inc(len);
200, 200,
201, 201,
202, 202,
209, 209,
210, 210,
217,218,219 : ; 217,218,219:;
216 : 216:
begin begin
inc(codes); inc(codes);
inc(len); inc(len);
end; end;
224,225,226 : 224,225,226:
begin begin
InternalError(777002); InternalError(777002);
end; end;
@ -1183,8 +1151,6 @@ begin
until false; until false;
calcsize:=len; calcsize:=len;
end; end;
{$endif NOAG386BIN} {$endif NOAG386BIN}
PROCEDURE DoneAsm; PROCEDURE DoneAsm;
BEGIN BEGIN
@ -1193,3 +1159,9 @@ PROCEDURE InitAsm;
BEGIN BEGIN
END; END;
end. end.
{
$Log$
Revision 1.4 2002-10-13 21:46:07 mazen
* assembler output format fixed
}

View File

@ -843,11 +843,11 @@ procedure tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword);
which is genereted in the g_restore_frame_pointer. Notice that SPARC has no which is genereted in the g_restore_frame_pointer. Notice that SPARC has no
RETURN instruction and that JMPL is used instead. The JMPL instrucion have one RETURN instruction and that JMPL is used instead. The JMPL instrucion have one
delay slot, so an inversion is possible such as delay slot, so an inversion is possible such as
JMPL %i6+8,%g0 JMPL %i7+8,%g0
RESTORE %g0,0,%g0 RESTORE %g0,0,%g0
If no inversion we can use just If no inversion we can use just
RESTORE %g0,0,%g0 RESTORE %g0,0,%g0
JMPL %i6+8,%g0 JMPL %i7+8,%g0
NOP} NOP}
with list do with list do
begin begin
@ -1264,7 +1264,10 @@ BEGIN
END. END.
{ {
$Log$ $Log$
Revision 1.15 2002-10-11 13:35:14 mazen Revision 1.16 2002-10-13 21:46:07 mazen
* assembler output format fixed
Revision 1.15 2002/10/11 13:35:14 mazen
*** empty log message *** *** empty log message ***
Revision 1.14 2002/10/10 19:57:51 mazen Revision 1.14 2002/10/10 19:57:51 mazen

View File

@ -1,17 +1,7 @@
{*****************************************************************************} {******************************************************************************
{ File : cpugas.pas } $Id$
{ Author : Mazen NEIFER }
{ Project : Free Pascal Compiler (FPC) }
{ Creation date : 2002\05\01 }
{ Last modification date : 2002\08\22 }
{ Licence : GPL }
{ Bug report : mazen.neifer.01@supaero.org }
{*****************************************************************************}
{ $Id$
Copyright (c) 1998-2000 by Florian Klaempfl Copyright (c) 1998-2000 by Florian Klaempfl
This unit implements an asmoutput class for SPARC AT&T syntax
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
@ -27,48 +17,43 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************} ****************************************************************************}
UNIT CpuGas; unit CpuGas;
{This unit implements an asmoutput class for SPARC AT&T syntax}
{$MACRO ON}{$INCLUDE fpcdefs.inc} {$MACRO ON}{$INCLUDE fpcdefs.inc}
INTERFACE interface
USES uses
cclasses,cpubase, cclasses,cpubase,
globals, globals,
aasmbase,aasmtai,aasmcpu,assemble,aggas; aasmbase,aasmtai,aasmcpu,assemble,aggas;
TYPE type
TGasSPARC=class(TGnuAssembler) TGasSPARC=class(TGnuAssembler)
PROCEDURE WriteInstruction(hp:Tai);OVERRIDE; procedure WriteInstruction(hp:Tai);override;
END; end;
IMPLEMENTATION implementation
USES uses
strings, finput,
dos,
globtype,
fmodule,finput,
cutils,systems, cutils,systems,
verbose; verbose;
{$DEFINE gas_reg2str:=std_reg2str} {$DEFINE gas_reg2str:=std_reg2str}
CONST const
line_length = 70; line_length = 70;
VAR var
{$ifdef GDB} {$ifdef GDB}
n_line : byte; { different types of source lines } n_line:byte; { different types of source lines }
linecount, linecount,
includecount : longint; includecount:longint;
funcname : pchar; funcname:pchar;
stabslastfileinfo : tfileposinfo; stabslastfileinfo:tfileposinfo;
{$endif} {$endif}
lastsec : tsection; { last section type written } lastsec:tsection; { last section type written }
lastfileinfo : tfileposinfo; lastfileinfo:tfileposinfo;
infile, infile,
lastinfile : tinputfile; lastinfile:tinputfile;
symendcount : longint; symendcount:longint;
function fixline(s:string):string;
function fixline(s:string):string; {return s with all leading and ending spaces and tabs removed}
{
return s with all leading and ending spaces and tabs removed
}
var var
i,j,k : longint; i,j,k:longint;
begin begin
i:=length(s); i:=length(s);
while (i>0) and (s[i] in [#9,' ']) do while (i>0) and (s[i] in [#9,' ']) do
@ -77,48 +62,47 @@ VAR
while (j<i) and (s[j] in [#9,' ']) do while (j<i) and (s[j] in [#9,' ']) do
inc(j); inc(j);
for k:=j to i do for k:=j to i do
if s[k] in [#0..#31,#127..#255] then if s[k] in [#0..#31,#127..#255]
then
s[k]:='.'; s[k]:='.';
fixline:=Copy(s,j,i-j+1); fixline:=Copy(s,j,i-j+1);
end; end;
function single2str(d:single):string;
function single2str(d : single) : string;
var var
hs : string; hs:string;
begin begin
str(d,hs); str(d,hs);
{ replace space with + } {replace space with +}
if hs[1]=' ' then if hs[1]=' '
then
hs[1]:='+'; hs[1]:='+';
single2str:='0d'+hs single2str:='0d'+hs
end; end;
function double2str(d:double):string;
function double2str(d : double) : string;
var var
hs : string; hs:string;
begin begin
str(d,hs); str(d,hs);
{ replace space with + } { replace space with + }
if hs[1]=' ' then if hs[1]=' '
then
hs[1]:='+'; hs[1]:='+';
double2str:='0d'+hs double2str:='0d'+hs
end; end;
function extended2str(e:extended):string;
function extended2str(e : extended) : string;
var var
hs : string; hs:string;
begin begin
str(e,hs); str(e,hs);
{ replace space with + } { replace space with + }
if hs[1]=' ' then if hs[1]=' '
then
hs[1]:='+'; hs[1]:='+';
extended2str:='0d'+hs extended2str:='0d'+hs
end; end;
function GetReferenceString(var ref:TReference):string;
function getreferencestring(var ref : treference) : string;
var var
s : string; s:string;
begin begin
with ref do with ref do
begin begin
@ -128,72 +112,78 @@ VAR
{ These are probably not correctly handled under GAS } { These are probably not correctly handled under GAS }
{ should be replaced by coding the segment override } { should be replaced by coding the segment override }
{ directly! - DJGPP FAQ } { directly! - DJGPP FAQ }
if segment<>R_NONE then if segment<>R_NONE
then
s:=gas_reg2str[segment]+':' s:=gas_reg2str[segment]+':'
else else
s:=''; s:='';
if assigned(symbol) then if assigned(symbol)
then
s:=s+symbol.name; s:=s+symbol.name;
if offset<0 then if offset<0
then
s:=s+tostr(offset) s:=s+tostr(offset)
else else if (offset>0)
if (offset>0) then then
begin begin
if assigned(symbol) then if assigned(symbol)
then
s:=s+'+'+tostr(offset) s:=s+'+'+tostr(offset)
else else
s:=s+tostr(offset); s:=s+tostr(offset);
end end
else if (index=R_NONE) and (base=R_NONE) and not assigned(symbol) then else if (index=R_NONE) and (base=R_NONE) and not assigned(symbol)
then
s:=s+'0'; s:=s+'0';
if (index<>R_NONE) and (base=R_NONE) then if (index<>R_NONE) and (base=R_NONE)
then
begin begin
s:=s+'(,'+gas_reg2str[index]; s:='['+gas_reg2str[index]+s;
if scalefactor<>0 then if scalefactor<>0
s:=s+','+tostr(scalefactor)+')' then
else s:=tostr(scalefactor)+'+'+s;
s:=s+')'; s:=s+']';
end end
else else if (index=R_NONE) and (base<>R_NONE)
if (index=R_NONE) and (base<>R_NONE) then then
s:=s+'('+gas_reg2str[base]+')' s:='['+gas_reg2str[base]+'+'+s+']'
else else if (index<>R_NONE) and (base<>R_NONE)
if (index<>R_NONE) and (base<>R_NONE) then then
begin begin
s:=s+'('+gas_reg2str[base]+','+gas_reg2str[index]; s:='['+gas_reg2str[base]+'+'+gas_reg2str[index];
if scalefactor<>0 then if scalefactor<>0
s:=s+','+tostr(scalefactor)+')' then
else s:=tostr(scalefactor)+'+'+s;
s := s+')'; s:= s+']';
end; end;
end; end;
getreferencestring:=s; getreferencestring:=s;
end; end;
function getopstr(const Oper:TOper):string;
function getopstr(const o:toper) : string;
var var
hs : string; hs:string;
begin begin
case o.typ of with Oper do
top_reg : case typ of
getopstr:=gas_reg2str[o.reg]; top_reg:
top_ref : getopstr:=gas_reg2str[reg];
getopstr:=getreferencestring(o.ref^); top_ref:
top_const : getopstr:=getreferencestring(ref^);
getopstr:='$'+tostr(longint(o.val)); top_const:
top_symbol : getopstr:={'$'+}tostr(longint(val));
top_symbol:
begin begin
if assigned(o.sym) then if assigned(sym) then
hs:='$'+o.sym.name hs:={'$'+}sym.name
else else
hs:='$'; hs:='$';
if o.symofs>0 then if symofs>0 then
hs:=hs+'+'+tostr(o.symofs) hs:=hs+'+'+tostr(symofs)
else else
if o.symofs<0 then if symofs<0 then
hs:=hs+tostr(o.symofs) hs:=hs+tostr(symofs)
else else
if not(assigned(o.sym)) then if not(assigned(sym)) then
hs:=hs+'0'; hs:=hs+'0';
getopstr:=hs; getopstr:=hs;
end; end;
@ -202,44 +192,40 @@ VAR
end; end;
end; end;
function getopstr_jmp(const o:toper) : string; function getopstr_jmp(const Oper:TOper):string;
var var
hs : string; hs:string;
begin begin
case o.typ of with Oper do
top_reg : case typ of
getopstr_jmp:='*'+gas_reg2str[o.reg]; top_reg:
top_ref : getopstr_jmp:=gas_reg2str[reg]+'+';
getopstr_jmp:='*'+getreferencestring(o.ref^); top_ref:
top_const : getopstr_jmp:=GetReferenceString(ref^);
getopstr_jmp:=tostr(longint(o.val)); top_const:
top_symbol : getopstr_jmp:=tostr(longint(val));
top_symbol:
begin begin
hs:=o.sym.name; hs:=sym.name;
if o.symofs>0 then if symofs>0 then
hs:=hs+'+'+tostr(o.symofs) hs:=hs+'+'+tostr(symofs)
else else
if o.symofs<0 then if symofs<0 then
hs:=hs+tostr(o.symofs); hs:=hs+tostr(symofs);
getopstr_jmp:=hs; getopstr_jmp:=hs;
end; end;
else else
internalerror(10001); internalerror(10001);
end; end;
end; end;
{**************************************************************************** {****************************************************************************
TISPARCATTASMOUTPUT TISPARCATTASMOUTPUT
****************************************************************************} ****************************************************************************}
const
ait_const2str:array[ait_const_32bit..ait_const_8bit]of string[8]=(#9'.long'#9,#9'.short'#9,#9'.byte'#9);
procedure TGasSPARC.WriteInstruction(hp:Tai); procedure TGasSPARC.WriteInstruction(hp:Tai);
var var
Op:TAsmOp; Op:TAsmOp;
s:STRING; s:String;
i:Integer; i:Integer;
sep:STRING[3];
begin begin
if hp.typ<>ait_instruction if hp.typ<>ait_instruction
then then
@ -248,52 +234,34 @@ procedure TGasSPARC.WriteInstruction(hp:Tai);
op:=taicpu(hp).opcode; op:=taicpu(hp).opcode;
{call maybe not translated to call} {call maybe not translated to call}
s:=#9+std_op2str[op]+cond2str[taicpu(hp).condition]; s:=#9+std_op2str[op]+cond2str[taicpu(hp).condition];
if is_CallJmp(op) {process operands}
then
{ call and jmp need an extra handling }
{ this code is only called if jmp isn't a labeled instruction }
{ quick hack to overcome a problem with manglednames=255 chars }
begin
s:=#9+std_op2str[op]+#9+getopstr_jmp(taicpu(hp).oper[0]);
end
ELSE
BEGIN {process operands}
s:=#9+std_op2str[op]; s:=#9+std_op2str[op];
IF taicpu(hp).ops<>0 if taicpu(hp).ops>0
THEN then
BEGIN begin
{ s+=#9+getopstr(taicpu(hp).oper[0]);
if not is_calljmp(op) then for i:=1 to taicpu(hp).ops-1 do
sep:=',' s+=','+getopstr(taicpu(hp).oper[i]);
else end;
}
sep:=#9;
FOR i:=0 TO taicpu(hp).ops-1 DO
BEGIN
s:=s+sep+getopstr(taicpu(hp).oper[i]);
sep:=',';
END;
END;
END;
AsmWriteLn(s); AsmWriteLn(s);
END; end;
{***************************************************************************** {*****************************************************************************
Initialize Initialize
*****************************************************************************} *****************************************************************************}
CONST const
as_SPARC_as_info:TAsmInfo=( as_SPARC_as_info:TAsmInfo=(
id : as_gas; id:as_gas;
idtxt : 'AS'; idtxt:'AS';
asmbin : 'as'; asmbin:'as';
asmcmd : '-o $OBJ $ASM'; asmcmd:'-o $OBJ $ASM';
supported_target : system_any; supported_target:system_any;
outputbinary: false; outputbinary:false;
allowdirect : true; allowdirect:true;
needar : true; needar:true;
labelprefix_only_inside_procedure : false; labelprefix_only_inside_procedure:false;
labelprefix : '.L'; labelprefix:'.L';
comment : '# '; comment:'; ';
secnames : ({sec_none}'', {no section} secnames:({sec_none}'', {no section}
{sec_code}'.text', {executable code} {sec_code}'.text', {executable code}
{sec_data}'.data', {initialized R/W data} {sec_data}'.data', {initialized R/W data}
{sec_bss}'.bss', {uninitialized R/W data} {sec_bss}'.bss', {uninitialized R/W data}

View File

@ -27,8 +27,13 @@ uses
symconst,symbase,symtype,symdef,paramgr; symconst,symbase,symtype,symdef,paramgr;
type type
TSparcParaManager=class(TParaManager) TSparcParaManager=class(TParaManager)
{Returns a structure giving the information on the storage of the parameter
(which must be an integer parameter)
@param(nr Parameter number of routine, starting from 1)}
function GetIntParaLoc(nr:longint):TParaLocation;override; function GetIntParaLoc(nr:longint):TParaLocation;override;
procedure create_param_loc_info(p:TAbstractProcDef);override; procedure create_param_loc_info(p:TAbstractProcDef);override;
{Returns the location where the invisible parameter for structured function
results will be passed.}
function GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;override; function GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;override;
end; end;
implementation implementation
@ -232,22 +237,23 @@ WriteLn('***********************************************');
end; end;
function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation; function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
begin begin
with GetFuncRetParaLoc do
case p.rettype.def.deftype of case p.rettype.def.deftype of
orddef,enumdef: orddef,enumdef:
begin begin
WriteLn('Allocating i0 as return register'); WriteLn('Allocating i0 as return register');
GetFuncRetParaLoc.loc:=LOC_REGISTER; loc:=LOC_REGISTER;
GetFuncRetParaLoc.register:=R_I0; register:=R_I0;
GetFuncRetParaLoc.size:=def_cgsize(p.rettype.def); size:=def_cgsize(p.rettype.def);
if GetFuncRetParaLoc.size in [OS_S64,OS_64] if size in [OS_S64,OS_64]
then then
GetFuncRetParaLoc.RegisterHigh:=R_I1; RegisterHigh:=R_I1;
end; end;
floatdef: floatdef:
begin begin
GetFuncRetParaLoc.loc:=LOC_FPUREGISTER; loc:=LOC_FPUREGISTER;
GetFuncRetParaLoc.register:=R_F1; register:=R_F1;
GetFuncRetParaLoc.size:=def_cgsize(p.rettype.def); size:=def_cgsize(p.rettype.def);
end; end;
setdef, setdef,
variantdef, variantdef,
@ -262,9 +268,10 @@ function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
arraydef, arraydef,
errordef: errordef:
begin begin
GetFuncRetParaLoc.loc:=LOC_REGISTER; loc:=LOC_REFERENCE;
GetFuncRetParaLoc.register:=R_I0; reference.index:=frame_pointer_reg;
GetFuncRetParaLoc.size:=OS_ADDR; reference.offset:=64;
size:=OS_ADDR;
end; end;
else else
internalerror(2002090903); internalerror(2002090903);
@ -275,7 +282,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.7 2002-10-10 19:57:51 mazen Revision 1.8 2002-10-13 21:46:07 mazen
* assembler output format fixed
Revision 1.7 2002/10/10 19:57:51 mazen
* Just to update repsitory * Just to update repsitory
Revision 1.6 2002/10/10 15:10:39 mazen Revision 1.6 2002/10/10 15:10:39 mazen

View File

@ -28,10 +28,13 @@ uses
aasmtai, aasmtai,
cclasses,globtype,cgbase,aasmbase,rgobj; cclasses,globtype,cgbase,aasmbase,rgobj;
type type
{This class implements the cpu spaecific register allocator. It is used by the
code generator to allocate and free registers which might be valid across
nodes. It also contains utility routines related to registers. Some of the
methods in this class overrides generic implementations in rgobj.pas.}
trgcpu=class(trgobj) trgcpu=class(trgobj)
{ to keep the same allocation order as with the old routines }
procedure UngetregisterInt(list:taasmoutput;Reg:tregister);override;
function GetExplicitRegisterInt(list:taasmoutput;Reg:tregister):tregister;override; function GetExplicitRegisterInt(list:taasmoutput;Reg:tregister):tregister;override;
procedure UngetregisterInt(list:taasmoutput;Reg:tregister);override;
end; end;
implementation implementation
uses uses
@ -59,7 +62,10 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.3 2002-10-12 19:03:23 mazen Revision 1.4 2002-10-13 21:46:07 mazen
* assembler output format fixed
Revision 1.3 2002/10/12 19:03:23 mazen
* Get/Unget expilit registers to be re-examined * Get/Unget expilit registers to be re-examined
} }