+ Aarch64 assembler reader

git-svn-id: trunk@29913 -
This commit is contained in:
Jonas Maebe 2015-02-23 22:52:36 +00:00
parent 96fcf6a12d
commit 558b8967b6
4 changed files with 1144 additions and 0 deletions

2
.gitattributes vendored
View File

@ -39,6 +39,8 @@ compiler/aarch64/ra64sri.inc svneol=native#text/plain
compiler/aarch64/ra64sta.inc svneol=native#text/plain
compiler/aarch64/ra64std.inc svneol=native#text/plain
compiler/aarch64/ra64sup.inc svneol=native#text/plain
compiler/aarch64/racpu.pas svneol=native#text/plain
compiler/aarch64/racpugas.pas svneol=native#text/plain
compiler/aarch64/rgcpu.pas svneol=native#text/plain
compiler/aarch64/symcpu.pas svneol=native#text/plain
compiler/aasmbase.pas svneol=native#text/plain

View File

@ -0,0 +1,88 @@
{
Copyright (c) 1998-2003 by Carl Eric Codere and Peter Vreman
Copyright (c) 2014 by Jonas Maebe
Handles the common AArch64 assembler reader routines
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit racpu;
{$i fpcdefs.inc}
interface
uses
cgbase,
cpubase,
aasmtai,aasmdata,
rautils;
type
TAArch64Operand=class(TOperand)
end;
TAArch64Instruction=class(TInstruction)
oppostfix : toppostfix;
function ConcatInstruction(p:TAsmList) : tai;override;
function Is64bit: boolean;
function cgsize: tcgsize;
end;
implementation
uses
verbose,
aasmcpu;
function TAArch64Instruction.ConcatInstruction(p:TAsmList) : tai;
begin
result:=inherited ConcatInstruction(p);
taicpu(result).oppostfix:=oppostfix;
end;
function TAArch64Instruction.Is64bit: boolean;
begin
result:=
(operands[1].opr.typ=OPR_REGISTER) and
(getsubreg(operands[1].opr.reg)=R_SUBQ);
end;
function TAArch64Instruction.cgsize: tcgsize;
begin
if ops<1 then
internalerror(2014122001);
if operands[1].opr.typ<>OPR_REGISTER then
internalerror(2014122002);
result:=reg_cgsize(operands[1].opr.reg);
{ a 32 bit integer register could actually be 16 or 8 bit }
if result=OS_32 then
case oppostfix of
PF_B:
result:=OS_8;
PF_SB:
result:=OS_S8;
PF_H:
result:=OS_16;
PF_SH:
result:=OS_S16;
end;
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -305,6 +305,18 @@ unit raatt;
end
end;
{$endif ARM}
{$ifdef aarch64}
{ b.cond }
case c of
'.':
begin
repeat
actasmpattern:=actasmpattern+c;
c:=current_scanner.asmgetchar;
until not(c in ['a'..'z','A'..'Z']);
end;
end;
{$endif aarch64}
{ Opcode ? }
If is_asmopcode(upper(actasmpattern)) then
Begin