* compiling skeleton

git-svn-id: trunk@10211 -
This commit is contained in:
florian 2008-02-04 20:57:09 +00:00
parent b7f1e364ad
commit a210a74629
2 changed files with 11 additions and 81 deletions

View File

@ -36,7 +36,6 @@ Unit raavrgas;
procedure handleopcode;override; procedure handleopcode;override;
procedure BuildReference(oper : tavroperand); procedure BuildReference(oper : tavroperand);
procedure BuildOperand(oper : tavroperand); procedure BuildOperand(oper : tavroperand);
function TryBuildShifterOp(oper : tavroperand) : boolean;
procedure BuildOpCode(instr : tavrinstruction); procedure BuildOpCode(instr : tavrinstruction);
procedure ReadSym(oper : tavroperand); procedure ReadSym(oper : tavroperand);
procedure ConvertCalljmp(instr : tavrinstruction); procedure ConvertCalljmp(instr : tavrinstruction);
@ -215,8 +214,8 @@ Unit raavrgas;
procedure AddLabelOperand(hl:tasmlabel); procedure AddLabelOperand(hl:tasmlabel);
begin begin
if not(actasmtoken in [AS_PLUS,AS_MINUS,AS_LPAREN]) and if not(actasmtoken in [AS_PLUS,AS_MINUS,AS_LPAREN]) { and
is_calljmp(actopcode) then is_calljmp(actopcode) } then
begin begin
oper.opr.typ:=OPR_SYMBOL; oper.opr.typ:=OPR_SYMBOL;
oper.opr.symbol:=hl; oper.opr.symbol:=hl;
@ -472,48 +471,10 @@ Unit raavrgas;
oper.opr.typ:=OPR_REGISTER; oper.opr.typ:=OPR_REGISTER;
oper.opr.reg:=tempreg; oper.opr.reg:=tempreg;
end end
else if (actasmtoken=AS_NOT) and (actopcode in [A_LDM,A_STM]) then
begin
consume(AS_NOT);
oper.opr.typ:=OPR_REFERENCE;
oper.opr.ref.addressmode:=AM_PREINDEXED;
oper.opr.ref.index:=tempreg;
end
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,getsupreg(actasmregister));
tempreg:=actasmregister;
consume(AS_REGISTER);
if actasmtoken=AS_MINUS then
begin
consume(AS_MINUS);
for ireg:=getsupreg(tempreg) to getsupreg(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: ;
@ -546,7 +507,6 @@ Unit raavrgas;
begin begin
Opcode:=ActOpcode; Opcode:=ActOpcode;
condition:=ActCondition; condition:=ActCondition;
oppostfix:=actoppostfix;
end; end;
{ We are reading operands, so opcode will be an AS_ID } { We are reading operands, so opcode will be an AS_ID }
@ -563,22 +523,11 @@ Unit raavrgas;
case actasmtoken of case actasmtoken of
AS_COMMA: { Operand delimiter } AS_COMMA: { Operand delimiter }
Begin Begin
if ((instr.opcode=A_MOV) and (operandnum=2)) or if operandnum>Max_Operands then
((operandnum=3) and not(instr.opcode in [A_UMLAL,A_UMULL,A_SMLAL,A_SMULL,A_MLA])) then Message(asmr_e_too_many_operands)
begin
Consume(AS_COMMA);
if not(TryBuildShifterOp(instr.Operands[operandnum+1] as tavroperand)) then
Message(asmr_e_illegal_shifterop_syntax);
Inc(operandnum);
end
else else
begin Inc(operandnum);
if operandnum>Max_Operands then Consume(AS_COMMA);
Message(asmr_e_too_many_operands)
else
Inc(operandnum);
Consume(AS_COMMA);
end;
end; end;
AS_SEPARATOR, AS_SEPARATOR,
AS_END : { End of asm operands for this opcode } AS_END : { End of asm operands for this opcode }
@ -602,11 +551,6 @@ Unit raavrgas;
'IA','IB','DA','DB','FD','FA','ED','EA', 'IA','IB','DA','DB','FD','FA','ED','EA',
'B','D','E','P','T','H','S'); 'B','D','E','P','T','H','S');
postfixsorted : array[1..19] of TOpPostfix = (
PF_EP,PF_SB,PF_BT,PF_SH,
PF_IA,PF_IB,PF_DA,PF_DB,PF_FD,PF_FA,PF_ED,PF_EA,
PF_B,PF_D,PF_E,PF_P,PF_T,PF_H,PF_S);
var var
len, len,
j, j,
@ -625,13 +569,13 @@ Unit raavrgas;
actcondition:=C_None; actcondition:=C_None;
{ first, handle B else BLS is read wrong } { first, handle B else BLS is read wrong }
if ((hs[1]='B') and (length(hs)=3)) then if ((copy(hs,1,2)='BR') and (length(hs)=4)) then
begin begin
for icond:=low(tasmcond) to high(tasmcond) do for icond:=low(tasmcond) to high(tasmcond) do
begin begin
if copy(hs,2,3)=uppercond2str[icond] then if copy(hs,2,3)=uppercond2str[icond] then
begin begin
actopcode:=A_B; actopcode:=A_BRxx;
actasmtoken:=AS_OPCODE; actasmtoken:=AS_OPCODE;
actcondition:=icond; actcondition:=icond;
is_asmopcode:=true; is_asmopcode:=true;
@ -668,20 +612,6 @@ Unit raavrgas;
end; end;
end; end;
end; end;
{ check for postfix }
if length(hs)>0 then
begin
for j:=low(postfixsorted) to high(postfixsorted) do
begin
if copy(hs,1,length(postfix2strsorted[j]))=postfix2strsorted[j] then
begin
actoppostfix:=postfixsorted[j];
{ strip postfix }
delete(hs,1,length(postfix2strsorted[j]));
break;
end;
end;
end;
{ if we stripped all postfixes, it's a valid opcode } { if we stripped all postfixes, it's a valid opcode }
is_asmopcode:=length(hs)=0; is_asmopcode:=length(hs)=0;
end; end;
@ -710,8 +640,8 @@ Unit raavrgas;
begin begin
instr:=tavrinstruction.Create(tavroperand); instr:=tavrinstruction.Create(tavroperand);
BuildOpcode(instr); BuildOpcode(instr);
if is_calljmp(instr.opcode) then { if is_calljmp(instr.opcode) then
ConvertCalljmp(instr); ConvertCalljmp(instr); }
{ {
instr.AddReferenceSizes; instr.AddReferenceSizes;
instr.SetInstructionOpsize; instr.SetInstructionOpsize;
@ -719,7 +649,6 @@ Unit raavrgas;
} }
instr.ConcatInstruction(curlist); instr.ConcatInstruction(curlist);
instr.Free; instr.Free;
actoppostfix:=PF_None;
end; end;

View File

@ -67,6 +67,7 @@ interface
,asmmode_m68k_mot ,asmmode_m68k_mot
,asmmode_x86_64_intel ,asmmode_x86_64_intel
,asmmode_x86_64_att ,asmmode_x86_64_att
,asmmode_avr_gas
); );
(* IMPORTANT NOTE: (* IMPORTANT NOTE: