- removed FPC_NEW_BIGENDIAN_SETS define and if(n)defs

* left old cpu-specific set helper code under ifdef FPC_OLD_BIGENDIAN_SETS
    in case someone wants to write new assembler set helpers (although most
    of them should be optimally generated by the compiler already if
    http://wiki.freepascal.org/FPC_HowToDo#Bit.28field.29_getting.2Fsetting_primitives
    are optimally implemented)

git-svn-id: trunk@13582 -
This commit is contained in:
Jonas Maebe 2009-08-23 08:16:40 +00:00
parent 0eec337a00
commit c2c68ddb8f
9 changed files with 15 additions and 299 deletions

View File

@ -432,18 +432,11 @@ implementation
location_reset(location,LOC_CONSTANT,int_cgsize(resultdef.size));
if (source_info.endian=target_info.endian) then
begin
{$if defined(FPC_NEW_BIGENDIAN_SETS) or defined(FPC_LITTLE_ENDIAN)}
{ not plongint, because that will "sign extend" the set on 64 bit platforms }
{ if changed to "paword", please also modify "32-resultdef.size*8" and }
{ cross-endian code below }
{ Extra aint type cast to avoid range errors }
location.value:=aint(pCardinal(value_set)^)
{$else}
location.value:=reverse_byte(Psetbytes(value_set)^[0]);
location.value:=location.value or (reverse_byte(Psetbytes(value_set)^[1]) shl 8);
location.value:=location.value or (reverse_byte(Psetbytes(value_set)^[2]) shl 16);
location.value:=location.value or (reverse_byte(Psetbytes(value_set)^[3]) shl 24);
{$endif}
end
else
begin
@ -490,11 +483,7 @@ implementation
begin
if (source_info.endian=target_info.endian) then
begin
{$if defined(FPC_NEW_BIGENDIAN_SETS) or defined(FPC_LITTLE_ENDIAN)}
if tai_const(hp1).value<>Psetbytes(value_set)^[i ] then
{$else}
if tai_const(hp1).value<>reverse_byte(Psetbytes(value_set)^[i xor 3]) then
{$endif}
break
end
else if tai_const(hp1).value<>reverse_byte(Psetbytes(value_set)^[i]) then
@ -537,13 +526,8 @@ implementation
new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,lastlabel.name,const_align(8));
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel));
if (source_info.endian=target_info.endian) then
{$if defined(FPC_NEW_BIGENDIAN_SETS) or defined(FPC_LITTLE_ENDIAN)}
for i:=0 to 31 do
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(Psetbytes(value_set)^[i]))
{$else}
for i:=0 to 31 do
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(reverse_byte(Psetbytes(value_set)^[i xor 3])))
{$endif}
else
for i:=0 to 31 do
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(reverse_byte(Psetbytes(value_set)^[i])));

View File

@ -2362,7 +2362,6 @@ begin
def_system_macro('FPC_HAS_STR_CURRENCY');
def_system_macro('FPC_REAL2REAL_FIXED');
def_system_macro('FPC_STRTOCHARARRAYPROC');
def_system_macro('FPC_NEW_BIGENDIAN_SETS');
def_system_macro('FPC_STRTOSHORTSTRINGPROC');
def_system_macro('FPC_OBJFPC_EXTENDED_IF');
{$if defined(x86) or defined(powerpc) or defined(powerpc64)}

View File

@ -595,13 +595,8 @@ implementation
{ arrays of 32-bit values CEC }
if source_info.endian = target_info.endian then
begin
{$if defined(FPC_NEW_BIGENDIAN_SETS) or defined(FPC_LITTLE_ENDIAN)}
for i:=0 to p.resultdef.size-1 do
list.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[i]));
{$else}
for i:=0 to p.resultdef.size-1 do
list.concat(tai_const.create_8bit(reverse_byte(Psetbytes(tsetconstnode(p).value_set)^[i xor 3])));
{$endif}
end
else
begin

View File

@ -13,7 +13,13 @@
**********************************************************************}
{$ifndef FPC_NEW_BIGENDIAN_SETS}
{ the following code is exactly big endian set-related, but specific to the old
scheme whereby sets were either 4 or 32 bytes. I've left the routines here
so if someone wants to, they can create equivalents of the new varset helpers
from rtl/inc/genset.inc
}
{$ifdef FPC_OLD_BIGENDIAN_SETS}
{$define FPC_SYSTEM_HAS_FPC_SET_LOAD_SMALL}
function fpc_set_load_small(l: fpc_small_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_LOAD_SMALL']; compilerproc;
@ -543,4 +549,4 @@ end;
{$endif LARGESET}
{$endif ndef FPC_NEW_BIGENDIAN_SETS}
{$endif FPC_OLD_BIGENDIAN_SETS}

View File

@ -32,13 +32,8 @@ type
fpc_big_chararray = array[0..0] of char;
fpc_big_widechararray = array[0..0] of widechar;
{$endif ndef FPC_STRTOCHARARRAYPROC}
{$ifdef FPC_NEW_BIGENDIAN_SETS}
fpc_small_set = bitpacked array[0..31] of 0..1;
fpc_normal_set = bitpacked array[0..255] of 0..1;
{$else}
fpc_small_set = longint;
fpc_normal_set = array[0..7] of longint;
{$endif}
fpc_normal_set_byte = array[0..31] of byte;
fpc_normal_set_long = array[0..7] of longint;
@ -635,20 +630,6 @@ Procedure fpc_Copy_proc (Src, Dest, TypeInfo : Pointer); compilerproc; inline;
{$endif FPC_HAS_FEATURE_RTTI}
{$ifndef FPC_NEW_BIGENDIAN_SETS}
function fpc_set_load_small(l: fpc_small_set): fpc_normal_set; compilerproc;
function fpc_set_create_element(b : byte): fpc_normal_set; compilerproc;
function fpc_set_set_byte(const source: fpc_normal_set; b : byte): fpc_normal_set; compilerproc;
function fpc_set_unset_byte(const source: fpc_normal_set; b : byte): fpc_normal_set; compilerproc;
function fpc_set_set_range(const orgset: fpc_normal_set; l,h : byte): fpc_normal_set; compilerproc;
function fpc_set_add_sets(const set1,set2: fpc_normal_set): fpc_normal_set; compilerproc;
function fpc_set_mul_sets(const set1,set2: fpc_normal_set): fpc_normal_set; compilerproc;
function fpc_set_sub_sets(const set1,set2: fpc_normal_set): fpc_normal_set; compilerproc;
function fpc_set_symdif_sets(const set1,set2: fpc_normal_set): fpc_normal_set; compilerproc;
function fpc_set_comp_sets(const set1,set2: fpc_normal_set): boolean; compilerproc;
function fpc_set_contains_sets(const set1,set2: fpc_normal_set): boolean; compilerproc;
{$endif ndef FPC_NEW_BIGENDIAN_SETS}
{$ifdef FPC_SETBASE_USED}
procedure fpc_varset_load(const l;sourcesize : longint;var dest;size,srcminusdstbase : ptrint); compilerproc;
{$else}

View File

@ -13,216 +13,6 @@
**********************************************************************}
{$ifndef FPC_NEW_BIGENDIAN_SETS}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_LOAD_SMALL}
{ Error No pascal version of FPC_SET_LOAD_SMALL}
{ THIS DEPENDS ON THE ENDIAN OF THE ARCHITECTURE!
Not anymore PM}
function fpc_set_load_small(l: fpc_small_set): fpc_normal_set; [public,alias:'FPC_SET_LOAD_SMALL']; compilerproc;
{
load a normal set p from a smallset l
}
begin
FillDWord(fpc_set_load_small,sizeof(fpc_set_load_small) div 4,0);
move(l,fpc_set_load_small,sizeof(l));
end;
{$endif FPC_SYSTEM_HAS_FPC_SET_LOAD_SMALL}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_CREATE_ELEMENT}
function fpc_set_create_element(b : byte): fpc_normal_set;[public,alias:'FPC_SET_CREATE_ELEMENT']; compilerproc;
{
create a new set in p from an element b
}
begin
FillDWord(fpc_set_create_element,SizeOf(fpc_set_create_element) div 4,0);
{$ifndef FPC_NEW_BIGENDIAN_SETS}
fpc_set_create_element[b div 32] := 1 shl (b mod 32);
{$else}
fpc_set_create_element[b] := 1;
{$endif}
end;
{$endif FPC_SYSTEM_HAS_FPC_SET_CREATE_ELEMENT}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_SET_BYTE}
function fpc_set_set_byte(const source: fpc_normal_set; b : byte): fpc_normal_set; compilerproc;
{
add the element b to the set "source"
}
var
c: longint;
begin
move(source,fpc_set_set_byte,sizeof(source));
{$ifndef FPC_NEW_BIGENDIAN_SETS}
c := fpc_set_set_byte[b div 32];
c := (1 shl (b mod 32)) or c;
fpc_set_set_byte[b div 32] := c;
{$else}
fpc_set_set_byte[b] := 1;
{$endif}
end;
{$endif FPC_SYSTEM_HAS_FPC_SET_SET_BYTE}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_UNSET_BYTE}
function fpc_set_unset_byte(const source: fpc_normal_set; b : byte): fpc_normal_set; compilerproc;
{
suppresses the element b to the set pointed by p
used for exclude(set,element)
}
var
c: longint;
begin
move(source,fpc_set_unset_byte,sizeof(source));
{$ifndef FPC_NEW_BIGENDIAN_SETS}
c := fpc_set_unset_byte[b div 32];
c := c and not (1 shl (b mod 32));
fpc_set_unset_byte[b div 32] := c;
{$else}
fpc_set_unset_byte[b] := 0;
{$endif}
end;
{$endif FPC_SYSTEM_HAS_FPC_SET_UNSET_BYTE}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_SET_RANGE}
function fpc_set_set_range(const orgset: fpc_normal_set; l,h : byte): fpc_normal_set; compilerproc;
{
adds the range [l..h] to the set orgset
}
var
i: integer;
c: longint;
begin
move(orgset,fpc_set_set_range,sizeof(orgset));
for i:=l to h do
begin
{$ifndef FPC_NEW_BIGENDIAN_SETS}
c := fpc_set_set_range[i div 32];
c := (1 shl (i mod 32)) or c;
fpc_set_set_range[i div 32] := c;
{$else}
fpc_set_set_range[i] := 1;
{$endif}
end;
end;
{$endif ndef FPC_SYSTEM_HAS_FPC_SET_SET_RANGE}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_ADD_SETS}
function fpc_set_add_sets(const set1,set2: fpc_normal_set): fpc_normal_set;[public,alias:'FPC_SET_ADD_SETS']; compilerproc;
var
src1: fpc_normal_set_long absolute set1;
src2: fpc_normal_set_long absolute set2;
dest: fpc_normal_set_long absolute fpc_set_add_sets;
{
adds set1 and set2 into set dest
}
var
i: integer;
begin
for i:=0 to 7 do
dest[i] := src1[i] or src2[i];
end;
{$endif}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_MUL_SETS}
function fpc_set_mul_sets(const set1,set2: fpc_normal_set): fpc_normal_set;[public,alias:'FPC_SET_MUL_SETS']; compilerproc;
var
src1: fpc_normal_set_long absolute set1;
src2: fpc_normal_set_long absolute set2;
dest: fpc_normal_set_long absolute fpc_set_mul_sets;
{
multiplies (takes common elements of) set1 and set2 result put in dest
}
var
i: integer;
begin
for i:=0 to 7 do
dest[i] := src1[i] and src2[i];
end;
{$endif}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_SUB_SETS}
function fpc_set_sub_sets(const set1,set2: fpc_normal_set): fpc_normal_set;[public,alias:'FPC_SET_SUB_SETS']; compilerproc;
var
src1: fpc_normal_set_long absolute set1;
src2: fpc_normal_set_long absolute set2;
dest: fpc_normal_set_long absolute fpc_set_sub_sets;
{
computes the diff from set1 to set2 result in dest
}
var
i: integer;
begin
for i:=0 to 7 do
dest[i] := src1[i] and not src2[i];
end;
{$endif}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_SYMDIF_SETS}
function fpc_set_symdif_sets(const set1,set2: fpc_normal_set): fpc_normal_set;[public,alias:'FPC_SET_SYMDIF_SETS']; compilerproc;
var
src1: fpc_normal_set_long absolute set1;
src2: fpc_normal_set_long absolute set2;
dest: fpc_normal_set_long absolute fpc_set_symdif_sets;
{
computes the symetric diff from set1 to set2 result in dest
}
var
i: integer;
begin
for i:=0 to 7 do
dest[i] := src1[i] xor src2[i];
end;
{$endif}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_COMP_SETS}
function fpc_set_comp_sets(const set1,set2 : fpc_normal_set):boolean;[public,alias:'FPC_SET_COMP_SETS'];compilerproc;
{
compares set1 and set2 zeroflag is set if they are equal
}
var
i: integer;
src1: fpc_normal_set_long absolute set1;
src2: fpc_normal_set_long absolute set2;
begin
fpc_set_comp_sets:= false;
for i:=0 to 7 do
if src1[i] <> src2[i] then
exit;
fpc_set_comp_sets:= true;
end;
{$endif}
{$ifndef FPC_SYSTEM_HAS_FPC_SET_CONTAINS_SET}
function fpc_set_contains_sets(const set1,set2 : fpc_normal_set):boolean;[public,alias:'FPC_SET_CONTAINS_SETS'];compilerproc;
{
on exit, zero flag is set if set1 <= set2 (set2 contains set1)
}
var
i : integer;
src1: fpc_normal_set_long absolute set1;
src2: fpc_normal_set_long absolute set2;
begin
fpc_set_contains_sets:= false;
for i:=0 to 7 do
if (src1[i] and not src2[i]) <> 0 then
exit;
fpc_set_contains_sets:= true;
end;
{$endif}
{$endif ndef FPC_NEW_BIGENDIAN_SETS}
{****************************************************************************
Var sets
@ -285,18 +75,10 @@ procedure fpc_varset_load(const l;sourcesize : longint;var dest;size : ptrint);
}
procedure fpc_varset_create_element(b,size : ptrint; var data); compilerproc;
type
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray = array[0..sizeof(sizeint)-1] of byte;
{$else}
tbsetarray = bitpacked array[0..sizeof(sizeint)-1] of 0..1;
{$endif}
begin
FillChar(data,size,0);
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray(data)[b div 8]:=1 shl (b mod 8);
{$else}
tbsetarray(data)[b]:=1;
{$endif}
end;
{$endif ndef FPC_SYSTEM_HAS_FPC_VARSET_CREATE_ELEMENT}
@ -307,18 +89,10 @@ procedure fpc_varset_create_element(b,size : ptrint; var data); compilerproc;
}
procedure fpc_varset_set(const source;var dest; b,size : ptrint); compilerproc;
type
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray = array[0..sizeof(sizeint)-1] of byte;
{$else}
tbsetarray = bitpacked array[0..sizeof(sizeint)-1] of 0..1;
{$endif}
begin
move(source,dest,size);
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray(dest)[b div 8]:=tbytearray(dest)[b div 8] or (1 shl (b mod 8));
{$else}
tbsetarray(dest)[b]:=1;
{$endif}
end;
{$endif ndef FPC_SYSTEM_HAS_FPC_VARSET_SET_BYTE}
@ -330,18 +104,10 @@ procedure fpc_varset_set(const source;var dest; b,size : ptrint); compilerproc;
}
procedure fpc_varset_unset(const source;var dest; b,size : ptrint); compilerproc;
type
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray = array[0..sizeof(sizeint)-1] of byte;
{$else}
tbsetarray = bitpacked array[0..sizeof(sizeint)-1] of 0..1;
{$endif}
begin
move(source,dest,size);
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray(dest)[b div 8]:=tbytearray(dest)[b div 8] and not (1 shl (b mod 8));
{$else}
tbsetarray(dest)[b]:=0;
{$endif}
end;
{$endif ndef FPC_SYSTEM_HAS_FPC_VARSET_UNSET_BYTE}
@ -352,21 +118,13 @@ procedure fpc_varset_unset(const source;var dest; b,size : ptrint); compilerproc
}
procedure fpc_varset_set_range(const orgset; var dest;l,h,size : ptrint); compilerproc;
type
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray = array[0..sizeof(sizeint)-1] of byte;
{$else}
tbsetarray = bitpacked array[0..sizeof(sizeint)-1] of 0..1;
{$endif}
var
i : ptrint;
begin
move(orgset,dest,size);
for i:=l to h do
{$ifndef FPC_NEW_BIGENDIAN_SETS}
tbytearray(dest)[i div 8]:=(1 shl (i mod 8)) or tbytearray(dest)[i div 8];
{$else}
tbsetarray(dest)[i]:=1;
{$endif}
end;
{$endif ndef FPC_SYSTEM_HAS_FPC_VARSET_SET_RANGE}

View File

@ -456,16 +456,16 @@ end;
Function SetToString(TypeInfo: PTypeInfo; Value: Integer; Brackets: Boolean) : String;
{$ifdef FPC_NEW_BIGENDIAN_SETS}
type
tsetarr = bitpacked array[0..31] of 0..1;
{$endif}
Var
I : Integer;
PTI : PTypeInfo;
begin
{$if defined(FPC_NEW_BIGENDIAN_SETS) and defined(FPC_BIG_ENDIAN)}
{$if defined(FPC_BIG_ENDIAN)}
{ On big endian systems, set element 0 is in the most significant bit,
and the same goes for the elements of bitpacked arrays there. }
case GetTypeData(TypeInfo)^.OrdType of
otSByte,otUByte: Value:=Value shl 24;
otSWord,otUWord: Value:=Value shl 16;
@ -476,20 +476,13 @@ begin
Result:='';
For I:=0 to SizeOf(Integer)*8-1 do
begin
{$ifdef FPC_NEW_BIGENDIAN_SETS}
if (tsetarr(Value)[i]<>0) then
{$else}
if ((Value and 1)<>0) then
{$endif}
begin
If Result='' then
Result:=GetEnumName(PTI,i)
else
Result:=Result+','+GetEnumName(PTI,I);
end;
{$ifndef FPC_NEW_BIGENDIAN_SETS}
Value:=Value shr 1;
{$endif FPC_NEW_BIGENDIAN_SETS}
end;
if Brackets then
Result:='['+Result+']';

View File

@ -14,7 +14,7 @@
**********************************************************************}
{$ifndef FPC_NEW_BIGENDIAN_SETS}
{$ifdef FPC_OLD_BIGENDIAN_SETS}
{$define FPC_SYSTEM_HAS_FPC_SET_LOAD_SMALL}
function fpc_set_load_small(l: fpc_small_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_LOAD_SMALL']; compilerproc;
@ -333,4 +333,4 @@ asm
srwi. r3,r3,5
end;
{$endif ndef FPC_NEW_BIGENDIAN_SETS}
{$endif FPC_OLD_BIGENDIAN_SETS}

View File

@ -14,7 +14,7 @@
**********************************************************************}
{$ifndef FPC_NEW_BIGENDIAN_SETS}
{$ifdef FPC_OLD_BIGENDIAN_SETS}
{$define FPC_SYSTEM_HAS_FPC_SET_LOAD_SMALL}
function fpc_set_load_small(l: fpc_small_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_LOAD_SMALL']; compilerproc;
@ -330,6 +330,6 @@ asm
srwi. r3,r3,5
end;
{$endif ndef FPC_NEW_BIGENDIAN_SETS}
{$endif FPC_OLD_BIGENDIAN_SETS}