+ x86_64 pic draft

This commit is contained in:
florian 2005-02-06 00:05:56 +00:00
parent 47534143af
commit b1c8bfc478
21 changed files with 145 additions and 60 deletions

View File

@ -1891,6 +1891,12 @@ implementation
too much of a a speed penalty}
if (ref^.segment<>NR_NO) and (ref^.segment<>NR_DS) then
segprefix:=ref^.segment;
{$endif}
{$ifdef extdebug}
if (cs_create_pic in aktmoduleswitches) and
assigned(r.symbol) and
(r.refaddr=addr_no) then
internalerror(200502052);
{$endif}
typ:=top_ref;
if assigned(add_reg_instruction_hook) then
@ -2236,7 +2242,10 @@ begin
end.
{
$Log$
Revision 1.93 2005-01-31 17:07:50 peter
Revision 1.94 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.93 2005/01/31 17:07:50 peter
* fix [regpara] in intel assembler
Revision 1.92 2004/11/01 10:34:08 peter

View File

@ -788,6 +788,8 @@ implementation
if (cs_local_browser in aktmoduleswitches) and
not(cs_browser in aktmoduleswitches) then
exclude(aktmoduleswitches,cs_local_browser);
if (cs_create_pic in aktmoduleswitches) then
def_system_macro('FPC_PIC');
end;
@ -1348,6 +1350,10 @@ implementation
current_module.realmodulename:=stringdup(orgpattern);
current_module.islibrary:=true;
exportlib.preparelib(orgpattern);
if tf_library_needs_pic in target_info.flags then
include(aktmoduleswitches,cs_create_pic);
consume(_ID);
consume(_SEMICOLON);
end
@ -1602,7 +1608,10 @@ implementation
end.
{
$Log$
Revision 1.181 2005-01-24 22:08:32 peter
Revision 1.182 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.181 2005/01/24 22:08:32 peter
* interface wrapper generation moved to cgobj
* generate interface wrappers after the module is parsed

View File

@ -230,7 +230,8 @@ interface
tf_smartlink_sections,
tf_needs_dwarf_cfi,
tf_use_8_3,
tf_pic_uses_got
tf_pic_uses_got,
tf_library_needs_pic
);
psysteminfo = ^tsysteminfo;
@ -717,7 +718,10 @@ finalization
end.
{
$Log$
Revision 1.100 2005-01-25 18:48:15 peter
Revision 1.101 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.100 2005/01/25 18:48:15 peter
* tf_pic_uses_got added
Revision 1.99 2004/12/28 20:43:00 hajny

View File

@ -285,7 +285,8 @@ unit i_linux;
system : system_x86_64_LINUX;
name : 'Linux for x86-64';
shortname : 'Linux';
flags : [tf_needs_symbol_size,tf_needs_dwarf_cfi];
flags : [tf_needs_symbol_size,tf_needs_dwarf_cfi,
tf_library_needs_pic];
cpu : cpu_x86_64;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -348,7 +349,7 @@ unit i_linux;
system : system_SPARC_Linux;
name : 'Linux for SPARC';
shortname : 'Linux';
flags : [tf_needs_symbol_size];
flags : [tf_needs_symbol_size,tf_library_needs_pic];
cpu : cpu_SPARC;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -513,7 +514,10 @@ initialization
end.
{
$Log$
Revision 1.34 2005-01-30 17:45:38 florian
Revision 1.35 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.34 2005/01/30 17:45:38 florian
* better alignment on linux
Revision 1.33 2005/01/25 18:48:15 peter

View File

@ -70,6 +70,8 @@ interface
AsmWrite(gas_regname(segment)+':');
if assigned(symbol) then
AsmWrite(symbol.name);
if ref.refaddr=addr_pic then
AsmWrite('@GOTPCREL');
if offset<0 then
AsmWrite(tostr(offset))
else
@ -111,7 +113,7 @@ interface
top_reg :
AsmWrite(gas_regname(o.reg));
top_ref :
if o.ref^.refaddr=addr_no then
if o.ref^.refaddr in [addr_no,addr_pic] then
WriteReference(o.ref^)
else
begin
@ -279,7 +281,10 @@ initialization
end.
{
$Log$
Revision 1.17 2004-10-31 21:45:04 peter
Revision 1.18 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.17 2004/10/31 21:45:04 peter
* generic tlocation
* move tlocation to cgutils

View File

@ -112,6 +112,7 @@ unit cgx86;
procedure g_overflowcheck(list: taasmoutput; const l:tlocation;def:tdef);override;
procedure make_simple_ref(list:taasmoutput;var ref: treference);
protected
procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
procedure check_register_size(size:tcgsize;reg:tregister);
@ -119,7 +120,6 @@ unit cgx86;
procedure opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle);
private
procedure sizes2load(s1,s2 : tcgsize;var op: tasmop; var s3: topsize);
procedure make_simple_ref(list:taasmoutput;var ref: treference);
procedure floatload(list: taasmoutput; t : tcgsize;const ref : treference);
procedure floatstore(list: taasmoutput; t : tcgsize;const ref : treference);
@ -328,6 +328,7 @@ unit cgx86;
{$ifdef x86_64}
var
hreg : tregister;
href : treference;
{$endif x86_64}
begin
{$ifdef x86_64}
@ -360,6 +361,30 @@ unit cgx86;
end;
end;
end;
if (cs_create_pic in aktmoduleswitches) and
assigned(ref.symbol) then
begin
reference_reset_symbol(href,ref.symbol,0);
hreg:=getaddressregister(list);
href.refaddr:=addr_pic;
href.base:=NR_RIP;
list.concat(taicpu.op_ref_reg(A_MOV,S_Q,href,hreg));
ref.symbol:=nil;
if ref.index=NR_NO then
begin
ref.index:=hreg;
ref.scalefactor:=1;
end
else if ref.base=NR_NO then
ref.base:=hreg
else
begin
list.concat(taicpu.op_reg_reg(A_ADD,S_Q,ref.base,hreg));
ref.base:=hreg;
end;
end;
{$endif x86_64}
end;
@ -1746,7 +1771,10 @@ unit cgx86;
end.
{
$Log$
Revision 1.144 2005-02-05 18:32:17 florian
Revision 1.145 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.144 2005/02/05 18:32:17 florian
* fixed previous commit
Revision 1.143 2005/02/05 18:08:48 florian

View File

@ -255,7 +255,10 @@ unit nx86add;
exprasmlist.concat(taicpu.op_reg_reg(op,TCGSize2Opsize[opsize],right.location.register,left.location.register));
LOC_REFERENCE,
LOC_CREFERENCE :
exprasmlist.concat(taicpu.op_ref_reg(op,TCGSize2Opsize[opsize],right.location.reference,left.location.register));
begin
tcgx86(cg).make_simple_ref(exprasmlist,right.location.reference);
exprasmlist.concat(taicpu.op_ref_reg(op,TCGSize2Opsize[opsize],right.location.reference,left.location.register));
end;
LOC_CONSTANT :
begin
{$ifdef x86_64}
@ -512,7 +515,10 @@ unit nx86add;
location_force_mem(exprasmlist,left.location);
case left.location.loc of
LOC_REFERENCE,LOC_CREFERENCE:
exprasmlist.concat(taicpu.op_ref_reg(op,S_NO,left.location.reference,right.location.register));
begin
tcgx86(cg).make_simple_ref(exprasmlist,left.location.reference);
exprasmlist.concat(taicpu.op_ref_reg(op,S_NO,left.location.reference,right.location.register));
end;
LOC_MMREGISTER,LOC_CMMREGISTER:
exprasmlist.concat(taicpu.op_reg_reg(op,S_NO,left.location.register,right.location.register));
else
@ -535,7 +541,10 @@ unit nx86add;
location_force_mem(exprasmlist,right.location);
case right.location.loc of
LOC_REFERENCE,LOC_CREFERENCE:
exprasmlist.concat(taicpu.op_ref_reg(op,S_NO,right.location.reference,left.location.register));
begin
tcgx86(cg).make_simple_ref(exprasmlist,right.location.reference);
exprasmlist.concat(taicpu.op_ref_reg(op,S_NO,right.location.reference,left.location.register));
end;
LOC_MMREGISTER,LOC_CMMREGISTER:
exprasmlist.concat(taicpu.op_reg_reg(op,S_NO,right.location.register,left.location.register));
else
@ -795,7 +804,10 @@ begin
end.
{
$Log$
Revision 1.15 2004-11-01 12:43:29 peter
Revision 1.16 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.15 2004/11/01 12:43:29 peter
* shortstr compare with empty string fixed
* removed special i386 code

View File

@ -79,7 +79,8 @@ NR_R15W,$0103000f,r15w,%r15w,r15w,r15w,-1,-1,15,OT_REG16,0,64
NR_R15D,$0104000f,r15d,%r15d,r15d,r15d,-1,-1,15,OT_REG32,0,64
; EIP is needed for DWARF call frame info return address (RA)
NR_EIP,$05000000,EIP,EIP,EIP,EIP,-1,8,16,OT_NONE,0
NR_RIP,$05000000,rip,%rip,rip,rip,-1,8,16,OT_NONE,0,64
NR_EIP,$05000000,eip,%eip,eip,eip,-1,8,16,OT_NONE,0
NR_CS,$05000001,cs,%cs,cs,cs,-1,-1,-1,OT_REG_CS,1
NR_DS,$05000002,ds,%ds,ds,ds,-1,-1,-1,OT_REG_DESS,3
NR_ES,$05000003,es,%es,es,es,-1,-1,-1,OT_REG_DESS,0
@ -142,7 +143,10 @@ NR_XMM15,$0400000f,xmm15,%xmm15,xmm15,xmm15,-1,-1,32,OT_XMMREG,7,64
;
; $Log$
; Revision 1.5 2004-06-16 20:07:11 florian
; Revision 1.6 2005-02-06 00:05:56 florian
; + x86_64 pic draft
;
; Revision 1.5 2004/06/16 20:07:11 florian
; * dwarf branch merged
;
; Revision 1.4.2.2 2004/04/20 16:35:58 peter

View File

@ -52,12 +52,8 @@ unit cgcpu;
procedure Tcgx86_64.init_register_allocators;
begin
inherited init_register_allocators;
if cs_create_pic in aktmoduleswitches then
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RSI,RS_RDI,
RS_R8,RS_R9,RS_R10,RS_R11,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[RS_EBP,RS_EBX])
else
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RBX,RS_RSI,RS_RDI,
RS_R8,RS_R9,RS_R10,RS_R11,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[RS_EBP]);
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RBX,RS_RSI,RS_RDI,
RS_R8,RS_R9,RS_R10,RS_R11,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[RS_RBP]);
rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBNONE,[RS_XMM0,RS_XMM1,RS_XMM2,RS_XMM3,RS_XMM4,RS_XMM5,RS_XMM6,RS_XMM7,
RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15],first_mm_imreg,[]);
rgfpu:=Trgx86fpu.create;
@ -144,7 +140,10 @@ begin
end.
{
$Log$
Revision 1.20 2005-01-24 22:08:33 peter
Revision 1.21 2005-02-06 00:05:56 florian
+ x86_64 pic draft
Revision 1.20 2005/01/24 22:08:33 peter
* interface wrapper generation moved to cgobj
* generate interface wrappers after the module is parsed

View File

@ -9,23 +9,23 @@
18,
7,
6,
82,
83,
84,
85,
70,
86,
71,
8,
12,
26,
25,
11,
76,
77,
78,
79,
80,
81,
71,
82,
72,
13,
4,
31,
@ -33,12 +33,12 @@
9,
27,
14,
72,
70,
73,
23,
35,
74,
75,
100,
76,
101,
102,
103,
@ -46,6 +46,7 @@
105,
106,
107,
108,
45,
46,
48,
@ -84,15 +85,15 @@
10,
28,
15,
69,
24,
36,
22,
21,
34,
33,
73,
99,
91,
74,
100,
92,
93,
94,
@ -100,20 +101,20 @@
96,
97,
98,
86,
99,
87,
88,
89,
90,
108,
91,
109,
118,
110,
119,
120,
121,
122,
123,
110,
124,
111,
112,
113,
@ -121,5 +122,5 @@
115,
116,
117,
69,
118,
0

View File

@ -68,7 +68,8 @@
'%r15b',
'%r15w',
'%r15d',
'EIP',
'%rip',
'%eip',
'%cs',
'%ds',
'%es',

View File

@ -68,6 +68,7 @@ NR_R15 = tregister($0105000f);
NR_R15L = tregister($0101000f);
NR_R15W = tregister($0103000f);
NR_R15D = tregister($0104000f);
NR_RIP = tregister($05000000);
NR_EIP = tregister($05000000);
NR_CS = tregister($05000001);
NR_DS = tregister($05000002);

View File

@ -69,6 +69,7 @@
15,
15,
16,
16,
-1,
-1,
-1,

View File

@ -1,2 +1,2 @@
{ don't edit, this file is generated from x86reg.dat }
124
125

View File

@ -69,6 +69,7 @@ tregister($0101000f),
tregister($0103000f),
tregister($0104000f),
tregister($05000000),
tregister($05000000),
tregister($05000001),
tregister($05000002),
tregister($05000003),

View File

@ -69,6 +69,7 @@
0,
0,
0,
0,
1,
3,
0,

View File

@ -69,6 +69,7 @@ OT_REG8,
OT_REG16,
OT_REG32,
OT_NONE,
OT_NONE,
OT_REG_CS,
OT_REG_DESS,
OT_REG_DESS,

View File

@ -68,7 +68,6 @@
57,
61,
65,
91,
92,
93,
94,
@ -101,6 +100,7 @@
121,
122,
123,
124,
69,
70,
71,
@ -122,4 +122,5 @@
87,
88,
89,
90
90,
91

View File

@ -1,5 +1,4 @@
{ don't edit, this file is generated from x86reg.dat }
69,
0,
2,
1,
@ -11,23 +10,23 @@
18,
7,
6,
82,
83,
84,
85,
70,
86,
71,
8,
12,
26,
25,
11,
76,
77,
78,
79,
80,
81,
71,
82,
72,
13,
4,
31,
@ -35,12 +34,12 @@
9,
27,
14,
72,
70,
73,
23,
35,
74,
75,
100,
76,
101,
102,
103,
@ -48,6 +47,7 @@
105,
106,
107,
108,
45,
46,
48,
@ -86,15 +86,15 @@
10,
28,
15,
69,
24,
36,
22,
21,
34,
33,
73,
99,
91,
74,
100,
92,
93,
94,
@ -102,24 +102,25 @@
96,
97,
98,
86,
99,
87,
88,
89,
90,
108,
91,
109,
118,
110,
119,
120,
121,
122,
123,
110,
124,
111,
112,
113,
114,
115,
116,
117
117,
118

View File

@ -90,6 +90,7 @@
-1,
-1,
-1,
-1,
12,
13,
14,

View File

@ -68,7 +68,8 @@
'r15b',
'r15w',
'r15d',
'EIP',
'rip',
'eip',
'cs',
'ds',
'es',