mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 16:49:20 +02:00
* RISC-V 32 compilation fixed
+ lazarus project file for the compiler added git-svn-id: branches/laksen/riscv_new@39511 -
This commit is contained in:
parent
14bfcbb0da
commit
44150f43ac
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -641,6 +641,7 @@ compiler/ppcmips.lpi svneol=native#text/plain
|
|||||||
compiler/ppcmipsel.lpi svneol=native#text/plain
|
compiler/ppcmipsel.lpi svneol=native#text/plain
|
||||||
compiler/ppcppc.lpi svneol=native#text/plain
|
compiler/ppcppc.lpi svneol=native#text/plain
|
||||||
compiler/ppcppc64.lpi svneol=native#text/plain
|
compiler/ppcppc64.lpi svneol=native#text/plain
|
||||||
|
compiler/ppcriscv32.lpi svneol=native#text/plain
|
||||||
compiler/ppcriscv64.lpi svneol=native#text/plain
|
compiler/ppcriscv64.lpi svneol=native#text/plain
|
||||||
compiler/ppcsparc.lpi svneol=native#text/plain
|
compiler/ppcsparc.lpi svneol=native#text/plain
|
||||||
compiler/ppcsparc64.lpi svneol=native#text/plain
|
compiler/ppcsparc64.lpi svneol=native#text/plain
|
||||||
|
86
compiler/ppcriscv32.lpi
Normal file
86
compiler/ppcriscv32.lpi
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<LRSInOutputDirectory Value="False"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="ppcrv32"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||||
|
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="1">
|
||||||
|
<Mode0 Name="default">
|
||||||
|
<local>
|
||||||
|
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||||
|
</local>
|
||||||
|
</Mode0>
|
||||||
|
</Modes>
|
||||||
|
</RunParams>
|
||||||
|
<Units Count="4">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="pp.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="riscv32\aasmcpu.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit1>
|
||||||
|
<Unit2>
|
||||||
|
<Filename Value="riscv32\aoptcpu.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit2>
|
||||||
|
<Unit3>
|
||||||
|
<Filename Value="aopt.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit3>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="riscv32\pp"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="riscv32;riscv"/>
|
||||||
|
<OtherUnitFiles Value="riscv32;riscv;systems"/>
|
||||||
|
<UnitOutputDirectory Value="riscv32\lazbuild"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
<AllowLabel Value="False"/>
|
||||||
|
<CPPInline Value="False"/>
|
||||||
|
<UseAnsiStrings Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<Other>
|
||||||
|
<Verbosity>
|
||||||
|
<ShowWarn Value="False"/>
|
||||||
|
<ShowNotes Value="False"/>
|
||||||
|
<ShowHints Value="False"/>
|
||||||
|
</Verbosity>
|
||||||
|
<ConfigFile>
|
||||||
|
<StopAfterErrCount Value="50"/>
|
||||||
|
</ConfigFile>
|
||||||
|
<CustomOptions Value="-driscv32
|
||||||
|
-Sew"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</CONFIG>
|
@ -163,7 +163,7 @@ unit cgcpu;
|
|||||||
if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
|
if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
|
||||||
a_reg_alloc(list,NR_FRAME_POINTER_REG);
|
a_reg_alloc(list,NR_FRAME_POINTER_REG);
|
||||||
|
|
||||||
reference_reset_base(href,NR_STACK_POINTER_REG,-4,0);
|
reference_reset_base(href,NR_STACK_POINTER_REG,-4,ctempposinvalid,0,[]);
|
||||||
|
|
||||||
{ Int registers }
|
{ Int registers }
|
||||||
regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall);
|
regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall);
|
||||||
@ -248,7 +248,7 @@ unit cgcpu;
|
|||||||
regs:=regs+[RS_RETURN_ADDRESS_REG];
|
regs:=regs+[RS_RETURN_ADDRESS_REG];
|
||||||
|
|
||||||
stackcount:=0;
|
stackcount:=0;
|
||||||
reference_reset_base(href,NR_STACK_POINTER_REG,-4,0);
|
reference_reset_base(href,NR_STACK_POINTER_REG,-4,ctempposinvalid,0,[]);
|
||||||
for r:=RS_X31 downto RS_X0 do
|
for r:=RS_X31 downto RS_X0 do
|
||||||
if r in regs then
|
if r in regs then
|
||||||
dec(href.offset,4);
|
dec(href.offset,4);
|
||||||
@ -373,7 +373,7 @@ unit cgcpu;
|
|||||||
src:=src2
|
src:=src2
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
reference_reset(src,sizeof(aint));
|
reference_reset(src,sizeof(aint),[]);
|
||||||
{ load the address of src2 into src.base }
|
{ load the address of src2 into src.base }
|
||||||
src.base := GetAddressRegister(list);
|
src.base := GetAddressRegister(list);
|
||||||
a_loadaddr_ref_reg(list, src2, src.base);
|
a_loadaddr_ref_reg(list, src2, src.base);
|
||||||
@ -382,7 +382,7 @@ unit cgcpu;
|
|||||||
dst:=dst2
|
dst:=dst2
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
reference_reset(dst,sizeof(aint));
|
reference_reset(dst,sizeof(aint),[]);
|
||||||
{ load the address of dst2 into dst.base }
|
{ load the address of dst2 into dst.base }
|
||||||
dst.base := GetAddressRegister(list);
|
dst.base := GetAddressRegister(list);
|
||||||
a_loadaddr_ref_reg(list, dst2, dst.base);
|
a_loadaddr_ref_reg(list, dst2, dst.base);
|
||||||
|
@ -38,6 +38,8 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
TAsmOp=(A_None,
|
TAsmOp=(A_None,
|
||||||
|
{ Pseudo instructions }
|
||||||
|
A_NOP,
|
||||||
{ normal opcodes }
|
{ normal opcodes }
|
||||||
A_LUI,A_AUIPC,A_JAL,A_JALR,
|
A_LUI,A_AUIPC,A_JAL,A_JALR,
|
||||||
A_Bxx,A_LB,A_LH,A_LW,A_LBU,A_LHU,
|
A_Bxx,A_LB,A_LH,A_LW,A_LBU,A_LHU,
|
||||||
|
@ -43,8 +43,8 @@ unit cpunode;
|
|||||||
nrvset,
|
nrvset,
|
||||||
nrvinl,
|
nrvinl,
|
||||||
nrv32mat,
|
nrv32mat,
|
||||||
nrv32cnv,
|
nrv32cnv
|
||||||
nrvcon
|
// ,nrvcon
|
||||||
;
|
;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -30,6 +30,7 @@ interface
|
|||||||
|
|
||||||
const
|
const
|
||||||
gas_op2str: array[tasmop] of string[14] = ('<none>',
|
gas_op2str: array[tasmop] of string[14] = ('<none>',
|
||||||
|
'nop',
|
||||||
'lui','auipc','jal','jalr',
|
'lui','auipc','jal','jalr',
|
||||||
'b','lb','lh','lw','lbu','lhu',
|
'b','lb','lh','lw','lbu','lhu',
|
||||||
'sb','sh','sw',
|
'sb','sh','sw',
|
||||||
|
@ -42,7 +42,7 @@ implementation
|
|||||||
cgbase,pass_2,
|
cgbase,pass_2,
|
||||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||||
nmem,nld,ncnv,
|
nmem,nld,ncnv,
|
||||||
ncgutil,cgutils,cgobj,tgobj,regvars,rgobj,rgcpu,
|
ncgutil,cgutils,cgobj,tgobj,rgobj,rgcpu,
|
||||||
cg64f32,cgcpu,cpupi,procinfo;
|
cg64f32,cgcpu,cpupi,procinfo;
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ Unit rarv32gas;
|
|||||||
{ aasm }
|
{ aasm }
|
||||||
cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||||
{ symtable }
|
{ symtable }
|
||||||
symconst,symsym,
|
symconst,symdef,symsym,
|
||||||
{ parser }
|
{ parser }
|
||||||
procinfo,
|
procinfo,
|
||||||
rabase,rautils,
|
rabase,rautils,
|
||||||
@ -62,7 +62,7 @@ Unit rarv32gas;
|
|||||||
procedure trv32attreader.ReadSym(oper : trvoperand);
|
procedure trv32attreader.ReadSym(oper : trvoperand);
|
||||||
var
|
var
|
||||||
tempstr, mangledname : string;
|
tempstr, mangledname : string;
|
||||||
typesize,l,k : aint;
|
l,k,typesize : tcgint;
|
||||||
begin
|
begin
|
||||||
tempstr:=actasmpattern;
|
tempstr:=actasmpattern;
|
||||||
Consume(AS_ID);
|
Consume(AS_ID);
|
||||||
@ -139,7 +139,7 @@ Unit rarv32gas;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
l : aint;
|
l : tcgint;
|
||||||
relsym: string;
|
relsym: string;
|
||||||
asmsymtyp: tasmsymtype;
|
asmsymtyp: tasmsymtype;
|
||||||
isflags: tindsymflags;
|
isflags: tindsymflags;
|
||||||
@ -201,7 +201,7 @@ Unit rarv32gas;
|
|||||||
if (relsym<>'') then
|
if (relsym<>'') then
|
||||||
begin
|
begin
|
||||||
if (oper.opr.typ = OPR_REFERENCE) then
|
if (oper.opr.typ = OPR_REFERENCE) then
|
||||||
oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym)
|
oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym,AT_DATA)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Message(asmr_e_invalid_reference_syntax);
|
Message(asmr_e_invalid_reference_syntax);
|
||||||
@ -256,7 +256,7 @@ Unit rarv32gas;
|
|||||||
Procedure trv32attreader.BuildOperand(oper : trvoperand);
|
Procedure trv32attreader.BuildOperand(oper : trvoperand);
|
||||||
var
|
var
|
||||||
expr : string;
|
expr : string;
|
||||||
typesize,l : aint;
|
typesize,l : tcgint;
|
||||||
|
|
||||||
|
|
||||||
procedure AddLabelOperand(hl:tasmlabel);
|
procedure AddLabelOperand(hl:tasmlabel);
|
||||||
@ -281,7 +281,7 @@ Unit rarv32gas;
|
|||||||
hasdot : boolean;
|
hasdot : boolean;
|
||||||
l,
|
l,
|
||||||
toffset,
|
toffset,
|
||||||
tsize : aint;
|
tsize : tcgint;
|
||||||
begin
|
begin
|
||||||
if not(actasmtoken in [AS_DOT,AS_PLUS,AS_MINUS]) then
|
if not(actasmtoken in [AS_DOT,AS_PLUS,AS_MINUS]) then
|
||||||
exit;
|
exit;
|
||||||
@ -319,7 +319,7 @@ Unit rarv32gas;
|
|||||||
if (oper.opr.val<>0) then
|
if (oper.opr.val<>0) then
|
||||||
Message(asmr_e_wrong_sym_type);
|
Message(asmr_e_wrong_sym_type);
|
||||||
oper.opr.typ:=OPR_SYMBOL;
|
oper.opr.typ:=OPR_SYMBOL;
|
||||||
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION);
|
oper.opr.symbol:=current_asmdata.DefineAsmSymbol(mangledname,AB_EXTERNAL,AT_FUNCTION,voidcodepointertype);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
inc(oper.opr.val,l);
|
inc(oper.opr.val,l);
|
||||||
|
Loading…
Reference in New Issue
Block a user