From 23f1b2c49e19bb2555b49096654e469179398341 Mon Sep 17 00:00:00 2001 From: mazen Date: Wed, 10 Dec 2003 13:16:35 +0000 Subject: [PATCH] * improve hadlign %hi and %lo operators --- compiler/sparc/aasmcpu.pas | 24 +++++++++++- compiler/sparc/racpugas.pas | 74 ++++++++++++++----------------------- 2 files changed, 51 insertions(+), 47 deletions(-) diff --git a/compiler/sparc/aasmcpu.pas b/compiler/sparc/aasmcpu.pas index 170d66cae4..cd1df8b764 100644 --- a/compiler/sparc/aasmcpu.pas +++ b/compiler/sparc/aasmcpu.pas @@ -65,6 +65,7 @@ uses function is_move:boolean;override; { register spilling code } + function spilling_get_operation_type(opnr: longint): topertype;override; function spilling_decode_loadstore(op: tasmop; var counterpart: tasmop; var wasload: boolean): boolean;override; function spilling_create_loadstore(op: tasmop; r:tregister; const ref:treference): tai;override; function spilling_create_load(const ref:treference;r:tregister): tai;override; @@ -235,6 +236,24 @@ implementation (oper[1]^.typ=top_reg); end; + + + function taicpu.spilling_get_operation_type(opnr: longint): topertype; + {$WARNING ******Check taicpu.spilling_get_operation_type******} + begin + result := operand_read; + case opcode of + A_STB..A_STDA: + begin + if opnr = 1 then + result := operand_write; + end; + else + if opnr = 0 then + result := operand_write; + end; + end; + function taicpu.spilling_decode_loadstore(op: tasmop; var counterpart: tasmop; var wasload: boolean): boolean; begin @@ -335,7 +354,10 @@ implementation end. { $Log$ - Revision 1.36 2003-10-30 15:03:18 mazen + Revision 1.37 2003-12-10 13:16:35 mazen + * improve hadlign %hi and %lo operators + + Revision 1.36 2003/10/30 15:03:18 mazen * now uses standard routines in rgHelper unit to search registers by number and by name Revision 1.35 2003/10/24 07:00:17 mazen diff --git a/compiler/sparc/racpugas.pas b/compiler/sparc/racpugas.pas index 5d64a79ce4..0e6b8f0dc9 100644 --- a/compiler/sparc/racpugas.pas +++ b/compiler/sparc/racpugas.pas @@ -36,7 +36,7 @@ Interface procedure BuildReference(oper : tSparcoperand); procedure BuildOperand(oper : tSparcoperand); procedure BuildOpCode(instr : tSparcinstruction); - procedure ReadAt(oper : tSparcoperand); + procedure ReadPercent(oper : tSparcoperand); procedure ReadSym(oper : tSparcoperand); procedure ConvertCalljmp(instr : tSparcinstruction); procedure handlepercent;override; @@ -93,7 +93,7 @@ Interface end; - procedure tSparcReader.ReadAt(oper : tSparcoperand); + procedure tSparcReader.ReadPercent(oper : tSparcoperand); begin { check for ...@ } if actasmtoken=AS_AT then @@ -104,9 +104,9 @@ Interface Consume(AS_AT); if actasmtoken=AS_ID then begin - if upper(actasmpattern)='L' then + if upper(actasmpattern)='LO' then oper.opr.ref.symaddr:=refs_lo - else if upper(actasmpattern)='HA' then + else if upper(actasmpattern)='HI' then oper.opr.ref.symaddr:=refs_hi else Message(asmr_e_invalid_reference_syntax); @@ -158,8 +158,8 @@ Interface Begin oper.opr.Ref.Offset:=BuildConstExpression(false,true); Consume(AS_RPAREN); - if actasmtoken=AS_AT then - ReadAt(oper); + if actasmtoken=AS_MOD then + ReadPercent(oper); end; exit; End; @@ -211,8 +211,8 @@ Interface end; end; Consume(AS_RPAREN); - if actasmtoken=AS_AT then - ReadAt(oper); + if actasmtoken=AS_MOD then + ReadPercent(oper); End; AS_COMMA: { (, ... can either be scaling, or index } Begin @@ -247,42 +247,20 @@ Interface actasmpattern[len]:='%'; c:=current_scanner.asmgetchar; { to be a register there must be a letter and not a number } - if c in ['0'..'9'] then - begin - actasmtoken:=AS_MOD; - end - else - begin - while c in ['a'..'z','A'..'Z','0'..'9'] do - Begin - inc(len); - actasmpattern[len]:=c; - c:=current_scanner.asmgetchar; - end; - actasmpattern[0]:=chr(len); - uppervar(actasmpattern); - if (actasmpattern = '%ST') and (c='(') then - Begin - actasmpattern:=actasmpattern+c; - c:=current_scanner.asmgetchar; - if c in ['0'..'9'] then - actasmpattern:=actasmpattern + c - else - Message(asmr_e_invalid_fpu_register); - c:=current_scanner.asmgetchar; - if c <> ')' then - Message(asmr_e_invalid_fpu_register) - else - Begin - actasmpattern:=actasmpattern + c; - c:=current_scanner.asmgetchar; { let us point to next character. } - end; - end; - if is_register(actasmpattern) then - exit; + while c in ['a'..'z','A'..'Z','0'..'9'] do + Begin + inc(len); + actasmpattern[len]:=c; + c:=current_scanner.asmgetchar; + end; + actasmpattern[0]:=chr(len); + uppervar(actasmpattern); + if is_register(actasmpattern) then + exit; + if(actasmpattern='%HI')or(actasmpattern='%LO')then + actasmtoken:=AS_MOD + else Message(asmr_e_invalid_register); - actasmtoken:=raatt.AS_NONE; - end; end; Procedure tSparcReader.BuildOperand(oper : tSparcoperand); @@ -406,7 +384,8 @@ Interface AS_INTNUM, AS_MINUS, - AS_PLUS: + AS_PLUS, + AS_MOD: Begin { Constant memory offset } { This must absolutely be followed by ( } @@ -467,7 +446,7 @@ Interface else begin if oper.SetupVar(expr,false) then - ReadAt(oper) + ReadPercent(oper) else Begin { look for special symbols ... } @@ -715,7 +694,10 @@ initialization end. { $Log$ - Revision 1.1 2003-12-08 13:02:21 mazen + Revision 1.2 2003-12-10 13:16:36 mazen + * improve hadlign %hi and %lo operators + + Revision 1.1 2003/12/08 13:02:21 mazen + support for native sparc assembler reader }