* fixed reading of reg. sets in the arm assembler reader

This commit is contained in:
florian 2003-11-21 16:29:26 +00:00
parent be56bf3901
commit 256299c274
6 changed files with 90 additions and 23 deletions

View File

@ -187,6 +187,7 @@ unit agarmgas;
end; end;
end; end;
Procedure TARMGNUAssembler.WriteInstruction(hp : tai); Procedure TARMGNUAssembler.WriteInstruction(hp : tai);
var op: TAsmOp; var op: TAsmOp;
s: string; s: string;
@ -226,7 +227,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.14 2003-11-17 23:23:47 florian Revision 1.15 2003-11-21 16:29:26 florian
* fixed reading of reg. sets in the arm assembler reader
Revision 1.14 2003/11/17 23:23:47 florian
+ first part of arm assembler reader + first part of arm assembler reader
Revision 1.13 2003/11/07 15:58:32 florian Revision 1.13 2003/11/07 15:58:32 florian

View File

@ -759,8 +759,8 @@ unit cgcpu;
OS_32,OS_S32: OS_32,OS_S32:
begin begin
instr:=taicpu.op_reg_reg(A_MOV,reg2,reg1); instr:=taicpu.op_reg_reg(A_MOV,reg2,reg1);
add_move_instruction(instr);
list.concat(instr); list.concat(instr);
add_move_instruction(instr);
end; end;
else internalerror(2002090901); else internalerror(2002090901);
end; end;
@ -954,8 +954,8 @@ unit cgcpu;
else else
begin begin
instr:=taicpu.op_reg_reg(A_MOV,r,tmpref.base); instr:=taicpu.op_reg_reg(A_MOV,r,tmpref.base);
add_move_instruction(instr);
list.concat(instr); list.concat(instr);
add_move_instruction(instr);
end; end;
end; end;
reference_release(list,tmpref); reference_release(list,tmpref);
@ -1282,7 +1282,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.22 2003-11-07 15:58:32 florian Revision 1.23 2003-11-21 16:29:26 florian
* fixed reading of reg. sets in the arm assembler reader
Revision 1.22 2003/11/07 15:58:32 florian
* Florian's culmutative nr. 1; contains: * Florian's culmutative nr. 1; contains:
- invalid calling conventions for a certain cpu are rejected - invalid calling conventions for a certain cpu are rejected
- arm softfloat calling conventions - arm softfloat calling conventions

View File

@ -181,6 +181,11 @@ unit cpubase;
'ge','lt','gt','le','al','nv' 'ge','lt','gt','le','al','nv'
); );
uppercond2str : array[TAsmCond] of string[2]=('',
'EQ','NE','CS','CC','MI','PL','VS','VC','HI','LS',
'GE','LT','GT','LE','AL','NV'
);
inverse_cond : array[TAsmCond] of TAsmCond=(C_None, inverse_cond : array[TAsmCond] of TAsmCond=(C_None,
C_NE,C_EQ,C_CC,C_CS,C_PL,C_MI,C_VC,C_VS,C_LS,C_HI, C_NE,C_EQ,C_CC,C_CS,C_PL,C_MI,C_VC,C_VS,C_LS,C_HI,
C_LT,C_GE,C_LE,C_GT,C_None,C_None C_LT,C_GE,C_LE,C_GT,C_None,C_None
@ -564,7 +569,10 @@ unit cpubase;
end. end.
{ {
$Log$ $Log$
Revision 1.18 2003-11-17 23:23:47 florian Revision 1.19 2003-11-21 16:29:26 florian
* fixed reading of reg. sets in the arm assembler reader
Revision 1.18 2003/11/17 23:23:47 florian
+ first part of arm assembler reader + first part of arm assembler reader
Revision 1.17 2003/11/02 14:30:03 florian Revision 1.17 2003/11/02 14:30:03 florian

View File

@ -384,9 +384,10 @@ Unit raarmgas;
var var
tempreg : tregister; tempreg,ireg : tregister;
hl : tasmlabel; hl : tasmlabel;
ofs : longint; ofs : longint;
registerset : tcpuregisterset;
Begin Begin
expr:=''; expr:='';
case actasmtoken of case actasmtoken of
@ -396,6 +397,13 @@ Unit raarmgas;
BuildReference(oper); BuildReference(oper);
end; end;
AS_HASH: { Constant expression }
Begin
Consume(AS_HASH);
BuildConstantOperand(oper);
end;
(*
AS_INTNUM, AS_INTNUM,
AS_MINUS, AS_MINUS,
AS_PLUS: AS_PLUS:
@ -413,7 +421,7 @@ Unit raarmgas;
else else
BuildReference(oper); BuildReference(oper);
end; end;
*)
AS_ID: { A constant expression, or a Variable ref. } AS_ID: { A constant expression, or a Variable ref. }
Begin Begin
{ Local Label ? } { Local Label ? }
@ -519,7 +527,8 @@ Unit raarmgas;
BuildReference(oper); BuildReference(oper);
end; end;
AS_REGISTER: { Register, a variable reference or a constant reference } { Register, a variable reference or a constant reference }
AS_REGISTER:
Begin Begin
{ save the type of register used. } { save the type of register used. }
tempreg:=actasmregister; tempreg:=actasmregister;
@ -534,6 +543,38 @@ Unit raarmgas;
else else
Message(asmr_e_syn_operand); Message(asmr_e_syn_operand);
end; end;
{ Registerset }
AS_LSBRACKET:
begin
consume(AS_LSBRACKET);
registerset:=[];
while true do
begin
if actasmtoken=AS_REGISTER then
begin
include(registerset,actasmregister);
tempreg:=actasmregister;
consume(AS_REGISTER);
if actasmtoken=AS_MINUS then
begin
consume(AS_MINUS);
for ireg:=tempreg to actasmregister do
include(registerset,ireg);
consume(AS_REGISTER);
end;
end
else
consume(AS_REGISTER);
if actasmtoken=AS_COMMA then
consume(AS_COMMA)
else
break;
end;
consume(AS_RSBRACKET);
oper.opr.typ:=OPR_REGSET;
oper.opr.regset:=registerset;
end;
AS_END, AS_END,
AS_SEPARATOR, AS_SEPARATOR,
AS_COMMA: ; AS_COMMA: ;
@ -586,13 +627,7 @@ Unit raarmgas;
if operandnum>Max_Operands then if operandnum>Max_Operands then
Message(asmr_e_too_many_operands) Message(asmr_e_too_many_operands)
else else
begin Inc(operandnum);
{ condition operands doesn't set the operand but write to the
condition field of the instruction
}
if instr.Operands[operandnum].opr.typ<>OPR_NONE then
Inc(operandnum);
end;
Consume(AS_COMMA); Consume(AS_COMMA);
end; end;
AS_SEPARATOR, AS_SEPARATOR,
@ -604,8 +639,6 @@ Unit raarmgas;
BuildOperand(instr.Operands[operandnum] as tarmoperand); BuildOperand(instr.Operands[operandnum] as tarmoperand);
end; { end case } end; { end case }
until false; until false;
if (operandnum=1) and (instr.Operands[operandnum].opr.typ=OPR_NONE) then
dec(operandnum);
instr.Ops:=operandnum; instr.Ops:=operandnum;
end; end;
@ -662,7 +695,7 @@ Unit raarmgas;
begin begin
for icond:=low(tasmcond) to high(tasmcond) do for icond:=low(tasmcond) to high(tasmcond) do
begin begin
if copy(hs,1,2)=cond2str[icond] then if copy(hs,1,2)=uppercond2str[icond] then
begin begin
actcondition:=icond; actcondition:=icond;
{ strip condition } { strip condition }
@ -750,6 +783,9 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.1 2003-11-17 23:23:47 florian Revision 1.2 2003-11-21 16:29:26 florian
* fixed reading of reg. sets in the arm assembler reader
Revision 1.1 2003/11/17 23:23:47 florian
+ first part of arm assembler reader + first part of arm assembler reader
} }

View File

@ -298,14 +298,17 @@ const
procedure tcgppc.do_register_allocation(list:Taasmoutput;headertai:tai); procedure tcgppc.do_register_allocation(list:Taasmoutput;headertai:tai);
begin begin
{ Int } { Int }
rgint.check_unreleasedregs;
rgint.do_register_allocation(list,headertai); rgint.do_register_allocation(list,headertai);
rgint.translate_registers(list); rgint.translate_registers(list);
{ FPU } { FPU }
rgfpu.check_unreleasedregs;
rgfpu.do_register_allocation(list,headertai); rgfpu.do_register_allocation(list,headertai);
rgfpu.translate_registers(list); rgfpu.translate_registers(list);
{ MM } { MM }
rgmm.check_unreleasedregs;
rgmm.do_register_allocation(list,headertai); rgmm.do_register_allocation(list,headertai);
rgmm.translate_registers(list); rgmm.translate_registers(list);
end; end;
@ -2443,7 +2446,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.136 2003-11-02 17:19:33 florian Revision 1.137 2003-11-21 16:29:26 florian
* fixed reading of reg. sets in the arm assembler reader
Revision 1.136 2003/11/02 17:19:33 florian
+ copying of open array value parameters to the heap implemented + copying of open array value parameters to the heap implemented
Revision 1.135 2003/11/02 15:20:06 jonas Revision 1.135 2003/11/02 15:20:06 jonas

View File

@ -66,7 +66,7 @@ Function SearchLabel(const s: string; var hl: tasmlabel;emit:boolean): boolean;
type type
TOprType=(OPR_NONE,OPR_CONSTANT,OPR_SYMBOL,OPR_LOCAL, TOprType=(OPR_NONE,OPR_CONSTANT,OPR_SYMBOL,OPR_LOCAL,
OPR_REFERENCE,OPR_REGISTER,OPR_REGLIST,OPR_COND); OPR_REFERENCE,OPR_REGISTER,OPR_REGLIST,OPR_COND,OPR_REGSET);
TOprRec = record TOprRec = record
case typ:TOprType of case typ:TOprType of
@ -81,7 +81,10 @@ type
{$endif m68k} {$endif m68k}
{$ifdef powerpc} {$ifdef powerpc}
OPR_COND : (cond : tasmcond); OPR_COND : (cond : tasmcond);
{$endif m68k} {$endif powerpc}
{$ifdef arm}
OPR_REGSET : (regset : tcpuregisterset);
{$endif arm}
end; end;
TOperand = class TOperand = class
@ -1121,6 +1124,10 @@ end;
operands[i].opr.localscale,operands[i].opr.localgetoffset); operands[i].opr.localscale,operands[i].opr.localgetoffset);
OPR_REFERENCE: OPR_REFERENCE:
ai.loadref(i-1,operands[i].opr.ref); ai.loadref(i-1,operands[i].opr.ref);
{$ifdef ARM}
OPR_REGSET:
ai.loadregset(i-1,operands[i].opr.regset);
{$endif ARM}
end; end;
end; end;
ai.SetCondition(condition); ai.SetCondition(condition);
@ -1618,7 +1625,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.78 2003-11-17 23:23:47 florian Revision 1.79 2003-11-21 16:29:26 florian
* fixed reading of reg. sets in the arm assembler reader
Revision 1.78 2003/11/17 23:23:47 florian
+ first part of arm assembler reader + first part of arm assembler reader
Revision 1.77 2003/11/12 16:05:39 florian Revision 1.77 2003/11/12 16:05:39 florian