浏览代码

* Fixed a few issues

daniel 22 年之前
父节点
当前提交
4c450c3bb0
共有 3 个文件被更改,包括 27 次插入11 次删除
  1. 6 2
      compiler/i386/n386set.pas
  2. 11 8
      compiler/i386/popt386.pas
  3. 10 1
      compiler/rgobj.pas

+ 6 - 2
compiler/i386/n386set.pas

@@ -605,7 +605,8 @@ implementation
           end;
           end;
         objectlibrary.getlabel(table);
         objectlibrary.getlabel(table);
         { make it a 32bit register }
         { make it a 32bit register }
-        indexreg:=rg.makeregsize(hregister,OS_INT);
+        indexreg.enum:=R_INTREGISTER;
+        indexreg.number:=(hregister.number and not $ff) or R_SUBWHOLE;
         cg.a_load_reg_reg(exprasmlist,opsize,OS_INT,hregister,indexreg);
         cg.a_load_reg_reg(exprasmlist,opsize,OS_INT,hregister,indexreg);
         { create reference }
         { create reference }
         reference_reset_symbol(href,table,0);
         reference_reset_symbol(href,table,0);
@@ -718,7 +719,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.48  2003-02-19 22:00:15  daniel
+  Revision 1.49  2003-02-19 22:39:56  daniel
+    * Fixed a few issues
+
+  Revision 1.48  2003/02/19 22:00:15  daniel
     * Code generator converted to new register notation
     * Code generator converted to new register notation
     - Horribily outdated todo.txt removed
     - Horribily outdated todo.txt removed
 
 

+ 11 - 8
compiler/i386/popt386.pas

@@ -151,7 +151,7 @@ Begin
                             (Taicpu(hp1).condition in [C_O,C_NO]))))
                             (Taicpu(hp1).condition in [C_O,C_NO]))))
                     Then
                     Then
                       Begin
                       Begin
-                        reference_reset(tmpref);
+                        reference_reset_old(tmpref);
                         Case Taicpu(p).oper[0].val Of
                         Case Taicpu(p).oper[0].val Of
                           3: Begin
                           3: Begin
                              {imul 3, reg1, reg2 to
                              {imul 3, reg1, reg2 to
@@ -209,7 +209,7 @@ Begin
                                             Taicpu(p).oper[1].reg,Taicpu(p).oper[1].reg);
                                             Taicpu(p).oper[1].reg,Taicpu(p).oper[1].reg);
                                         End;
                                         End;
                                     InsertLLItem(AsmL,p, p.next, hp1);
                                     InsertLLItem(AsmL,p, p.next, hp1);
-                                    reference_reset(tmpref);
+                                    reference_reset_old(tmpref);
                                     TmpRef.Index := Taicpu(p).oper[1].reg;
                                     TmpRef.Index := Taicpu(p).oper[1].reg;
                                     TmpRef.ScaleFactor := 2;
                                     TmpRef.ScaleFactor := 2;
                                     If (Taicpu(p).oper[2].typ = Top_Reg)
                                     If (Taicpu(p).oper[2].typ = Top_Reg)
@@ -298,7 +298,7 @@ Begin
                                          hp1 :=  Taicpu.op_ref_reg(A_LEA, S_L, TmpRef, Taicpu(p).oper[1].reg);
                                          hp1 :=  Taicpu.op_ref_reg(A_LEA, S_L, TmpRef, Taicpu(p).oper[1].reg);
                                        End;
                                        End;
                                      InsertLLItem(AsmL,p, p.next, hp1);
                                      InsertLLItem(AsmL,p, p.next, hp1);
-                                     reference_reset(tmpref);
+                                     reference_reset_old(tmpref);
                                      TmpRef.Index := Taicpu(p).oper[1].reg;
                                      TmpRef.Index := Taicpu(p).oper[1].reg;
                                      If (Taicpu(p).oper[2].typ = Top_Reg) Then
                                      If (Taicpu(p).oper[2].typ = Top_Reg) Then
                                        Begin
                                        Begin
@@ -1375,7 +1375,7 @@ Begin
                              Taicpu(hp2).ops:=2;
                              Taicpu(hp2).ops:=2;
                              Taicpu(hp2).opcode := A_MOV;
                              Taicpu(hp2).opcode := A_MOV;
                              Taicpu(hp2).Loadoper(1,Taicpu(hp1).oper[0]);
                              Taicpu(hp2).Loadoper(1,Taicpu(hp1).oper[0]);
-                             reference_reset(tmpref);
+                             reference_reset_old(tmpref);
                              tmpRef.base .enum:= STACK_POINTER_REG;
                              tmpRef.base .enum:= STACK_POINTER_REG;
                              tmpRef.offset := l;
                              tmpRef.offset := l;
                              Taicpu(hp2).loadRef(0,tmpRef);
                              Taicpu(hp2).loadRef(0,tmpRef);
@@ -1412,7 +1412,7 @@ Begin
                           Taicpu(p).ops:=2;
                           Taicpu(p).ops:=2;
                           Taicpu(p).opcode := A_MOV;
                           Taicpu(p).opcode := A_MOV;
                           Taicpu(p).Loadoper(1,Taicpu(p).oper[0]);
                           Taicpu(p).Loadoper(1,Taicpu(p).oper[0]);
-                          reference_reset(tmpref);
+                          reference_reset_old(tmpref);
                           TmpRef.base.enum := R_ESP;
                           TmpRef.base.enum := R_ESP;
                           Taicpu(p).LoadRef(0,TmpRef);
                           Taicpu(p).LoadRef(0,TmpRef);
                           asml.Remove(hp1);
                           asml.Remove(hp1);
@@ -1448,7 +1448,7 @@ Begin
                         TmpBool1 := True; {should we check the next instruction?}
                         TmpBool1 := True; {should we check the next instruction?}
                         TmpBool2 := False; {have we found an add/sub which could be
                         TmpBool2 := False; {have we found an add/sub which could be
                                             integrated in the lea?}
                                             integrated in the lea?}
-                        reference_reset(tmpref);
+                        reference_reset_old(tmpref);
                         TmpRef.index := Taicpu(p).oper[1].reg;
                         TmpRef.index := Taicpu(p).oper[1].reg;
                         TmpRef.scalefactor := 1 shl Taicpu(p).oper[0].val;
                         TmpRef.scalefactor := 1 shl Taicpu(p).oper[0].val;
                         While TmpBool1 And
                         While TmpBool1 And
@@ -1540,7 +1540,7 @@ Begin
                     {changes "shl $2, %reg" to "lea (,%reg,4), %reg"
                     {changes "shl $2, %reg" to "lea (,%reg,4), %reg"
                              "shl $3, %reg" to "lea (,%reg,8), %reg}
                              "shl $3, %reg" to "lea (,%reg,8), %reg}
                                  Begin
                                  Begin
-                                   reference_reset(tmpref);
+                                   reference_reset_old(tmpref);
                                    TmpRef.index := Taicpu(p).oper[1].reg;
                                    TmpRef.index := Taicpu(p).oper[1].reg;
                                    TmpRef.scalefactor := 1 shl Taicpu(p).oper[0].val;
                                    TmpRef.scalefactor := 1 shl Taicpu(p).oper[0].val;
                                    hp1 := Taicpu.Op_ref_reg(A_LEA,S_L,TmpRef, Taicpu(p).oper[1].reg);
                                    hp1 := Taicpu.Op_ref_reg(A_LEA,S_L,TmpRef, Taicpu(p).oper[1].reg);
@@ -2054,7 +2054,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.37  2003-02-19 22:00:16  daniel
+  Revision 1.38  2003-02-19 22:39:56  daniel
+    * Fixed a few issues
+
+  Revision 1.37  2003/02/19 22:00:16  daniel
     * Code generator converted to new register notation
     * Code generator converted to new register notation
     - Horribily outdated todo.txt removed
     - Horribily outdated todo.txt removed
 
 

+ 10 - 1
compiler/rgobj.pas

@@ -274,6 +274,7 @@ unit rgobj;
 
 
      {# Clear to zero a treference }
      {# Clear to zero a treference }
      procedure reference_reset(var ref : treference);
      procedure reference_reset(var ref : treference);
+     procedure reference_reset_old(var ref : treference);
      {# Clear to zero a treference, and set is base address
      {# Clear to zero a treference, and set is base address
         to base register.
         to base register.
      }
      }
@@ -1092,6 +1093,11 @@ unit rgobj;
       {$endif}
       {$endif}
       end;
       end;
 
 
+    procedure reference_reset_old(var ref : treference);
+      begin
+        FillChar(ref,sizeof(treference),0);
+      end;
+
 
 
     procedure reference_reset_base(var ref : treference;base : tregister;offset : longint);
     procedure reference_reset_base(var ref : treference;base : tregister;offset : longint);
       begin
       begin
@@ -1202,7 +1208,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2003-02-19 22:00:14  daniel
+  Revision 1.24  2003-02-19 22:39:56  daniel
+    * Fixed a few issues
+
+  Revision 1.23  2003/02/19 22:00:14  daniel
     * Code generator converted to new register notation
     * Code generator converted to new register notation
     - Horribily outdated todo.txt removed
     - Horribily outdated todo.txt removed