|
@@ -27,17 +27,9 @@ interface
|
|
uses
|
|
uses
|
|
cobjects,
|
|
cobjects,
|
|
aasm,globals,verbose,
|
|
aasm,globals,verbose,
|
|
- cpubase;
|
|
|
|
|
|
+ cpubase,tainst;
|
|
|
|
|
|
type
|
|
type
|
|
- pairegalloc = ^tairegalloc;
|
|
|
|
- tairegalloc = object(tai)
|
|
|
|
- allocation : boolean;
|
|
|
|
- reg : tregister;
|
|
|
|
- constructor alloc(r : tregister);
|
|
|
|
- constructor dealloc(r : tregister);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
paiframe = ^taiframe;
|
|
paiframe = ^taiframe;
|
|
taiframe = object(tai)
|
|
taiframe = object(tai)
|
|
G,R : TRegister;
|
|
G,R : TRegister;
|
|
@@ -53,12 +45,7 @@ type
|
|
|
|
|
|
|
|
|
|
paialpha = ^taialpha;
|
|
paialpha = ^taialpha;
|
|
- taialpha = object(tai)
|
|
|
|
- is_jmp : boolean; { is this instruction a jump? (needed for optimizer) }
|
|
|
|
- opcode : tasmop;
|
|
|
|
- ops : longint;
|
|
|
|
- condition : TasmCond;
|
|
|
|
- oper : array[0..2] of toper;
|
|
|
|
|
|
+ taialpha = object(tainstruction)
|
|
constructor op_none(op : tasmop);
|
|
constructor op_none(op : tasmop);
|
|
|
|
|
|
constructor op_reg(op : tasmop;_op1 : tregister);
|
|
constructor op_reg(op : tasmop;_op1 : tregister);
|
|
@@ -92,194 +79,142 @@ type
|
|
constructor op_sym_ofs_reg(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : tregister);
|
|
constructor op_sym_ofs_reg(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : tregister);
|
|
constructor op_sym_ofs_ref(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : preference);
|
|
constructor op_sym_ofs_ref(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : preference);
|
|
|
|
|
|
- destructor done;virtual;
|
|
|
|
function getcopy:plinkedlist_item;virtual;
|
|
function getcopy:plinkedlist_item;virtual;
|
|
private
|
|
private
|
|
segprefix : tregister;
|
|
segprefix : tregister;
|
|
- procedure init(op : tasmop); { this need to be called by all constructor }
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
-{*****************************************************************************
|
|
|
|
- TaiRegAlloc
|
|
|
|
-*****************************************************************************}
|
|
|
|
-
|
|
|
|
- constructor tairegalloc.alloc(r : tregister);
|
|
|
|
- begin
|
|
|
|
- inherited init;
|
|
|
|
- typ:=ait_regalloc;
|
|
|
|
- allocation:=true;
|
|
|
|
- reg:=r;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- constructor tairegalloc.dealloc(r : tregister);
|
|
|
|
- begin
|
|
|
|
- inherited init;
|
|
|
|
- typ:=ait_regalloc;
|
|
|
|
- allocation:=false;
|
|
|
|
- reg:=r;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
|
|
|
|
{*****************************************************************************
|
|
{*****************************************************************************
|
|
taialpha Constructors
|
|
taialpha Constructors
|
|
*****************************************************************************}
|
|
*****************************************************************************}
|
|
|
|
|
|
- procedure taialpha.init(op : tasmop);
|
|
|
|
- begin
|
|
|
|
- typ:=ait_instruction;
|
|
|
|
- is_jmp:=false;
|
|
|
|
- segprefix:=R_NO;
|
|
|
|
- opcode:=op;
|
|
|
|
- ops:=0;
|
|
|
|
- condition:=c_none;
|
|
|
|
- fillchar(oper,sizeof(oper),0);
|
|
|
|
- end;
|
|
|
|
|
|
|
|
constructor taialpha.op_none(op : tasmop);
|
|
constructor taialpha.op_none(op : tasmop);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_reg(op : tasmop;_op1 : tregister);
|
|
constructor taialpha.op_reg(op : tasmop;_op1 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=1;
|
|
ops:=1;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_const(op : tasmop;_op1 : longint);
|
|
constructor taialpha.op_const(op : tasmop;_op1 : longint);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=1;
|
|
ops:=1;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_ref(op : tasmop;_op1 : preference);
|
|
constructor taialpha.op_ref(op : tasmop;_op1 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=1;
|
|
ops:=1;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_reg_reg(op : tasmop;_op1,_op2 : tregister);
|
|
constructor taialpha.op_reg_reg(op : tasmop;_op1,_op2 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_reg_const(op:tasmop; _op1: tregister; _op2: longint);
|
|
constructor taialpha.op_reg_const(op:tasmop; _op1: tregister; _op2: longint);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_reg_ref(op : tasmop;_op1 : tregister;_op2 : preference);
|
|
constructor taialpha.op_reg_ref(op : tasmop;_op1 : tregister;_op2 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_const_reg(op : tasmop;_op1 : longint;_op2 : tregister);
|
|
constructor taialpha.op_const_reg(op : tasmop;_op1 : longint;_op2 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_const_const(op : tasmop;_op1,_op2 : longint);
|
|
constructor taialpha.op_const_const(op : tasmop;_op1,_op2 : longint);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_const_ref(op : tasmop;_op1 : longint;_op2 : preference);
|
|
constructor taialpha.op_const_ref(op : tasmop;_op1 : longint;_op2 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor taialpha.op_ref_reg(op : tasmop;_op1 : preference;_op2 : tregister);
|
|
constructor taialpha.op_ref_reg(op : tasmop;_op1 : preference;_op2 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_ref_ref(op : tasmop;_op1,_op2 : preference);
|
|
constructor taialpha.op_ref_ref(op : tasmop;_op1,_op2 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
|
|
constructor taialpha.op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=3;
|
|
ops:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor taialpha.op_reg_const_reg(op : tasmop;_op1 : tregister;_op2 : longint;_op3 : tregister);
|
|
constructor taialpha.op_reg_const_reg(op : tasmop;_op1 : tregister;_op2 : longint;_op3 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=3;
|
|
ops:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor taialpha.op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister;_op3 : preference);
|
|
constructor taialpha.op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister;_op3 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=3;
|
|
ops:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor taialpha.op_const_ref_reg(op : tasmop;_op1 : longint;_op2 : preference;_op3 : tregister);
|
|
constructor taialpha.op_const_ref_reg(op : tasmop;_op1 : longint;_op2 : preference;_op3 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=3;
|
|
ops:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor taialpha.op_const_reg_ref(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : preference);
|
|
constructor taialpha.op_const_reg_ref(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=3;
|
|
ops:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor taialpha.op_reg_ref_const(op : tasmop;_op1 : tregister;_op2 : preference;_op3 : longint);
|
|
constructor taialpha.op_reg_ref_const(op : tasmop;_op1 : tregister;_op2 : preference;_op3 : longint);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=3;
|
|
ops:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : pasmsymbol);
|
|
constructor taialpha.op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : pasmsymbol);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
condition:=cond;
|
|
condition:=cond;
|
|
ops:=1;
|
|
ops:=1;
|
|
end;
|
|
end;
|
|
@@ -287,45 +222,31 @@ implementation
|
|
|
|
|
|
constructor taialpha.op_sym(op : tasmop;_op1 : pasmsymbol);
|
|
constructor taialpha.op_sym(op : tasmop;_op1 : pasmsymbol);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=1;
|
|
ops:=1;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_sym_ofs(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint);
|
|
constructor taialpha.op_sym_ofs(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=1;
|
|
ops:=1;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_sym_ofs_reg(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : tregister);
|
|
constructor taialpha.op_sym_ofs_reg(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : tregister);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor taialpha.op_sym_ofs_ref(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : preference);
|
|
constructor taialpha.op_sym_ofs_ref(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : preference);
|
|
begin
|
|
begin
|
|
- inherited init;
|
|
|
|
- init(op);
|
|
|
|
|
|
+ inherited init(op);
|
|
ops:=2;
|
|
ops:=2;
|
|
end;
|
|
end;
|
|
|
|
|
|
- destructor taialpha.done;
|
|
|
|
- var
|
|
|
|
- i : longint;
|
|
|
|
- begin
|
|
|
|
- for i:=1 to ops do
|
|
|
|
- if (oper[i-1].typ=top_ref) then
|
|
|
|
- dispose(oper[i-1].ref);
|
|
|
|
- inherited done;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
function taialpha.getcopy:plinkedlist_item;
|
|
function taialpha.getcopy:plinkedlist_item;
|
|
var
|
|
var
|
|
i : longint;
|
|
i : longint;
|
|
@@ -364,7 +285,10 @@ implementation
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.3 1999-08-06 14:15:54 florian
|
|
|
|
|
|
+ Revision 1.4 1999-08-06 16:04:07 michael
|
|
|
|
+ + introduced tainstruction
|
|
|
|
+
|
|
|
|
+ Revision 1.3 1999/08/06 14:15:54 florian
|
|
* made the alpha version compilable
|
|
* made the alpha version compilable
|
|
|
|
|
|
Revision 1.2 1999/08/05 15:50:33 michael
|
|
Revision 1.2 1999/08/05 15:50:33 michael
|