diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index caf030d118..d59e84c8eb 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -11696,9 +11696,6 @@ unit aoptx86; 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 hp1,hp2: tai; carryadd_opcode : TAsmOp; @@ -12352,7 +12349,7 @@ unit aoptx86; below) } if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then 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; asml.InsertBefore(hp_new, hp_flagalloc); @@ -12389,7 +12386,7 @@ unit aoptx86; for c := 0 to x - 1 do if Assigned(ConstMovs[c]) then 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])]); end; @@ -12631,7 +12628,7 @@ unit aoptx86; below) } if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then 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); if Assigned(hp_prev2) then TrySwapMovOp(hp_prev2, hp_new); @@ -12720,7 +12717,7 @@ unit aoptx86; below) } if not TmpUsedRegs[R_INTREGISTER].IsUsed(ConstRegs[x]) then 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); if Assigned(hp_prev2) then TrySwapMovOp(hp_prev2, hp_new); @@ -12758,7 +12755,7 @@ unit aoptx86; for x := 0 to c - 1 do if Assigned(ConstMovs[x]) then 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])]); end; diff --git a/compiler/x86/cpubase.pas b/compiler/x86/cpubase.pas index 40a357fd52..f21d97a140 100644 --- a/compiler/x86/cpubase.pas +++ b/compiler/x86/cpubase.pas @@ -338,6 +338,7 @@ topsize2memsize: array[topsize] of integer = function cgsize2subreg(regtype: tregistertype; s:Tcgsize):Tsubregister; function reg2opsize(r:Tregister):topsize; + function subreg2opsize(sr : tsubregister):topsize; function reg_cgsize(const reg: tregister): tcgsize; function is_calljmp(o:tasmop):boolean; function is_calljmpuncondret(o:tasmop):boolean; @@ -521,15 +522,21 @@ implementation end; - function reg2opsize(r:Tregister):topsize; + function subreg2opsize(sr : tsubregister):topsize; 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); + begin + result:=_subreg2opsize[sr]; + end; + + + function reg2opsize(r:Tregister):topsize; begin reg2opsize:=S_L; case getregtype(r) of R_INTREGISTER : - reg2opsize:=subreg2opsize[getsubreg(r)]; + reg2opsize:=subreg2opsize(getsubreg(r)); R_FPUREGISTER : reg2opsize:=S_FL; R_MMXREGISTER,