2
Copyright (c) 1999-2002 by Mazen Neifer
4
Contains the assembler object for the SPARC
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
****************************************************************************
30
globtype,globals,verbose,
31
aasmbase,aasmtai,aasmdata,aasmsym,
32
cgbase,cgutils,cpubase,cpuinfo;
35
{ "mov reg,reg" source operand number }
37
{ "mov reg,reg" source operand number }
41
taicpu = class(tai_cpu_abstract_sym)
42
delayslot_annulled : boolean; { conditinal opcode with ,a }
43
constructor op_none(op : tasmop);
45
constructor op_reg(op : tasmop;_op1 : tregister);
46
constructor op_const(op : tasmop;_op1 : LongInt);
47
constructor op_ref(op : tasmop;const _op1 : treference);
49
constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
50
constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
51
constructor op_reg_const(op:tasmop; _op1: tregister; _op2: LongInt);
52
constructor op_const_reg(op:tasmop; _op1: LongInt; _op2: tregister);
53
constructor op_ref_reg(op : tasmop;const _op1 : treference;_op2 : tregister);
55
constructor op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
56
constructor op_reg_ref_reg(op:tasmop;_op1:TRegister;_op2:TReference;_op3:tregister);
57
constructor op_reg_const_reg(op:tasmop;_op1:TRegister;_op2:aint;_op3:tregister);
59
{ this is for Jmp instructions }
60
constructor op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
61
constructor op_sym(op : tasmop;_op1 : tasmsymbol);
62
constructor op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
63
procedure loadbool(opidx:longint;_b:boolean);
64
{ register allocation }
65
function is_same_reg_move(regtype: Tregistertype):boolean; override;
67
{ register spilling code }
68
function spilling_get_operation_type(opnr: longint): topertype;override;
71
tai_align = class(tai_align_abstract)
78
function spilling_create_load(const ref:treference;r:tregister): tai;
79
function spilling_create_store(r:tregister; const ref:treference): tai;
83
{*****************************************************************************
85
*****************************************************************************}
87
procedure taicpu.loadbool(opidx:longint;_b:boolean);
101
constructor taicpu.op_none(op : tasmop);
103
inherited create(op);
107
constructor taicpu.op_reg(op : tasmop;_op1 : tregister);
109
inherited create(op);
115
constructor taicpu.op_ref(op : tasmop;const _op1 : treference);
117
inherited create(op);
123
constructor taicpu.op_const(op : tasmop;_op1 : LongInt);
125
inherited create(op);
131
constructor taicpu.op_reg_reg(op : tasmop;_op1,_op2 : tregister);
133
inherited create(op);
139
constructor taicpu.op_reg_const(op:tasmop; _op1: tregister; _op2: LongInt);
141
inherited create(op);
147
constructor taicpu.op_const_reg(op:tasmop; _op1: LongInt; _op2: tregister);
149
inherited create(op);
156
constructor taicpu.op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
158
inherited create(op);
165
constructor taicpu.op_ref_reg(op : tasmop;const _op1 : treference;_op2 : tregister);
167
inherited create(op);
174
constructor taicpu.op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
176
inherited create(op);
184
constructor taicpu.op_reg_ref_reg(op:tasmop;_op1:TRegister;_op2:TReference;_op3:tregister);
186
inherited create(op);
187
{ only allowed to load the address }
188
if not(_op2.refaddr in [addr_lo,addr_hi]) then
189
internalerror(200305311);
197
constructor taicpu.op_reg_const_reg(op:tasmop;_op1:TRegister;_op2:aint;_op3:tregister);
199
inherited create(op);
207
constructor taicpu.op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
209
inherited create(op);
210
is_jmp:=op in [A_BA,A_Bxx];
213
loadsymbol(0,_op1,0);
217
constructor taicpu.op_sym(op : tasmop;_op1 : tasmsymbol);
219
inherited create(op);
220
is_jmp:=op in [A_BA,A_Bxx];
222
loadsymbol(0,_op1,0);
226
constructor taicpu.op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
228
inherited create(op);
230
loadsymbol(0,_op1,_op1ofs);
234
function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
237
((opcode=A_MOV) and (regtype = R_INTREGISTER)) or
238
((regtype = R_FPUREGISTER) and (opcode in [A_FMOVS,A_FMOVD]))
241
(oper[0]^.typ=top_reg) and
242
(oper[1]^.typ=top_reg) and
243
(oper[0]^.reg=oper[1]^.reg);
247
function taicpu.spilling_get_operation_type(opnr: longint): topertype;
249
result := operand_read;
251
A_FCMPs,A_FCMPd,A_FCMPq :
256
result := operand_write;
262
function spilling_create_load(const ref:treference;r:tregister): tai;
264
case getregtype(r) of
266
result:=taicpu.op_ref_reg(A_LD,ref,r);
271
result:=taicpu.op_ref_reg(A_LDF,ref,r);
273
result:=taicpu.op_ref_reg(A_LDD,ref,r);
275
internalerror(200401042);
279
internalerror(200401041);
284
function spilling_create_store(r:tregister; const ref:treference): tai;
286
case getregtype(r) of
288
result:=taicpu.op_reg_ref(A_ST,r,ref);
293
result:=taicpu.op_reg_ref(A_STF,r,ref);
295
result:=taicpu.op_reg_ref(A_STD,r,ref);
297
internalerror(200401042);
301
internalerror(200401041);
317
cai_align:=tai_align;