Browse Source

+ TOperand.SetCorrectSize virtual method added
to be able to change the suffix according to the instruction
(FIADD word ptr w need a s as ATT suffix
wheras FILD word ptr w need a w suffix :( )

pierre 25 years ago
parent
commit
67a0b6c79e
3 changed files with 60 additions and 5 deletions
  1. 33 2
      compiler/ra386.pas
  2. 15 2
      compiler/ra386att.pas
  3. 12 1
      compiler/rautils.pas

+ 33 - 2
compiler/ra386.pas

@@ -36,6 +36,7 @@ Procedure FWaitWarning;
 type
   P386Operand=^T386Operand;
   T386Operand=object(TOperand)
+    Procedure SetCorrectSize(opcode:tasmop);virtual;
   end;
 
   P386Instruction=^T386Instruction;
@@ -141,6 +142,27 @@ begin
    Message(asmr_w_fwait_emu_prob);
 end;
 
+{*****************************************************************************
+                              T386Operand
+*****************************************************************************}
+
+Procedure T386Operand.SetCorrectSize(opcode:tasmop);
+begin
+  if att_needsuffix[opcode]=attsufFPU then
+    begin
+     case size of
+      S_L : size:=S_FS;
+      S_IQ : size:=S_FL;
+     end;
+    end
+  else if att_needsuffix[opcode]=attsufFPUint then
+    begin
+      case size of
+      S_W : size:=S_IS;
+      S_L : size:=S_IL;
+      end;
+    end;
+end;
 
 {*****************************************************************************
                               T386Instruction
@@ -156,6 +178,8 @@ var
   so : longint;
 begin
   for i:=1to ops do
+   begin
+   operands[i]^.SetCorrectSize(opcode);
    if (operands[i]^.size=S_NO) then
     begin
       case operands[i]^.Opr.Typ of
@@ -190,6 +214,7 @@ begin
           end;
       end;
     end;
+   end;
 end;
 
 
@@ -339,7 +364,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.12  2000-02-09 13:23:01  peter
+  Revision 1.13  2000-04-04 13:48:44  pierre
+    + TOperand.SetCorrectSize virtual method added
+      to be able to change the suffix according to the instruction
+      (FIADD word ptr w need a s as ATT suffix
+      wheras FILD word ptr w need a w suffix :( )
+
+  Revision 1.12  2000/02/09 13:23:01  peter
     * log truncated
 
   Revision 1.11  2000/01/07 01:14:34  peter
@@ -354,4 +385,4 @@ end.
   Revision 1.8  1999/08/04 00:23:23  florian
     * renamed i386asm and i386base to cpuasm and cpubase
 
-}
+}

+ 15 - 2
compiler/ra386att.pas

@@ -134,6 +134,9 @@ const
   att_sizefpusuffix : array[0..9] of topsize = (
     S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_FL,S_FS,S_IQ,S_FX
   );
+  att_sizefpuintsuffix : array[0..9] of topsize = (
+    S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_IL,S_IS,S_IQ,S_NO
+  );
 var
   i    : tasmop;
   cond : string[4];
@@ -163,6 +166,8 @@ Begin
             actopcode:=i;
             if att_needsuffix[actopcode]=attsufFPU then
              actopsize:=att_sizefpusuffix[sufidx]
+            else if att_needsuffix[actopcode]=attsufFPUint then
+             actopsize:=att_sizefpuintsuffix[sufidx]
             else
              actopsize:=att_sizesuffix[sufidx];
             actasmtoken:=AS_OPCODE;
@@ -184,6 +189,8 @@ Begin
                      actopcode:=CondASmOp[j];
                      if att_needsuffix[actopcode]=attsufFPU then
                       actopsize:=att_sizefpusuffix[sufidx]
+                     else if att_needsuffix[actopcode]=attsufFPUint then
+                      actopsize:=att_sizefpuintsuffix[sufidx]
                      else
                       actopsize:=att_sizesuffix[sufidx];
                      actcondition:=cnd;
@@ -1985,7 +1992,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.72  2000-03-15 23:10:01  pierre
+  Revision 1.73  2000-04-04 13:48:44  pierre
+    + TOperand.SetCorrectSize virtual method added
+      to be able to change the suffix according to the instruction
+      (FIADD word ptr w need a s as ATT suffix
+      wheras FILD word ptr w need a w suffix :( )
+
+  Revision 1.72  2000/03/15 23:10:01  pierre
     * fix for bug 848 (that still genrated wrong code)
     + better testing for variables used in assembler
       (gives an error if variable is not directly reachable !)
@@ -2054,4 +2067,4 @@ end.
     * string constants are now handle correctly and also allowed in
       constant expressions
 
-}
+}

+ 12 - 1
compiler/rautils.pas

@@ -94,6 +94,7 @@ type
     destructor  done;virtual;
     Procedure BuildOperand;virtual;
     Procedure SetSize(_size:longint);
+    Procedure SetCorrectSize(opcode:tasmop);virtual;
     Function  SetupResult:boolean;
     Function  SetupSelf:boolean;
     Function  SetupOldEBP:boolean;
@@ -658,6 +659,10 @@ begin
 end;
 
 
+Procedure TOperand.SetCorrectSize(opcode:tasmop);
+begin
+end;
+
 Procedure TOperand.SetSize(_size:longint);
 begin
   if (size = S_NO) and (_size<extended_size) then
@@ -1508,7 +1513,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.38  2000-03-28 22:10:12  pierre
+  Revision 1.39  2000-04-04 13:48:45  pierre
+    + TOperand.SetCorrectSize virtual method added
+      to be able to change the suffix according to the instruction
+      (FIADD word ptr w need a s as ATT suffix
+      wheras FILD word ptr w need a w suffix :( )
+
+  Revision 1.38  2000/03/28 22:10:12  pierre
    * Object fields are simple offsets in TP/Delphi mode
 
   Revision 1.37  2000/03/16 15:10:25  pierre