* m68k compiler compilation fixed

This commit is contained in:
florian 2004-05-06 20:30:51 +00:00
parent 91733f9237
commit 5168141540
5 changed files with 105 additions and 55 deletions

View File

@ -35,6 +35,8 @@ unit cgcpu;
type
tcg68k = class(tcg)
procedure init_register_allocators;override;
procedure done_register_allocators;override;
procedure a_call_name(list : taasmoutput;const s : string);override;
procedure a_call_reg(list : taasmoutput;reg : tregister);override;
procedure a_load_const_reg(list : taasmoutput;size : tcgsize;a : aword;register : tregister);override;
@ -170,17 +172,41 @@ unit cgcpu;
{****************************************************************************}
{ TCG68K }
{****************************************************************************}
procedure tcg68k.init_register_allocators;
begin
inherited init_register_allocators;
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,
[RS_D0,RS_D1,RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7],
first_int_imreg,[]);
rg[R_ADDRESSREGISTER]:=trgcpu.create(R_ADDRESSREGISTER,R_SUBWHOLE,
[RS_A0,RS_A1,RS_A2,RS_A3,RS_A4,RS_A5,RS_A6],
first_addr_imreg,[]);
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
[RS_FP0,RS_FP1,RS_FP2,RS_FP3,RS_FP4,RS_FP5,RS_FP6,RS_FP7],
first_fpu_imreg,[]);
end;
procedure tcg68k.done_register_allocators;
begin
rg[R_INTREGISTER].free;
rg[R_FPUREGISTER].free;
rg[R_ADDRESSREGISTER].free;
inherited done_register_allocators;
end;
function tcg68k.fixref(list: taasmoutput; var ref: treference): boolean;
begin
result := false;
result:=false;
{ The Coldfire and MC68020+ have extended
addressing capabilities with a 32-bit
displacement.
}
if (aktoptprocessor <> MC68000) then
if (aktoptprocessor<>MC68000) then
exit;
if (ref.base<> NR_NO) then
if (ref.base<>NR_NO) then
begin
if (ref.index <> NR_NO) and assigned(ref.symbol) then
internalerror(20020814);
@ -245,6 +271,7 @@ unit cgcpu;
end;
end;
procedure tcg68k.a_load_reg_ref(list : taasmoutput;fromsize,tosize : tcgsize;register : tregister;const ref : treference);
var
href : treference;
@ -255,6 +282,7 @@ unit cgcpu;
list.concat(taicpu.op_reg_ref(A_MOVE,TCGSize2OpSize[fromsize],register,href));
end;
procedure tcg68k.a_load_reg_reg(list : taasmoutput;fromsize,tosize : tcgsize;reg1,reg2 : tregister);
begin
{ move to destination register }
@ -263,6 +291,7 @@ unit cgcpu;
sign_extend(list, fromsize, reg2);
end;
procedure tcg68k.a_load_ref_reg(list : taasmoutput;fromsize,tosize : tcgsize;const ref : treference;register : tregister);
var
href : treference;
@ -288,6 +317,7 @@ unit cgcpu;
list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,r));
end;
procedure tcg68k.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister);
begin
{ in emulation mode, only 32-bit single is supported }
@ -331,21 +361,25 @@ unit cgcpu;
list.concat(taicpu.op_reg_ref(A_FMOVE,opsize,reg, ref));
end;
procedure tcg68k.a_loadmm_reg_reg(list: taasmoutput;fromsize,tosize : tcgsize; reg1, reg2: tregister;shuffle : pmmshuffle);
begin
internalerror(20020729);
end;
procedure tcg68k.a_loadmm_ref_reg(list: taasmoutput;fromsize,tosize : tcgsize; const ref: treference; reg: tregister;shuffle : pmmshuffle);
begin
internalerror(20020729);
end;
procedure tcg68k.a_loadmm_reg_ref(list: taasmoutput;fromsize,tosize : tcgsize; reg: tregister; const ref: treference;shuffle : pmmshuffle);
begin
internalerror(20020729);
end;
procedure tcg68k.a_parammm_reg(list: taasmoutput; size: tcgsize; reg: tregister;const locpara : tparalocation;shuffle : pmmshuffle);
begin
internalerror(20020729);
@ -501,6 +535,7 @@ unit cgcpu;
end;
end;
procedure tcg68k.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister);
var
hreg1,hreg2,r,r2: tregister;
@ -883,12 +918,11 @@ unit cgcpu;
a_load_ref_reg(list,OS_8,OS_8,srcref,hregister);
a_load_reg_ref(list,OS_8,OS_8,hregister,dstref);
end
end
else
begin
iregister := getaddressregister(list);
jregister := getaddressregister(list);
iregister:=getaddressregister(list);
jregister:=getaddressregister(list);
{ reference for move (An)+,(An)+ }
reference_reset(hp1);
hp1.base := iregister; { source register }
@ -1028,7 +1062,7 @@ unit cgcpu;
{ return with immediate size possible here
signed!
RTD is not supported on the coldfire }
if (aktoptprocessor = MC68020) and (parasize < $7FFF) then
if (aktoptprocessor=MC68020) and (parasize<$7FFF) then
list.concat(taicpu.op_const(A_RTD,S_NO,parasize))
{ manually restore the stack }
else
@ -1038,7 +1072,7 @@ unit cgcpu;
{ point to nowhere! }
{ save the PC counter (pop it from the stack) }
hregister := getaddressregister(list);
hregister:=getaddressregister(list);
reference_reset_base(ref,NR_STACK_POINTER_REG,0);
ref.direction:=dir_inc;
list.concat(taicpu.op_ref_reg(A_MOVE,S_L,ref,hregister));
@ -1066,7 +1100,6 @@ unit cgcpu;
tosave : tcpuregisterset;
ref : treference;
begin
tosave:=std_saved_registers;
{ only save the registers which are not used and must be saved }
tosave:=tosave*(rg[R_INTREGISTER].used_in_proc+rg[R_ADDRESSREGISTER].used_in_proc);
@ -1276,7 +1309,10 @@ end.
{
$Log$
Revision 1.24 2004-04-19 21:15:12 florian
Revision 1.25 2004-05-06 20:30:51 florian
* m68k compiler compilation fixed
Revision 1.24 2004/04/19 21:15:12 florian
* fixed compilation
Revision 1.23 2004/04/18 21:13:59 florian

View File

@ -115,13 +115,14 @@ unit cpubase;
{$i r68kcon.inc}
{ Integer Super registers first and last }
first_int_supreg = RS_SP;
first_int_imreg = RS_SP+1;
first_int_imreg = RS_D7+1;
{ Float Super register first and last }
first_fpu_supreg = RS_FP7;
first_fpu_imreg = RS_FP7+1;
{ Integer Super registers first and last }
first_addr_imreg = RS_SP+1;
{ MM Super register first and last }
first_mm_supreg = 0;
first_mm_imreg = 0;
@ -314,10 +315,10 @@ unit cpubase;
This is not compatible with the m68k-sun
implementation.
}
stab_regindex : array[tregisterindex] of shortint =
(
{$i r68ksta.inc}
);
stab_regindex : array[tregisterindex] of shortint =
(
{$i r68ksta.inc}
);
{*****************************************************************************
Generic Register names
@ -512,7 +513,10 @@ implementation
end.
{
$Log$
Revision 1.26 2004-04-25 21:26:16 florian
Revision 1.27 2004-05-06 20:30:51 florian
* m68k compiler compilation fixed
Revision 1.26 2004/04/25 21:26:16 florian
* some m68k stuff fixed
Revision 1.25 2004/04/18 21:13:59 florian

View File

@ -1528,7 +1528,7 @@ type
end
else
Message1(sym_e_unknown_id,actasmpattern);
expr := actasmpattern;
Consume(AS_ID);
case actasmtoken of
@ -1538,7 +1538,7 @@ type
else
Message(asmr_e_syntax_error);
end;
end;
end;
end;
@ -1753,21 +1753,21 @@ type
TM68kInstruction
*****************************************************************************}
type
TM68kInstruction=class(TInstruction)
procedure InitOperands;override;
procedure BuildOpcode;override;
procedure ConcatInstruction(p : taasmoutput);override;
Procedure ConcatLabeledInstr(p : taasmoutput);
end;
type
TM68kInstruction=class(TInstruction)
procedure InitOperands;override;
procedure BuildOpcode;override;
procedure ConcatInstruction(p : taasmoutput);override;
Procedure ConcatLabeledInstr(p : taasmoutput);
end;
procedure TM68kInstruction.InitOperands;
var
i : longint;
begin
for i:=1 to max_operands do
Operands[i]:=TM68kOperand.Create;
end;
var
i : longint;
begin
for i:=1 to max_operands do
Operands[i]:=TM68kOperand.Create;
end;
Procedure TM68kInstruction.BuildOpCode;
@ -2269,7 +2269,10 @@ Begin
end.
{
$Log$
Revision 1.14 2004-03-02 00:36:33 olle
Revision 1.3 2004-05-06 20:30:51 florian
* m68k compiler compilation fixed
Revision 1.14 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.13 2003/02/19 22:00:16 daniel

View File

@ -1733,6 +1733,7 @@ begin
{$endif}
{$ifdef m68k}
def_symbol('CPU68K');
def_symbol('CPUM68K');
def_symbol('CPU32');
def_symbol('FPC_CURRENCY_IS_INT64');
def_symbol('FPC_COMP_IS_INT64');
@ -2047,7 +2048,10 @@ finalization
end.
{
$Log$
Revision 1.133 2004-04-04 18:46:09 olle
Revision 1.134 2004-05-06 20:30:51 florian
* m68k compiler compilation fixed
Revision 1.133 2004/04/04 18:46:09 olle
+ added $APPTYPE TOOL for MPW tools on MacOS
Revision 1.132 2004/03/29 19:19:35 florian

View File

@ -77,7 +77,7 @@ type
OPR_LOCAL : (localsym:tvarsym;localsymofs:longint;localindexreg:tregister;localscale:byte;localgetoffset:boolean);
OPR_REGISTER : (reg:tregister);
{$ifdef m68k}
OPR_REGLIST : (reglist:Tsupregset);
OPR_REGLIST : (regset : tcpuregisterset);
{$endif m68k}
{$ifdef powerpc}
OPR_COND : (cond : tasmcond);
@ -1083,25 +1083,25 @@ Begin
end;
Procedure TInstruction.Swapoperands;
Var
p : toperand;
Begin
case Ops of
2 :
begin
p:=Operands[1];
Operands[1]:=Operands[2];
Operands[2]:=p;
Procedure TInstruction.Swapoperands;
Var
p : toperand;
Begin
case Ops of
2 :
begin
p:=Operands[1];
Operands[1]:=Operands[2];
Operands[2]:=p;
end;
3 :
begin
p:=Operands[1];
Operands[1]:=Operands[3];
Operands[3]:=p;
end;
end;
end;
3 :
begin
p:=Operands[1];
Operands[1]:=Operands[3];
Operands[3]:=p;
end;
end;
end;
function TInstruction.ConcatInstruction(p:TAAsmoutput) : tai;
@ -1632,7 +1632,10 @@ end;
end.
{
$Log$
Revision 1.85 2004-03-23 22:34:49 peter
Revision 1.86 2004-05-06 20:30:51 florian
* m68k compiler compilation fixed
Revision 1.85 2004/03/23 22:34:49 peter
* constants ordinals now always have a type assigned
* integer constants have the smallest type, unsigned prefered over
signed