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

git-svn-id: trunk@7983 -
This commit is contained in:
tom_at_work 2007-07-08 20:50:58 +00:00
parent f31889df57
commit 2d1f9b20a3
9 changed files with 37 additions and 43 deletions

View File

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

View File

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

View File

@ -89,10 +89,10 @@ implementation
reference_reset(tmpref); reference_reset(tmpref);
tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tprocdef(procdefinition).libsym).mangledname); 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)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R12,tmpref));
tmpref.base:=NR_R12; 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)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LWZ,NR_R12,tmpref));
reference_reset_base(tmpref,NR_R12,-tprocdef(procdefinition).extnumber); reference_reset_base(tmpref,NR_R12,-tprocdef(procdefinition).extnumber);

View File

@ -103,9 +103,11 @@ Unit rappcgas;
if actasmtoken=AS_ID then if actasmtoken=AS_ID then
begin begin
if upper(actasmpattern)='L' then 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 else if upper(actasmpattern)='HA' then
oper.opr.ref.refaddr:=addr_hi oper.opr.ref.refaddr:=addr_higha
else else
Message(asmr_e_invalid_reference_syntax); Message(asmr_e_invalid_reference_syntax);
Consume(AS_ID); Consume(AS_ID);

View File

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

View File

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

View File

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

View File

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

View File

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