Browse Source

* fixed passing of constant longint parameters

git-svn-id: branches/i8086@23788 -
nickysn 12 years ago
parent
commit
78cf362a90
1 changed files with 27 additions and 5 deletions
  1. 27 5
      compiler/i8086/cgcpu.pas

+ 27 - 5
compiler/i8086/cgcpu.pas

@@ -323,12 +323,34 @@ unit cgcpu;
       begin
         if use_push(cgpara) then
           begin
-            cgpara.check_simple_location;
-            if tcgsize2size[cgpara.location^.size]>cgpara.alignment then
-              pushsize:=cgpara.location^.size
+            if tcgsize2size[cgpara.Size] > 2 then
+              begin
+                if tcgsize2size[cgpara.Size] <> 4 then
+                  internalerror(2013031101);
+                if tcgsize2size[cgpara.location^.size] <> 2 then
+                  internalerror(2013031101);
+                if cgpara.location^.Next = nil then
+                  internalerror(2013031101);
+                if tcgsize2size[cgpara.location^.Next^.size] <> 2 then
+                  internalerror(2013031101);
+                if cgpara.location^.Next^.Next <> nil then
+                  internalerror(2013031101);
+                Writeln(cgpara.alignment);
+                if cgpara.alignment <> 4 then
+                  internalerror(2013031101);
+
+                list.concat(taicpu.op_const(A_PUSH,tcgsize2opsize[pushsize],a shr 16));
+                list.concat(taicpu.op_const(A_PUSH,tcgsize2opsize[pushsize],a and $FFFF));
+              end
             else
-              pushsize:=int_cgsize(cgpara.alignment);
-            list.concat(taicpu.op_const(A_PUSH,tcgsize2opsize[pushsize],a));
+              begin
+                cgpara.check_simple_location;
+                if tcgsize2size[cgpara.location^.size]>cgpara.alignment then
+                  pushsize:=cgpara.location^.size
+                else
+                  pushsize:=int_cgsize(cgpara.alignment);
+                list.concat(taicpu.op_const(A_PUSH,tcgsize2opsize[pushsize],a));
+              end;
           end
         else
           inherited a_load_const_cgpara(list,size,a,cgpara);