瀏覽代碼

* use the 'leave' instruction on 80186+

git-svn-id: trunk@24378 -
nickysn 12 年之前
父節點
當前提交
7c0679efdb
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      compiler/i8086/cgcpu.pas

+ 7 - 4
compiler/i8086/cgcpu.pas

@@ -889,10 +889,13 @@ unit cgcpu;
               end
               end
             else
             else
               begin
               begin
-                list.concat(Taicpu.op_reg_reg(A_MOV, S_W, NR_BP, NR_SP));
-                list.concat(Taicpu.op_reg(A_POP, S_W, NR_BP));
-                {todo: use LEAVE for 286+}
-                {list.concat(Taicpu.op_none(A_LEAVE,S_NO));}
+                if current_settings.cputype < cpu_186 then
+                  begin
+                    list.concat(Taicpu.op_reg_reg(A_MOV, S_W, NR_BP, NR_SP));
+                    list.concat(Taicpu.op_reg(A_POP, S_W, NR_BP));
+                  end
+                else
+                  list.concat(Taicpu.op_none(A_LEAVE,S_NO));
               end;
               end;
             list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
             list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
           end;
           end;