mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:49:35 +02:00
* changed reg2opsize to function
This commit is contained in:
parent
c5efd5c7d5
commit
3f0491bb38
@ -286,25 +286,6 @@ uses
|
||||
regset16bit : tregisterset = [R_AX..R_DI,R_CS..R_SS];
|
||||
regset32bit : tregisterset = [R_EAX..R_EDI];
|
||||
|
||||
{ Convert reg to opsize }
|
||||
reg2opsize : array[firstreg..lastreg] of topsize = (S_NO,
|
||||
S_L,S_L,S_L,S_L,S_L,S_L,S_L,S_L,
|
||||
S_W,S_W,S_W,S_W,S_W,S_W,S_W,S_W,
|
||||
S_B,S_B,S_B,S_B,S_B,S_B,S_B,S_B,
|
||||
S_W,S_W,S_W,S_W,S_W,S_W,
|
||||
S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,
|
||||
S_L,S_L,S_L,S_L,S_L,S_L,
|
||||
S_L,S_L,S_L,S_L,
|
||||
S_L,S_L,S_L,S_L,S_L,
|
||||
S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D,
|
||||
S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D
|
||||
);
|
||||
|
||||
{Converts subregister number to opsize}
|
||||
subreg2opsize:array[0..4] of Topsize = (S_B,S_B,S_W,S_L,S_D);
|
||||
{Converts subregister number to cgsize}
|
||||
{ subreg2cgsize:array[0..4] of Tcgsize = (OS_8,OS_8,OS_16,OS_32);}
|
||||
|
||||
{# Standard opcode string table (for each tasmop enumeration). The
|
||||
opcode strings should conform to the names as defined by the
|
||||
processor manufacturer.
|
||||
@ -645,13 +626,13 @@ uses
|
||||
{the return_result_reg, is used inside the called function to store its return
|
||||
value when that is a scalar value otherwise a pointer to the address of the
|
||||
result is placed inside it}
|
||||
return_result_reg = accumulator;
|
||||
return_result_reg = accumulator;
|
||||
RS_RETURN_RESULT_REG = RS_ACCUMULATOR;
|
||||
NR_RETURN_RESULT_REG = NR_ACCUMULATOR;
|
||||
|
||||
{the function_result_reg contains the function result after a call to a scalar
|
||||
function othewise it contains a pointer to the returned result}
|
||||
function_result_reg = accumulator;
|
||||
function_result_reg = accumulator;
|
||||
{# Hi-Results are returned in this register (64-bit value high register) }
|
||||
accumulatorhigh = R_EDX;
|
||||
RS_ACCUMULATORHIGH = RS_EDX;
|
||||
@ -693,6 +674,7 @@ uses
|
||||
|
||||
procedure convert_register_to_enum(var r:Tregister);
|
||||
function cgsize2subreg(s:Tcgsize):Tsubregister;
|
||||
function reg2opsize(r:Tregister):topsize;
|
||||
function is_calljmp(o:tasmop):boolean;
|
||||
function flags_to_cond(const f: TResFlags) : TAsmCond;
|
||||
|
||||
@ -748,6 +730,49 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function reg2opsize(r:Tregister):topsize;
|
||||
const
|
||||
subreg2opsize : array[0..4] of Topsize = (S_B,S_B,S_W,S_L,S_D);
|
||||
|
||||
enum2opsize : array[firstreg..lastreg] of topsize = (S_NO,
|
||||
S_L,S_L,S_L,S_L,S_L,S_L,S_L,S_L,
|
||||
S_W,S_W,S_W,S_W,S_W,S_W,S_W,S_W,
|
||||
S_B,S_B,S_B,S_B,S_B,S_B,S_B,S_B,
|
||||
S_W,S_W,S_W,S_W,S_W,S_W,
|
||||
S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,
|
||||
S_L,S_L,S_L,S_L,S_L,S_L,
|
||||
S_L,S_L,S_L,S_L,
|
||||
S_L,S_L,S_L,S_L,S_L,
|
||||
S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D,
|
||||
S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D
|
||||
);
|
||||
begin
|
||||
reg2opsize:=S_L;
|
||||
if (r.enum=R_INTREGISTER) then
|
||||
begin
|
||||
if (r.number shr 8)=0 then
|
||||
begin
|
||||
case r.number of
|
||||
NR_CS,NR_DS,NR_ES,
|
||||
NR_SS,NR_FS,NR_GS :
|
||||
reg2opsize:=S_W;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (r.number and $ff)>4 then
|
||||
internalerror(200303181);
|
||||
reg2opsize:=subreg2opsize[r.number and $ff];
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
reg2opsize:=enum2opsize[r.enum];
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function supreg_name(r:Tsuperregister):string;
|
||||
|
||||
var s:string[4];
|
||||
@ -799,7 +824,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.43 2003-03-08 08:59:07 daniel
|
||||
Revision 1.44 2003-03-18 18:15:53 peter
|
||||
* changed reg2opsize to function
|
||||
|
||||
Revision 1.43 2003/03/08 08:59:07 daniel
|
||||
+ $define newra will enable new register allocator
|
||||
+ getregisterint will return imaginary registers with $newra
|
||||
+ -sr switch added, will skip register allocation so you can see
|
||||
|
@ -1830,7 +1830,7 @@ Begin
|
||||
begin
|
||||
hp1 := Tai_Marker.Create(NoPropInfoEnd);
|
||||
insertllitem(asml,p,p.next,hp1);
|
||||
hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize[regcounter.enum],
|
||||
hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(regcounter),
|
||||
regcounter,taicpu(p).oper[0].ref^);
|
||||
new(pTaiprop(hp1.optinfo));
|
||||
pTaiProp(hp1.optinfo)^ := pTaiProp(p.optinfo)^;
|
||||
@ -1882,7 +1882,7 @@ Begin
|
||||
begin
|
||||
hp1 := Tai_Marker.Create(NoPropInfoEnd);
|
||||
insertllitem(asml,p,p.next,hp1);
|
||||
hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize[regcounter.enum],
|
||||
hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(regcounter),
|
||||
regcounter,taicpu(p).oper[1].ref^);
|
||||
new(pTaiprop(hp1.optinfo));
|
||||
pTaiProp(hp1.optinfo)^ := pTaiProp(p.optinfo)^;
|
||||
@ -1999,7 +1999,10 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.41 2003-02-26 21:15:43 daniel
|
||||
Revision 1.42 2003-03-18 18:15:53 peter
|
||||
* changed reg2opsize to function
|
||||
|
||||
Revision 1.41 2003/02/26 21:15:43 daniel
|
||||
* Fixed the optimizer
|
||||
|
||||
Revision 1.40 2003/02/19 22:00:15 daniel
|
||||
|
@ -1442,7 +1442,7 @@ Begin
|
||||
opr.reg:=actasmregister;
|
||||
if opr.reg.enum<>R_INTREGISTER then
|
||||
internalerror(200302023);
|
||||
size:=subreg2opsize[actasmregister.number and $ff];
|
||||
size:=reg2opsize(actasmregister);
|
||||
Consume(AS_REGISTER);
|
||||
end
|
||||
else
|
||||
@ -1595,10 +1595,7 @@ Begin
|
||||
Message(asmr_e_invalid_operand_type);
|
||||
opr.typ:=OPR_REGISTER;
|
||||
opr.reg:=tempreg;
|
||||
if opr.reg.enum=R_INTREGISTER then
|
||||
size:=subreg2opsize[opr.reg.number and $ff]
|
||||
else
|
||||
size:=reg2opsize[opr.reg.enum];
|
||||
size:=reg2opsize(opr.reg);
|
||||
end
|
||||
else
|
||||
Message(asmr_e_syn_operand);
|
||||
@ -2138,7 +2135,10 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.39 2003-02-20 15:52:58 pierre
|
||||
Revision 1.40 2003-03-18 18:15:53 peter
|
||||
* changed reg2opsize to function
|
||||
|
||||
Revision 1.39 2003/02/20 15:52:58 pierre
|
||||
* fix a range check error
|
||||
|
||||
Revision 1.38 2003/02/19 22:00:16 daniel
|
||||
|
@ -1584,10 +1584,7 @@ Begin
|
||||
Message(asmr_e_invalid_operand_type);
|
||||
opr.typ:=OPR_REGISTER;
|
||||
opr.reg:=tempreg;
|
||||
if opr.reg.enum=R_INTREGISTER then
|
||||
size:=subreg2opsize[opr.reg.number and $ff]
|
||||
else
|
||||
size:=reg2opsize[opr.reg.enum];
|
||||
size:=reg2opsize(opr.reg)
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1983,7 +1980,10 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.42 2003-03-17 21:32:52 peter
|
||||
Revision 1.43 2003-03-18 18:15:53 peter
|
||||
* changed reg2opsize to function
|
||||
|
||||
Revision 1.42 2003/03/17 21:32:52 peter
|
||||
* allow character constants in reference declaration
|
||||
|
||||
Revision 1.41 2003/02/26 22:57:44 daniel
|
||||
|
Loading…
Reference in New Issue
Block a user