mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 01:29:21 +02:00
+ added helper functions get_x86_string_op_si_param and get_x86_string_op_di_param
* use get_x86_string_op_si_param in the nasm writer git-svn-id: trunk@37450 -
This commit is contained in:
parent
5a5cd65559
commit
e3ca2a3043
@ -989,16 +989,7 @@ interface
|
||||
else if is_x86_parameterized_string_instruction_op(fixed_opcode) then
|
||||
begin
|
||||
writer.AsmWrite(#9#9);
|
||||
case fixed_opcode of
|
||||
A_MOVS,A_OUTS:
|
||||
i:=1;
|
||||
A_CMPS,A_LODS:
|
||||
i:=0;
|
||||
A_SCAS,A_STOS,A_INS:
|
||||
i:=-1;
|
||||
else
|
||||
internalerror(2017101102);
|
||||
end;
|
||||
i:=get_x86_string_op_si_param(fixed_opcode);
|
||||
if (i<>-1) and (taicpu(hp).oper[i]^.typ=top_ref) and
|
||||
(taicpu(hp).oper[i]^.ref^.segment<>NR_NO) then
|
||||
writer.AsmWrite(std_regname(taicpu(hp).oper[i]^.ref^.segment)+' ');
|
||||
|
@ -325,6 +325,12 @@ uses
|
||||
function is_x86_parameterized_string_instruction_op(op: TAsmOp): boolean;
|
||||
function x86_param2paramless_string_op(op: TAsmOp): TAsmOp;
|
||||
function get_x86_string_op_size(op: TAsmOp): TOpSize;
|
||||
{ returns the 0-based operand number (intel syntax) of the ds:[si] param of
|
||||
a x86 string instruction }
|
||||
function get_x86_string_op_si_param(op: TAsmOp):shortint;
|
||||
{ returns the 0-based operand number (intel syntax) of the es:[di] param of
|
||||
a x86 string instruction }
|
||||
function get_x86_string_op_di_param(op: TAsmOp):shortint;
|
||||
|
||||
{$ifdef i8086}
|
||||
{ return whether we need to add an extra FWAIT instruction before the given
|
||||
@ -752,6 +758,36 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function get_x86_string_op_si_param(op: TAsmOp):shortint;
|
||||
begin
|
||||
case op of
|
||||
A_MOVS,A_OUTS:
|
||||
result:=1;
|
||||
A_CMPS,A_LODS:
|
||||
result:=0;
|
||||
A_SCAS,A_STOS,A_INS:
|
||||
result:=-1;
|
||||
else
|
||||
internalerror(2017101102);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function get_x86_string_op_di_param(op: TAsmOp):shortint;
|
||||
begin
|
||||
case op of
|
||||
A_MOVS,A_SCAS,A_STOS,A_INS:
|
||||
result:=0;
|
||||
A_CMPS:
|
||||
result:=1;
|
||||
A_LODS,A_OUTS:
|
||||
result:=-1;
|
||||
else
|
||||
internalerror(2017101202);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef i8086}
|
||||
function requires_fwait_on_8087(op: TAsmOp): boolean;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user