* moved the insertion of fwaits for 8087 from the nasm asm writer to ti8086procinfo.postprocess_code

git-svn-id: trunk@30634 -
This commit is contained in:
nickysn 2015-04-17 23:27:03 +00:00
parent 58c66b4759
commit a6e39edb8f
2 changed files with 31 additions and 8 deletions

View File

@ -32,10 +32,14 @@ unit cpupi;
type
ti8086procinfo = class(tcgprocinfo)
private
procedure insert_8087_fwaits(list : TAsmList);
public
constructor create(aparent:tprocinfo);override;
procedure set_first_temp_offset;override;
function calc_stackframe_size:longint;override;
procedure generate_parameter_info;override;
procedure postprocess_code;override;
end;
@ -44,8 +48,9 @@ unit cpupi;
uses
cutils,
systems,globals,globtype,
aasmtai,aasmcpu,
cgobj,tgobj,paramgr,
cpubase,
cpubase,cpuinfo,
cgutils,
symconst;
@ -95,6 +100,31 @@ unit cpupi;
para_stack_size := 0;
end;
procedure ti8086procinfo.insert_8087_fwaits(list : TAsmList);
var
curtai: tai;
begin
curtai:=tai(list.First);
while assigned(curtai) do
begin
if (curtai.typ=ait_instruction)
and requires_fwait_on_8087(taicpu(curtai).opcode) then
list.InsertBefore(taicpu.op_none(A_FWAIT),curtai);
curtai:=tai(curtai.Next);
end;
end;
procedure ti8086procinfo.postprocess_code;
begin
{ nickysn note: I don't know if the 187 requires FWAIT before
every instruction like the 8087, so I'm including it just in case }
if current_settings.cputype<=cpu_186 then
insert_8087_fwaits(aktproccode);
end;
begin
cprocinfo:=ti8086procinfo;
end.

View File

@ -909,13 +909,6 @@ interface
else
begin
prefix:='';
{$ifdef i8086}
{ nickysn note: I don't know if the 187 requires FWAIT before
every instruction like the 8087, so I'm including it just in case }
if (current_settings.cputype<=cpu_186) and
requires_fwait_on_8087(fixed_opcode) then
prefix:='wait '+prefix;
{$endif i8086}
{$ifndef i8086}
{ We need to explicitely set
word prefix to get selectors