fpc/compiler/riscv/rarvgas.pas
Jeppe Johansen 2b78a8fd3d - Add support for .option directive in riscv assembler.
- Use addiw when adjusting U32 to S32

git-svn-id: trunk@41870 -
2019-04-14 20:51:29 +00:00

86 lines
2.1 KiB
ObjectPascal

{
Copyright (c) 2019 by Jeppe Johansen
Does the parsing for the RISC-V GNU AS styled inline assembler.
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 rarvgas;
{$I fpcdefs.inc}
interface
uses
raatt,
cpubase;
type
trvattreader = class(tattreader)
function is_targetdirective(const s: string): boolean; override;
procedure HandleTargetDirective; override;
end;
implementation
uses
{ helpers }
cutils,
{ global }
globtype,globals,verbose,
systems,
{ aasm }
aasmbase,aasmtai,aasmdata,aasmcpu,
{ symtable }
symconst,symsym,symdef,
{ parser }
procinfo,
rabase,rautils,
cgbase,cgobj,cgrv
;
function trvattreader.is_targetdirective(const s: string): boolean;
begin
case s of
'.option':
result:=true
else
Result:=inherited is_targetdirective(s);
end;
end;
procedure trvattreader.HandleTargetDirective;
var
id: string;
begin
case actasmpattern of
'.option':
begin
consume(AS_TARGET_DIRECTIVE);
id:=actasmpattern;
Consume(AS_ID);
curList.concat(tai_directive.create(asd_option, lower(id)));
end
else
inherited HandleTargetDirective;
end;
end;
end.