mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-01 14:19:34 +02:00
* factor out subreg2opsize
This commit is contained in:
parent
6d5876a29c
commit
4096d9b74f
@ -11696,9 +11696,6 @@ unit aoptx86;
|
|||||||
|
|
||||||
|
|
||||||
function TX86AsmOptimizer.OptPass2Jcc(var p : tai) : boolean;
|
function TX86AsmOptimizer.OptPass2Jcc(var p : tai) : boolean;
|
||||||
const
|
|
||||||
subreg2opsize : array[tsubregister] of topsize =
|
|
||||||
(S_NO,S_B,S_B,S_W,S_L,S_Q,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO);
|
|
||||||
var
|
var
|
||||||
hp1,hp2: tai;
|
hp1,hp2: tai;
|
||||||
carryadd_opcode : TAsmOp;
|
carryadd_opcode : TAsmOp;
|
||||||
@ -12352,7 +12349,7 @@ unit aoptx86;
|
|||||||
below) }
|
below) }
|
||||||
if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then
|
if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then
|
||||||
begin
|
begin
|
||||||
hp_new := taicpu.op_const_reg(A_MOV, subreg2opsize[R_SUBWHOLE], taicpu(hp1).oper[0]^.val, ConstRegs[X]);
|
hp_new := taicpu.op_const_reg(A_MOV, subreg2opsize(R_SUBWHOLE), taicpu(hp1).oper[0]^.val, ConstRegs[X]);
|
||||||
taicpu(hp_new).fileinfo := taicpu(hp_prev).fileinfo;
|
taicpu(hp_new).fileinfo := taicpu(hp_prev).fileinfo;
|
||||||
|
|
||||||
asml.InsertBefore(hp_new, hp_flagalloc);
|
asml.InsertBefore(hp_new, hp_flagalloc);
|
||||||
@ -12389,7 +12386,7 @@ unit aoptx86;
|
|||||||
for c := 0 to x - 1 do
|
for c := 0 to x - 1 do
|
||||||
if Assigned(ConstMovs[c]) then
|
if Assigned(ConstMovs[c]) then
|
||||||
begin
|
begin
|
||||||
taicpu(ConstMovs[c]).opsize := subreg2opsize[ConstWriteSizes[Word(ConstRegs[c])]];
|
taicpu(ConstMovs[c]).opsize := subreg2opsize(ConstWriteSizes[Word(ConstRegs[c])]);
|
||||||
setsubreg(taicpu(ConstMovs[c]).oper[1]^.reg, ConstWriteSizes[Word(ConstRegs[c])]);
|
setsubreg(taicpu(ConstMovs[c]).oper[1]^.reg, ConstWriteSizes[Word(ConstRegs[c])]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -12631,7 +12628,7 @@ unit aoptx86;
|
|||||||
below) }
|
below) }
|
||||||
if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then
|
if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then
|
||||||
begin
|
begin
|
||||||
hp_new := taicpu.op_const_reg(A_MOV, subreg2opsize[R_SUBWHOLE], taicpu(hp1).oper[0]^.val, ConstRegs[X]);
|
hp_new := taicpu.op_const_reg(A_MOV, subreg2opsize(R_SUBWHOLE), taicpu(hp1).oper[0]^.val, ConstRegs[X]);
|
||||||
asml.InsertBefore(hp_new, hp_flagalloc);
|
asml.InsertBefore(hp_new, hp_flagalloc);
|
||||||
if Assigned(hp_prev2) then
|
if Assigned(hp_prev2) then
|
||||||
TrySwapMovOp(hp_prev2, hp_new);
|
TrySwapMovOp(hp_prev2, hp_new);
|
||||||
@ -12720,7 +12717,7 @@ unit aoptx86;
|
|||||||
below) }
|
below) }
|
||||||
if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then
|
if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then
|
||||||
begin
|
begin
|
||||||
hp_new := taicpu.op_const_reg(A_MOV, subreg2opsize[R_SUBWHOLE], taicpu(hp1).oper[0]^.val, ConstRegs[X]);
|
hp_new := taicpu.op_const_reg(A_MOV, subreg2opsize(R_SUBWHOLE), taicpu(hp1).oper[0]^.val, ConstRegs[X]);
|
||||||
asml.InsertBefore(hp_new, hp_flagalloc);
|
asml.InsertBefore(hp_new, hp_flagalloc);
|
||||||
if Assigned(hp_prev2) then
|
if Assigned(hp_prev2) then
|
||||||
TrySwapMovOp(hp_prev2, hp_new);
|
TrySwapMovOp(hp_prev2, hp_new);
|
||||||
@ -12758,7 +12755,7 @@ unit aoptx86;
|
|||||||
for x := 0 to c - 1 do
|
for x := 0 to c - 1 do
|
||||||
if Assigned(ConstMovs[x]) then
|
if Assigned(ConstMovs[x]) then
|
||||||
begin
|
begin
|
||||||
taicpu(ConstMovs[x]).opsize := subreg2opsize[ConstWriteSizes[Word(ConstRegs[x])]];
|
taicpu(ConstMovs[x]).opsize := subreg2opsize(ConstWriteSizes[Word(ConstRegs[x])]);
|
||||||
setsubreg(taicpu(ConstMovs[x]).oper[1]^.reg, ConstWriteSizes[Word(ConstRegs[x])]);
|
setsubreg(taicpu(ConstMovs[x]).oper[1]^.reg, ConstWriteSizes[Word(ConstRegs[x])]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -338,6 +338,7 @@ topsize2memsize: array[topsize] of integer =
|
|||||||
|
|
||||||
function cgsize2subreg(regtype: tregistertype; s:Tcgsize):Tsubregister;
|
function cgsize2subreg(regtype: tregistertype; s:Tcgsize):Tsubregister;
|
||||||
function reg2opsize(r:Tregister):topsize;
|
function reg2opsize(r:Tregister):topsize;
|
||||||
|
function subreg2opsize(sr : tsubregister):topsize;
|
||||||
function reg_cgsize(const reg: tregister): tcgsize;
|
function reg_cgsize(const reg: tregister): tcgsize;
|
||||||
function is_calljmp(o:tasmop):boolean;
|
function is_calljmp(o:tasmop):boolean;
|
||||||
function is_calljmpuncondret(o:tasmop):boolean;
|
function is_calljmpuncondret(o:tasmop):boolean;
|
||||||
@ -521,15 +522,21 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function reg2opsize(r:Tregister):topsize;
|
function subreg2opsize(sr : tsubregister):topsize;
|
||||||
const
|
const
|
||||||
subreg2opsize : array[tsubregister] of topsize =
|
_subreg2opsize : array[tsubregister] of topsize =
|
||||||
(S_NO,S_B,S_B,S_W,S_L,S_Q,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO);
|
(S_NO,S_B,S_B,S_W,S_L,S_Q,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO);
|
||||||
|
begin
|
||||||
|
result:=_subreg2opsize[sr];
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function reg2opsize(r:Tregister):topsize;
|
||||||
begin
|
begin
|
||||||
reg2opsize:=S_L;
|
reg2opsize:=S_L;
|
||||||
case getregtype(r) of
|
case getregtype(r) of
|
||||||
R_INTREGISTER :
|
R_INTREGISTER :
|
||||||
reg2opsize:=subreg2opsize[getsubreg(r)];
|
reg2opsize:=subreg2opsize(getsubreg(r));
|
||||||
R_FPUREGISTER :
|
R_FPUREGISTER :
|
||||||
reg2opsize:=S_FL;
|
reg2opsize:=S_FL;
|
||||||
R_MMXREGISTER,
|
R_MMXREGISTER,
|
||||||
|
Loading…
Reference in New Issue
Block a user