* Change several $ifdef i386 to x86

* Change several OS_32 to OS_INT/OS_ADDR
This commit is contained in:
peter 2004-01-31 17:45:16 +00:00
parent f621c564a2
commit 1422985ca0
19 changed files with 257 additions and 236 deletions

View File

@ -1684,8 +1684,8 @@ implementation
end;
ref^:=r;
{$ifdef i386}
{ We allow this exception for i386, since overloading this would be
{$ifdef x86}
{ We allow this exception for x86, since overloading this would be
too much of a a speed penalty}
if (ref^.segment<>NR_NO) and (ref^.segment<>NR_DS) then
segprefix:=ref^.segment;
@ -1826,9 +1826,9 @@ implementation
for i:=0 to ops-1 do
ppuloadoper(ppufile,oper[i]^);
opcode:=tasmop(ppufile.getword);
{$ifdef i386}
{$ifdef x86}
ppufile.getdata(segprefix,sizeof(Tregister));
{$endif i386}
{$endif x86}
is_jmp:=boolean(ppufile.getbyte);
end;
@ -1843,9 +1843,9 @@ implementation
for i:=0 to ops-1 do
ppuwriteoper(ppufile,oper[i]^);
ppufile.putword(word(opcode));
{$ifdef i386}
{$ifdef x86}
ppufile.putdata(segprefix,sizeof(Tregister));
{$endif i386}
{$endif x86}
ppufile.putbyte(byte(is_jmp));
end;
@ -1975,7 +1975,11 @@ implementation
end.
{
$Log$
Revision 1.68 2004-01-30 13:42:03 florian
Revision 1.69 2004-01-31 17:45:16 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.68 2004/01/30 13:42:03 florian
* fixed more alignment issues
Revision 1.67 2004/01/26 16:12:27 daniel

View File

@ -77,7 +77,7 @@ Begin
GetLastInstruction(p, hp);
CurProp^.Regs := PPaiProp(hp^.OptInfo)^.Regs;
{ !!!!!!!!!!!! }
{$ifdef i386}
{$ifdef x86}
CurProp^.CondRegs.Flags :=
PPaiProp(hp^.OptInfo)^.CondRegs.Flags;
{$endif}
@ -177,7 +177,11 @@ End.
{
$Log$
Revision 1.6 2002-05-18 13:34:05 peter
Revision 1.7 2004-01-31 17:45:16 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.6 2002/05/18 13:34:05 peter
* readded missing revisions
Revision 1.5 2002/05/16 19:46:35 carl

View File

@ -490,7 +490,7 @@ Begin
With Regs[Counter] Do
If (typ = Con_Ref) And
(Not(cs_UncertainOpts in aktglobalswitches) Or
{$ifdef i386}
{$ifdef x86}
{for movsl}
(Ref.Base = R_EDI) Or
{$endif}
@ -788,7 +788,11 @@ End.
{
$Log$
Revision 1.9 2004-01-30 13:42:03 florian
Revision 1.10 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.9 2004/01/30 13:42:03 florian
* fixed more alignment issues
Revision 1.8 2002/11/18 17:31:54 peter

View File

@ -1225,9 +1225,9 @@ Implementation
fillbuffer : tfillbuffer;
InlineLevel,
l : longint;
{$ifdef i386}
{$ifdef x86}
co : comp;
{$endif i386}
{$endif x86}
begin
inlinelevel:=0;
{ main loop }
@ -1299,14 +1299,14 @@ Implementation
objectdata.writebytes(Tai_real_32bit(hp).value,4);
ait_comp_64bit :
begin
{$ifdef i386}
{$ifdef x86}
{$ifdef FPC}
co:=comp(Tai_comp_64bit(hp).value);
{$else}
co:=Tai_comp_64bit(hp).value;
{$endif}
objectdata.writebytes(co,8);
{$endif i386}
{$endif x86}
end;
ait_string :
objectdata.writebytes(Tai_string(hp).str^,Tai_string(hp).len);
@ -1661,7 +1661,11 @@ Implementation
end.
{
$Log$
Revision 1.60 2004-01-30 15:44:23 jonas
Revision 1.61 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.60 2004/01/30 15:44:23 jonas
+ support for piped assembling under Darwin
Revision 1.59 2003/11/10 17:22:28 marco

View File

@ -1257,7 +1257,7 @@ implementation
end
else
begin
tmpreg:=cg.getintregister(list,size);
tmpreg:=getintregister(list,size);
a_load_reg_reg(list,size,size,src2,tmpreg);
a_op_reg_reg(list,op,size,src1,tmpreg);
a_load_reg_reg(list,size,size,tmpreg,dst);
@ -1922,8 +1922,8 @@ implementation
{ calculate necessary memory }
a_load_ref_reg(list,OS_INT,OS_INT,lenref,sizereg);
a_op_const_reg_reg(list,OP_ADD,OS_INT,1,sizereg,sizereg);
a_op_const_reg_reg(list,OP_MUL,OS_INT,elesize,sizereg,sizereg);
a_op_const_reg(list,OP_ADD,OS_INT,1,sizereg);
a_op_const_reg(list,OP_MUL,OS_INT,elesize,sizereg);
{ load source }
a_load_ref_reg(list,OS_ADDR,OS_ADDR,ref,sourcereg);
@ -2139,7 +2139,11 @@ finalization
end.
{
$Log$
Revision 1.152 2004-01-22 22:12:21 peter
Revision 1.153 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.152 2004/01/22 22:12:21 peter
* g_finalize needs to reset to nil after decr_ref
* support loadref in decr_ref reset to nil

View File

@ -721,8 +721,8 @@ interface
if cs_mmx in aktlocalswitches then
second_opmmxset
else
{$endif SUPPORT_MMX}
{$endif}
{$endif SUPPORT_MMX}
internalerror(200109041);
end
else
@ -749,7 +749,11 @@ begin
end.
{
$Log$
Revision 1.26 2004-01-12 16:39:40 peter
Revision 1.27 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.26 2004/01/12 16:39:40 peter
* sparc updates, mostly float related
Revision 1.25 2003/12/29 11:37:52 jonas

View File

@ -114,7 +114,6 @@ implementation
if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
internalerror(200304235);
location_release(exprasmlist,left.location);
// allocate_tempparaloc;
cg.a_paramaddr_ref(exprasmlist,left.location.reference,tempparaloc);
inc(tcgcallnode(aktcallnode).pushedparasize,POINTER_SIZE);
end;
@ -138,15 +137,14 @@ implementation
if left.resulttype.def.deftype=floatdef then
begin
location_release(exprasmlist,left.location);
// allocate_tempparaloc;
{$ifdef i386}
{$ifdef x86}
if tempparaloc.loc<>LOC_REFERENCE then
internalerror(200309291);
case left.location.loc of
LOC_FPUREGISTER,
LOC_CFPUREGISTER:
begin
size:=align(tfloatdef(left.resulttype.def).size,tempparaloc.alignment);
size:=align(TCGSize2Size[left.location.size],tempparaloc.alignment);
inc(tcgcallnode(aktcallnode).pushedparasize,size);
if tempparaloc.reference.index=NR_STACK_POINTER_REG then
begin
@ -208,7 +206,7 @@ implementation
else
internalerror(200204243);
end;
{$else i386}
{$else x86}
case left.location.loc of
LOC_FPUREGISTER,
LOC_CFPUREGISTER:
@ -230,7 +228,7 @@ implementation
aktcallnode.procdefinition.proccalloption) then
begin
location_release(exprasmlist,left.location);
{$ifdef i386}
{$ifdef x86}
if tempparaloc.loc<>LOC_REFERENCE then
internalerror(200309292);
if not (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
@ -246,9 +244,9 @@ implementation
else
reference_reset_base(href,tempparaloc.reference.index,tempparaloc.reference.offset);
cg.g_concatcopy(exprasmlist,left.location.reference,href,size,false,false);
{$else i386}
{$else x86}
cg.a_param_copy_ref(exprasmlist,left.resulttype.def.size,left.location.reference,tempparaloc);
{$endif i386}
{$endif x86}
end
else
begin
@ -263,14 +261,12 @@ implementation
if cgsize in [OS_64,OS_S64] then
begin
inc(tcgcallnode(aktcallnode).pushedparasize,8);
// allocate_tempparaloc;
cg64.a_param64_loc(exprasmlist,left.location,tempparaloc);
location_release(exprasmlist,left.location);
end
else
begin
location_release(exprasmlist,left.location);
// allocate_tempparaloc;
inc(tcgcallnode(aktcallnode).pushedparasize,align(tcgsize2size[tempparaloc.size],tempparaloc.alignment));
cg.a_param_loc(exprasmlist,left.location,tempparaloc);
end;
@ -280,7 +276,6 @@ implementation
LOC_CMMXREGISTER:
begin
location_release(exprasmlist,left.location);
// allocate_tempparaloc;
inc(tcgcallnode(aktcallnode).pushedparasize,8);
cg.a_parammm_reg(exprasmlist,left.location.register);
end;
@ -353,7 +348,6 @@ implementation
begin
inc(tcgcallnode(aktcallnode).pushedparasize,POINTER_SIZE);
location_release(exprasmlist,left.location);
// allocate_tempparaloc;
cg.a_param_loc(exprasmlist,left.location,tempparaloc);
end
else
@ -1163,7 +1157,11 @@ begin
end.
{
$Log$
Revision 1.151 2004-01-26 17:34:14 florian
Revision 1.152 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.151 2004/01/26 17:34:14 florian
* set aktlocaldata for inlined procedures correctly
Revision 1.150 2004/01/12 16:39:40 peter

View File

@ -408,7 +408,7 @@ interface
else
internalerror(2002032214);
end;
cg.a_cmp_const_reg_label(exprasmlist,OS_32,OC_NE,0,location.register,l1);
cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_NE,0,location.register,l1);
reference_reset(hr);
hr.symbol:=objectlibrary.newasmsymboldata('FPC_EMPTYCHAR');
cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
@ -448,7 +448,7 @@ interface
begin
if hd.implementedinterfaces.searchintf(resulttype.def)<>-1 then
begin
cg.a_op_const_reg(exprasmlist,OP_ADD,OS_32,aword(
cg.a_op_const_reg(exprasmlist,OP_ADD,OS_ADDR,aword(
hd.implementedinterfaces.ioffsets(
hd.implementedinterfaces.searchintf(resulttype.def))^),location.register);
break;
@ -535,7 +535,11 @@ end.
{
$Log$
Revision 1.52 2003-12-26 00:32:21 florian
Revision 1.53 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.52 2003/12/26 00:32:21 florian
+ fpu<->mm register conversion
Revision 1.51 2003/12/22 23:08:59 peter

View File

@ -179,7 +179,6 @@ implementation
var
hl,otlabel,oflabel : tasmlabel;
{$ifdef i386}
(*
org_regvar_loaded_other,
then_regvar_loaded_other,
@ -191,7 +190,6 @@ implementation
then_list,
else_list : taasmoutput;
*)
{$endif i386}
begin
location_reset(location,LOC_VOID,OS_NO);
@ -202,7 +200,6 @@ implementation
objectlibrary.getlabel(falselabel);
secondpass(left);
{$ifdef i386}
(*
{ save regvars loaded in the beginning so that we can restore them }
{ when processing the else-block }
@ -212,10 +209,8 @@ implementation
exprasmlist := taasmoutput.create;
end;
*)
{$endif i386}
maketojumpbool(exprasmlist,left,lr_dont_load_regvars);
{$ifdef i386}
(*
if cs_regvars in aktglobalswitches then
begin
@ -223,7 +218,6 @@ implementation
org_regvar_loaded_other := rg.regvar_loaded_other;
end;
*)
{$endif i386}
if assigned(right) then
begin
@ -231,7 +225,6 @@ implementation
secondpass(right);
end;
{$ifdef i386}
{ save current asmlist (previous instructions + then-block) and }
{ loaded regvar state and create new clean ones }
if cs_regvars in aktglobalswitches then
@ -243,7 +236,6 @@ implementation
then_list := exprasmlist;
exprasmlist := taasmoutput.create;}
end;
{$endif i386}
if assigned(t1) then
begin
@ -252,16 +244,12 @@ implementation
objectlibrary.getlabel(hl);
{ do go back to if line !! }
(*
{$ifdef i386}
if not(cs_regvars in aktglobalswitches) then
{$endif i386}
*)
aktfilepos:=exprasmList.getlasttaifilepos^
(*
{$ifdef i386}
else
aktfilepos:=then_list.getlasttaifilepos^
{$endif i386}
*)
;
cg.a_jmp_always(exprasmlist,hl);
@ -269,7 +257,6 @@ implementation
cg.a_label(exprasmlist,falselabel);
secondpass(t1);
(*
{$ifdef i386}
{ save current asmlist (previous instructions + else-block) }
{ and loaded regvar state and create a new clean list }
if cs_regvars in aktglobalswitches then
@ -279,7 +266,6 @@ implementation
else_list := exprasmlist;
exprasmlist := taasmoutput.create;
end;
{$endif i386}
*)
if assigned(right) then
cg.a_label(exprasmlist,hl);
@ -287,7 +273,6 @@ implementation
else
begin
(*
{$ifdef i386}
if cs_regvars in aktglobalswitches then
begin
{ else_regvar_loaded_int := rg.regvar_loaded_int;
@ -295,7 +280,6 @@ implementation
else_list := exprasmlist;
exprasmlist := taasmoutput.create;
end;
{$endif i386}
*)
cg.a_label(exprasmlist,falselabel);
end;
@ -305,7 +289,6 @@ implementation
end;
(*
{$ifdef i386}
if cs_regvars in aktglobalswitches then
begin
{ add loads of regvars at the end of the then- and else-blocks }
@ -338,7 +321,6 @@ implementation
exprasmlist.free;
exprasmlist := org_list;
end;
{$endif i386}
*)
truelabel:=otlabel;
@ -1391,7 +1373,7 @@ implementation
cg.g_exception_reason_load(exprasmlist,href);
if implicitframe then
begin
cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
{ finally code only needed to be executed on exception }
flowcontrol:=[];
secondpass(t1);
@ -1403,29 +1385,29 @@ implementation
end
else
begin
cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,1,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel);
cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel);
if fc_exit in tryflowcontrol then
begin
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,1,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktexitlabel);
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktexitlabel);
decconst:=1;
end
else
decconst:=2;
if fc_break in tryflowcontrol then
begin
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,decconst,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktbreaklabel);
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktbreaklabel);
decconst:=1;
end
else
inc(decconst);
if fc_continue in tryflowcontrol then
begin
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,decconst,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktcontinuelabel);
cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG);
cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktcontinuelabel);
end;
cg.a_label(exprasmlist,reraiselabel);
cg.a_call_name(exprasmlist,'FPC_RERAISE');
@ -1481,7 +1463,11 @@ begin
end.
{
$Log$
Revision 1.89 2004-01-12 22:11:38 peter
Revision 1.90 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.89 2004/01/12 22:11:38 peter
* use localalign info for alignment for locals and temps
* sparc fpu flags branching added
* moved powerpc copy_valye_openarray to generic

View File

@ -373,7 +373,9 @@ implementation
var
addvalue : TConstExprInt;
addconstant : boolean;
{$ifndef cpu64bit}
hregisterhi,
{$endif cpu64bit}
hregister : tregister;
cgsize : tcgsize;
begin
@ -408,7 +410,9 @@ implementation
begin
location_force_reg(exprasmlist,tcallparanode(tcallparanode(left).right).left.location,cgsize,false);
hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
{$ifndef cpu64bit}
hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.registerhigh;
{$endif cpu64bit}
{ insert multiply with addvalue if its >1 }
if addvalue>1 then
cg.a_op_const_reg(exprasmlist,OP_IMUL,cgsize,addvalue,hregister);
@ -461,15 +465,16 @@ implementation
{*****************************************************************************
INCLUDE/EXCLUDE GENERIC HANDLING
*****************************************************************************}
procedure tcginlinenode.second_IncludeExclude;
var
hregister : tregister;
L : longint;
cgop : topcg;
addrreg, hregister2: tregister;
use_small : boolean;
cgsize : tcgsize;
href : treference;
L : longint;
cgop : topcg;
addrreg2,addrreg,
hregister,hregister2: tregister;
use_small : boolean;
cgsize : tcgsize;
href : treference;
begin
secondpass(tcallparanode(left).left);
if tcallparanode(tcallparanode(left).right).left.nodetype=ordconstn then
@ -500,7 +505,7 @@ implementation
end
else
begin
use_small:=
use_small:=
{ set type }
(tsetdef(tcallparanode(left).left.resulttype.def).settype=smallset)
and
@ -514,33 +519,17 @@ implementation
secondpass(tcallparanode(tcallparanode(left).right).left);
{ bitnumber - which must be loaded into register }
hregister:=cg.getintregister(exprasmlist,OS_INT);
hregister2:=cg.getintregister(exprasmlist,OS_INT);
hregister:=cg.getintregister(exprasmlist,OS_32);
hregister2:=cg.getintregister(exprasmlist,OS_32);
case tcallparanode(tcallparanode(left).right).left.location.loc of
LOC_CREGISTER,
LOC_REGISTER:
begin
cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,
tcallparanode(tcallparanode(left).right).left.location.register,hregister);
end;
LOC_CREFERENCE,
LOC_REFERENCE:
begin
cgsize := def_cgsize(tcallparanode(tcallparanode(left).right).left.resulttype.def);
cg.a_load_ref_reg(exprasmlist,cgsize,cgsize,
tcallparanode(tcallparanode(left).right).left.location.reference,hregister);
end;
else
internalerror(20020727);
end;
cg.a_load_loc_reg(exprasmlist,OS_32,
tcallparanode(tcallparanode(left).right).left.location,hregister);
if use_small then
begin
{ hregister contains the bitnumber to add }
cg.a_load_const_reg(exprasmlist, OS_INT, 1, hregister2);
cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_INT, hregister, hregister2);
cg.a_load_const_reg(exprasmlist, OS_32, 1, hregister2);
cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_32, hregister, hregister2);
{ possiblities :
bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
@ -549,19 +538,17 @@ implementation
{ location of set }
if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
begin
if inlinenumber=in_include_x_y then
begin
cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2,
tcallparanode(left).left.location.reference);
end
else
begin
cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2,
hregister2);
cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2,
tcallparanode(left).left.location.reference);
end;
if inlinenumber=in_include_x_y then
begin
cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2,
tcallparanode(left).left.location.reference);
end
else
begin
cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2,hregister2);
cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2,
tcallparanode(left).left.location.reference);
end;
end
else
internalerror(20020728);
@ -578,34 +565,36 @@ implementation
cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_32, 5, hregister,hregister2);
cg.a_op_const_reg(exprasmlist, OP_SHL, OS_32, 2, hregister2);
addrreg:=cg.getaddressregister(exprasmlist);
{ we need an extra address register to be able to do an ADD operation }
addrreg2:=cg.getaddressregister(exprasmlist);
cg.a_load_reg_reg(exprasmlist,OS_32,OS_ADDR,hregister2,addrreg2);
{ calculate the correct address of the operand }
cg.a_loadaddr_ref_reg(exprasmlist, tcallparanode(left).left.location.reference,addrreg);
cg.a_op_reg_reg(exprasmlist, OP_ADD, OS_INT, hregister2, addrreg);
cg.a_op_reg_reg(exprasmlist, OP_ADD, OS_32, addrreg2, addrreg);
cg.ungetregister(exprasmlist,addrreg2);
{ hregister contains the bitnumber to add }
cg.a_load_const_reg(exprasmlist, OS_INT, 1, hregister2);
cg.a_op_const_reg(exprasmlist, OP_AND, OS_INT, 31, hregister);
cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_INT, hregister, hregister2);
cg.a_load_const_reg(exprasmlist, OS_32, 1, hregister2);
cg.a_op_const_reg(exprasmlist, OP_AND, OS_32, 31, hregister);
cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_32, hregister, hregister2);
reference_reset_base(href,addrreg,0);
if inlinenumber=in_include_x_y then
begin
cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2, href);
end
else
begin
cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2, hregister2);
cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2, href);
end;
cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2, href)
else
begin
cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2, hregister2);
cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2, href);
end;
cg.ungetregister(exprasmlist,addrreg);
end;
cg.ungetregister(exprasmlist,hregister);
cg.ungetregister(exprasmlist,hregister2);
cg.ungetregister(exprasmlist,hregister);
cg.ungetregister(exprasmlist,hregister2);
end;
end;
{*****************************************************************************
FLOAT GENERIC HANDLING
*****************************************************************************}
@ -676,7 +665,11 @@ end.
{
$Log$
Revision 1.50 2003-12-31 20:47:02 jonas
Revision 1.51 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.50 2003/12/31 20:47:02 jonas
* properly fixed assigned() mess (by handling it separately in ncginl)
-> all assigned()-related tests in the test suite work again

View File

@ -813,7 +813,7 @@ implementation
end;
{ if mulsize = 1, we won't have to modify the index }
location_force_reg(exprasmlist,right.location,OS_32,mulsize = 1);
location_force_reg(exprasmlist,right.location,OS_ADDR,(mulsize = 1));
if isjump then
begin
@ -881,7 +881,11 @@ begin
end.
{
$Log$
Revision 1.84 2004-01-12 16:38:50 peter
Revision 1.85 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.84 2004/01/12 16:38:50 peter
* don't generate IMUL reg,1
Revision 1.83 2003/12/06 01:15:22 florian

View File

@ -169,9 +169,9 @@ begin
else
begin
href2.index := lengthreg;
{$ifdef i386}
{$ifdef x86}
href2.scalefactor := 1;
{$endif i386}
{$endif x86}
end;
{ we need to be one position after the last char }
inc(href2.offset);
@ -201,7 +201,11 @@ end.
{
$Log$
Revision 1.11 2003-10-10 17:48:13 peter
Revision 1.12 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.11 2003/10/10 17:48:13 peter
* old trgobj moved to x86/rgcpu and renamed to trgx86fpu
* tregisteralloctor renamed to trgobj
* removed rgobj from a lot of units

View File

@ -46,8 +46,9 @@ interface
instructions to do bit tests.
}
procedure emit_bit_test_reg_reg(list : taasmoutput; bitnumber : tregister;
value : tregister; __result :tregister);virtual;
procedure emit_bit_test_reg_reg(list : taasmoutput;
bitsize: tcgsize; bitnumber,value : tregister;
ressize: tcgsize; res :tregister);virtual;
end;
tcgcasenode = class(tcasenode)
@ -129,7 +130,9 @@ implementation
{ __Result register is set to 1, if the bit is set otherwise, __Result}
{ is set to zero. __RESULT register is also used as scratch. }
{**********************************************************************}
procedure tcginnode.emit_bit_test_reg_reg(list : taasmoutput; bitnumber : tregister; value : tregister; __result :tregister);
procedure tcginnode.emit_bit_test_reg_reg(list : taasmoutput;
bitsize: tcgsize; bitnumber,value : tregister;
ressize: tcgsize; res :tregister);
begin
{ first make sure that the bit number is modulo 32 }
@ -138,9 +141,10 @@ implementation
{ cg.a_op_const_reg(list,OP_AND,31,bitnumber); }
{ rotate value register "bitnumber" bits to the right }
cg.a_op_reg_reg_reg(list,OP_SHR,OS_INT,bitnumber,value,__result);
cg.a_op_reg_reg(list,OP_SHR,bitsize,bitnumber,value);
{ extract the bit we want }
cg.a_op_const_reg(list,OP_AND,OS_INT,1,__result);
cg.a_op_const_reg(list,OP_AND,bitsize,1,value);
cg.a_load_reg_reg(list,bitsize,ressize,value,res);
end;
@ -314,8 +318,9 @@ implementation
if (left.location.loc = LOC_CREGISTER) and
(hr<>pleftreg) then
begin
cg.a_op_const_reg(exprasmlist,OP_SUB,opsize,setparts[i].start,pleftreg);
hr:=cg.getintregister(exprasmlist,OS_INT);
cg.a_op_const_reg_reg(exprasmlist,OP_SUB,opsize,setparts[i].start,pleftreg,hr);
cg.a_load_reg_reg(exprasmlist,opsize,OS_INT,pleftreg,hr);
pleftreg:=hr;
opsize := OS_INT;
end
@ -381,49 +386,29 @@ implementation
handle smallsets separate, because it allows faster checks }
if use_small then
begin
{**************************** SMALL SET **********************}
{**************************** SMALL SET **********************}
if left.nodetype=ordconstn then
begin
location_force_reg(exprasmlist,right.location,OS_32,true);
cg.ungetregister(exprasmlist,right.location.register);
{ allocate a register for the result }
location.register := cg.getintregister(exprasmlist,location.size);
{ then SHR the register }
cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,
tordconstnode(left).value and 31,right.location.register,location.register);
{ then extract the lowest bit }
cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,1,location.register);
{ first SHR the register }
cg.a_op_const_reg(exprasmlist,OP_SHR,OS_32,tordconstnode(left).value and 31,right.location.register);
{ then extract the lowest bit }
cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,right.location.register);
location.register:=cg.getintregister(exprasmlist,location.size);
cg.a_load_reg_reg(exprasmlist,OS_32,location.size,right.location.register,location.register);
end
else
begin
case left.location.loc of
LOC_REGISTER,
LOC_CREGISTER:
begin
hr3:=cg.makeregsize(left.location.register,OS_INT);
cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,hr3);
hr:=cg.getintregister(exprasmlist,OS_INT);
cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,hr3,hr);
end;
else
begin
hr:=cg.getintregister(exprasmlist,OS_INT);
cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),OS_INT,
left.location.reference,hr);
location_release(exprasmlist,left.location);
end;
end;
location_force_reg(exprasmlist,left.location,OS_32,false);
location_force_reg(exprasmlist,right.location,OS_32,true);
{ free the resources }
cg.ungetregister(exprasmlist,right.location.register);
{ allocate a register for the result }
location.register := cg.getintregister(exprasmlist,location.size);
location.register:=cg.getintregister(exprasmlist,location.size);
{ emit bit test operation }
emit_bit_test_reg_reg(exprasmlist,hr,right.location.register,location.register);
{ free bitnumber register }
cg.ungetregister(exprasmlist,hr);
emit_bit_test_reg_reg(exprasmlist,right.location.size,left.location.register,
right.location.register,location.size,location.register);
end;
location_release(exprasmlist,left.location);
location_release(exprasmlist,right.location);
end
else
{************************** NOT SMALL SET ********************}
@ -437,21 +422,21 @@ implementation
{ assumption (other cases will be caught by range checking) (JM) }
{ load left in register }
location_force_reg(exprasmlist,left.location,OS_INT,true);
location_force_reg(exprasmlist,left.location,OS_32,true);
if left.location.loc = LOC_CREGISTER then
hr := cg.getintregister(exprasmlist,OS_INT)
hr := cg.getintregister(exprasmlist,OS_32)
else
hr := left.location.register;
{ load right in register }
hr2:=cg.getintregister(exprasmlist,OS_INT);
cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
hr2:=cg.getintregister(exprasmlist,OS_32);
cg.a_load_const_reg(exprasmlist,OS_32,right.location.value,hr2);
{ emit bit test operation }
emit_bit_test_reg_reg(exprasmlist,left.location.register,hr2,hr2);
emit_bit_test_reg_reg(exprasmlist,OS_32,left.location.register,hr2,OS_32,hr2);
{ if left > 31 then hr := 0 else hr := $ffffffff }
cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,32,left.location.register,hr);
cg.a_op_const_reg(exprasmlist,OP_SAR,OS_INT,31,hr);
cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_32,32,left.location.register,hr);
cg.a_op_const_reg(exprasmlist,OP_SAR,OS_32,31,hr);
{ free registers }
cg.ungetregister(exprasmlist,hr2);
@ -460,10 +445,11 @@ implementation
else
cg.ungetregister(exprasmlist,left.location.register);
{ if left > 31, then result := 0 else result := result of bit test }
cg.a_op_reg_reg(exprasmlist,OP_AND,OS_32,hr,hr2);
{ allocate a register for the result }
location.register := cg.getintregister(exprasmlist,location.size);
{ if left > 31, then result := 0 else result := result of bit test }
cg.a_op_reg_reg_reg(exprasmlist,OP_AND,OS_INT,hr,hr2,location.register);
cg.a_load_reg_reg(exprasmlist,OS_32,location.size,hr2,location.register);
end { of right.location.loc=LOC_CONSTANT }
{ do search in a normal set which could have >32 elementsm
but also used if the left side contains higher values > 32 }
@ -485,13 +471,14 @@ implementation
end
else
begin
location_force_reg(exprasmlist,left.location,OS_INT,true);
location_force_reg(exprasmlist,left.location,OS_32,true);
pleftreg := left.location.register;
location_freetemp(exprasmlist,left.location);
cg.a_op_const_reg(exprasmlist,OP_SHR,OS_32,5,pleftreg);
hr := cg.getaddressregister(exprasmlist);
cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,5,pleftreg,hr);
cg.a_op_const_reg(exprasmlist,OP_SHL,OS_32,2,hr);
cg.a_load_reg_reg(exprasmlist,OS_32,OS_ADDR,pleftreg,hr);
cg.a_op_const_reg(exprasmlist,OP_SHL,OS_ADDR,2,hr);
href := right.location.reference;
if (href.base = NR_NO) then
@ -508,15 +495,15 @@ implementation
end;
reference_release(exprasmlist,href);
{ allocate a register for the result }
location.register := cg.getintregister(exprasmlist,location.size);
cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,location.register);
cg.ungetregister(exprasmlist,pleftreg);
hr := cg.getintregister(exprasmlist,OS_32);
cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_32,31,pleftreg,hr);
cg.a_op_reg_reg(exprasmlist,OP_SHR,OS_32,hr,location.register);
cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,hr);
cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,31,pleftreg);
cg.a_op_reg_reg(exprasmlist,OP_SHR,OS_32,pleftreg,hr);
cg.ungetregister(exprasmlist,pleftreg);
cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,hr);
location.register := cg.getintregister(exprasmlist,location.size);
cg.a_load_reg_reg(exprasmlist,OS_32,location.size,hr,location.register);
cg.ungetregister(exprasmlist,hr);
cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,location.register);
end;
end;
end;
@ -1010,7 +997,11 @@ begin
end.
{
$Log$
Revision 1.55 2004-01-28 15:36:46 florian
Revision 1.56 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.55 2004/01/28 15:36:46 florian
* fixed another couple of arm bugs
Revision 1.54 2003/12/09 19:14:50 jonas

View File

@ -458,15 +458,15 @@ implementation
if (target_info.endian = ENDIAN_BIG) and
(l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
inc(l.reference.offset,TCGSize2Size[l.size]-TCGSize2Size[dst_size]);
{$ifdef i386}
{$ifdef x86}
l.size:=dst_size;
{$endif i386}
{$endif x86}
end;
cg.a_load_loc_reg(list,dst_size,l,hregister);
{$ifndef i386}
{$ifndef x86}
if (TCGSize2Size[dst_size]<TCGSize2Size[l.size]) then
l.size:=dst_size;
{$endif not i386}
{$endif not x86}
end;
end;
if (l.loc <> LOC_CREGISTER) or
@ -580,16 +580,16 @@ implementation
if (target_info.endian = ENDIAN_BIG) and
(l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
inc(l.reference.offset,TCGSize2Size[l.size]-TCGSize2Size[dst_size]);
{$ifdef i386}
{$ifdef x86}
l.size:=dst_size;
{$endif i386}
{$endif x86}
end;
cg.a_load_loc_reg(list,dst_size,l,hregister);
{$ifndef i386}
{$ifndef x86}
if (TCGSize2Size[dst_size]<TCGSize2Size[l.size]) then
l.size:=dst_size;
{$endif not i386}
{$endif not x86}
end;
end;
location_reset(l,LOC_REGISTER,dst_size);
@ -1560,7 +1560,7 @@ implementation
if paraloc1.loc=LOC_REGISTER then
cg.a_load_reg_ref(list,OS_INT,OS_INT,paraloc1.register,href);
paramanager.allocparaloc(list,paraloc1);
cg.a_param_const(list,OS_32,stackframe,paraloc1);
cg.a_param_const(list,OS_INT,stackframe,paraloc1);
paramanager.freeparaloc(list,paraloc1);
{ No register saving needed, saveregisters is used }
{$ifndef x86}
@ -1591,7 +1591,7 @@ implementation
begin
stacksize:=current_procinfo.calc_stackframe_size;
if (stacksize<>0) then
cg.a_op_const_reg(list,OP_ADD,OS_32,stacksize,current_procinfo.framepointer);
cg.a_op_const_reg(list,OP_ADD,OS_ADDR,stacksize,current_procinfo.framepointer);
end
else
cg.g_restore_frame_pointer(list);
@ -2098,7 +2098,11 @@ implementation
end.
{
$Log$
Revision 1.184 2004-01-21 21:01:34 peter
Revision 1.185 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.184 2004/01/21 21:01:34 peter
* fixed stackchecking for register calling
Revision 1.183 2004/01/17 15:55:10 jonas

View File

@ -428,7 +428,9 @@ implementation
hp:=left;
while assigned(hp) and (hp.nodetype in [vecn,derefn,subscriptn]) do
hp:=tunarynode(hp).left;
if assigned(hp) and (hp.nodetype=loadn) and
{$ifdef i386}
if assigned(hp) and
(hp.nodetype=loadn) and
((tloadnode(hp).symtableentry.typ=absolutesym) and
tabsolutesym(tloadnode(hp).symtableentry).absseg) then
begin
@ -438,6 +440,7 @@ implementation
resulttype.setdef(tpointerdef.createfar(left.resulttype));
end
else
{$endif i386}
begin
if not(nf_typedaddr in flags) then
resulttype:=voidpointertype
@ -967,7 +970,11 @@ begin
end.
{
$Log$
Revision 1.77 2004-01-26 16:12:28 daniel
Revision 1.78 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.77 2004/01/26 16:12:28 daniel
* reginfo now also only allocated during register allocation
* third round of gdb cleanups: kick out most of concatstabto

View File

@ -2032,12 +2032,6 @@ const
{ retrieve names, remove reg for register parameters }
s1:=ad.name;
s2:=fd.name;
{$ifdef i386}
if copy(s1,1,3)='reg' then
delete(s1,1,3);
if copy(s2,1,3)='reg' then
delete(s2,1,3);
{$endif i386}
{ compare names }
if (s1<>s2) then
begin
@ -2155,7 +2149,11 @@ const
end.
{
$Log$
Revision 1.156 2004-01-21 14:22:00 florian
Revision 1.157 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.156 2004/01/21 14:22:00 florian
+ reintroduce implemented
Revision 1.155 2003/11/23 17:05:15 peter

View File

@ -622,7 +622,7 @@ implementation
{ startvarrec contains the start of the variant part of a record }
maxsize, startvarrecsize : longint;
usedalign,
minalignment,maxalignment,startvarrecalign : byte;
maxalignment,startvarrecalign : byte;
hp,pt : tnode;
vs,vs2 : tvarsym;
srsym : tsym;
@ -755,8 +755,9 @@ implementation
abssym:=tabsolutesym.create(vs.realname,tt);
abssym.fileinfo:=vs.fileinfo;
abssym.abstyp:=toaddr;
abssym.absseg:=false;
abssym.fieldoffset:=tordconstnode(pt).value;
{$ifdef i386}
abssym.absseg:=false;
if (target_info.system in [system_i386_go32v2,system_i386_watcom]) and
try_to_consume(_COLON) then
begin
@ -770,6 +771,7 @@ implementation
else
Message(type_e_ordinal_expr_expected);
end;
{$endif i386}
symtablestack.replace(vs,abssym);
vs.free;
end
@ -1113,25 +1115,7 @@ implementation
UnionSym:=tvarsym.create('$case',vs_value,uniontype);
symtablestack:=symtablestack.next;
{ Align the offset where the union symtable is added }
if trecordsymtable(symtablestack).usefieldalignment=-1 then
begin
{$ifdef i386}
if maxalignment>2 then
minalignment:=4
else if maxalignment>1 then
minalignment:=2
else
minalignment:=1;
{$else}
{$ifdef m68k}
minalignment:=2;
{$endif}
minalignment:=1;
{$endif}
end
else
minalignment:=maxalignment;
usedalign:=used_align(maxalignment,minalignment,maxalignment);
usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign);
offset:=align(trecordsymtable(symtablestack).datasize,usedalign);
trecordsymtable(symtablestack).datasize:=offset+unionsymtable.datasize;
if maxalignment>trecordsymtable(symtablestack).fieldalignment then
@ -1151,7 +1135,11 @@ implementation
end.
{
$Log$
Revision 1.62 2004-01-29 16:51:29 peter
Revision 1.63 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.62 2004/01/29 16:51:29 peter
* fixed alignment calculation for variant records
* fixed alignment padding of records

View File

@ -225,7 +225,9 @@ interface
tabsolutesym = class(tvarsym)
abstyp : absolutetyp;
{$ifdef i386}
absseg : boolean;
{$endif i386}
asmname : pstring;
ref : tsymlist;
constructor create(const n : string;const tt : ttype);
@ -1414,7 +1416,9 @@ implementation
fieldoffset:=0;
asmname:=nil;
abstyp:=absolutetyp(ppufile.getbyte);
{$ifdef i386}
absseg:=false;
{$endif i386}
case abstyp of
tovar :
ref:=ppufile.getsymlist;
@ -1423,7 +1427,9 @@ implementation
toaddr :
begin
fieldoffset:=ppufile.getlongint;
{$ifdef i386}
absseg:=boolean(ppufile.getbyte);
{$endif i386}
end;
end;
end;
@ -1450,7 +1456,9 @@ implementation
toaddr :
begin
ppufile.putlongint(fieldoffset);
{$ifdef i386}
ppufile.putbyte(byte(absseg));
{$endif i386}
end;
end;
ppufile.writeentry(ibabsolutesym);
@ -2547,7 +2555,11 @@ implementation
end.
{
$Log$
Revision 1.147 2004-01-27 22:45:30 daniel
Revision 1.148 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.147 2004/01/27 22:45:30 daniel
* Stab generation bug fixed
Revision 1.146 2004/01/26 22:08:20 daniel

View File

@ -32,14 +32,18 @@ unit cpunode;
implementation
uses
{ generic nodes }
ncgbas,
ncgld,
ncgflw,
ncgcnv,
ncgmem,
ncgmat,
ncgcon,
ncgld,
ncgcal,
ncgadd,
ncgset,
ncginl,
ncgopt,
// n386con,n386flw,n386mat,n386mem,
// n386set,n386inl,n386opt,
{ this not really a node }
@ -54,7 +58,11 @@ unit cpunode;
end.
{
$Log$
Revision 1.5 2004-01-20 12:59:37 florian
Revision 1.6 2004-01-31 17:45:17 peter
* Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR
Revision 1.5 2004/01/20 12:59:37 florian
* common addnode code for x86-64 and i386
Revision 1.4 2003/04/30 22:15:59 florian