mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 18:24:19 +02:00
* fixed is_condreg
* fixed branch condition parsing in assembler reader
This commit is contained in:
parent
3f1b80bfaa
commit
6623aaf098
@ -647,8 +647,15 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
function is_condreg(r : tregister):boolean;
|
function is_condreg(r : tregister):boolean;
|
||||||
|
var
|
||||||
|
supreg: tsuperregister;
|
||||||
begin
|
begin
|
||||||
result:=(r>=NR_CR0) and (r<=NR_CR0);
|
result := false;
|
||||||
|
if (getregtype(r) = R_SPECIALREGISTER) then
|
||||||
|
begin
|
||||||
|
supreg := getsupreg(r);
|
||||||
|
result := (supreg >= RS_CR0) and (supreg <= RS_CR7);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -685,7 +692,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.77 2003-11-15 19:00:10 florian
|
Revision 1.78 2003-11-23 20:00:39 jonas
|
||||||
|
* fixed is_condreg
|
||||||
|
* fixed branch condition parsing in assembler reader
|
||||||
|
|
||||||
|
Revision 1.77 2003/11/15 19:00:10 florian
|
||||||
* fixed ppc assembler reader
|
* fixed ppc assembler reader
|
||||||
|
|
||||||
Revision 1.76 2003/11/12 16:05:40 florian
|
Revision 1.76 2003/11/12 16:05:40 florian
|
||||||
|
@ -485,21 +485,24 @@ Unit rappcgas;
|
|||||||
tempreg:=actasmregister;
|
tempreg:=actasmregister;
|
||||||
Consume(AS_REGISTER);
|
Consume(AS_REGISTER);
|
||||||
if (actasmtoken in [AS_END,AS_SEPARATOR,AS_COMMA]) then
|
if (actasmtoken in [AS_END,AS_SEPARATOR,AS_COMMA]) then
|
||||||
Begin
|
if is_condreg(tempreg) and
|
||||||
if is_condreg(tempreg) then
|
((actopcode = A_BC) or
|
||||||
begin
|
(actopcode = A_BCCTR) or
|
||||||
{ it isn't a real operand, everything is stored in the condition }
|
(actopcode = A_BCLR) or
|
||||||
oper.opr.typ:=OPR_NONE;
|
(actopcode = A_TW) or
|
||||||
{ !!!! }
|
(actopcode = A_TWI)) then
|
||||||
end
|
begin
|
||||||
else
|
{ it isn't a real operand, everything is stored in the condition }
|
||||||
begin
|
oper.opr.typ:=OPR_NONE;
|
||||||
if not (oper.opr.typ in [OPR_NONE,OPR_REGISTER]) then
|
actcondition.cr := getsupreg(tempreg);
|
||||||
Message(asmr_e_invalid_operand_type);
|
end
|
||||||
oper.opr.typ:=OPR_REGISTER;
|
else
|
||||||
oper.opr.reg:=tempreg;
|
begin
|
||||||
end;
|
if not (oper.opr.typ in [OPR_NONE,OPR_REGISTER]) then
|
||||||
end
|
Message(asmr_e_invalid_operand_type);
|
||||||
|
oper.opr.typ:=OPR_REGISTER;
|
||||||
|
oper.opr.reg:=tempreg;
|
||||||
|
end
|
||||||
else if is_condreg(tempreg) then
|
else if is_condreg(tempreg) then
|
||||||
begin
|
begin
|
||||||
if not(actcondition.cond in [C_T..C_DZF]) then
|
if not(actcondition.cond in [C_T..C_DZF]) then
|
||||||
@ -517,13 +520,13 @@ Unit rappcgas;
|
|||||||
begin
|
begin
|
||||||
oper.opr.typ:=OPR_NONE;
|
oper.opr.typ:=OPR_NONE;
|
||||||
if actasmpattern='LT' then
|
if actasmpattern='LT' then
|
||||||
actcondition.crbit:=(ord(tempreg)-ord(NR_CR0))*4
|
actcondition.crbit:=(getsupreg(tempreg)-(RS_CR0))*4
|
||||||
else if actasmpattern='GT' then
|
else if actasmpattern='GT' then
|
||||||
actcondition.crbit:=(ord(tempreg)-ord(NR_CR0))*4+1
|
actcondition.crbit:=(getsupreg(tempreg)-(RS_CR0))*4+1
|
||||||
else if actasmpattern='EQ' then
|
else if actasmpattern='EQ' then
|
||||||
actcondition.crbit:=(ord(tempreg)-ord(NR_CR0))*4+2
|
actcondition.crbit:=(getsupreg(tempreg)-(RS_CR0))*4+2
|
||||||
else if actasmpattern='SO' then
|
else if actasmpattern='SO' then
|
||||||
actcondition.crbit:=(ord(tempreg)-ord(NR_CR0))*4+3
|
actcondition.crbit:=(getsupreg(tempreg)-(RS_CR0))*4+3
|
||||||
else
|
else
|
||||||
Message(asmr_e_syn_operand);
|
Message(asmr_e_syn_operand);
|
||||||
consume(AS_ID);
|
consume(AS_ID);
|
||||||
@ -663,6 +666,8 @@ Unit rappcgas;
|
|||||||
actopcode:=A_BC;
|
actopcode:=A_BC;
|
||||||
actcondition.simple:=true;
|
actcondition.simple:=true;
|
||||||
actcondition.cond:=cond;
|
actcondition.cond:=cond;
|
||||||
|
if (cond in [C_LT,C_LE,C_EQ,C_GE,C_GT,C_NL,C_NE,C_NG,C_SO,C_NS,C_UN,C_NU]) then
|
||||||
|
actcondition.cr := RS_CR0;
|
||||||
actasmtoken:=AS_OPCODE;
|
actasmtoken:=AS_OPCODE;
|
||||||
is_asmopcode:=true;
|
is_asmopcode:=true;
|
||||||
exit;
|
exit;
|
||||||
@ -675,6 +680,7 @@ Unit rappcgas;
|
|||||||
actcondition.simple:=false;
|
actcondition.simple:=false;
|
||||||
actcondition.bo:=AsmCondFlag2BOLT_NU[cond];
|
actcondition.bo:=AsmCondFlag2BOLT_NU[cond];
|
||||||
actcondition.bo:=AsmCondFlag2BI[cond];
|
actcondition.bo:=AsmCondFlag2BI[cond];
|
||||||
|
actcondition.cr := RS_CR0;
|
||||||
actasmtoken:=AS_OPCODE;
|
actasmtoken:=AS_OPCODE;
|
||||||
is_asmopcode:=true;
|
is_asmopcode:=true;
|
||||||
exit;
|
exit;
|
||||||
@ -707,6 +713,7 @@ Unit rappcgas;
|
|||||||
begin
|
begin
|
||||||
instr:=TPPCInstruction.Create(TPPCOperand);
|
instr:=TPPCInstruction.Create(TPPCOperand);
|
||||||
BuildOpcode(instr);
|
BuildOpcode(instr);
|
||||||
|
instr.condition := actcondition;
|
||||||
if is_calljmp(instr.opcode) then
|
if is_calljmp(instr.opcode) then
|
||||||
ConvertCalljmp(instr);
|
ConvertCalljmp(instr);
|
||||||
{
|
{
|
||||||
@ -744,7 +751,11 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2003-11-23 18:32:42 florian
|
Revision 1.6 2003-11-23 20:00:39 jonas
|
||||||
|
* fixed is_condreg
|
||||||
|
* fixed branch condition parsing in assembler reader
|
||||||
|
|
||||||
|
Revision 1.5 2003/11/23 18:32:42 florian
|
||||||
+ skeleton for bXX crX,<label>
|
+ skeleton for bXX crX,<label>
|
||||||
|
|
||||||
Revision 1.4 2003/11/23 17:33:24 jonas
|
Revision 1.4 2003/11/23 17:33:24 jonas
|
||||||
|
Loading…
Reference in New Issue
Block a user