Sfoglia il codice sorgente

* merged trefaddr.addr_lo/addr_hi with trefaddr.addr_low/addr.high; some related bugfixing/cleanup

git-svn-id: trunk@7983 -
tom_at_work 18 anni fa
parent
commit
2d1f9b20a3

+ 7 - 7
compiler/cgbase.pas

@@ -64,22 +64,22 @@ interface
        trefaddr = (
          addr_no,
          addr_full,
-         {IFNDEF POWERPC64}
-         // these are also available for ppc64 on Mac OS X
-         addr_hi,
-         addr_lo,
-         {ENDIF}
          addr_pic
-         {$IFDEF POWERPC64}
+         {$IF defined(POWERPC) or defined(POWERPC64)}
          ,
          addr_low,         // bits 48-63
          addr_high,        // bits 32-47
+         {$IF defined(POWERPC64)}
          addr_higher,      // bits 16-31
          addr_highest,     // bits 00-15
-         addr_higha,       // bits 16-31, adjusted
+         {$ENDIF}
+         addr_higha        // bits 16-31, adjusted
+         {$IF defined(POWERPC64)}
+         ,
          addr_highera,     // bits 32-47, adjusted
          addr_highesta     // bits 48-63, adjusted
          {$ENDIF}
+         {$ENDIF}
          );
 
 

+ 0 - 3
compiler/powerpc/cpubase.pas

@@ -237,9 +237,6 @@ uses
                                 Reference
 *****************************************************************************}
 
-    const
-      symaddr2str: array[trefaddr] of string[3] = ('','','@ha','@l','');
-
     const
       { MacOS only. Whether the direct data area (TOC) directly contain
         global variables. Otherwise it contains pointers to global variables. }

+ 2 - 2
compiler/powerpc/nppccal.pas

@@ -89,10 +89,10 @@ implementation
 
                   reference_reset(tmpref);
                   tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tprocdef(procdefinition).libsym).mangledname);
-                  tmpref.refaddr:=addr_hi;
+                  tmpref.refaddr:=addr_higha;
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R12,tmpref));
                   tmpref.base:=NR_R12;
-                  tmpref.refaddr:=addr_lo;
+                  tmpref.refaddr:=addr_low;
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LWZ,NR_R12,tmpref));
 
                   reference_reset_base(tmpref,NR_R12,-tprocdef(procdefinition).extnumber);

+ 4 - 2
compiler/powerpc/rappcgas.pas

@@ -103,9 +103,11 @@ Unit rappcgas;
             if actasmtoken=AS_ID then
               begin
                 if upper(actasmpattern)='L' then
-                  oper.opr.ref.refaddr:=addr_lo
+                  oper.opr.ref.refaddr:=addr_low
+                else if upper(actasmpattern)='HI' then
+                  oper.opr.ref.refaddr:=addr_high
                 else if upper(actasmpattern)='HA' then
-                  oper.opr.ref.refaddr:=addr_hi
+                  oper.opr.ref.refaddr:=addr_higha
                 else
                   Message(asmr_e_invalid_reference_syntax);
                 Consume(AS_ID);

+ 0 - 3
compiler/powerpc64/cpubase.pas

@@ -249,9 +249,6 @@ type
                               Reference
 *****************************************************************************}
 
-const
-  symaddr2str: array[trefaddr] of string[9] = ('', '', 'ha16','lo16','', '@l', '@h', '@higher', '@highest', '@ha', '@highera', '@highesta');
-
 const
   { MacOS only. Whether the direct data area (TOC) directly contain
     global variables. Otherwise it contains pointers to global variables. }

+ 3 - 9
compiler/powerpc64/rappcgas.pas

@@ -118,15 +118,9 @@ begin
         Message(asmr_e_invalid_reference_syntax);
 
       { darwin/ppc64's relocation symbols are 32 bits }
-      if (target_info.system = system_powerpc64_darwin) then
-        case oper.opr.ref.refaddr of
-          addr_low:
-            oper.opr.ref.refaddr:=addr_lo;
-          addr_higha:
-            oper.opr.ref.refaddr:=addr_hi;
-          else if (oper.opr.ref.refaddr<>addr_no) then
-            Message(asmr_e_invalid_reference_syntax);
-        end;
+      if (target_info.system = system_powerpc64_darwin) and
+        (not (oper.opr.ref.refaddr in [addr_no, addr_low, addr_higha])) then
+        Message(asmr_e_invalid_reference_syntax);
 
       Consume(AS_ID);
     end

+ 6 - 6
compiler/ppcgen/agppcgas.pas

@@ -69,14 +69,14 @@ unit agppcgas;
 
 {$ifdef cpu64bit}
     const
-      refaddr2str: array[trefaddr] of string[9] = ('', '', 'ha16','lo16','', '@l', '@h', '@higher', '@highest', '@ha', '@highera', '@highesta');
-      verbose_refaddrs = [addr_lo,addr_hi,addr_low, addr_high, addr_higher, addr_highest, addr_higha, addr_highera, addr_highesta];
-      refaddr2str_darwin: array[trefaddr] of string[4] = ('','','ha16','lo16','','@err', '@err', '@err', '@err', '@err', '@err', '@err');
+      refaddr2str: array[trefaddr] of string[9] = ('', '', '', '@l', '@h', '@higher', '@highest', '@ha', '@highera', '@highesta');
+      verbose_refaddrs = [addr_low, addr_high, addr_higher, addr_highest, addr_higha, addr_highera, addr_highesta];
+      refaddr2str_darwin: array[trefaddr] of string[4] = ('','','','lo16', 'hi16', '@err', '@err', 'ha16', '@err', '@err');
 {$else cpu64bit}
     const
-      refaddr2str: array[trefaddr] of string[3] = ('','','@ha','@l','');
-      refaddr2str_darwin: array[trefaddr] of string[4] = ('','','ha16','lo16','');
-      verbose_refaddrs = [addr_lo,addr_hi];
+      refaddr2str: array[trefaddr] of string[3] = ('','','','@l','@h','@ha');
+      refaddr2str_darwin: array[trefaddr] of string[4] = ('','','','lo16','hi16','ha16');
+      verbose_refaddrs = [addr_low,addr_high,addr_higha];
 {$endif cpu64bit}
 
 

+ 6 - 6
compiler/ppcgen/cgppc.pas

@@ -170,9 +170,9 @@ unit cgppc;
         current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
         l1 := current_asmdata.RefAsmSymbol('L'+s+'$lazy_ptr');
         reference_reset_symbol(href,l1,0);
-        href.refaddr := addr_hi;
+        href.refaddr := addr_higha;
         current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href));
-        href.refaddr := addr_lo;
+        href.refaddr := addr_low;
         href.base := NR_R11;
 {$ifndef cpu64bit}
         current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LWZU,NR_R12,href));
@@ -240,7 +240,7 @@ unit cgppc;
                  tmpref.offset := ref2.offset;
                  tmpref.symbol := ref2.symbol;
                  tmpref.relsymbol := ref2.relsymbol;
-                 tmpref.refaddr := addr_hi;
+                 tmpref.refaddr := addr_higha;
                  if ref2.base<> NR_NO then
                    begin
                      list.concat(taicpu.op_reg_reg_ref(A_ADDIS,r,
@@ -249,7 +249,7 @@ unit cgppc;
                  else
                    list.concat(taicpu.op_reg_ref(A_LIS,r,tmpref));
                  tmpref.base := NR_NO;
-                 tmpref.refaddr := addr_lo;
+                 tmpref.refaddr := addr_low;
                  { can be folded with one of the next instructions by the }
                  { optimizer probably                                     }
                  list.concat(taicpu.op_reg_reg_ref(A_ADDI,r,r,tmpref));
@@ -688,14 +688,14 @@ unit cgppc;
                 tmpref.symbol := ref.symbol;
                 tmpref.relsymbol := ref.relsymbol;
                 tmpref.offset := ref.offset;
-                tmpref.refaddr := addr_hi;
+                tmpref.refaddr := addr_higha;
                 if ref.base <> NR_NO then
                   list.concat(taicpu.op_reg_reg_ref(A_ADDIS,tmpreg,
                     ref.base,tmpref))
                 else
                   list.concat(taicpu.op_reg_ref(A_LIS,tmpreg,tmpref));
                 ref.base := tmpreg;
-                ref.refaddr := addr_lo;
+                ref.refaddr := addr_low;
                 list.concat(taicpu.op_reg_ref(op,reg,ref));
               end
             else

+ 9 - 5
compiler/ppcgen/rgcpu.pas

@@ -77,19 +77,23 @@ unit rgcpu;
               end
             else
               hreg:=cg.getintregister(helplist,OS_ADDR);
+
             reference_reset(tmpref);
             tmpref.offset:=spilltemp.offset;
-            tmpref.refaddr:=addr_hi;
+            tmpref.refaddr := addr_higha;
             ins:=taicpu.op_reg_reg_ref(A_ADDIS,hreg,spilltemp.base,tmpref);
             add_cpu_interferences(ins);
             helplist.concat(ins);
             tmpref:=spilltemp;
-            tmpref.refaddr:=addr_lo;
+            tmpref.refaddr := addr_low;
             tmpref.base:=hreg;
+	    
             ins:=spilling_create_load(tmpref,tempreg);
             add_cpu_interferences(ins);
+	    
+	    
             helplist.concat(ins);
-
+	    
             if getregtype(tempreg)=R_INTREGISTER then
               ungetregisterinline(helplist,hreg);
 
@@ -127,12 +131,12 @@ unit rgcpu;
               hreg:=cg.getintregister(helplist,OS_ADDR);
             reference_reset(tmpref);
             tmpref.offset:=spilltemp.offset;
-            tmpref.refaddr:=addr_hi;
+            tmpref.refaddr := addr_higha;
             ins:=taicpu.op_reg_reg_ref(A_ADDIS,hreg,spilltemp.base,tmpref);
             add_cpu_interferences(ins);
             helplist.concat(ins);
             tmpref:=spilltemp;
-            tmpref.refaddr:=addr_lo;
+            tmpref.refaddr := addr_low;
             tmpref.base:=hreg;
             ins:=spilling_create_store(tempreg,tmpref);
             add_cpu_interferences(ins);