* MIPS: removed ConvertCalljmp method. Testing shows that it never changes instructions.

* Treat numerical expressions in operands as constants, not as references by default. A reference cannot be represented by number alone on MIPS.

git-svn-id: trunk@33116 -
This commit is contained in:
sergei 2016-02-23 21:19:46 +00:00
parent 5f6442074a
commit 4e7c0d0670

View File

@ -34,7 +34,6 @@ Interface
function is_asmopcode(const s: string):boolean;override;
procedure BuildOperand(oper : TOperand);
procedure BuildOpCode(instr : TInstruction);
procedure ConvertCalljmp(instr : TInstruction);
procedure handlepercent;override;
procedure handledollar;override;
procedure handleopcode;override;
@ -215,18 +214,28 @@ Interface
gotplus:=true;
end;
AS_INTNUM,
AS_MOD:
AS_INTNUM:
Begin
if not gotplus then
Message(asmr_e_invalid_reference_syntax);
l:=BuildConstExpression(True,False);
if negative then
l:=-l;
{ Constant memory offset }
oper.InitRef;
oper.opr.ref.refaddr:=addr_full;
oper.opr.ref.offset:=l;
case oper.opr.typ of
OPR_NONE:
begin
oper.opr.typ:=OPR_CONSTANT;
oper.opr.val:=l;
end;
OPR_CONSTANT :
inc(oper.opr.val,l);
OPR_REFERENCE:
inc(oper.opr.ref.offset,l);
OPR_LOCAL:
inc(oper.opr.localsymofs,l);
else
InternalError(12345);
end;
GotPlus:=(prevasmtoken=AS_PLUS) or
(prevasmtoken=AS_MINUS);
if GotPlus then
@ -496,25 +505,6 @@ Interface
end;
procedure TMipsReader.ConvertCalljmp(instr : TInstruction);
var
newopr : toprrec;
begin
if instr.Operands[1].opr.typ=OPR_REFERENCE then
with newopr do
begin
typ:=OPR_SYMBOL;
symbol:=instr.Operands[1].opr.ref.symbol;
symofs:=instr.Operands[1].opr.ref.offset;
if (instr.Operands[1].opr.ref.base<>NR_NO) or
(instr.Operands[1].opr.ref.index<>NR_NO) or
(instr.Operands[1].opr.ref.refaddr<>addr_full) then
Message(asmr_e_syn_operand);
instr.Operands[1].opr:=newopr;
end;
end;
procedure TMipsReader.handleopcode;
var
instr : TInstruction;
@ -524,8 +514,6 @@ Interface
with instr do
begin
condition := actcondition;
if is_calljmp(opcode) then
ConvertCalljmp(instr);
{ Coprocessor-related instructions have operands referring to both coprocessor registers
and general-purpose ones. The input representation "$<number>" is the same for both,
but symbolic names must not be used for non-GPRs on output. }